Skip to content

Commit 013bb57

Browse files
committed
Add tests for oss-fuzz-61469: Undef dynamic property in ++/-- unset in error handler
This was fixed as a consequence of a3a3964 Closes GH-12011
1 parent 508e70a commit 013bb57

5 files changed

+86
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
OSS Fuzz #61469: Undef variable in ++/-- for dynamic property that is unset in error handler
3+
--FILE--
4+
<?php
5+
class C {
6+
function errorHandle() {
7+
unset($this->a);
8+
}
9+
}
10+
$c = new C;
11+
set_error_handler([$c,'errorHandle']);
12+
$c->a += 5;
13+
var_dump($c->a);
14+
?>
15+
--EXPECT--
16+
int(5)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
OSS Fuzz #61469: Undef variable in ++/-- for dynamic property that is unset in error handler
3+
--FILE--
4+
<?php
5+
class C {
6+
function errorHandle() {
7+
unset($this->a);
8+
}
9+
}
10+
$c = new C;
11+
set_error_handler([$c,'errorHandle']);
12+
13+
$v = ($c->a--);
14+
var_dump($c->a);
15+
var_dump($v);
16+
?>
17+
--EXPECT--
18+
NULL
19+
NULL
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
OSS Fuzz #61469: Undef variable in ++/-- for dynamic property that is unset in error handler
3+
--FILE--
4+
<?php
5+
class C {
6+
function errorHandle() {
7+
unset($this->a);
8+
}
9+
}
10+
$c = new C;
11+
set_error_handler([$c,'errorHandle']);
12+
13+
$v = ($c->a--);
14+
var_dump($c->a);
15+
var_dump($v);
16+
?>
17+
--EXPECT--
18+
NULL
19+
NULL
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
OSS Fuzz #61469: Undef variable in ++/-- for dynamic property that is unset in error handler
3+
--FILE--
4+
<?php
5+
class C {
6+
function errorHandle() {
7+
unset($this->a);
8+
}
9+
}
10+
$c = new C;
11+
set_error_handler([$c,'errorHandle']);
12+
(--$c->a);
13+
var_dump($c->a);
14+
?>
15+
--EXPECT--
16+
NULL
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
OSS Fuzz #61469: Undef variable in ++/-- for dynamic property that is unset in error handler
3+
--FILE--
4+
<?php
5+
class C {
6+
function errorHandle() {
7+
unset($this->a);
8+
}
9+
}
10+
$c = new C;
11+
set_error_handler([$c,'errorHandle']);
12+
(++$c->a);
13+
var_dump($c->a);
14+
?>
15+
--EXPECT--
16+
int(1)

0 commit comments

Comments
 (0)