Skip to content

Commit 2094880

Browse files
committed
Add tests for disable_class
1 parent 7800e33 commit 2094880

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
Disable non-internal class
3+
--INI--
4+
disable_classes=UserLand
5+
--FILE--
6+
<?php
7+
8+
class UserLand {}
9+
$o = new UserLand();
10+
var_dump($o);
11+
?>
12+
DONE
13+
--EXPECT--
14+
object(UserLand)#1 (0) {
15+
}
16+
DONE
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Disable class with typed properties
3+
--EXTENSIONS--
4+
reflection
5+
--INI--
6+
disable_classes=Exception
7+
--XFAIL--
8+
Use After Free due to types being freed by zend_disable_class()
9+
--FILE--
10+
<?php
11+
12+
//$o = new ReflectionMethod(Exception::class, "__toString");
13+
//var_dump($o);
14+
15+
$o = new Exception();
16+
//var_dump($o);
17+
?>
18+
--EXPECTF--
19+
Warning: ReflectionMethod() has been disabled for security reasons in %s
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
DNF typed properties in internal classes that is disabled
3+
--EXTENSIONS--
4+
zend_test
5+
--INI--
6+
disable_classes=_ZendTestClass
7+
--XFAIL--
8+
Use After Free due to types being freed by zend_disable_class()
9+
--FILE--
10+
<?php
11+
$o = new _ZendTestClass();
12+
//var_dump($o);
13+
?>
14+
--EXPECT--
15+
string(42) "_ZendTestInterface|(Traversable&Countable)"
16+
Cannot assign array to property _ZendTestClass::$dnfProperty of type _ZendTestInterface|(Traversable&Countable)

0 commit comments

Comments
 (0)