summaryrefslogtreecommitdiff
path: root/ext/reflection/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/reflection/tests')
-rw-r--r--ext/reflection/tests/ReflectionClassConstant_basic1.phpt8
-rw-r--r--ext/reflection/tests/ReflectionClass_getInterfaces_002.phpt18
-rw-r--r--ext/reflection/tests/ReflectionClass_getMethods_003.phpt6
-rw-r--r--ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperties_003.phpt6
-rw-r--r--ext/reflection/tests/ReflectionClass_modifiers_001.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_toString_001.phpt4
-rw-r--r--ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt76
-rw-r--r--ext/reflection/tests/ReflectionProperty_basic2.phpt8
-rw-r--r--ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt8
-rw-r--r--ext/reflection/tests/ReflectionProperty_getModifiers_basic.phpt24
-rw-r--r--ext/reflection/tests/bug49719.phpt2
-rw-r--r--ext/reflection/tests/bug61388.phpt6
-rw-r--r--ext/reflection/tests/bug76737.phpt33
-rw-r--r--ext/reflection/tests/exception.inc16
15 files changed, 116 insertions, 105 deletions
diff --git a/ext/reflection/tests/ReflectionClassConstant_basic1.phpt b/ext/reflection/tests/ReflectionClassConstant_basic1.phpt
index 548d64e1bf..78510d0b35 100644
--- a/ext/reflection/tests/ReflectionClassConstant_basic1.phpt
+++ b/ext/reflection/tests/ReflectionClassConstant_basic1.phpt
@@ -73,7 +73,7 @@ bool(false)
isProtected():
bool(false)
getModifiers():
-int(256)
+int(1)
getDeclaringClass():
object(ReflectionClass)#3 (1) {
["name"]=>
@@ -107,7 +107,7 @@ bool(false)
isProtected():
bool(true)
getModifiers():
-int(512)
+int(2)
getDeclaringClass():
object(ReflectionClass)#3 (1) {
["name"]=>
@@ -141,7 +141,7 @@ bool(true)
isProtected():
bool(false)
getModifiers():
-int(1024)
+int(4)
getDeclaringClass():
object(ReflectionClass)#3 (1) {
["name"]=>
@@ -175,7 +175,7 @@ bool(true)
isProtected():
bool(false)
getModifiers():
-int(1024)
+int(4)
getDeclaringClass():
object(ReflectionClass)#3 (1) {
["name"]=>
diff --git a/ext/reflection/tests/ReflectionClass_getInterfaces_002.phpt b/ext/reflection/tests/ReflectionClass_getInterfaces_002.phpt
index 8fa08869da..998bd4bea6 100644
--- a/ext/reflection/tests/ReflectionClass_getInterfaces_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_getInterfaces_002.phpt
@@ -25,24 +25,24 @@ Array
[name] => I6
)
- [I2] => ReflectionClass Object
+ [I4] => ReflectionClass Object
(
- [name] => I2
+ [name] => I4
)
- [I1] => ReflectionClass Object
+ [I3] => ReflectionClass Object
(
- [name] => I1
+ [name] => I3
)
- [I4] => ReflectionClass Object
+ [I2] => ReflectionClass Object
(
- [name] => I4
+ [name] => I2
)
- [I3] => ReflectionClass Object
+ [I1] => ReflectionClass Object
(
- [name] => I3
+ [name] => I1
)
[I5] => ReflectionClass Object
@@ -50,4 +50,4 @@ Array
[name] => I5
)
-) \ No newline at end of file
+)
diff --git a/ext/reflection/tests/ReflectionClass_getMethods_003.phpt b/ext/reflection/tests/ReflectionClass_getMethods_003.phpt
index 885bd908f1..b08fcaa4d4 100644
--- a/ext/reflection/tests/ReflectionClass_getMethods_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_getMethods_003.phpt
@@ -17,9 +17,9 @@ class C {
}
$rc = new ReflectionClass("C");
-$StaticFlag = 0x01;
-$pubFlag = 0x100;
-$privFlag = 0x400;
+$StaticFlag = ReflectionMethod::IS_STATIC;
+$pubFlag = ReflectionMethod::IS_PUBLIC;
+$privFlag = ReflectionMethod::IS_PRIVATE;
echo "No methods:";
var_dump($rc->getMethods(0));
diff --git a/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt
index f77bbacda7..ffe8876133 100644
--- a/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt
@@ -29,8 +29,8 @@ dump_modifiers('g');
?>
--EXPECT--
int(0)
+int(64)
int(32)
-int(4)
int(0)
int(0)
int(0)
diff --git a/ext/reflection/tests/ReflectionClass_getProperties_003.phpt b/ext/reflection/tests/ReflectionClass_getProperties_003.phpt
index ac16a68349..229e828056 100644
--- a/ext/reflection/tests/ReflectionClass_getProperties_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperties_003.phpt
@@ -17,9 +17,9 @@ class C {
}
$rc = new ReflectionClass("C");
-$StaticFlag = 0x01;
-$pubFlag = 0x100;
-$privFlag = 0x400;
+$StaticFlag = ReflectionProperty::IS_STATIC;
+$pubFlag = ReflectionProperty::IS_PUBLIC;
+$privFlag = ReflectionProperty::IS_PRIVATE;
echo "No properties:";
var_dump($rc->getProperties(0));
diff --git a/ext/reflection/tests/ReflectionClass_modifiers_001.phpt b/ext/reflection/tests/ReflectionClass_modifiers_001.phpt
index d82519e4f4..1370228f04 100644
--- a/ext/reflection/tests/ReflectionClass_modifiers_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_modifiers_001.phpt
@@ -25,7 +25,7 @@ foreach ($classes as $class) {
bool(false)
bool(false)
bool(true)
-int(32)
+int(64)
bool(false)
bool(false)
bool(false)
@@ -37,7 +37,7 @@ int(0)
bool(true)
bool(false)
bool(false)
-int(4)
+int(32)
bool(false)
bool(true)
bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_toString_001.phpt b/ext/reflection/tests/ReflectionClass_toString_001.phpt
index cafdd2e37c..e97af14110 100644
--- a/ext/reflection/tests/ReflectionClass_toString_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_toString_001.phpt
@@ -13,8 +13,8 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
- Constants [3] {
Constant [ public int IS_IMPLICIT_ABSTRACT ] { 16 }
- Constant [ public int IS_EXPLICIT_ABSTRACT ] { 32 }
- Constant [ public int IS_FINAL ] { 4 }
+ Constant [ public int IS_EXPLICIT_ABSTRACT ] { 64 }
+ Constant [ public int IS_FINAL ] { 32 }
}
- Static properties [0] {
diff --git a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
index 55aea10763..d1a19c7116 100644
--- a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
@@ -87,151 +87,151 @@ printf("0x%08x\n", $a->getModifiers());
?>
--EXPECTF--
Modifiers for method TestClass::foo():
-0x00000100
+0x00000001
Modifiers for method TestClass::stat():
-0x00000101
+0x00000011
Modifiers for method TestClass::priv():
-0x00000400
+0x00000004
Modifiers for method TestClass::prot():
-0x00000200
+0x00000002
Modifiers for method TestClass::fin():
-0x00000104
+0x00000021
Modifiers for method TestClass::__destruct():
-0x00000100
+0x00000001
Modifiers for method TestClass::__call():
-0x00000100
+0x00000001
Modifiers for method TestClass::__clone():
-0x00000100
+0x00000001
Modifiers for method TestClass::__get():
-0x00000100
+0x00000001
Modifiers for method TestClass::__set():
-0x00000100
+0x00000001
Modifiers for method TestClass::__unset():
-0x00000100
+0x00000001
Modifiers for method TestClass::__isset():
-0x00000100
+0x00000001
Modifiers for method TestClass::__tostring():
-0x00000100
+0x00000001
Modifiers for method TestClass::__sleep():
-0x00000100
+0x00000001
Modifiers for method TestClass::__wakeup():
-0x00000100
+0x00000001
Modifiers for method TestClass::__set_state():
-0x00000100
+0x00000001
Modifiers for method TestClass::__autoload():
-0x00000100
+0x00000001
Modifiers for method TestClass::foo():
-0x00000100
+0x00000001
Modifiers for method TestClass::stat():
-0x00000101
+0x00000011
Modifiers for method TestClass::priv():
-0x00000400
+0x00000004
Modifiers for method TestClass::prot():
-0x00000200
+0x00000002
Modifiers for method TestClass::fin():
-0x00000104
+0x00000021
Modifiers for method TestClass::__destruct():
-0x00000100
+0x00000001
Modifiers for method TestClass::__call():
-0x00000100
+0x00000001
Modifiers for method TestClass::__clone():
-0x00000100
+0x00000001
Modifiers for method TestClass::__get():
-0x00000100
+0x00000001
Modifiers for method TestClass::__set():
-0x00000100
+0x00000001
Modifiers for method TestClass::__unset():
-0x00000100
+0x00000001
Modifiers for method TestClass::__isset():
-0x00000100
+0x00000001
Modifiers for method TestClass::__tostring():
-0x00000100
+0x00000001
Modifiers for method TestClass::__sleep():
-0x00000100
+0x00000001
Modifiers for method TestClass::__wakeup():
-0x00000100
+0x00000001
Modifiers for method TestClass::__set_state():
-0x00000100
+0x00000001
Modifiers for method TestClass::__autoload():
-0x00000100
+0x00000001
Modifiers for method TestInterface::int():
-0x00000102
+0x00000041
Modifiers for method TestInterface::__clone():
-0x00000102
+0x00000041
Modifiers for method AbstractClass::foo():
-0x00000102
+0x00000041
Wrong number of params:
@@ -239,4 +239,4 @@ Wrong number of params:
Warning: ReflectionMethod::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d
ReflectionMethod::getModifiers() modifiers:
-0x00000100
+0x00000001
diff --git a/ext/reflection/tests/ReflectionProperty_basic2.phpt b/ext/reflection/tests/ReflectionProperty_basic2.phpt
index 62938df100..8db0e2013f 100644
--- a/ext/reflection/tests/ReflectionProperty_basic2.phpt
+++ b/ext/reflection/tests/ReflectionProperty_basic2.phpt
@@ -43,7 +43,7 @@ Reflecting on property TestClass::pub
isDefault():
bool(true)
getModifiers():
-int(256)
+int(1)
getDeclaringClass():
object(ReflectionClass)#%d (1) {
["name"]=>
@@ -59,7 +59,7 @@ Reflecting on property TestClass::stat
isDefault():
bool(true)
getModifiers():
-int(257)
+int(17)
getDeclaringClass():
object(ReflectionClass)#%d (1) {
["name"]=>
@@ -75,7 +75,7 @@ Reflecting on property TestClass::prot
isDefault():
bool(true)
getModifiers():
-int(512)
+int(2)
getDeclaringClass():
object(ReflectionClass)#%d (1) {
["name"]=>
@@ -93,7 +93,7 @@ Reflecting on property TestClass::priv
isDefault():
bool(true)
getModifiers():
-int(1024)
+int(4)
getDeclaringClass():
object(ReflectionClass)#%d (1) {
["name"]=>
diff --git a/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt b/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt
index fe888a83bc..e8b9b6ed0d 100644
--- a/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt
+++ b/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt
@@ -40,27 +40,27 @@ reflectProperty("TestClass", "priv");
Reflecting on property TestClass::pub
getModifiers():
-int(256)
+int(1)
**********************************
**********************************
Reflecting on property TestClass::stat
getModifiers():
-int(257)
+int(17)
**********************************
**********************************
Reflecting on property TestClass::prot
getModifiers():
-int(512)
+int(2)
**********************************
**********************************
Reflecting on property TestClass::priv
getModifiers():
-int(1024)
+int(4)
**********************************
diff --git a/ext/reflection/tests/ReflectionProperty_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionProperty_getModifiers_basic.phpt
index 4c99444e30..6856569d3e 100644
--- a/ext/reflection/tests/ReflectionProperty_getModifiers_basic.phpt
+++ b/ext/reflection/tests/ReflectionProperty_getModifiers_basic.phpt
@@ -32,15 +32,15 @@ for ($i = 1;$i <= 6;$i++) {
?>
--EXPECT--
-C::a1: int(256)
-D::a1: int(256)
-C::a2: int(512)
-D::a2: int(512)
-C::a3: int(1024)
-D::a3: int(1024)
-C::a4: int(257)
-D::a4: int(257)
-C::a5: int(513)
-D::a5: int(513)
-C::a6: int(1025)
-D::a6: int(1025)
+C::a1: int(1)
+D::a1: int(1)
+C::a2: int(2)
+D::a2: int(2)
+C::a3: int(4)
+D::a3: int(4)
+C::a4: int(17)
+D::a4: int(17)
+C::a5: int(18)
+D::a5: int(18)
+C::a6: int(20)
+D::a6: int(20)
diff --git a/ext/reflection/tests/bug49719.phpt b/ext/reflection/tests/bug49719.phpt
index f200ce297c..b62e1b2ec5 100644
--- a/ext/reflection/tests/bug49719.phpt
+++ b/ext/reflection/tests/bug49719.phpt
@@ -36,7 +36,7 @@ $prop->setAccessible(true);
var_dump($prop->getValue(new b2));
?>
---EXPECTF--
+--EXPECT--
bool(false)
bool(false)
bool(false)
diff --git a/ext/reflection/tests/bug61388.phpt b/ext/reflection/tests/bug61388.phpt
index 3d6dc83fa0..b9fe6bfaaa 100644
--- a/ext/reflection/tests/bug61388.phpt
+++ b/ext/reflection/tests/bug61388.phpt
@@ -14,12 +14,6 @@ print_r($reflObj->getProperties(ReflectionProperty::IS_PUBLIC));
--EXPECT--
Array
(
- [0] => ReflectionProperty Object
- (
- [name] => test
- [class] => ArrayObject
- )
-
)
Array
(
diff --git a/ext/reflection/tests/bug76737.phpt b/ext/reflection/tests/bug76737.phpt
new file mode 100644
index 0000000000..716b40e76a
--- /dev/null
+++ b/ext/reflection/tests/bug76737.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #76737: Unserialized reflection objects are broken, they shouldn't be serializable
+--FILE--
+<?php
+
+try {
+ $r = new ReflectionClass('stdClass');
+ var_dump(serialize($r));
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $s = 'C:15:"ReflectionClass":0:{}';
+ var_dump(unserialize($s));
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $s = 'O:15:"ReflectionClass":0:{}';
+ var_dump(unserialize($s));
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECTF--
+Serialization of 'ReflectionClass' is not allowed
+Unserialization of 'ReflectionClass' is not allowed
+
+Warning: Erroneous data format for unserializing 'ReflectionClass' in %s on line %d
+
+Notice: unserialize(): Error at offset 26 of 27 bytes in %s on line %d
+bool(false)
diff --git a/ext/reflection/tests/exception.inc b/ext/reflection/tests/exception.inc
deleted file mode 100644
index da3fceaac7..0000000000
--- a/ext/reflection/tests/exception.inc
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-class ReflectionExceptionEx extends ReflectionException {
- function MyException($_errno, $_errmsg) {
- $this->errno = $_errno;
- $this->errmsg = $_errmsg;
- }
-
- function getErrno() {
- return $this->errno;
- }
-
- function getErrmsg() {
- return $this->errmsg;
- }
-}
-?>