1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Deprecate Reflection export() methods

And remove the Reflector::export() interface method.
This commit is contained in:
Nikita Popov
2019-07-11 13:41:10 +02:00
parent 0ba7c3eadf
commit 3121b7174f
34 changed files with 125 additions and 73 deletions

View File

@@ -19,7 +19,7 @@ class x extends c implements a, b {
function foo() { }
}
ReflectionClass::export('x');
echo new ReflectionClass('x');
?>
--EXPECTF--

View File

@@ -9,7 +9,7 @@ class A {
}
}
ReflectionClass::export("A");
echo new ReflectionClass("A");
?>
--EXPECTF--
Class [ <user> class A ] {

View File

@@ -6262,12 +6262,11 @@ ZEND_END_ARG_INFO()
static const zend_function_entry reflection_functions[] = {
ZEND_ME(reflection, getModifierNames, arginfo_reflection_getModifierNames, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_ME(reflection, export, arginfo_reflection_export, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_DEP_ME(reflection, export, arginfo_reflection_export, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_FE_END
};
static const zend_function_entry reflector_functions[] = {
ZEND_FENTRY(export, NULL, NULL, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)
ZEND_ABSTRACT_ME(reflector, __toString, arginfo_reflection__void)
PHP_FE_END
};
@@ -6322,7 +6321,7 @@ static const zend_function_entry reflection_function_abstract_functions[] = {
static const zend_function_entry reflection_function_functions[] = {
ZEND_ME(reflection_function, __construct, arginfo_reflection_function___construct, 0)
ZEND_ME(reflection_function, __toString, arginfo_reflection__void, 0)
ZEND_ME(reflection_function, export, arginfo_reflection_function_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_DEP_ME(reflection_function, export, arginfo_reflection_function_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_ME(reflection_function, isDisabled, arginfo_reflection__void, 0)
ZEND_ME(reflection_function, invoke, arginfo_reflection_function_invoke, 0)
ZEND_ME(reflection_function, invokeArgs, arginfo_reflection_function_invokeArgs, 0)
@@ -6379,7 +6378,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_getClosure, 0)
ZEND_END_ARG_INFO()
static const zend_function_entry reflection_method_functions[] = {
ZEND_ME(reflection_method, export, arginfo_reflection_method_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_DEP_ME(reflection_method, export, arginfo_reflection_method_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_ME(reflection_method, __construct, arginfo_reflection_method___construct, 0)
ZEND_ME(reflection_method, __toString, arginfo_reflection__void, 0)
ZEND_ME(reflection_method, isPublic, arginfo_reflection__void, 0)
@@ -6477,7 +6476,7 @@ ZEND_END_ARG_INFO()
static const zend_function_entry reflection_class_functions[] = {
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(reflection_class, export, arginfo_reflection_class_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_DEP_ME(reflection_class, export, arginfo_reflection_class_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_ME(reflection_class, __construct, arginfo_reflection_class___construct, 0)
ZEND_ME(reflection_class, __toString, arginfo_reflection__void, 0)
ZEND_ME(reflection_class, getName, arginfo_reflection__void, 0)
@@ -6544,7 +6543,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_object___construct, 0)
ZEND_END_ARG_INFO()
static const zend_function_entry reflection_object_functions[] = {
ZEND_ME(reflection_object, export, arginfo_reflection_object_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_DEP_ME(reflection_object, export, arginfo_reflection_object_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_ME(reflection_object, __construct, arginfo_reflection_object___construct, 0)
PHP_FE_END
};
@@ -6580,7 +6579,7 @@ ZEND_END_ARG_INFO()
static const zend_function_entry reflection_property_functions[] = {
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(reflection_property, export, arginfo_reflection_property_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_DEP_ME(reflection_property, export, arginfo_reflection_property_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_ME(reflection_property, __construct, arginfo_reflection_property___construct, 0)
ZEND_ME(reflection_property, __toString, arginfo_reflection__void, 0)
ZEND_ME(reflection_property, getName, arginfo_reflection__void, 0)
@@ -6614,7 +6613,7 @@ ZEND_END_ARG_INFO()
static const zend_function_entry reflection_class_constant_functions[] = {
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(reflection_class_constant, export, arginfo_reflection_class_constant_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_DEP_ME(reflection_class_constant, export, arginfo_reflection_class_constant_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_ME(reflection_class_constant, __construct, arginfo_reflection_class_constant___construct, 0)
ZEND_ME(reflection_class_constant, __toString, arginfo_reflection__void, 0)
ZEND_ME(reflection_class_constant, getName, arginfo_reflection__void, 0)
@@ -6641,7 +6640,7 @@ ZEND_END_ARG_INFO()
static const zend_function_entry reflection_parameter_functions[] = {
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(reflection_parameter, export, arginfo_reflection_parameter_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_DEP_ME(reflection_parameter, export, arginfo_reflection_parameter_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_ME(reflection_parameter, __construct, arginfo_reflection_parameter___construct, 0)
ZEND_ME(reflection_parameter, __toString, arginfo_reflection__void, 0)
ZEND_ME(reflection_parameter, getName, arginfo_reflection__void, 0)
@@ -6689,7 +6688,7 @@ ZEND_END_ARG_INFO()
static const zend_function_entry reflection_extension_functions[] = {
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(reflection_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_DEP_ME(reflection_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_ME(reflection_extension, __construct, arginfo_reflection_extension___construct, 0)
ZEND_ME(reflection_extension, __toString, arginfo_reflection__void, 0)
ZEND_ME(reflection_extension, getName, arginfo_reflection__void, 0)
@@ -6712,7 +6711,7 @@ ZEND_END_ARG_INFO()
static const zend_function_entry reflection_zend_extension_functions[] = {
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(reflection_zend_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_DEP_ME(reflection_zend_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
ZEND_ME(reflection_zend_extension, __construct, arginfo_reflection_zend_extension___construct, 0)
ZEND_ME(reflection_zend_extension, __toString, arginfo_reflection__void, 0)
ZEND_ME(reflection_zend_extension, getName, arginfo_reflection__void, 0)

View File

@@ -14,7 +14,7 @@ function test ($a, $b = 1, $c = "") {
$func = new ReflectionFunction("test");
var_dump($func->export("test"));
echo $func;
echo "--getName--\n";
var_dump($func->getName());
echo "--isInternal--\n";
@@ -60,8 +60,6 @@ Function [ <user> function test ] {
Parameter #2 [ <optional> $c = '' ]
}
}
NULL
--getName--
string(4) "test"
--isInternal--

View File

@@ -14,7 +14,7 @@ function test ($a, $b = 1, $c = "") {
$func = new ReflectionFunction("test");
var_dump($func->export("test"));
echo $func;
echo "--getName--\n";
var_dump($func->getName());
echo "--isInternal--\n";
@@ -60,8 +60,6 @@ Function [ <user> function test ] {
Parameter #2 [ <optional> $c = '' ]
}
}
NULL
--getName--
string(4) "test"
--isInternal--

View File

@@ -56,9 +56,13 @@ __toString():
string(35) "Constant [ public bool PUB ] { 1 }
"
export():
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
string(35) "Constant [ public bool PUB ] { 1 }
"
export():
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
Constant [ public bool PUB ] { 1 }
NULL
@@ -90,9 +94,13 @@ __toString():
string(38) "Constant [ protected int PROT ] { 4 }
"
export():
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
string(38) "Constant [ protected int PROT ] { 4 }
"
export():
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
Constant [ protected int PROT ] { 4 }
NULL
@@ -124,9 +132,13 @@ __toString():
string(45) "Constant [ private string PRIV ] { keepOut }
"
export():
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
string(45) "Constant [ private string PRIV ] { keepOut }
"
export():
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
Constant [ private string PRIV ] { keepOut }
NULL
@@ -158,9 +170,13 @@ __toString():
string(45) "Constant [ private string PRIV ] { keepOut }
"
export():
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
string(45) "Constant [ private string PRIV ] { keepOut }
"
export():
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
Constant [ private string PRIV ] { keepOut }
NULL

View File

@@ -1,12 +1,12 @@
--TEST--
ReflectionClass::export() - array constants
ReflectionClass::__toString() - array constants
--FILE--
<?php
Class A {
const A = 8;
const B = ["a", "b"];
}
ReflectionClass::export("A");
echo new ReflectionClass("A"), "\n";
?>
--EXPECTF--
Class [ <user> class A ] {

View File

@@ -1,5 +1,5 @@
--TEST--
ReflectionClass::export() - various parameters
ReflectionClass::__toString() - various parameters
--FILE--
<?php
Class A {
@@ -17,7 +17,7 @@ Class A {
Class C extends A { }
define('K', "16 chars long --");
ReflectionClass::export("C");
echo new ReflectionClass("C"), "\n";
?>
--EXPECTF--
Class [ <user> class C extends A ] {

View File

@@ -1,5 +1,5 @@
--TEST--
ReflectionClass::export() - ensure inherited private props are hidden.
ReflectionClass::__toString() - ensure inherited private props are hidden.
--FILE--
<?php
Class c {
@@ -9,8 +9,8 @@ Class c {
class d extends c {}
ReflectionClass::export("c");
ReflectionClass::export("d");
echo new ReflectionClass("c"), "\n";
echo new ReflectionClass("d"), "\n";
?>
--EXPECTF--
Class [ <user> class c ] {

View File

@@ -21,7 +21,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
}
- Static methods [1] {
Method [ <internal:Reflection, prototype Reflector> static public method export ] {
Method [ <internal, deprecated:Reflection> static public method export ] {
- Parameters [2] {
Parameter #0 [ <required> $argument ]

View File

@@ -5,18 +5,14 @@ Gerrit "Remi" te Sligte <remi@wolerized.com>
Leon Luijkx <leon@phpgg.nl>
--FILE--
<?php
ob_start();
ReflectionExtension::export("reflection", true);
$test = ob_get_clean();
var_dump(empty($test));
unset($test);
ob_start();
ReflectionExtension::export("reflection", false);
$test = ob_get_clean();
var_dump(empty($test));
?>
==DONE==
--EXPECT--
bool(true)
--EXPECTF--
Deprecated: Function ReflectionExtension::export() is deprecated in %s on line %d
bool(false)
==DONE==

View File

@@ -60,6 +60,8 @@ string(%d) "Method [ <user, inherits TestClass> public method foo ] {
"
export():
Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
string(%d) "Method [ <user, inherits TestClass> public method foo ] {
@@ %s 16 - 18
}
@@ -76,6 +78,8 @@ string(%d) "Method [ <user> static public method stat ] {
"
export():
Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
string(%d) "Method [ <user> static public method stat ] {
@@ %s 20 - 22
}
@@ -92,6 +96,8 @@ string(%d) "Method [ <user> private method priv ] {
"
export():
Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
string(%d) "Method [ <user> private method priv ] {
@@ %s 24 - 26
}
@@ -108,6 +114,8 @@ string(%d) "Method [ <user> protected method prot ] {
"
export():
Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
string(%d) "Method [ <user> protected method prot ] {
@@ %s 28 - 28
}
@@ -124,6 +132,8 @@ string(%d) "Method [ <user, inherits TestClass> protected method prot ] {
"
export():
Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
string(%d) "Method [ <user, inherits TestClass> protected method prot ] {
@@ %s 28 - 28
}
@@ -140,6 +150,8 @@ string(%d) "Method [ <user> abstract public method int ] {
"
export():
Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
string(%d) "Method [ <user> abstract public method int ] {
@@ %s 36 - 36
}
@@ -160,6 +172,8 @@ string(%d) "Method [ <internal:Reflection, ctor> public method __construct ] {
"
export():
Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
string(%d) "Method [ <internal:Reflection, ctor> public method __construct ] {
- Parameters [2] {
@@ -180,6 +194,8 @@ string(%d) "Method [ <user, dtor> public method __destruct ] {
"
export():
Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
string(%d) "Method [ <user, dtor> public method __destruct ] {
@@ %s 30 - 30
}

View File

@@ -1,5 +1,5 @@
--TEST--
ReflectionObject::export() : very basic test with no dynamic properties
ReflectionObject::__toString() : very basic test with no dynamic properties
--FILE--
<?php
@@ -8,7 +8,7 @@ class Foo {
}
$f = new foo;
ReflectionObject::export($f);
echo new ReflectionObject($f);
?>
--EXPECTF--

View File

@@ -1,5 +1,5 @@
--TEST--
ReflectionObject::export() : very basic test with dynamic properties
ReflectionObject::__toString() : very basic test with dynamic properties
--FILE--
<?php
@@ -9,7 +9,7 @@ class Foo {
$f = new foo;
$f->dynProp = 'hello';
$f->dynProp2 = 'hello again';
ReflectionObject::export($f);
echo new ReflectionObject($f);
?>
--EXPECTF--

View File

@@ -1,5 +1,5 @@
--TEST--
ReflectionObject::export() - ensure dynamic property with same name as inherited private property is shown.
ReflectionObject::__toString() - ensure dynamic property with same name as inherited private property is shown.
--FILE--
<?php
class C {
@@ -11,7 +11,7 @@ class D extends C{
$Obj = new D;
$Obj->p = 'value';
ReflectionObject::export($Obj)
echo new ReflectionObject($Obj);
?>
--EXPECTF--
Object of class [ <user> class D extends C ] {

View File

@@ -1,5 +1,5 @@
--TEST--
ReflectionParameter::export()
ReflectionParameter::__toString()
--CREDITS--
Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
--FILE--
@@ -9,11 +9,11 @@ function ReflectionParameterTest($test, $test2 = null) {
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
foreach($reflect->getParameters() as $key => $value) {
echo ReflectionParameter::export('ReflectionParameterTest', $key);
echo new ReflectionParameter('ReflectionParameterTest', $key), "\n";
}
?>
==DONE==
--EXPECT--
--EXPECTF--
Parameter #0 [ <required> $test ]
Parameter #1 [ <optional> $test2 = NULL ]
==DONE==

View File

@@ -26,6 +26,9 @@ catch (ReflectionException $e) {
echo $e->getMessage() . "\n";
}
?>
--EXPECT--
--EXPECTF--
Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d
Method ReflectionFunction::__invoke() does not exist
Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d
The parameter class is expected to be either a string, an array(class, method) or a callable object

View File

@@ -13,9 +13,11 @@ foreach($params as $key => $value) {
ReflectionParameter::export('ReflectionParameterTest', 'incorrect_parameter');
}
--EXPECTF--
Fatal error: Uncaught ReflectionException: The parameter specified by its name could not be found in %s.php:%d
Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d
Fatal error: Uncaught ReflectionException: The parameter specified by its name could not be found in %s:%d
Stack trace:
#0 [internal function]: ReflectionParameter->__construct('ReflectionParam...', 'incorrect_param...')
#1 %s.php(%d): ReflectionParameter::export('ReflectionParam...', 'incorrect_param...')
#1 %s(%d): ReflectionParameter::export('ReflectionParam...', 'incorrect_param...')
#2 {main}
thrown in %s.php on line %d
thrown in %s on line %d

View File

@@ -47,7 +47,7 @@ reflectProperty("TestClass", "prot");
reflectProperty("TestClass", "priv");
?>
--EXPECT--
--EXPECTF--
**********************************
Reflecting on property TestClass::pub
@@ -55,9 +55,13 @@ __toString():
string(35) "Property [ <default> public $pub ]
"
export():
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
string(35) "Property [ <default> public $pub ]
"
export():
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
Property [ <default> public $pub ]
NULL
@@ -84,9 +88,13 @@ __toString():
string(33) "Property [ public static $stat ]
"
export():
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
string(33) "Property [ public static $stat ]
"
export():
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
Property [ public static $stat ]
NULL
@@ -113,9 +121,13 @@ __toString():
string(39) "Property [ <default> protected $prot ]
"
export():
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
string(39) "Property [ <default> protected $prot ]
"
export():
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
Property [ <default> protected $prot ]
NULL
@@ -138,9 +150,13 @@ __toString():
string(37) "Property [ <default> private $priv ]
"
export():
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
string(37) "Property [ <default> private $priv ]
"
export():
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
Property [ <default> private $priv ]
NULL

View File

@@ -1,5 +1,5 @@
--TEST--
Test ReflectionProperty::export() usage.
Test ReflectionProperty::__toString() usage.
--FILE--
<?php
@@ -7,10 +7,8 @@ class TestClass {
public $proper = 5;
}
var_dump(ReflectionProperty::export('TestClass', 'proper'));
echo new ReflectionProperty('TestClass', 'proper');
?>
--EXPECT--
Property [ <default> public $proper ]
NULL

View File

@@ -39,16 +39,26 @@ ReflectionProperty::export('TestClass', "nonExistentProperty", true, false);
?>
--EXPECTF--
Non-existent class:
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
Class NonExistentClass does not exist
Wrong property parameter type:
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
The parameter class is expected to be either a string or an object
Non-existent property:
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
Property TestClass::$nonExistentProperty does not exist
Incorrect number of args:
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
Warning: ReflectionProperty::export() expects at least 2 parameters, 0 given in %s on line %d
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
Warning: ReflectionProperty::export() expects at most 3 parameters, 4 given in %s on line %d

View File

@@ -14,10 +14,12 @@ var_dump($reflection->getURL());
var_dump($reflection->getVersion() === PHP_VERSION);
var_dump(gettype($reflection->export('Zend OPcache', true)) === 'string');
?>
--EXPECT--
--EXPECTF--
string(17) "Zend Technologies"
string(13) "Copyright (c)"
string(12) "Zend OPcache"
string(20) "http://www.zend.com/"
bool(true)
Deprecated: Function ReflectionZendExtension::export() is deprecated in %s on line %d
bool(true)

View File

@@ -13,7 +13,7 @@ class just_constants
const FLOAT_CONSTANT = 3.14159265;
}
Reflection::export(new ReflectionClass('just_constants'));
echo new ReflectionClass('just_constants');
?>
--EXPECTF--
Class [ <user> class just_constants ] {

View File

@@ -19,10 +19,7 @@ class Test {
function foo() {
}
}
Reflection::export(new ReflectionClass('Test'));
?>
===DONE===
<?php exit(0); ?>
echo new ReflectionClass('Test');
--EXPECTF--
Class [ <user> class Test ] {
@@ %sbug33389.php 3-18
@@ -93,5 +90,3 @@ Class [ <user> class Test ] {
}
}
}
===DONE===

View File

@@ -19,7 +19,7 @@ class bar extends foo {
}
}
Reflection::export(new ReflectionClass(new bar));
echo new ReflectionClass(new bar);
?>
--EXPECTF--

View File

@@ -8,7 +8,7 @@ class foo {
class bar extends foo {
}
ReflectionClass::export("bar");
echo new ReflectionClass("bar");
?>
--EXPECTF--
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in %s on line %d

View File

@@ -1,5 +1,5 @@
--TEST--
Reflection Bug #41061 ("visibility error" in ReflectionFunction::export())
Reflection Bug #41061 ("visibility error" in ReflectionFunction::__toString())
--FILE--
<?php
@@ -11,8 +11,8 @@ class bar {
}
}
Reflection::export(new ReflectionFunction('foo'));
Reflection::export(new ReflectionMethod('bar', 'foo'));
echo new ReflectionFunction('foo'), "\n";
echo new ReflectionMethod('bar', 'foo'), "\n";
?>
===DONE===
<?php exit(0); ?>

View File

@@ -1,5 +1,5 @@
--TEST--
Bug #45571 (ReflectionClass::export() shows superclasses' private static methods.)
Bug #45571 (ReflectionClass::__toString() shows superclasses' private static methods.)
--FILE--
<?php
@@ -14,7 +14,7 @@ Class A {
Class C extends A { }
ReflectionClass::export("C");
echo new ReflectionClass("C");
?>
--EXPECTF--

View File

@@ -23,7 +23,7 @@ class foo extends foo2 {
}
}
ReflectionObject::export(new foo);
echo new ReflectionObject(new foo);
?>
--EXPECTF--

View File

@@ -10,5 +10,6 @@ try {
} catch (Exception $e) { }
?>
ok
--EXPECT--
--EXPECTF--
Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d
ok

View File

@@ -10,8 +10,8 @@ trait bar {
}
reflectionclass::export('foo');
reflectionclass::export('bar');
echo new ReflectionClass('foo'), "\n";
echo new ReflectionClass('bar'), "\n";
?>
--EXPECTF--

View File

@@ -31,7 +31,9 @@ try {
===DONE===
--EXPECT--
Error: simplexml_load_string() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given
Error: Function Reflection::export() is deprecated
Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given
Error: simplexml_load_file() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given
Error: Function Reflection::export() is deprecated
Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given
===DONE===

View File

@@ -2,7 +2,7 @@
SPL: Test shape of interface Countable.
--FILE--
<?php
ReflectionClass::export('Countable');
echo new ReflectionClass('Countable');
?>
--EXPECTF--
Interface [ <internal%s> interface Countable ] {

View File

@@ -2,8 +2,8 @@
Bug #61116 (HTML functions use encoding, not charset)
--FILE--
<?php
Reflection::export(new ReflectionFunction('htmlspecialchars'));
Reflection::export(new ReflectionFunction('get_html_translation_table'));
echo new ReflectionFunction('htmlspecialchars'), "\n";
echo new ReflectionFunction('get_html_translation_table'), "\n";
?>
--EXPECT--
Function [ <internal:standard> function htmlspecialchars ] {