diff options
Diffstat (limited to 'ext/reflection/tests')
39 files changed, 0 insertions, 2003 deletions
diff --git a/ext/reflection/tests/001.phpt b/ext/reflection/tests/001.phpt deleted file mode 100755 index 8e4a487298..0000000000 --- a/ext/reflection/tests/001.phpt +++ /dev/null @@ -1,91 +0,0 @@ ---TEST-- -Reflection inheritance ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class ReflectionClassEx extends ReflectionClass -{ - public $bla; - - function getMethodNames() - { - $res = array(); - foreach($this->getMethods() as $m) - { - $res[] = $m->class . '::' . $m->name; - } - return $res; - } -} - -$r = new ReflectionClassEx('ReflectionClassEx'); - -$exp = array ( - 'UMLClass::__clone', - 'UMLClass::export', - 'UMLClass::__construct', - 'UMLClass::__toString', - 'UMLClass::getName', - 'UMLClass::isInternal', - 'UMLClass::isUserDefined', - 'UMLClass::isInstantiable', - 'UMLClass::getFileName', - 'UMLClass::getStartLine', - 'UMLClass::getEndLine', - 'UMLClass::getDocComment', - 'UMLClass::getConstructor', - 'UMLClass::getMethod', - 'UMLClass::getMethods', - 'UMLClass::getProperty', - 'UMLClass::getProperties', - 'UMLClass::getConstants', - 'UMLClass::getConstant', - 'UMLClass::getInterfaces', - 'UMLClass::isInterface', - 'UMLClass::isAbstract', - 'UMLClass::isFinal', - 'UMLClass::getModifiers', - 'UMLClass::isInstance', - 'UMLClass::newInstance', - 'UMLClass::getParentClass', - 'UMLClass::isSubclassOf', - 'UMLClass::getStaticProperties', - 'UMLClass::getDefaultProperties', - 'UMLClass::isIterateable', - 'UMLClass::implementsInterface', - 'UMLClass::getExtension', - 'UMLClass::getExtensionName'); - -$miss = array(); - -$res = $r->getMethodNames(); - -foreach($exp as $m) -{ - if (!in_array($m, $exp)) - { - $miss[] = $m; - } -} - -var_dump($miss); - -$props = array_keys(get_class_vars('ReflectionClassEx')); -sort($props); -var_dump($props); -var_dump($r->name); -?> -===DONE=== ---EXPECT-- -array(0) { -} -array(2) { - [0]=> - string(3) "bla" - [1]=> - string(4) "name" -} -string(17) "ReflectionClassEx" -===DONE=== diff --git a/ext/reflection/tests/002.phpt b/ext/reflection/tests/002.phpt deleted file mode 100755 index e522ac807a..0000000000 --- a/ext/reflection/tests/002.phpt +++ /dev/null @@ -1,65 +0,0 @@ ---TEST-- -Reflection properties are read only ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class ReflectionMethodEx extends ReflectionMethod -{ - public $foo = "xyz"; - - function __construct($c,$m) - { - echo __METHOD__ . "\n"; - parent::__construct($c,$m); - } -} - -$r = new ReflectionMethodEx('ReflectionMethodEx','getName'); - -var_dump($r->class); -var_dump($r->name); -var_dump($r->foo); -@var_dump($r->bar); - -try -{ - $r->class = 'bullshit'; -} -catch(ReflectionException $e) -{ - echo $e->getMessage() . "\n"; -} -try -{ -$r->name = 'bullshit'; -} -catch(ReflectionException $e) -{ - echo $e->getMessage() . "\n"; -} - -$r->foo = 'bar'; -$r->bar = 'baz'; - -var_dump($r->class); -var_dump($r->name); -var_dump($r->foo); -var_dump($r->bar); - -?> -===DONE=== ---EXPECTF-- -ReflectionMethodEx::__construct -string(18) "ReflectionMethodEx" -string(7) "getName" -string(3) "xyz" -NULL -Cannot set read-only property ReflectionMethodEx::$class -Cannot set read-only property ReflectionMethodEx::$name -string(18) "ReflectionMethodEx" -string(7) "getName" -string(3) "bar" -string(3) "baz" -===DONE=== diff --git a/ext/reflection/tests/003.phpt b/ext/reflection/tests/003.phpt deleted file mode 100755 index af8d82d576..0000000000 --- a/ext/reflection/tests/003.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ReflectionMethod::invoke() with base class method ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class Foo -{ - function Test() - { - echo __METHOD__ . "\n"; - } -} - -class Bar extends Foo -{ - function Test() - { - echo __METHOD__ . "\n"; - } -} - -$o = new Bar; -$r = new ReflectionMethod('Foo','Test'); - -$r->invoke($o); - -?> -===DONE=== ---EXPECT-- -Foo::Test -===DONE=== diff --git a/ext/reflection/tests/004.phpt b/ext/reflection/tests/004.phpt deleted file mode 100755 index 362cbcecdd..0000000000 --- a/ext/reflection/tests/004.phpt +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -ReflectionMethod::invoke() with non object or null value ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class a { - function a(){ - } -} -class b { -} - -$b = new b(); - -$a=new ReflectionClass("a"); -$m=$a->getMethod("a"); - -try { - $m->invoke(null); -} catch (ReflectionException $E) { - echo $E->getMessage()."\n"; -} - - -try { - $m->invoke($b); -} catch (ReflectionException $E) { - echo $E->getMessage()."\n"; -} - -$b = new a(); -try { - $m->invoke($b); -} catch (ReflectionException $E) { - echo $E->getMessage()."\n"; -} - -echo "===DONE===\n";?> ---EXPECT-- -Non-object passed to Invoke() -Given object is not an instance of the class this method was declared in -===DONE=== diff --git a/ext/reflection/tests/005.phpt b/ext/reflection/tests/005.phpt deleted file mode 100755 index bedc7d0326..0000000000 --- a/ext/reflection/tests/005.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -ReflectionMethod::getDocComment() uses wrong comment block ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -function strip_doc_comment($c) -{ - if (!strlen($c) || $c === false) return $c; - return trim(substr($c, 3, -2)); -} - -/** Comment for class A */ -class A -{ - /** Method A::bla() - */ - function bla() - { - } - - function foo() { - /** - * This is a valid comment inside a method - */ - } - - function bar() { - // I don't have a doc comment.... - } - - /** - * Comment for A::baz() - */ - function baz() { - } -} - -$r = new ReflectionClass('A'); -var_dump(strip_doc_comment($r->getDocComment())); - -foreach($r->getMethods() as $m) -{ - var_dump(strip_doc_comment($m->getDocComment())); -} - -?> -===DONE=== ---EXPECT-- -string(19) "Comment for class A" -string(15) "Method A::bla()" -bool(false) -bool(false) -string(22) "* Comment for A::baz()" -===DONE=== diff --git a/ext/reflection/tests/006.phpt b/ext/reflection/tests/006.phpt deleted file mode 100755 index 9e97ae4654..0000000000 --- a/ext/reflection/tests/006.phpt +++ /dev/null @@ -1,105 +0,0 @@ ---TEST-- -ReflectionClass::[gs]etStaticPropertyValue ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -/* ReflectionClass cannot touch protected or private static properties */ - -/* ReflectionClass cannot create or delete static properties */ - -Class Test -{ - static public $pub = 'pub'; - static protected $pro = 'pro'; - static private $pri = 'pri'; - - static function testing() - { - $ref = new ReflectionClass('Test'); - - foreach(array('pub', 'pro', 'pri') as $name) - { - try - { - var_dump($ref->getStaticPropertyValue($name)); - var_dump($ref->getStaticPropertyValue($name)); - $ref->setStaticPropertyValue($name, 'updated'); - var_dump($ref->getStaticPropertyValue($name)); - } - catch(Exception $e) - { - echo "EXCEPTION\n"; - } - } - } -} - -Class TestDerived extends Test -{ -// static public $pub = 'pub'; -// static protected $pro = 'pro'; - static private $pri = 'pri'; - - static function testing() - { - $ref = new ReflectionClass('Test'); - - foreach(array('pub', 'pro', 'pri') as $name) - { - try - { - var_dump($ref->getStaticPropertyValue($name)); - var_dump($ref->getStaticPropertyValue($name)); - $ref->setStaticPropertyValue($name, 'updated'); - var_dump($ref->getStaticPropertyValue($name)); - } - catch(Exception $e) - { - echo "EXCEPTION\n"; - } - } - } -} - -$ref = new ReflectionClass('Test'); - -foreach(array('pub', 'pro', 'pri') as $name) -{ - try - { - var_dump($ref->getStaticPropertyValue($name)); - var_dump($ref->getStaticPropertyValue($name)); - $ref->setStaticPropertyValue($name, 'updated'); - var_dump($ref->getStaticPropertyValue($name)); - } - catch(Exception $e) - { - echo "EXCEPTION\n"; - } -} - -Test::testing(); -TestDerived::testing(); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -string(3) "pub" -string(3) "pub" -string(7) "updated" -EXCEPTION -EXCEPTION -string(7) "updated" -string(7) "updated" -string(7) "updated" -EXCEPTION -EXCEPTION -string(7) "updated" -string(7) "updated" -string(7) "updated" -EXCEPTION -EXCEPTION -===DONE=== diff --git a/ext/reflection/tests/007.phpt b/ext/reflection/tests/007.phpt deleted file mode 100755 index 83764e5515..0000000000 --- a/ext/reflection/tests/007.phpt +++ /dev/null @@ -1,162 +0,0 @@ ---TEST-- -ReflectionClass::newInstance[Args] ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -function test($class) -{ - echo "====>$class\n"; - try - { - $ref = new ReflectionClass($class); - } - catch (ReflectionException $e) - { - var_dump($e->getMessage()); - return; // only here - } - - echo "====>newInstance()\n"; - try - { - var_dump($ref->newInstance()); - } - catch (ReflectionException $e) - { - var_dump($e->getMessage()); - } - - echo "====>newInstance(25)\n"; - try - { - var_dump($ref->newInstance(25)); - } - catch (ReflectionException $e) - { - var_dump($e->getMessage()); - } - - echo "====>newInstance(25, 42)\n"; - try - { - var_dump($ref->newInstance(25, 42)); - } - catch (ReflectionException $e) - { - var_dump($e->getMessage()); - } - - echo "\n"; -} - -function __autoload($class) -{ - echo __FUNCTION__ . "($class)\n"; -} - -test('Class_does_not_exist'); - -Class NoCtor -{ -} - -test('NoCtor'); - -Class WithCtor -{ - function __construct() - { - echo __METHOD__ . "()\n"; - var_dump(func_get_args()); - } -} - -test('WithCtor'); - -Class WithCtorWithArgs -{ - function __construct($arg) - { - echo __METHOD__ . "($arg)\n"; - var_dump(func_get_args()); - } -} - -test('WithCtorWithArgs'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- - -====>Class_does_not_exist -__autoload(Class_does_not_exist) -string(41) "Class Class_does_not_exist does not exist" -====>NoCtor -====>newInstance() -object(NoCtor)#%d (0) { -} -====>newInstance(25) -string(86) "Class NoCtor does not have a constructor, so you cannot pass any constructor arguments" -====>newInstance(25, 42) -string(86) "Class NoCtor does not have a constructor, so you cannot pass any constructor arguments" - -====>WithCtor -====>newInstance() -WithCtor::__construct() -array(0) { -} -object(WithCtor)#%d (0) { -} -====>newInstance(25) -WithCtor::__construct() -array(1) { - [0]=> - int(25) -} -object(WithCtor)#%d (0) { -} -====>newInstance(25, 42) -WithCtor::__construct() -array(2) { - [0]=> - int(25) - [1]=> - int(42) -} -object(WithCtor)#%d (0) { -} - -====>WithCtorWithArgs -====>newInstance() - -Warning: Missing argument 1 for WithCtorWithArgs::__construct() in %s007.php on line %d - -Notice: Undefined variable: arg in %s007.php on line %d -WithCtorWithArgs::__construct() -array(0) { -} -object(WithCtorWithArgs)#%d (0) { -} -====>newInstance(25) -WithCtorWithArgs::__construct(25) -array(1) { - [0]=> - int(25) -} -object(WithCtorWithArgs)#%d (0) { -} -====>newInstance(25, 42) -WithCtorWithArgs::__construct(25) -array(2) { - [0]=> - int(25) - [1]=> - int(42) -} -object(WithCtorWithArgs)#%d (0) { -} - -===DONE=== diff --git a/ext/reflection/tests/008.phpt b/ext/reflection/tests/008.phpt deleted file mode 100755 index 2abdcdb57b..0000000000 --- a/ext/reflection/tests/008.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -ReflectionMethod::__construct() tests ---FILE-- -<?php - -$a = array("", 1, "::", "a::", "::b", "a::b"); - -foreach ($a as $val) { - try { - new ReflectionMethod($val); - } catch (Exception $e) { - var_dump($e->getMessage()); - } -} - -$a = array("", 1, ""); -$b = array("", "", 1); - -foreach ($a as $key=>$val) { - try { - new ReflectionMethod($val, $b[$key]); - } catch (Exception $e) { - var_dump($e->getMessage()); - } -} - -echo "Done\n"; -?> ---EXPECTF-- -string(20) "Invalid method name " -string(21) "Invalid method name 1" -string(21) "Class does not exist" -string(22) "Class a does not exist" -string(21) "Class does not exist" -string(22) "Class a does not exist" -string(21) "Class does not exist" -string(66) "The parameter class is expected to be either a string or an object" -string(21) "Class does not exist" -Done diff --git a/ext/reflection/tests/bug26640.phpt b/ext/reflection/tests/bug26640.phpt deleted file mode 100755 index 026e67561a..0000000000 --- a/ext/reflection/tests/bug26640.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Reflection Bug #26640 (__autoload() not invoked by Reflection classes) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -function __autoload($c) -{ - class autoload_class - { - public function __construct() - { - print "autoload success\n"; - } - } -} - -$a = new ReflectionClass('autoload_class'); - -if (is_object($a)) { - echo "OK\n"; -} - -?> ---EXPECT-- -OK diff --git a/ext/reflection/tests/bug26695.phpt b/ext/reflection/tests/bug26695.phpt deleted file mode 100755 index 22619d4f1a..0000000000 --- a/ext/reflection/tests/bug26695.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Reflection Bug #26695 (Reflection API does not recognize mixed-case class hints) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class Foo { -} - -class Bar { - function demo(foo $f) { - } -} - -$class = new ReflectionClass('bar'); -$methods = $class->getMethods(); -$params = $methods[0]->getParameters(); - -$class = $params[0]->getClass(); - -var_dump($class->getName()); -?> -===DONE=== ---EXPECT-- -string(3) "Foo" -===DONE===
\ No newline at end of file diff --git a/ext/reflection/tests/bug29268.phpt b/ext/reflection/tests/bug29268.phpt deleted file mode 100755 index cd8f9b8ed1..0000000000 --- a/ext/reflection/tests/bug29268.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Reflection Bug #29268 (__autoload() not called with reflectionProperty->getClass()) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -function __autoload($classname) { - echo "__autoload($classname)\n"; - eval("class $classname {}"); -} - -class B{ - public function doit(A $a){ - } -} - -$ref = new reflectionMethod('B','doit'); -$parameters = $ref->getParameters(); -foreach($parameters as $parameter) -{ - $class = $parameter->getClass(); - echo $class->name."\n"; -} -echo "ok\n"; -?> ---EXPECT-- -__autoload(A) -A -ok diff --git a/ext/reflection/tests/bug29523.phpt b/ext/reflection/tests/bug29523.phpt deleted file mode 100755 index ac83cc789b..0000000000 --- a/ext/reflection/tests/bug29523.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Reflection Bug #29523 (ReflectionParameter::isOptional() is incorrect) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class TestClass -{ -} - -function optionalTest(TestClass $a, TestClass $b, $c = 3) -{ -} - -$function = new ReflectionFunction('optionalTest'); -$numberOfNotOptionalParameters = 0; -$numberOfOptionalParameters = 0; -foreach($function->getParameters() as $parameter) -{ - var_dump($parameter->isOptional()); - if ($parameter->isOptional()) - { - ++$numberOfOptionalParameters; - } - else - { - ++$numberOfNotOptionalParameters; - } -} -var_dump($function->getNumberOfRequiredParameters()); -var_dump($numberOfNotOptionalParameters); - -?> ---EXPECT-- -bool(false) -bool(false) -bool(true) -int(2) -int(2) diff --git a/ext/reflection/tests/bug29828.phpt b/ext/reflection/tests/bug29828.phpt deleted file mode 100755 index 7d4de40c12..0000000000 --- a/ext/reflection/tests/bug29828.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Reflection Bug #29828 (Interfaces no longer work) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -interface Bla -{ - function bla(); -} - -class BlaMore implements Bla -{ - function bla() - { - echo "Hello\n"; - } -} - -$r = new ReflectionClass('BlaMore'); - -var_dump(count($r->getMethods())); -var_dump($r->getMethod('bla')->isConstructor()); -var_dump($r->getMethod('bla')->isAbstract()); - -$o=new BlaMore; -$o->bla(); - -?> -===DONE=== ---EXPECT-- -int(1) -bool(false) -bool(false) -Hello -===DONE=== diff --git a/ext/reflection/tests/bug29986.phpt b/ext/reflection/tests/bug29986.phpt deleted file mode 100644 index 997bcf7ccd..0000000000 --- a/ext/reflection/tests/bug29986.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Reflection Bug #29986 (Class constants won't work with predefined constants when using ReflectionClass) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class just_constants -{ - const BOOLEAN_CONSTANT = true; - const NULL_CONSTANT = null; - const STRING_CONSTANT = 'This is a string'; - const INTEGER_CONSTANT = 1000; - const FLOAT_CONSTANT = 3.14159265; -} - -Reflection::export(new ReflectionClass('just_constants')); -?> ---EXPECTF-- -Class [ <user> class just_constants ] { - @@ %s %d-%d - - - Constants [5] { - Constant [ boolean BOOLEAN_CONSTANT ] { 1 } - Constant [ null NULL_CONSTANT ] { } - Constant [ string STRING_CONSTANT ] { This is a string } - Constant [ integer INTEGER_CONSTANT ] { 1000 } - Constant [ double FLOAT_CONSTANT ] { 3.14159265 } - } - - - Static properties [0] { - } - - - Static methods [0] { - } - - - Properties [0] { - } - - - Methods [0] { - } -} diff --git a/ext/reflection/tests/bug30146.phpt b/ext/reflection/tests/bug30146.phpt deleted file mode 100755 index 3a7ce92a01..0000000000 --- a/ext/reflection/tests/bug30146.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Reflection Bug #30146 (ReflectionProperty->getValue() requires instance for static property) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class test { - static public $a = 1; -} - -$r = new ReflectionProperty('test', 'a'); -var_dump($r->getValue(null)); - -$r->setValue(NULL, 2); -var_dump($r->getValue()); - -$r->setValue(3); -var_dump($r->getValue()); -?> -===DONE=== ---EXPECT-- -int(1) -int(2) -int(3) -===DONE===
\ No newline at end of file diff --git a/ext/reflection/tests/bug30148.phpt b/ext/reflection/tests/bug30148.phpt deleted file mode 100755 index d058aaa248..0000000000 --- a/ext/reflection/tests/bug30148.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Reflection Bug #30148 (ReflectionMethod->isConstructor() fails for inherited classes) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class Root -{ - function Root() {} -} -class Base extends Root -{ - function __construct() {} -} -class Derived extends Base -{ -} -$a = new ReflectionMethod('Root','Root'); -$b = new ReflectionMethod('Base','Root'); -$c = new ReflectionMethod('Base','__construct'); -$d = new ReflectionMethod('Derived','Root'); -$e = new ReflectionMethod('Derived','__construct'); -var_dump($a->isConstructor()); -var_dump($b->isConstructor()); -var_dump($c->isConstructor()); -var_dump($d->isConstructor()); -var_dump($e->isConstructor()); -?> -===DONE=== ---EXPECT-- -bool(true) -bool(false) -bool(true) -bool(false) -bool(true) -===DONE===
\ No newline at end of file diff --git a/ext/reflection/tests/bug30209.phpt b/ext/reflection/tests/bug30209.phpt deleted file mode 100755 index bab16ee35e..0000000000 --- a/ext/reflection/tests/bug30209.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Reflection Bug #30209 (ReflectionClass::getMethod() lowercases attribute) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class Foo -{ - private $name = 'testBAR'; - - public function testBAR() - { - try - { - $class = new ReflectionClass($this); - var_dump($this->name); - $method = $class->getMethod($this->name); - var_dump($this->name); - } - - catch (Exception $e) {} - } -} - -$foo = new Foo; -$foo->testBAR(); -?> -===DONE=== ---EXPECTF-- -string(7) "testBAR" -string(7) "testBAR" -===DONE=== diff --git a/ext/reflection/tests/bug30856.phpt b/ext/reflection/tests/bug30856.phpt deleted file mode 100755 index e5f06ab057..0000000000 --- a/ext/reflection/tests/bug30856.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Reflection Bug #30856 (ReflectionClass::getStaticProperties segfaults) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class bogus { - const C = 'test'; - static $a = bogus::C; -} - -$class = new ReflectionClass('bogus'); - -var_dump($class->getStaticProperties()); -?> -===DONE=== ---EXPECT-- -array(1) { - ["a"]=> - string(4) "test" -} -===DONE=== diff --git a/ext/reflection/tests/bug30961.phpt b/ext/reflection/tests/bug30961.phpt deleted file mode 100755 index dab07417b3..0000000000 --- a/ext/reflection/tests/bug30961.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Reflection Bug #30961 (Wrong linenumber in ReflectionClass getStartLine()) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - class a - { - } - - class b extends a - { - } - - $ref1 = new ReflectionClass('a'); - $ref2 = new ReflectionClass('b'); - echo $ref1->getStartLine() . "\n"; - echo $ref2->getStartLine() . "\n"; -?> ---EXPECT-- -2 -6 diff --git a/ext/reflection/tests/bug31651.phpt b/ext/reflection/tests/bug31651.phpt deleted file mode 100755 index 66a56c0f47..0000000000 --- a/ext/reflection/tests/bug31651.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -Reflection Bug #31651 (ReflectionClass::getDefaultProperties segfaults with arrays.) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class Test -{ - public $a = array('a' => 1); -} - -$ref = new ReflectionClass('Test'); - -print_r($ref->getDefaultProperties()); - -?> ---EXPECT-- -Array -( - [a] => Array - ( - [a] => 1 - ) - -) diff --git a/ext/reflection/tests/bug32981.phpt b/ext/reflection/tests/bug32981.phpt deleted file mode 100755 index 53214d7aa0..0000000000 --- a/ext/reflection/tests/bug32981.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Reflection Bug #32981 (ReflectionMethod::getStaticVariables() causes apache2.0.54 seg fault) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class TestClass -{ - static function test() - { - static $enabled = true; - } -} - -$class = new ReflectionClass('TestClass'); -foreach ($class->getMethods() as $method) -{ - var_dump($method->getName()); - $arr_static_vars[] = $method->getStaticVariables(); -} - -var_dump($arr_static_vars); - -?> -===DONE=== ---EXPECT-- -string(4) "test" -array(1) { - [0]=> - array(1) { - ["enabled"]=> - bool(true) - } -} -===DONE=== diff --git a/ext/reflection/tests/bug33312.phpt b/ext/reflection/tests/bug33312.phpt deleted file mode 100755 index b39ec3c6f1..0000000000 --- a/ext/reflection/tests/bug33312.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Reflection Bug #33312 (ReflectionParameter methods do not work correctly) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class Foo { - public function bar(Foo $foo, $bar = 'bar') { - } -} - -$class = new ReflectionClass('Foo'); -$method = $class->getMethod('bar'); - -foreach ($method->getParameters() as $parameter) { - if ($parameter->isDefaultValueAvailable()) { - print $parameter->getDefaultValue()."\n"; - } -} -?> ---EXPECT-- -bar diff --git a/ext/reflection/tests/bug33389.phpt b/ext/reflection/tests/bug33389.phpt deleted file mode 100755 index d2a84e212d..0000000000 --- a/ext/reflection/tests/bug33389.phpt +++ /dev/null @@ -1,99 +0,0 @@ ---TEST-- -Reflection Bug #33389 (double free() when exporting a ReflectionClass) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -define ('foobar', 1); -class Test { - function foo1($arg=foobar) { - } - function foo2($arg=null) { - } - function foo3($arg=false) { - } - function foo4($arg='foo') { - } - function foo5($arg=1) { - } - function bar($arg) { - } - function foo() { - } -} -Reflection::export(new ReflectionClass('Test')); -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -Class [ <user> class Test ] { - @@ %sbug33389.php 3-18 - - - Constants [0] { - } - - - Static properties [0] { - } - - - Static methods [0] { - } - - - Properties [0] { - } - - - Methods [7] { - Method [ <user> public method foo1 ] { - @@ %sbug33389.php 4 - 5 - - - Parameters [1] { - Parameter #0 [ <optional> $arg = 1 ] - } - } - - Method [ <user> public method foo2 ] { - @@ %sbug33389.php 6 - 7 - - - Parameters [1] { - Parameter #0 [ <optional> $arg = NULL ] - } - } - - Method [ <user> public method foo3 ] { - @@ %sbug33389.php 8 - 9 - - - Parameters [1] { - Parameter #0 [ <optional> $arg = false ] - } - } - - Method [ <user> public method foo4 ] { - @@ %sbug33389.php 10 - 11 - - - Parameters [1] { - Parameter #0 [ <optional> $arg = 'foo' ] - } - } - - Method [ <user> public method foo5 ] { - @@ %sbug33389.php 12 - 13 - - - Parameters [1] { - Parameter #0 [ <optional> $arg = 1 ] - } - } - - Method [ <user> public method bar ] { - @@ %sbug33389.php 14 - 15 - - - Parameters [1] { - Parameter #0 [ <required> $arg ] - } - } - - Method [ <user> public method foo ] { - @@ %sbug33389.php 16 - 17 - } - } -} - -===DONE=== diff --git a/ext/reflection/tests/bug36308.phpt b/ext/reflection/tests/bug36308.phpt deleted file mode 100755 index 52717b474a..0000000000 --- a/ext/reflection/tests/bug36308.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Reflection Bug #36308 (ReflectionProperty::getDocComment() does not reflect extended class commentary) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class Base { - /** Base comment block */ - public $foo = 'bar'; -} - -class Extended extends Base { - /** Extended commentary */ - public $foo = 'zim'; -} - -$reflect = new ReflectionClass('Extended'); -$props = $reflect->getProperties(); -echo $props[0]->getDocComment(); -?> ---EXPECT-- -/** Extended commentary */
\ No newline at end of file diff --git a/ext/reflection/tests/bug36337.phpt b/ext/reflection/tests/bug36337.phpt deleted file mode 100644 index 8ec928fc89..0000000000 --- a/ext/reflection/tests/bug36337.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -Reflection Bug #36337 (ReflectionProperty fails to return correct visibility) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -abstract class enum { - protected $_values; - - public function __construct() { - $property = new ReflectionProperty(get_class($this),'_values'); - var_dump($property->isProtected()); - } - -} - -final class myEnum extends enum { - public $_values = array( - 0 => 'No value', - ); -} - -$x = new myEnum(); - -echo "Done\n"; -?> ---EXPECT-- -bool(false) -Done diff --git a/ext/reflection/tests/bug36434.phpt b/ext/reflection/tests/bug36434.phpt deleted file mode 100644 index e305c657a8..0000000000 --- a/ext/reflection/tests/bug36434.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Reflection Bug #36434 (Properties from parent class fail to indetify their true origin) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class ancester -{ -public $ancester = 0; - function ancester() - { - return $this->ancester; - } -} -class foo extends ancester -{ -public $bar = "1"; - function foo() - { - return $this->bar; - } -} - -$r = new ReflectionClass('foo'); -foreach ($r->GetProperties() as $p) -{ - echo $p->getName(). " ". $p->getDeclaringClass()->getName()."\n"; -} - -?> ---EXPECT-- -bar foo -ancester ancester diff --git a/ext/reflection/tests/bug37816.phpt b/ext/reflection/tests/bug37816.phpt deleted file mode 100755 index 18a49046dc..0000000000 --- a/ext/reflection/tests/bug37816.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Bug #37816 (ReflectionProperty does not throw exception when accessing protected attribute) ---FILE-- -<?php - -class TestClass -{ - protected $p = 2; -} - -$o = new TestClass; - -$r = new ReflectionProperty($o, 'p'); - -try -{ - $x = $r->getValue($o); -} -catch (Exception $e) -{ - echo 'Caught: ' . $e->getMessage() . "\n"; -} - -?> -===DONE=== ---EXPECTF-- -Caught: Cannot access non-public member TestClass::p -===DONE=== diff --git a/ext/reflection/tests/bug38132.phpt b/ext/reflection/tests/bug38132.phpt deleted file mode 100755 index aeb6246b89..0000000000 --- a/ext/reflection/tests/bug38132.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Reflection Bug #38132 (ReflectionClass::getStaticProperties() retains \0 in key names) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class foo { - static protected $bar = 'baz'; - static public $a = 'a'; -} - -$class = new ReflectionClass('foo'); -$properties = $class->getStaticProperties(); -var_dump($properties, array_keys($properties)); -var_dump(isset($properties['*bar'])); -var_dump(isset($properties["\0*\0bar"])); -var_dump(isset($properties["bar"])); -?> ---EXPECT-- -array(2) { - ["bar"]=> - string(3) "baz" - ["a"]=> - string(1) "a" -} -array(2) { - [0]=> - string(3) "bar" - [1]=> - string(1) "a" -} -bool(false) -bool(false) -bool(true) diff --git a/ext/reflection/tests/bug38194.phpt b/ext/reflection/tests/bug38194.phpt deleted file mode 100755 index 5c888af59d..0000000000 --- a/ext/reflection/tests/bug38194.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Reflection Bug #38194 (ReflectionClass::isSubclassOf() returns TRUE for the class itself) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class Object { } - -$objectClass= new ReflectionClass('Object'); -var_dump($objectClass->isSubclassOf($objectClass)); -?> ---EXPECT-- -bool(false) diff --git a/ext/reflection/tests/bug38217.phpt b/ext/reflection/tests/bug38217.phpt deleted file mode 100644 index 55e0c46644..0000000000 --- a/ext/reflection/tests/bug38217.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -#38217 (ReflectionClass::newInstanceArgs() tries to allocate too much memory) ---FILE-- -<?php - -class Object { - public function __construct() { - } -} - -$class= new ReflectionClass('Object'); -var_dump($class->newInstanceArgs()); - -class Object1 { - public function __construct($var) { - var_dump($var); - } -} - -$class= new ReflectionClass('Object1'); -var_dump($class->newInstanceArgs()); -var_dump($class->newInstanceArgs(array('test'))); - - -echo "Done\n"; -?> ---EXPECTF-- -object(Object)#%d (0) { -} - -Warning: Missing argument 1 for Object1::__construct() in %s on line %d - -Notice: Undefined variable: var in %s on line %d -NULL -object(Object1)#%d (0) { -} -string(4) "test" -object(Object1)#%d (0) { -} -Done diff --git a/ext/reflection/tests/bug38653.phpt b/ext/reflection/tests/bug38653.phpt deleted file mode 100644 index 68781d2aba..0000000000 --- a/ext/reflection/tests/bug38653.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Bug #38653 (memory leak in ReflectionClass::getConstant()) ---FILE-- -<?php - -class foo { - const cons = 10; - const cons1 = ""; - const cons2 = "test"; -} - -class bar extends foo { -} - -$foo = new ReflectionClass("foo"); -var_dump($foo->getConstant("cons")); -var_dump($foo->getConstant("cons1")); -var_dump($foo->getConstant("cons2")); -var_dump($foo->getConstant("no such const")); - -echo "Done\n"; -?> ---EXPECTF-- -int(10) -string(0) "" -string(4) "test" -bool(false) -Done diff --git a/ext/reflection/tests/bug38942.phpt b/ext/reflection/tests/bug38942.phpt deleted file mode 100755 index 817190c997..0000000000 --- a/ext/reflection/tests/bug38942.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Bug #38942 (Double old-style-ctor inheritance) ---FILE-- -<?php -class foo { - public function foo() {} -} - -class bar extends foo { -} -ReflectionClass::export("bar"); -?> ---EXPECTF-- -Class [ <user> class bar extends foo ] { - @@ %sbug38942.php 6-7 - - - Constants [0] { - } - - - Static properties [0] { - } - - - Static methods [0] { - } - - - Properties [0] { - } - - - Methods [1] { - Method [ <user, inherits foo, ctor> public method foo ] { - @@ %sbug38942.php 3 - 3 - } - } -} diff --git a/ext/reflection/tests/bug39001.phpt b/ext/reflection/tests/bug39001.phpt deleted file mode 100644 index 1ed675f029..0000000000 --- a/ext/reflection/tests/bug39001.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Bug #39001 (ReflectionProperty returns incorrect declaring class for protected properties) ---FILE-- -<?php - -class Meta { -} - -class CParent extends Meta { - public $publicVar; - protected $protectedVar; -} - -class Child extends CParent { -} - -$r = new ReflectionClass('Child'); - -var_dump($r->getProperty('publicVar')->getDeclaringClass()->getName()); -var_dump($r->getProperty('protectedVar')->getDeclaringClass()->getName()); - -echo "Done\n"; -?> ---EXPECTF-- -string(7) "CParent" -string(7) "CParent" -Done diff --git a/ext/reflection/tests/bug39067.phpt b/ext/reflection/tests/bug39067.phpt deleted file mode 100644 index 8a7a6044e1..0000000000 --- a/ext/reflection/tests/bug39067.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -Bug #39067 (getDeclaringClass() and private properties) ---FILE-- -<?php - -class A { - private $x; -} - -class B extends A { - private $x; -} - -class C extends B { - private $x; -} - -$rc = new ReflectionClass('C'); -var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); - -$rc = new ReflectionClass('B'); -var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); - -$rc = new ReflectionClass('A'); -var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); - -class Test { - private $x; -} - -class Test2 extends Test { - public $x; -} - -$rc = new ReflectionClass('Test2'); -var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); - -echo "Done\n"; -?> ---EXPECTF-- -string(1) "C" -string(1) "B" -string(1) "A" -string(5) "Test2" -Done diff --git a/ext/reflection/tests/exception.inc b/ext/reflection/tests/exception.inc deleted file mode 100644 index e403339965..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; - } -} -?> diff --git a/ext/reflection/tests/parameters_001.phpt b/ext/reflection/tests/parameters_001.phpt deleted file mode 100755 index 62cd069b60..0000000000 --- a/ext/reflection/tests/parameters_001.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -ReflectionParameter Check for parameter being optional ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class Test { - function func($x, $y = NULL){ - } -} - - -$f = new ReflectionMethod('Test', 'func'); -var_dump($f->getNumberOfParameters()); -var_dump($f->getNumberOfRequiredParameters()); - -$p = new ReflectionParameter(array('Test', 'func'), 'x'); -var_dump($p->isOptional()); - -$p = new ReflectionParameter(array('Test', 'func'), 'y'); -var_dump($p->isOptional()); - -try { - $p = new ReflectionParameter(array('Test', 'func'), 'z'); - var_dump($p->isOptional()); -} -catch (Exception $e) { - var_dump($e->getMessage()); -} - -?> -===DONE=== ---EXPECT-- -int(2) -int(1) -bool(false) -bool(true) -string(54) "The parameter specified by its name could not be found" -===DONE=== diff --git a/ext/reflection/tests/parameters_002.phpt b/ext/reflection/tests/parameters_002.phpt deleted file mode 100755 index 6f911448c2..0000000000 --- a/ext/reflection/tests/parameters_002.phpt +++ /dev/null @@ -1,209 +0,0 @@ ---TEST-- -ReflectionParameter::getClass(), getDeclaringClass(), getDeclaringFunction() ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -function test($nix, Array $ar, &$ref, stdClass $std, NonExistingClass $na, stdClass &$opt = NULL, $def = "FooBar") -{ -} - -class test -{ - function test($nix, Array $ar, &$ref, stdClass $std, NonExistingClass $na, stdClass $opt = NULL, $def = "FooBar") - { - } -} - -function check_params_decl_func($r, $f) -{ - $c = $r->$f(); - echo $f . ': ' . ($c ? ($c instanceof ReflectionMethod ? $c->class . '::' : '') . $c->name : 'NULL') . "()\n"; -} - -function check_params_decl_class($r, $f) -{ - $c = $r->$f(); - echo $f . ': ' . ($c ? $c->name : 'NULL') . "\n"; -} - -function check_params_func($r, $f) -{ - echo $f . ': '; - $v = $r->$f(); - var_dump($v); -} - -function check_params($r) -{ - echo "#####" . ($r instanceof ReflectionMethod ? $r->class . '::' : '') . $r->name . "()#####\n"; - $i = 0; - foreach($r->getParameters() as $p) - { - echo "===" . $i . "===\n"; - $i++; - check_params_func($p, 'getName'); - check_params_func($p, 'isPassedByReference'); - try - { - check_params_decl_class($p, 'getClass'); - } - catch(ReflectionException $e) - { - echo $e->getMessage() . "\n"; - } - check_params_decl_class($p, 'getDeclaringClass'); -// check_params_decl_func($p, 'getDeclaringFunction'); - check_params_func($p, 'isArray'); - check_params_func($p, 'allowsNull'); - check_params_func($p, 'isOptional'); - check_params_func($p, 'isDefaultValueAvailable'); - if ($p->isOptional()) - { - check_params_func($p, 'getDefaultValue'); - } - } -} - -check_params(new ReflectionFunction('test')); - -check_params(new ReflectionMethod('test::test')); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -#####test()##### -===0=== -getName: string(3) "nix" -isPassedByReference: bool(false) -getClass: NULL -getDeclaringClass: NULL -isArray: bool(false) -allowsNull: bool(true) -isOptional: bool(false) -isDefaultValueAvailable: bool(false) -===1=== -getName: string(2) "ar" -isPassedByReference: bool(false) -getClass: NULL -getDeclaringClass: NULL -isArray: bool(true) -allowsNull: bool(false) -isOptional: bool(false) -isDefaultValueAvailable: bool(false) -===2=== -getName: string(3) "ref" -isPassedByReference: bool(true) -getClass: NULL -getDeclaringClass: NULL -isArray: bool(false) -allowsNull: bool(true) -isOptional: bool(false) -isDefaultValueAvailable: bool(false) -===3=== -getName: string(3) "std" -isPassedByReference: bool(false) -getClass: stdClass -getDeclaringClass: NULL -isArray: bool(false) -allowsNull: bool(false) -isOptional: bool(false) -isDefaultValueAvailable: bool(false) -===4=== -getName: string(2) "na" -isPassedByReference: bool(false) -Class NonExistingClass does not exist -getDeclaringClass: NULL -isArray: bool(false) -allowsNull: bool(false) -isOptional: bool(false) -isDefaultValueAvailable: bool(false) -===5=== -getName: string(3) "opt" -isPassedByReference: bool(true) -getClass: stdClass -getDeclaringClass: NULL -isArray: bool(false) -allowsNull: bool(true) -isOptional: bool(true) -isDefaultValueAvailable: bool(true) -getDefaultValue: NULL -===6=== -getName: string(3) "def" -isPassedByReference: bool(false) -getClass: NULL -getDeclaringClass: NULL -isArray: bool(false) -allowsNull: bool(true) -isOptional: bool(true) -isDefaultValueAvailable: bool(true) -getDefaultValue: string(6) "FooBar" -#####test::test()##### -===0=== -getName: string(3) "nix" -isPassedByReference: bool(false) -getClass: NULL -getDeclaringClass: test -isArray: bool(false) -allowsNull: bool(true) -isOptional: bool(false) -isDefaultValueAvailable: bool(false) -===1=== -getName: string(2) "ar" -isPassedByReference: bool(false) -getClass: NULL -getDeclaringClass: test -isArray: bool(true) -allowsNull: bool(false) -isOptional: bool(false) -isDefaultValueAvailable: bool(false) -===2=== -getName: string(3) "ref" -isPassedByReference: bool(true) -getClass: NULL -getDeclaringClass: test -isArray: bool(false) -allowsNull: bool(true) -isOptional: bool(false) -isDefaultValueAvailable: bool(false) -===3=== -getName: string(3) "std" -isPassedByReference: bool(false) -getClass: stdClass -getDeclaringClass: test -isArray: bool(false) -allowsNull: bool(false) -isOptional: bool(false) -isDefaultValueAvailable: bool(false) -===4=== -getName: string(2) "na" -isPassedByReference: bool(false) -Class NonExistingClass does not exist -getDeclaringClass: test -isArray: bool(false) -allowsNull: bool(false) -isOptional: bool(false) -isDefaultValueAvailable: bool(false) -===5=== -getName: string(3) "opt" -isPassedByReference: bool(false) -getClass: stdClass -getDeclaringClass: test -isArray: bool(false) -allowsNull: bool(true) -isOptional: bool(true) -isDefaultValueAvailable: bool(true) -getDefaultValue: NULL -===6=== -getName: string(3) "def" -isPassedByReference: bool(false) -getClass: NULL -getDeclaringClass: test -isArray: bool(false) -allowsNull: bool(true) -isOptional: bool(true) -isDefaultValueAvailable: bool(true) -getDefaultValue: string(6) "FooBar" -===DONE=== diff --git a/ext/reflection/tests/property_exists.phpt b/ext/reflection/tests/property_exists.phpt deleted file mode 100755 index 8fd45f2b8c..0000000000 --- a/ext/reflection/tests/property_exists.phpt +++ /dev/null @@ -1,224 +0,0 @@ ---TEST-- -Reflection and property_exists() ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class A -{ - public $a = 1; - protected $b = 2; - private $c = 3; - - public $empty; - public $init = 1; - - function __toString() - { - return 'obj(' . get_class($this) . ')'; - } - - static function test($oc, $props) - { - echo '===' . __CLASS__ . "===\n"; - foreach($props as $p2) { - echo $oc, '::$' , $p2, "\n"; - var_dump(property_exists($oc, $p2)); - } - } -} - -class B extends A -{ - private $c = 4; - - static function test($oc, $props) - { - echo '===' . __CLASS__ . "===\n"; - foreach($props as $p2) { - echo $oc, '::$' , $p2, "\n"; - var_dump(property_exists($oc, $p2)); - } - } -} - -class C extends B -{ - private $d = 5; - - static function test($oc, $props) - { - echo '===' . __CLASS__ . "===\n"; - foreach($props as $p2) { - echo $oc, '::$' , $p2, "\n"; - var_dump(property_exists($oc, $p2)); - } - } -} - -$oA = new A; -$oA->e = 6; - -$oC = new C; - -$pc = array($oA, 'A', 'B', 'C', $oC); -$pr = array('a', 'b', 'c', 'd', 'e'); - -foreach($pc as $p1) { - if (is_object($p1)) { - $p1->test($p1, $pr); - } else { - $r = new ReflectionMethod($p1, 'test'); - $r->invoke(NULL, $p1, $pr); - } - echo "===GLOBAL===\n"; - foreach($pr as $p2) { - echo $p1, '::$' , $p2, "\n"; - var_dump(property_exists($p1, $p2)); - } -} - -echo "===PROBLEMS===\n"; -var_dump(property_exists(NULL, 'empty')); -var_dump(property_exists(25,'empty')); -var_dump(property_exists('','')); -var_dump(property_exists('A','')); -var_dump(property_exists('A','123')); -var_dump(property_exists('A','init')); -var_dump(property_exists('A','empty')); -var_dump(property_exists(new A, '')); -var_dump(property_exists(new A, '123')); -var_dump(property_exists(new A, 'init')); -var_dump(property_exists(new A, 'empty')); -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -===A=== -obj(A)::$a -bool(true) -obj(A)::$b -bool(true) -obj(A)::$c -bool(true) -obj(A)::$d -bool(false) -obj(A)::$e -bool(true) -===GLOBAL=== -obj(A)::$a -bool(true) -obj(A)::$b -bool(false) -obj(A)::$c -bool(false) -obj(A)::$d -bool(false) -obj(A)::$e -bool(true) -===A=== -A::$a -bool(true) -A::$b -bool(true) -A::$c -bool(true) -A::$d -bool(false) -A::$e -bool(false) -===GLOBAL=== -A::$a -bool(true) -A::$b -bool(false) -A::$c -bool(false) -A::$d -bool(false) -A::$e -bool(false) -===B=== -B::$a -bool(true) -B::$b -bool(true) -B::$c -bool(true) -B::$d -bool(false) -B::$e -bool(false) -===GLOBAL=== -B::$a -bool(true) -B::$b -bool(false) -B::$c -bool(false) -B::$d -bool(false) -B::$e -bool(false) -===C=== -C::$a -bool(true) -C::$b -bool(true) -C::$c -bool(false) -C::$d -bool(true) -C::$e -bool(false) -===GLOBAL=== -C::$a -bool(true) -C::$b -bool(false) -C::$c -bool(false) -C::$d -bool(false) -C::$e -bool(false) -===C=== -obj(C)::$a -bool(true) -obj(C)::$b -bool(true) -obj(C)::$c -bool(false) -obj(C)::$d -bool(true) -obj(C)::$e -bool(false) -===GLOBAL=== -obj(C)::$a -bool(true) -obj(C)::$b -bool(false) -obj(C)::$c -bool(false) -obj(C)::$d -bool(false) -obj(C)::$e -bool(false) -===PROBLEMS=== - -Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists.php on line %d -NULL - -Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists.php on line %d -NULL -bool(false) -bool(false) -bool(false) -bool(true) -bool(true) -bool(false) -bool(false) -bool(true) -bool(true) -===DONE=== diff --git a/ext/reflection/tests/static_properties_002.phpt b/ext/reflection/tests/static_properties_002.phpt deleted file mode 100755 index 051b9fb10e..0000000000 --- a/ext/reflection/tests/static_properties_002.phpt +++ /dev/null @@ -1,62 +0,0 @@ ---TEST-- -Reflection and inheriting static properties ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class base { - static protected $prop = 2; - - static function show() { - echo __METHOD__ . '(' . self::$prop . ")\n"; - } - - static function inc() { - base::$prop++; - echo __METHOD__ . "()\n"; - } -} - -class derived extends base { - static public $prop; - - static function show() { - echo __METHOD__ . '(' . self::$prop . ")\n"; - } - - static function inc() { - derived::$prop++; - echo __METHOD__ . "()\n"; - } -} - -base::show(); -derived::show(); - -base::inc(); - -base::show(); -derived::show(); - -derived::inc(); - -base::show(); -derived::show(); - -$r = new ReflectionClass('derived'); -echo 'Number of properties: '. count($r->getStaticProperties()) . "\n"; - -echo "Done\n"; -?> ---EXPECTF-- -base::show(2) -derived::show(2) -base::inc() -base::show(3) -derived::show(3) -derived::inc() -base::show(4) -derived::show(4) -Number of properties: 1 -Done |