Deprecate __autoload()

This commit is contained in:
Nikita Popov 2017-01-30 22:28:17 +01:00
parent eaeecc523b
commit 162aa1a5fc
83 changed files with 465 additions and 498 deletions

View file

@ -1,24 +1,21 @@
--TEST-- --TEST--
Bug #26697 (calling class_exists on a nonexistent class in __autoload results in segfault) Bug #26697 (calling class_exists on a nonexistent class in __autoload results in segfault)
--SKIPIF--
<?php if (function_exists('__autoload')) die('skip __autoload() declared in auto_prepend_file');?>
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{
echo __METHOD__ . "($name)\n"; echo __METHOD__ . "($name)\n";
var_dump(class_exists('NotExistingClass')); var_dump(class_exists('NotExistingClass'));
echo __METHOD__ . "($name), done\n"; echo __METHOD__ . "($name), done\n";
} });
var_dump(class_exists('NotExistingClass')); var_dump(class_exists('NotExistingClass'));
?> ?>
===DONE=== ===DONE===
--EXPECTF-- --EXPECTF--
__autoload(NotExistingClass) {closure}(NotExistingClass)
bool(false) bool(false)
__autoload(NotExistingClass), done {closure}(NotExistingClass), done
bool(false) bool(false)
===DONE=== ===DONE===

View file

@ -5,8 +5,7 @@ Bug #31102 (Exception not handled when thrown inside __autoload())
$test = 0; $test = 0;
function __autoload($class) spl_autoload_register(function ($class) {
{
global $test; global $test;
echo __METHOD__ . "($class,$test)\n"; echo __METHOD__ . "($class,$test)\n";
@ -22,7 +21,7 @@ function __autoload($class)
case 3: case 3:
return; return;
} }
} });
while($test++ < 5) while($test++ < 5)
{ {
@ -39,11 +38,11 @@ while($test++ < 5)
===DONE=== ===DONE===
<?php exit(0); ?> <?php exit(0); ?>
--EXPECTF-- --EXPECTF--
__autoload(Test1,1) {closure}(Test1,1)
Caught: Test1::__construct Caught: Test1::__construct
__autoload(Test2,2) {closure}(Test2,2)
Caught: __autoload Caught: {closure}
__autoload(Test3,3) {closure}(Test3,3)
Fatal error: Uncaught Error: Class 'Test3' not found in %sbug31102.php(%d) : eval()'d code:1 Fatal error: Uncaught Error: Class 'Test3' not found in %sbug31102.php(%d) : eval()'d code:1
Stack trace: Stack trace:

View file

@ -2,11 +2,10 @@
Bug #33116 (crash when assigning class name to global variable in __autoload) Bug #33116 (crash when assigning class name to global variable in __autoload)
--FILE-- --FILE--
<?php <?php
function __autoload($class) spl_autoload_register(function ($class) {
{
$GLOBALS['include'][] = $class; $GLOBALS['include'][] = $class;
eval("class DefClass{}"); eval("class DefClass{}");
} });
$a = new DefClass; $a = new DefClass;
print_r($a); print_r($a);

View file

@ -2,7 +2,7 @@
Bug #37138 (__autoload tries to load callback'ed self and parent) Bug #37138 (__autoload tries to load callback'ed self and parent)
--FILE-- --FILE--
<?php <?php
function __autoload ($CN) {var_dump ($CN);} spl_autoload_register(function ($CN) { var_dump ($CN); });
class st { class st {
public static function e () {echo ("EHLO\n");} public static function e () {echo ("EHLO\n");}
public static function e2 () {call_user_func (array ('self', 'e'));} public static function e2 () {call_user_func (array ('self', 'e'));}

View file

@ -10,10 +10,9 @@ class ClassName
function test (OtherClassName $object) { } function test (OtherClassName $object) { }
function __autoload($class) spl_autoload_register(function ($class) {
{
var_dump("__autload($class)"); var_dump("__autload($class)");
} });
$obj = new ClassName; $obj = new ClassName;
test($obj); test($obj);

View file

@ -10,11 +10,11 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
set_include_path(dirname(__FILE__).'/bug39542:.'); set_include_path(dirname(__FILE__).'/bug39542:.');
} }
function __autoload($class) { spl_autoload_register(function ($class) {
if (!require_once($class.'.php')) { if (!require_once($class.'.php')) {
error_log('Error: Autoload class: '.$class.' not found!'); error_log('Error: Autoload class: '.$class.' not found!');
} }
} });
new bug39542(); new bug39542();

View file

@ -2,10 +2,10 @@
Bug #42798 (_autoload() not triggered for classes used in method signature) Bug #42798 (_autoload() not triggered for classes used in method signature)
--FILE-- --FILE--
<?php <?php
function __autoload($className) { spl_autoload_register(function ($className) {
print "$className\n"; print "$className\n";
exit(); exit();
} });
function foo($c = ok::constant) { function foo($c = ok::constant) {
} }

View file

@ -3,12 +3,13 @@ Bug #46665 (Triggering autoload with a variable classname causes truncated autol
--FILE-- --FILE--
<?php <?php
$baz = '\\Foo\\Bar\\Baz'; spl_autoload_register(function ($class) {
new $baz();
function __autoload($class) {
var_dump($class); var_dump($class);
require __DIR__ .'/bug46665_autoload.inc'; require __DIR__ .'/bug46665_autoload.inc';
} });
$baz = '\\Foo\\Bar\\Baz';
new $baz();
?> ?>
--EXPECTF-- --EXPECTF--

View file

@ -10,11 +10,7 @@ function au($class) {
}'); }');
} }
function __autoload($class) { spl_autoload_register('au');
au($class);
}
//spl_autoload_register('au');
set_exception_handler(function($exception) { set_exception_handler(function($exception) {
$h = new handler(); $h = new handler();

View file

@ -3,7 +3,7 @@ Bug #49908 (throwing exception in __autoload crashes when interface is not defin
--FILE-- --FILE--
<?php <?php
function __autoload($className) { spl_autoload_register(function ($className) {
var_dump($className); var_dump($className);
if ($className == 'Foo') { if ($className == 'Foo') {
@ -11,7 +11,7 @@ function __autoload($className) {
} else { } else {
throw new Exception($className); throw new Exception($className);
} }
} });
new Foo; new Foo;
@ -22,7 +22,9 @@ string(3) "Bar"
Fatal error: Uncaught Exception: Bar in %s:%d Fatal error: Uncaught Exception: Bar in %s:%d
Stack trace: Stack trace:
#0 %s(7): __autoload('Bar') #0 [internal function]: {closure}('Bar')
#1 %s(13): __autoload('Foo') #1 %s(%d): spl_autoload_call('Bar')
#2 {main} #2 [internal function]: {closure}('Foo')
#3 %s(%d): spl_autoload_call('Foo')
#4 {main}
thrown in %s on line %d thrown in %s on line %d

View file

@ -3,10 +3,10 @@ Bug #55007 (compiler fail after previous fail)
--FILE-- --FILE--
<?php <?php
function __autoload($classname) { spl_autoload_register(function ($classname) {
if ('CompileErrorClass'==$classname) eval('class CompileErrorClass { function foo() { $a[]; } }'); if ('CompileErrorClass'==$classname) eval('class CompileErrorClass { function foo() { $a[]; } }');
if ('MyErrorHandler'==$classname) eval('class MyErrorHandler { function __construct() { print "My error handler runs.\n"; } }'); if ('MyErrorHandler'==$classname) eval('class MyErrorHandler { function __construct() { print "My error handler runs.\n"; } }');
} });
function shutdown() { function shutdown() {
new MyErrorHandler(); new MyErrorHandler();

View file

@ -2,9 +2,10 @@
Bug #61011 (Crash when an exception is thrown by __autoload accessing a static property) Bug #61011 (Crash when an exception is thrown by __autoload accessing a static property)
--FILE-- --FILE--
<?php <?php
function __autoload($name) { spl_autoload_register(function ($name) {
throw new Exception($name); throw new Exception($name);
} });
try { try {
echo AAA::$a; //zend_fetch_var_address_helper echo AAA::$a; //zend_fetch_var_address_helper
} catch (Exception $e) { } catch (Exception $e) {

View file

@ -2,7 +2,7 @@
Bug #62907 (Double free when use traits) Bug #62907 (Double free when use traits)
--FILE-- --FILE--
<?php <?php
function __autoload($name) { spl_autoload_register(function ($name) {
if ($name == "B") { if ($name == "B") {
eval ("abstract class B extends A { }"); eval ("abstract class B extends A { }");
} else if ($name == "A") { } else if ($name == "A") {
@ -11,7 +11,7 @@ function __autoload($name) {
eval ("trait T { public function __construct() { } }"); eval ("trait T { public function __construct() { } }");
} }
return TRUE; return TRUE;
} });
class C extends B { class C extends B {
public function __construct() { public function __construct() {

View file

@ -2,9 +2,8 @@
Bug #63305 (zend_mm_heap corrupted with traits) Bug #63305 (zend_mm_heap corrupted with traits)
--FILE-- --FILE--
<?php <?php
new Attachment("");
function __autoload($class) { spl_autoload_register(function ($class) {
switch ($class) { switch ($class) {
case "Attachment": case "Attachment":
eval(<<<'PHP' eval(<<<'PHP'
@ -36,7 +35,9 @@ PHP
break; break;
} }
return TRUE; return TRUE;
} });
new Attachment("");
echo "okey"; echo "okey";
?> ?>
--EXPECT-- --EXPECT--

View file

@ -2,12 +2,11 @@
Bug #65254 (Exception not catchable when exception thrown in autoload with a namespace) Bug #65254 (Exception not catchable when exception thrown in autoload with a namespace)
--FILE-- --FILE--
<?php <?php
function __autoload($class) spl_autoload_register(function ($class) {
{
eval("namespace ns_test; class test {}"); eval("namespace ns_test; class test {}");
throw new \Exception('abcd'); throw new \Exception('abcd');
} });
try try
{ {

View file

@ -2,10 +2,10 @@
Bug #71163 (Segmentation Fault (cleanup_unfinished_calls)) Bug #71163 (Segmentation Fault (cleanup_unfinished_calls))
--FILE-- --FILE--
<?php <?php
function __autoload($name) { spl_autoload_register(function ($name) {
eval ("class $name extends Exception { public static function foo() {}}"); eval ("class $name extends Exception { public static function foo() {}}");
throw new Exception("boom"); throw new Exception("boom");
} });
function test2() { function test2() {
try { try {

View file

@ -3,9 +3,9 @@ Testing call_user_func() with autoload and passing invalid params
--FILE-- --FILE--
<?php <?php
function __autoload($class) { spl_autoload_register(function ($class) {
var_dump($class); var_dump($class);
} });
call_user_func(array('foo', 'bar')); call_user_func(array('foo', 'bar'));
call_user_func(array('', 'bar')); call_user_func(array('', 'bar'));

View file

@ -2,11 +2,11 @@
catch shouldn't call __autoload catch shouldn't call __autoload
--FILE-- --FILE--
<?php <?php
function __autoload($name) {
spl_autoload_register(function ($name) {
echo("AUTOLOAD '$name'\n"); echo("AUTOLOAD '$name'\n");
eval("class $name {}"); eval("class $name {}");
} });
try { try {
} catch (A $e) { } catch (A $e) {

View file

@ -3,9 +3,9 @@ Testing class_alias() using autoload
--FILE-- --FILE--
<?php <?php
function __autoload($a) { spl_autoload_register(function ($a) {
class foo { } class foo { }
} });
class_alias('foo', 'bar', 1); class_alias('foo', 'bar', 1);

View file

@ -2,10 +2,10 @@
instanceof shouldn't call __autoload instanceof shouldn't call __autoload
--FILE-- --FILE--
<?php <?php
function __autoload($name) { spl_autoload_register(function ($name) {
echo("AUTOLOAD '$name'\n"); echo("AUTOLOAD '$name'\n");
eval("class $name {}"); eval("class $name {}");
} });
class A { class A {
} }

View file

@ -4,10 +4,10 @@ is_a() and is_subclass_of() shouldn't call __autoload
error_reporting=14335 error_reporting=14335
--FILE-- --FILE--
<?php <?php
function __autoload($name) { spl_autoload_register(function ($name) {
echo("AUTOLOAD '$name'\n"); echo("AUTOLOAD '$name'\n");
eval("class $name {}"); eval("class $name {}");
} });
class BASE { class BASE {
} }

View file

@ -5523,13 +5523,15 @@ static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_as
} }
} }
if (zend_string_equals_literal(lcname, ZEND_AUTOLOAD_FUNC_NAME) if (zend_string_equals_literal(lcname, ZEND_AUTOLOAD_FUNC_NAME)) {
&& zend_ast_get_list(params_ast)->children != 1 if (zend_ast_get_list(params_ast)->children != 1) {
) {
zend_error_noreturn(E_COMPILE_ERROR, "%s() must take exactly 1 argument", zend_error_noreturn(E_COMPILE_ERROR, "%s() must take exactly 1 argument",
ZEND_AUTOLOAD_FUNC_NAME); ZEND_AUTOLOAD_FUNC_NAME);
} }
zend_error(E_DEPRECATED, "__autoload() is deprecated, use spl_autoload_register() instead");
}
key = zend_build_runtime_definition_key(lcname, decl->lex_pos); key = zend_build_runtime_definition_key(lcname, decl->lex_pos);
zend_hash_update_ptr(CG(function_table), key, op_array); zend_hash_update_ptr(CG(function_table), key, op_array);
zend_register_seen_symbol(lcname, ZEND_SYMBOL_FUNCTION); zend_register_seen_symbol(lcname, ZEND_SYMBOL_FUNCTION);

View file

@ -13,6 +13,7 @@ files/pear2coverage.phar.php
--EXPECTHEADERS-- --EXPECTHEADERS--
Content-type: text/html; charset=UTF-8 Content-type: text/html; charset=UTF-8
--EXPECTF-- --EXPECTF--
Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in %s on line %d
string(9) "\Web\View" string(9) "\Web\View"
Parse error: syntax error, unexpected %s, expecting %s in phar://%r([A-Za-z]:)?%r/%sfatal_error_webphar.php/Web/View.php on line 380 Parse error: syntax error, unexpected %s, expecting %s in phar://%r([A-Za-z]:)?%r/%sfatal_error_webphar.php/Web/View.php on line 380

View file

@ -53,10 +53,9 @@ function test($class)
echo "\n"; echo "\n";
} }
function __autoload($class) spl_autoload_register(function ($class) {
{
echo __FUNCTION__ . "($class)\n"; echo __FUNCTION__ . "($class)\n";
} });
test('Class_does_not_exist'); test('Class_does_not_exist');
@ -94,7 +93,7 @@ test('WithCtorWithArgs');
--EXPECTF-- --EXPECTF--
====>Class_does_not_exist ====>Class_does_not_exist
__autoload(Class_does_not_exist) {closure}(Class_does_not_exist)
string(41) "Class Class_does_not_exist does not exist" string(41) "Class Class_does_not_exist does not exist"
====>NoCtor ====>NoCtor
====>newInstance() ====>newInstance()

View file

@ -3,8 +3,7 @@ Reflection Bug #26640 (__autoload() not invoked by Reflection classes)
--FILE-- --FILE--
<?php <?php
function __autoload($c) spl_autoload_register(function ($c) {
{
class autoload_class class autoload_class
{ {
public function __construct() public function __construct()
@ -12,7 +11,7 @@ function __autoload($c)
print "autoload success\n"; print "autoload success\n";
} }
} }
} });
$a = new ReflectionClass('autoload_class'); $a = new ReflectionClass('autoload_class');

View file

@ -2,10 +2,10 @@
Reflection Bug #29268 (__autoload() not called with reflectionProperty->getClass()) Reflection Bug #29268 (__autoload() not called with reflectionProperty->getClass())
--FILE-- --FILE--
<?php <?php
function __autoload($classname) { spl_autoload_register(function ($classname) {
echo "__autoload($classname)\n"; echo "__autoload($classname)\n";
eval("class $classname {}"); eval("class $classname {}");
} });
class B{ class B{
public function doit(A $a){ public function doit(A $a){

View file

@ -4,13 +4,13 @@ Bug #28751 (SoapServer does not call _autoload())
<?php require_once('skipif.inc'); ?> <?php require_once('skipif.inc'); ?>
--FILE-- --FILE--
<?php <?php
function __autoload($className) { spl_autoload_register(function ($className) {
class SoapServerActions { class SoapServerActions {
function test() { function test() {
return "Hello World"; return "Hello World";
} }
} }
} });
$server = new SoapServer(NULL, array('uri'=>"http://testuri.org")); $server = new SoapServer(NULL, array('uri'=>"http://testuri.org"));
$server->setClass("SoapServerActions"); $server->setClass("SoapServerActions");

View file

@ -15,15 +15,14 @@ class fs {}
var_dump(class_implements(new fs)); var_dump(class_implements(new fs));
var_dump(class_implements('fs')); var_dump(class_implements('fs'));
spl_autoload_register(function ($classname) {
echo "attempting to autoload $classname\n";
});
echo "\n--- testing autoload ---\n"; echo "\n--- testing autoload ---\n";
var_dump(class_implements('non_existent')); var_dump(class_implements('non_existent'));
var_dump(class_implements('non_existent2', false)); var_dump(class_implements('non_existent2', false));
function __autoload($classname) {
echo "attempting to autoload $classname\n";
}
?> ?>
===DONE=== ===DONE===
--EXPECTF-- --EXPECTF--

View file

@ -15,15 +15,14 @@ class fs {}
var_dump(class_uses(new fs)); var_dump(class_uses(new fs));
var_dump(class_uses('fs')); var_dump(class_uses('fs'));
spl_autoload_register(function ($classname) {
echo "attempting to autoload $classname\n";
});
echo "\n--- testing autoload ---\n"; echo "\n--- testing autoload ---\n";
var_dump(class_uses('non_existent')); var_dump(class_uses('non_existent'));
var_dump(class_uses('non_existent2', false)); var_dump(class_uses('non_existent2', false));
function __autoload($classname) {
echo "attempting to autoload $classname\n";
}
?> ?>
===DONE=== ===DONE===
--EXPECTF-- --EXPECTF--

View file

@ -2,6 +2,11 @@
SPL: class_parents() and class_implements() SPL: class_parents() and class_implements()
--FILE-- --FILE--
<?php <?php
spl_autoload_register(function ($cname) {
var_dump($cname);
});
class a{} class a{}
class b extends a{} class b extends a{}
class c extends b{} class c extends b{}
@ -24,10 +29,6 @@ var_dump(class_implements(new a),
class_implements("bbb", 0) class_implements("bbb", 0)
); );
function __autoload($cname) {
var_dump($cname);
}
?> ?>
===DONE=== ===DONE===
<?php exit(0); ?> <?php exit(0); ?>

View file

@ -27,7 +27,7 @@
"access a property of an incomplete object. " \ "access a property of an incomplete object. " \
"Please ensure that the class definition \"%s\" of the object " \ "Please ensure that the class definition \"%s\" of the object " \
"you are trying to operate on was loaded _before_ " \ "you are trying to operate on was loaded _before_ " \
"unserialize() gets called or provide a __autoload() function " \ "unserialize() gets called or provide an autoloader " \
"to load the class definition" "to load the class definition"
static zend_object_handlers php_incomplete_object_handlers; static zend_object_handlers php_incomplete_object_handlers;

View file

@ -10,9 +10,9 @@ Test class_exists() function : basic functionality
echo "*** Testing class_exists() : basic functionality ***\n"; echo "*** Testing class_exists() : basic functionality ***\n";
function __autoload($className) { spl_autoload_register(function ($className) {
echo "In __autoload($className)\n"; echo "In autoload($className)\n";
} });
echo "Calling class_exists() on non-existent class with autoload explicitly enabled:\n"; echo "Calling class_exists() on non-existent class with autoload explicitly enabled:\n";
var_dump( class_exists('C', true) ); var_dump( class_exists('C', true) );
@ -34,7 +34,7 @@ echo "Done";
--EXPECTF-- --EXPECTF--
*** Testing class_exists() : basic functionality *** *** Testing class_exists() : basic functionality ***
Calling class_exists() on non-existent class with autoload explicitly enabled: Calling class_exists() on non-existent class with autoload explicitly enabled:
In __autoload(C) In autoload(C)
bool(false) bool(false)
Calling class_exists() on existing class with autoload explicitly enabled: Calling class_exists() on existing class with autoload explicitly enabled:
@ -47,7 +47,7 @@ Calling class_exists() on existing class with autoload explicitly disabled:
bool(true) bool(true)
Calling class_exists() on non-existent class with autoload unspecified: Calling class_exists() on non-existent class with autoload unspecified:
In __autoload(E) In autoload(E)
bool(false) bool(false)
Calling class_exists() on existing class with autoload unspecified: Calling class_exists() on existing class with autoload unspecified:

View file

@ -8,9 +8,9 @@ Test class_exists() function : usage variations - unexpected types for argument
* Alias to functions: * Alias to functions:
*/ */
function __autoload($className) { spl_autoload_register(function ($className) {
echo "In __autoload($className)\n"; echo "In autoload($className)\n";
} });
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n"; echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@ -88,15 +88,15 @@ Error: 8 - Undefined variable: undefined_var, %s(67)
Error: 8 - Undefined variable: unset_var, %s(70) Error: 8 - Undefined variable: unset_var, %s(70)
Arg value 0 Arg value 0
In __autoload(0) In autoload(0)
bool(false) bool(false)
Arg value 1 Arg value 1
In __autoload(1) In autoload(1)
bool(false) bool(false)
Arg value 12345 Arg value 12345
In __autoload(12345) In autoload(12345)
bool(false) bool(false)
Arg value -2345 Arg value -2345
@ -109,7 +109,7 @@ Arg value -10.5
bool(false) bool(false)
Arg value 101234567000 Arg value 101234567000
In __autoload(101234567000) In autoload(101234567000)
bool(false) bool(false)
Arg value 1.07654321E-9 Arg value 1.07654321E-9
@ -150,14 +150,14 @@ Arg value
bool(false) bool(false)
Arg value 1 Arg value 1
In __autoload(1) In autoload(1)
bool(false) bool(false)
Arg value Arg value
bool(false) bool(false)
Arg value 1 Arg value 1
In __autoload(1) In autoload(1)
bool(false) bool(false)
Arg value Arg value

View file

@ -8,9 +8,9 @@ Test class_exists() function : usage variations - unexpected types for argument
* Alias to functions: * Alias to functions:
*/ */
function __autoload($className) { spl_autoload_register(function ($className) {
echo "In __autoload($className)\n"; echo "In autoload($className)\n";
} });
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n"; echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@ -95,35 +95,35 @@ Arg value 0
bool(false) bool(false)
Arg value 1 Arg value 1
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value 12345 Arg value 12345
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value -2345 Arg value -2345
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value 10.5 Arg value 10.5
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value -10.5 Arg value -10.5
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value 101234567000 Arg value 101234567000
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value 1.07654321E-9 Arg value 1.07654321E-9
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value 0.5 Arg value 0.5
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d) Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d)
@ -158,14 +158,14 @@ Arg value
bool(false) bool(false)
Arg value 1 Arg value 1
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value Arg value
bool(false) bool(false)
Arg value 1 Arg value 1
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value Arg value
@ -178,11 +178,11 @@ Arg value
bool(false) bool(false)
Arg value string Arg value string
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value string Arg value string
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Error: 4096 - Object of class stdClass could not be converted to string, %s(80) Error: 4096 - Object of class stdClass could not be converted to string, %s(80)

View file

@ -11,9 +11,9 @@ Test get_declared_classes() function : testing autoloaded classes
echo "*** Testing get_declared_classes() : testing autoloaded classes ***\n"; echo "*** Testing get_declared_classes() : testing autoloaded classes ***\n";
function __autoload($class_name) { spl_autoload_register(function ($class_name) {
require_once $class_name . '.inc'; require_once $class_name . '.inc';
} });
echo "\n-- before instance is declared --\n"; echo "\n-- before instance is declared --\n";
var_dump(in_array('AutoLoaded', get_declared_classes())); var_dump(in_array('AutoLoaded', get_declared_classes()));

View file

@ -11,9 +11,9 @@ Test get_declared_interfaces() function : autoloading of interfaces
echo "*** Testing get_declared_interfaces() : autoloading of interfaces ***\n"; echo "*** Testing get_declared_interfaces() : autoloading of interfaces ***\n";
function __autoload($class_name) { spl_autoload_register(function ($class_name) {
require_once $class_name . '.inc'; require_once $class_name . '.inc';
} });
echo "\n-- before interface is used --\n"; echo "\n-- before interface is used --\n";
var_dump(in_array('AutoInterface', get_declared_interfaces())); var_dump(in_array('AutoInterface', get_declared_interfaces()));

View file

@ -11,9 +11,9 @@ Test get_declared_traits() function : testing autoloaded traits
echo "*** Testing get_declared_traits() : testing autoloaded traits ***\n"; echo "*** Testing get_declared_traits() : testing autoloaded traits ***\n";
function __autoload($trait_name) { spl_autoload_register(function ($trait_name) {
require_once $trait_name . '.inc'; require_once $trait_name . '.inc';
} });
echo "\n-- before instance is declared --\n"; echo "\n-- before instance is declared --\n";
var_dump(in_array('AutoTrait', get_declared_traits())); var_dump(in_array('AutoTrait', get_declared_traits()));

View file

@ -8,9 +8,9 @@ Test get_parent_class() function : usage variations - unexpected argument type.
* Alias to functions: * Alias to functions:
*/ */
function __autoload($className) { spl_autoload_register(function ($className) {
echo "In __autoload($className)\n"; echo "In autoload($className)\n";
} });
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n"; echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@ -160,11 +160,11 @@ Arg value
bool(false) bool(false)
Arg value string Arg value string
In __autoload(string) In autoload(string)
bool(false) bool(false)
Arg value String Arg value String
In __autoload(String) In autoload(String)
bool(false) bool(false)
Error: 4096 - Object of class stdClass could not be converted to string, %s(77) Error: 4096 - Object of class stdClass could not be converted to string, %s(77)

View file

@ -10,9 +10,9 @@ Test interface_exists() function : autoloaded interface
echo "*** Testing interface_exists() : autoloaded interface ***\n"; echo "*** Testing interface_exists() : autoloaded interface ***\n";
function __autoload($class_name) { spl_autoload_register(function ($class_name) {
require_once $class_name . '.inc'; require_once $class_name . '.inc';
} });
echo "\n-- no autoloading --\n"; echo "\n-- no autoloading --\n";
var_dump(interface_exists("AutoInterface", false)); var_dump(interface_exists("AutoInterface", false));

View file

@ -10,10 +10,9 @@ Test interface_exists() function : test autoload default value
echo "*** Testing interface_exists() : test autoload default value ***\n"; echo "*** Testing interface_exists() : test autoload default value ***\n";
function __autoload($class_name) { spl_autoload_register(function ($class_name) {
require_once $class_name . '.inc'; require_once $class_name . '.inc';
} });
var_dump(interface_exists("AutoInterface")); var_dump(interface_exists("AutoInterface"));

View file

@ -60,13 +60,10 @@ $t->test();
$t = new derived_a(); $t = new derived_a();
$t->test(); $t->test();
eval(' spl_autoload_register(function ($name) {
function __autoload($name) echo ">>>> In autoload: ";
{
echo ">>>> In __autoload: ";
var_dump($name); var_dump($name);
} });
');
echo "NOW WITH AUTOLOAD\n\n"; echo "NOW WITH AUTOLOAD\n\n";
@ -201,11 +198,11 @@ is_subclass_of( OBJECT:base, base) = no
is_subclass_of( STRING:base, base) = no is_subclass_of( STRING:base, base) = no
is_subclass_of( STRING:base, base,false) = no is_subclass_of( STRING:base, base,false) = no
>>> With Undefined >>> With Undefined
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, base,true) = no is_a( STRING:undefB, base,true) = no
is_a( STRING:undefB, base) = no is_a( STRING:undefB, base) = no
is_subclass_of( STRING:undefB, base,false) = no is_subclass_of( STRING:undefB, base,false) = no
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, base) = no is_subclass_of( STRING:undefB, base) = no
>>> With Defined class >>> With Defined class
@ -216,11 +213,11 @@ is_subclass_of( OBJECT:base, derived_a) = no
is_subclass_of( STRING:base, derived_a) = no is_subclass_of( STRING:base, derived_a) = no
is_subclass_of( STRING:base, derived_a,false) = no is_subclass_of( STRING:base, derived_a,false) = no
>>> With Undefined >>> With Undefined
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, derived_a,true) = no is_a( STRING:undefB, derived_a,true) = no
is_a( STRING:undefB, derived_a) = no is_a( STRING:undefB, derived_a) = no
is_subclass_of( STRING:undefB, derived_a,false) = no is_subclass_of( STRING:undefB, derived_a,false) = no
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, derived_a) = no is_subclass_of( STRING:undefB, derived_a) = no
>>> With Defined class >>> With Defined class
@ -231,11 +228,11 @@ is_subclass_of( OBJECT:base, if_a) = no
is_subclass_of( STRING:base, if_a) = no is_subclass_of( STRING:base, if_a) = no
is_subclass_of( STRING:base, if_a,false) = no is_subclass_of( STRING:base, if_a,false) = no
>>> With Undefined >>> With Undefined
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, if_a,true) = no is_a( STRING:undefB, if_a,true) = no
is_a( STRING:undefB, if_a) = no is_a( STRING:undefB, if_a) = no
is_subclass_of( STRING:undefB, if_a,false) = no is_subclass_of( STRING:undefB, if_a,false) = no
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, if_a) = no is_subclass_of( STRING:undefB, if_a) = no
>>> With Defined class >>> With Defined class
@ -246,11 +243,11 @@ is_subclass_of( OBJECT:base, undefA) = no
is_subclass_of( STRING:base, undefA) = no is_subclass_of( STRING:base, undefA) = no
is_subclass_of( STRING:base, undefA,false) = no is_subclass_of( STRING:base, undefA,false) = no
>>> With Undefined >>> With Undefined
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, undefA,true) = no is_a( STRING:undefB, undefA,true) = no
is_a( STRING:undefB, undefA) = no is_a( STRING:undefB, undefA) = no
is_subclass_of( STRING:undefB, undefA,false) = no is_subclass_of( STRING:undefB, undefA,false) = no
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, undefA) = no is_subclass_of( STRING:undefB, undefA) = no
@ -262,11 +259,11 @@ is_subclass_of( OBJECT:derived_a, base) = yes
is_subclass_of( STRING:derived_a, base) = yes is_subclass_of( STRING:derived_a, base) = yes
is_subclass_of( STRING:derived_a, base,false) = no is_subclass_of( STRING:derived_a, base,false) = no
>>> With Undefined >>> With Undefined
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, base,true) = no is_a( STRING:undefB, base,true) = no
is_a( STRING:undefB, base) = no is_a( STRING:undefB, base) = no
is_subclass_of( STRING:undefB, base,false) = no is_subclass_of( STRING:undefB, base,false) = no
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, base) = no is_subclass_of( STRING:undefB, base) = no
>>> With Defined class >>> With Defined class
@ -277,11 +274,11 @@ is_subclass_of( OBJECT:derived_a, derived_a) = no
is_subclass_of( STRING:derived_a, derived_a) = no is_subclass_of( STRING:derived_a, derived_a) = no
is_subclass_of( STRING:derived_a, derived_a,false) = no is_subclass_of( STRING:derived_a, derived_a,false) = no
>>> With Undefined >>> With Undefined
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, derived_a,true) = no is_a( STRING:undefB, derived_a,true) = no
is_a( STRING:undefB, derived_a) = no is_a( STRING:undefB, derived_a) = no
is_subclass_of( STRING:undefB, derived_a,false) = no is_subclass_of( STRING:undefB, derived_a,false) = no
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, derived_a) = no is_subclass_of( STRING:undefB, derived_a) = no
>>> With Defined class >>> With Defined class
@ -292,11 +289,11 @@ is_subclass_of( OBJECT:derived_a, if_a) = yes
is_subclass_of( STRING:derived_a, if_a) = yes is_subclass_of( STRING:derived_a, if_a) = yes
is_subclass_of( STRING:derived_a, if_a,false) = no is_subclass_of( STRING:derived_a, if_a,false) = no
>>> With Undefined >>> With Undefined
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, if_a,true) = no is_a( STRING:undefB, if_a,true) = no
is_a( STRING:undefB, if_a) = no is_a( STRING:undefB, if_a) = no
is_subclass_of( STRING:undefB, if_a,false) = no is_subclass_of( STRING:undefB, if_a,false) = no
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, if_a) = no is_subclass_of( STRING:undefB, if_a) = no
>>> With Defined class >>> With Defined class
@ -307,11 +304,11 @@ is_subclass_of( OBJECT:derived_a, undefA) = no
is_subclass_of( STRING:derived_a, undefA) = no is_subclass_of( STRING:derived_a, undefA) = no
is_subclass_of( STRING:derived_a, undefA,false) = no is_subclass_of( STRING:derived_a, undefA,false) = no
>>> With Undefined >>> With Undefined
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, undefA,true) = no is_a( STRING:undefB, undefA,true) = no
is_a( STRING:undefB, undefA) = no is_a( STRING:undefB, undefA) = no
is_subclass_of( STRING:undefB, undefA,false) = no is_subclass_of( STRING:undefB, undefA,false) = no
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, undefA) = no is_subclass_of( STRING:undefB, undefA) = no
@ -323,11 +320,11 @@ is_subclass_of( OBJECT:derived_b, base) = yes
is_subclass_of( STRING:derived_b, base) = yes is_subclass_of( STRING:derived_b, base) = yes
is_subclass_of( STRING:derived_b, base,false) = no is_subclass_of( STRING:derived_b, base,false) = no
>>> With Undefined >>> With Undefined
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, base,true) = no is_a( STRING:undefB, base,true) = no
is_a( STRING:undefB, base) = no is_a( STRING:undefB, base) = no
is_subclass_of( STRING:undefB, base,false) = no is_subclass_of( STRING:undefB, base,false) = no
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, base) = no is_subclass_of( STRING:undefB, base) = no
>>> With Defined class >>> With Defined class
@ -338,11 +335,11 @@ is_subclass_of( OBJECT:derived_b, derived_a) = no
is_subclass_of( STRING:derived_b, derived_a) = no is_subclass_of( STRING:derived_b, derived_a) = no
is_subclass_of( STRING:derived_b, derived_a,false) = no is_subclass_of( STRING:derived_b, derived_a,false) = no
>>> With Undefined >>> With Undefined
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, derived_a,true) = no is_a( STRING:undefB, derived_a,true) = no
is_a( STRING:undefB, derived_a) = no is_a( STRING:undefB, derived_a) = no
is_subclass_of( STRING:undefB, derived_a,false) = no is_subclass_of( STRING:undefB, derived_a,false) = no
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, derived_a) = no is_subclass_of( STRING:undefB, derived_a) = no
>>> With Defined class >>> With Defined class
@ -353,11 +350,11 @@ is_subclass_of( OBJECT:derived_b, if_a) = yes
is_subclass_of( STRING:derived_b, if_a) = yes is_subclass_of( STRING:derived_b, if_a) = yes
is_subclass_of( STRING:derived_b, if_a,false) = no is_subclass_of( STRING:derived_b, if_a,false) = no
>>> With Undefined >>> With Undefined
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, if_a,true) = no is_a( STRING:undefB, if_a,true) = no
is_a( STRING:undefB, if_a) = no is_a( STRING:undefB, if_a) = no
is_subclass_of( STRING:undefB, if_a,false) = no is_subclass_of( STRING:undefB, if_a,false) = no
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, if_a) = no is_subclass_of( STRING:undefB, if_a) = no
>>> With Defined class >>> With Defined class
@ -368,9 +365,9 @@ is_subclass_of( OBJECT:derived_b, undefA) = no
is_subclass_of( STRING:derived_b, undefA) = no is_subclass_of( STRING:derived_b, undefA) = no
is_subclass_of( STRING:derived_b, undefA,false) = no is_subclass_of( STRING:derived_b, undefA,false) = no
>>> With Undefined >>> With Undefined
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_a( STRING:undefB, undefA,true) = no is_a( STRING:undefB, undefA,true) = no
is_a( STRING:undefB, undefA) = no is_a( STRING:undefB, undefA) = no
is_subclass_of( STRING:undefB, undefA,false) = no is_subclass_of( STRING:undefB, undefA,false) = no
>>>> In __autoload: string(6) "undefB" >>>> In autoload: string(6) "undefB"
is_subclass_of( STRING:undefB, undefA) = no is_subclass_of( STRING:undefB, undefA) = no

View file

@ -8,9 +8,9 @@ Test is_subclass_of() function : usage variations - unexpected type for arg 1
* Alias to functions: * Alias to functions:
*/ */
// Note: basic use cases in Zend/tests/is_a.phpt // Note: basic use cases in Zend/tests/is_a.phpt
function __autoload($className) { spl_autoload_register(function ($className) {
echo "In __autoload($className)\n"; echo "In autoload($className)\n";
} });
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n"; echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@ -161,11 +161,11 @@ Arg value
bool(false) bool(false)
Arg value string Arg value string
In __autoload(string) In autoload(string)
bool(false) bool(false)
Arg value String Arg value String
In __autoload(String) In autoload(String)
bool(false) bool(false)
Arg value Arg value

View file

@ -8,9 +8,9 @@ Test is_subclass_of() function : usage variations - unexpected type for arg 2
* Alias to functions: * Alias to functions:
*/ */
function __autoload($className) { spl_autoload_register(function ($className) {
echo "In __autoload($className)\n"; echo "In autoload($className)\n";
} });
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n"; echo "Error: $err_no - $err_msg, $filename($linenum)\n";

View file

@ -8,9 +8,9 @@ Test is_subclass_of() function : usage variations - unexpected type for arg 1 w
* Alias to functions: * Alias to functions:
*/ */
// Note: basic use cases in Zend/tests/is_a.phpt // Note: basic use cases in Zend/tests/is_a.phpt
function __autoload($className) { spl_autoload_register(function ($className) {
echo "In __autoload($className)\n"; echo "In autoload($className)\n";
} });
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n"; echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@ -161,11 +161,11 @@ Arg value
bool(false) bool(false)
Arg value string Arg value string
In __autoload(string) In autoload(string)
bool(false) bool(false)
Arg value String Arg value String
In __autoload(String) In autoload(String)
bool(false) bool(false)
Arg value Arg value

View file

@ -8,15 +8,15 @@ method_exists() on non-existent class, with __autoload().
* Alias to functions: * Alias to functions:
*/ */
function __autoload($name) { spl_autoload_register(function ($name) {
echo "In __autoload($name)\n"; echo "In autoload($name)\n";
} });
var_dump(method_exists('UndefC', 'func')); var_dump(method_exists('UndefC', 'func'));
echo "Done"; echo "Done";
?> ?>
--EXPECTF-- --EXPECTF--
In __autoload(UndefC) In autoload(UndefC)
bool(false) bool(false)
Done Done

View file

@ -8,9 +8,9 @@ Test method_exists() function : usage variations - unexpected type for arg 1
* Alias to functions: * Alias to functions:
*/ */
function __autoload($className) { spl_autoload_register(function ($className) {
echo "In __autoload($className)\n"; echo "In autoload($className)\n";
} });
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n"; echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@ -160,11 +160,11 @@ Arg value
bool(false) bool(false)
Arg value string Arg value string
In __autoload(string) In autoload(string)
bool(false) bool(false)
Arg value String Arg value String
In __autoload(String) In autoload(String)
bool(false) bool(false)
Arg value Arg value

View file

@ -8,9 +8,9 @@ Test method_exists() function : usage variations - unexpected type for arg 2
* Alias to functions: * Alias to functions:
*/ */
function __autoload($className) { spl_autoload_register(function ($className) {
echo "In __autoload($className)\n"; echo "In autoload($className)\n";
} });
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n"; echo "Error: $err_no - $err_msg, $filename($linenum)\n";

View file

@ -10,9 +10,9 @@ Test property_exists() function : class auto loading
echo "*** Testing property_exists() : class auto loading ***\n"; echo "*** Testing property_exists() : class auto loading ***\n";
function __autoload($class_name) { spl_autoload_register(function ($class_name) {
require_once $class_name . '.inc'; require_once $class_name . '.inc';
} });
echo "\ntesting property in autoloaded class\n"; echo "\ntesting property in autoloaded class\n";
var_dump(property_exists("AutoTest", "bob")); var_dump(property_exists("AutoTest", "bob"));

View file

@ -10,9 +10,9 @@ Test trait_exists() function : basic functionality
echo "*** Testing trait_exists() : basic functionality ***\n"; echo "*** Testing trait_exists() : basic functionality ***\n";
function __autoload($traitName) { spl_autoload_register(function ($traitName) {
echo "In __autoload($traitName)\n"; echo "In autoload($traitName)\n";
} });
trait MyTrait {} trait MyTrait {}
@ -36,7 +36,7 @@ echo "Done";
--EXPECTF-- --EXPECTF--
*** Testing trait_exists() : basic functionality *** *** Testing trait_exists() : basic functionality ***
Calling trait_exists() on non-existent trait with autoload explicitly enabled: Calling trait_exists() on non-existent trait with autoload explicitly enabled:
In __autoload(C) In autoload(C)
bool(false) bool(false)
Calling trait_exists() on existing trait with autoload explicitly enabled: Calling trait_exists() on existing trait with autoload explicitly enabled:
@ -49,7 +49,7 @@ Calling trait_exists() on existing trait with autoload explicitly disabled:
bool(true) bool(true)
Calling trait_exists() on non-existent trait with autoload unspecified: Calling trait_exists() on non-existent trait with autoload unspecified:
In __autoload(E) In autoload(E)
bool(false) bool(false)
Calling trait_exists() on existing trait with autoload unspecified: Calling trait_exists() on existing trait with autoload unspecified:

View file

@ -8,9 +8,9 @@ Test trait_exists() function : usage variations - unexpected types for argument
* Alias to functions: * Alias to functions:
*/ */
function __autoload($traitName) { spl_autoload_register(function ($traitName) {
echo "In __autoload($traitName)\n"; echo "In autoload($traitName)\n";
} });
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n"; echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@ -88,15 +88,15 @@ Error: 8 - Undefined variable: undefined_var, %s(67)
Error: 8 - Undefined variable: unset_var, %s(70) Error: 8 - Undefined variable: unset_var, %s(70)
Arg value 0 Arg value 0
In __autoload(0) In autoload(0)
bool(false) bool(false)
Arg value 1 Arg value 1
In __autoload(1) In autoload(1)
bool(false) bool(false)
Arg value 12345 Arg value 12345
In __autoload(12345) In autoload(12345)
bool(false) bool(false)
Arg value -2345 Arg value -2345
@ -109,7 +109,7 @@ Arg value -10.5
bool(false) bool(false)
Arg value 101234567000 Arg value 101234567000
In __autoload(101234567000) In autoload(101234567000)
bool(false) bool(false)
Arg value 1.07654321E-9 Arg value 1.07654321E-9
@ -150,14 +150,14 @@ Arg value
bool(false) bool(false)
Arg value 1 Arg value 1
In __autoload(1) In autoload(1)
bool(false) bool(false)
Arg value Arg value
bool(false) bool(false)
Arg value 1 Arg value 1
In __autoload(1) In autoload(1)
bool(false) bool(false)
Arg value Arg value

View file

@ -8,9 +8,9 @@ Test trait_exists() function : usage variations - unexpected types for argument
* Alias to functions: * Alias to functions:
*/ */
function __autoload($traitName) { spl_autoload_register(function ($traitName) {
echo "In __autoload($traitName)\n"; echo "In autoload($traitName)\n";
} });
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
echo "Error: $err_no - $err_msg, $filename($linenum)\n"; echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@ -95,35 +95,35 @@ Arg value 0
bool(false) bool(false)
Arg value 1 Arg value 1
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value 12345 Arg value 12345
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value -2345 Arg value -2345
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value 10.5 Arg value 10.5
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value -10.5 Arg value -10.5
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value 101234567000 Arg value 101234567000
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value 1.07654321E-9 Arg value 1.07654321E-9
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value 0.5 Arg value 0.5
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d) Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d)
@ -158,14 +158,14 @@ Arg value
bool(false) bool(false)
Arg value 1 Arg value 1
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value Arg value
bool(false) bool(false)
Arg value 1 Arg value 1
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value Arg value
@ -178,11 +178,11 @@ Arg value
bool(false) bool(false)
Arg value string Arg value string
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Arg value string Arg value string
In __autoload(string_val) In autoload(string_val)
bool(false) bool(false)
Error: 4096 - Object of class stdClass could not be converted to string, %s(80) Error: 4096 - Object of class stdClass could not be converted to string, %s(80)

View file

@ -8,8 +8,7 @@ class test2 {
} }
} }
function __autoload($class) spl_autoload_register(function ($class) {
{
eval('class test1 extends test2 {}'); eval('class test1 extends test2 {}');
test1::use_stack( test1::use_stack(
@ -17,7 +16,7 @@ function __autoload($class)
11,12,13,14,15,16,17,18,19,20, 11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,27,28,29,30 21,22,23,24,25,26,27,28,29,30
); );
} });
call_user_func(array('test1', 'use_stack'), call_user_func(array('test1', 'use_stack'),
1,2,3,4,5,6,7,8,9,10, 1,2,3,4,5,6,7,8,9,10,

View file

@ -31,12 +31,11 @@ function unserializer($class_name)
eval("class TestNANew2 extends TestNew {}"); eval("class TestNANew2 extends TestNew {}");
break; break;
default: default:
echo "Try __autoload()\n"; echo "Try autoloader\n";
if (!function_exists('__autoload')) if (!spl_autoload_functions()) {
{ spl_autoload_register(function ($class_name) { do_autoload($class_name); });
eval('function __autoload($class_name) { do_autoload($class_name); }');
} }
__autoload($class_name); spl_autoload_call($class_name);
break; break;
} }
} }
@ -123,7 +122,7 @@ var_dump(unserialize('C:10:"TestNANew2":0:{}'));
echo "===AutoOld===\n"; echo "===AutoOld===\n";
var_dump(unserialize('O:19:"autoload_implements":0:{}')); var_dump(unserialize('O:19:"autoload_implements":0:{}'));
// Now we have __autoload(), that will be called before the old style header. // Now we have an autoloader, that will be called before the old style header.
// If the old style handler also fails to register the class then the object // If the old style handler also fails to register the class then the object
// becomes an incomplete class instance. // becomes an incomplete class instance.
@ -168,7 +167,7 @@ object(TestNANew2)#%d (0) {
} }
===AutoOld=== ===AutoOld===
unserializer(autoload_implements) unserializer(autoload_implements)
Try __autoload() Try autoloader
do_autoload(autoload_interface) do_autoload(autoload_interface)
do_autoload(autoload_implements) do_autoload(autoload_implements)
object(autoload_implements)#%d (0) { object(autoload_implements)#%d (0) {
@ -176,7 +175,7 @@ object(autoload_implements)#%d (0) {
===AutoNA=== ===AutoNA===
do_autoload(autoload_not_available) do_autoload(autoload_not_available)
unserializer(autoload_not_available) unserializer(autoload_not_available)
Try __autoload() Try autoloader
do_autoload(autoload_not_available) do_autoload(autoload_not_available)
do_autoload(autoload_not_available) do_autoload(autoload_not_available)

View file

@ -7,11 +7,10 @@ Bug #30234 (__autoload() not invoked for interfaces)
--FILE-- --FILE--
<?php <?php
function __autoload($class_name) spl_autoload_register(function ($class_name) {
{
require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.p5c'); require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.p5c');
echo __FUNCTION__ . '(' . $class_name . ")\n"; echo __FUNCTION__ . '(' . $class_name . ")\n";
} });
var_dump(interface_exists('autoload_interface', false)); var_dump(interface_exists('autoload_interface', false));
var_dump(class_exists('autoload_implements', false)); var_dump(class_exists('autoload_implements', false));
@ -30,8 +29,8 @@ var_dump(class_exists('autoload_implements', false));
--EXPECTF-- --EXPECTF--
bool(false) bool(false)
bool(false) bool(false)
__autoload(autoload_interface) {closure}(autoload_interface)
__autoload(Autoload_Implements) {closure}(Autoload_Implements)
object(autoload_implements)#%d (0) { object(autoload_implements)#%d (0) {
} }
bool(true) bool(true)

View file

@ -3,10 +3,10 @@ Bug #62836 (Seg fault or broken object references on unserialize())
--FILE-- --FILE--
<?php <?php
$serialized_object='O:1:"A":4:{s:1:"b";O:1:"B":0:{}s:2:"b1";r:2;s:1:"c";O:1:"B":0:{}s:2:"c1";r:4;}'; $serialized_object='O:1:"A":4:{s:1:"b";O:1:"B":0:{}s:2:"b1";r:2;s:1:"c";O:1:"B":0:{}s:2:"c1";r:4;}';
function __autoload($name) { spl_autoload_register(function ($name) {
unserialize("i:4;"); unserialize("i:4;");
eval("class $name {} "); eval("class $name {} ");
} });
print_r(unserialize($serialized_object)); print_r(unserialize($serialized_object));
echo "okey"; echo "okey";

View file

@ -13,4 +13,4 @@ Exception in %s:%d
Stack trace: Stack trace:
#0 {main} #0 {main}
Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d

View file

@ -6,9 +6,9 @@ Bug #70213: Unserialize context shared on double class lookup
ini_set('unserialize_callback_func', 'evil'); ini_set('unserialize_callback_func', 'evil');
function evil() { function evil() {
function __autoload($arg) { spl_autoload_register(function ($arg) {
var_dump(unserialize('R:1;')); var_dump(unserialize('R:1;'));
} });
} }
var_dump(unserialize('a:2:{i:0;i:42;i:1;O:4:"evil":0:{}}')); var_dump(unserialize('a:2:{i:0;i:42;i:1;O:4:"evil":0:{}}'));
@ -23,7 +23,7 @@ array(2) {
[0]=> [0]=>
int(42) int(42)
[1]=> [1]=>
object(__PHP_Incomplete_Class)#1 (1) { object(__PHP_Incomplete_Class)#2 (1) {
["__PHP_Incomplete_Class_Name"]=> ["__PHP_Incomplete_Class_Name"]=>
string(4) "evil" string(4) "evil"
} }

View file

@ -17,11 +17,11 @@ echo "Done\n";
object(__PHP_Incomplete_Class)#%d (0) { object(__PHP_Incomplete_Class)#%d (0) {
} }
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL NULL
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL NULL
Done Done

View file

@ -90,31 +90,31 @@ object(__PHP_Incomplete_Class)#%d (2) {
} }
bool(true) bool(true)
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 43 Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL NULL
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 46 Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 47 Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL NULL
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 49 Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL NULL
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 50 Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
string(9) "p.changed" string(9) "p.changed"
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 53 Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
bool(false) bool(false)
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 54 Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 55 Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
bool(false) bool(false)
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 56 Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 57 Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL NULL
Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 59 Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d

View file

@ -23,6 +23,6 @@ echo "Done";
object(__PHP_Incomplete_Class)#%d (0) { object(__PHP_Incomplete_Class)#%d (0) {
} }
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 15 Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL NULL
Done Done

View file

@ -13,9 +13,9 @@ Ensure __autoload is called twice if unserialize_callback_func is defined.
* Alias to functions: * Alias to functions:
*/ */
function __autoload($name) { spl_autoload_register(function ($name) {
echo "in __autoload($name)\n"; echo "in autoload($name)\n";
} });
ini_set('unserialize_callback_func','check'); ini_set('unserialize_callback_func','check');
@ -30,9 +30,9 @@ var_dump($o);
echo "Done"; echo "Done";
?> ?>
--EXPECTF-- --EXPECTF--
in __autoload(FOO) in autoload(FOO)
in check(FOO) in check(FOO)
in __autoload(FOO) in autoload(FOO)
Warning: unserialize(): Function check() hasn't defined the class it was called for in %s on line 23 Warning: unserialize(): Function check() hasn't defined the class it was called for in %s on line 23
object(__PHP_Incomplete_Class)#%d (1) { object(__PHP_Incomplete_Class)#%d (1) {

View file

@ -5,10 +5,10 @@ Bug #33853 (php:function call __autoload with lowercase param)
--FILE-- --FILE--
<?php <?php
function __autoload($className) { spl_autoload_register(function ($className) {
var_dump($className); var_dump($className);
exit(); exit();
} });
$xsl = new DomDocument(); $xsl = new DomDocument();
$xsl->loadXML('<?xml version="1.0" encoding="iso-8859-1" ?> $xsl->loadXML('<?xml version="1.0" encoding="iso-8859-1" ?>

View file

@ -7,17 +7,16 @@ ZE2 Autoload and class_exists
--FILE-- --FILE--
<?php <?php
function __autoload($class_name) spl_autoload_register(function ($class_name) {
{
require_once(dirname(__FILE__) . '/' . $class_name . '.p5c'); require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
echo __FUNCTION__ . '(' . $class_name . ")\n"; echo 'autoload(' . $class_name . ")\n";
} });
var_dump(class_exists('autoload_root')); var_dump(class_exists('autoload_root'));
?> ?>
===DONE=== ===DONE===
--EXPECT-- --EXPECT--
__autoload(autoload_root) autoload(autoload_root)
bool(true) bool(true)
===DONE=== ===DONE===

View file

@ -7,18 +7,17 @@ ZE2 Autoload and get_class_methods
--FILE-- --FILE--
<?php <?php
function __autoload($class_name) spl_autoload_register(function ($class_name) {
{
require_once(dirname(__FILE__) . '/' . $class_name . '.p5c'); require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
echo __FUNCTION__ . '(' . $class_name . ")\n"; echo 'autoload(' . $class_name . ")\n";
} });
var_dump(get_class_methods('autoload_root')); var_dump(get_class_methods('autoload_root'));
?> ?>
===DONE=== ===DONE===
--EXPECT-- --EXPECT--
__autoload(autoload_root) autoload(autoload_root)
array(1) { array(1) {
[0]=> [0]=>
string(12) "testFunction" string(12) "testFunction"

View file

@ -7,18 +7,17 @@ ZE2 Autoload and derived classes
--FILE-- --FILE--
<?php <?php
function __autoload($class_name) spl_autoload_register(function ($class_name) {
{
require_once(dirname(__FILE__) . '/' . $class_name . '.p5c'); require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
echo __FUNCTION__ . '(' . $class_name . ")\n"; echo 'autoload(' . $class_name . ")\n";
} });
var_dump(class_exists('autoload_derived')); var_dump(class_exists('autoload_derived'));
?> ?>
===DONE=== ===DONE===
--EXPECT-- --EXPECT--
__autoload(autoload_root) autoload(autoload_root)
__autoload(autoload_derived) autoload(autoload_derived)
bool(true) bool(true)
===DONE=== ===DONE===

View file

@ -7,12 +7,11 @@ ZE2 Autoload and recursion
--FILE-- --FILE--
<?php <?php
function __autoload($class_name) spl_autoload_register(function ($class_name) {
{
var_dump(class_exists($class_name)); var_dump(class_exists($class_name));
require_once(dirname(__FILE__) . '/' . $class_name . '.p5c'); require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
echo __FUNCTION__ . '(' . $class_name . ")\n"; echo 'autoload(' . $class_name . ")\n";
} });
var_dump(class_exists('autoload_derived')); var_dump(class_exists('autoload_derived'));
@ -21,7 +20,7 @@ var_dump(class_exists('autoload_derived'));
--EXPECT-- --EXPECT--
bool(false) bool(false)
bool(false) bool(false)
__autoload(autoload_root) autoload(autoload_root)
__autoload(autoload_derived) autoload(autoload_derived)
bool(true) bool(true)
===DONE=== ===DONE===

View file

@ -7,12 +7,11 @@ ZE2 Autoload from destructor
--FILE-- --FILE--
<?php <?php
function __autoload($class_name) spl_autoload_register(function ($class_name) {
{
var_dump(class_exists($class_name, false)); var_dump(class_exists($class_name, false));
require_once(dirname(__FILE__) . '/' . $class_name . '.p5c'); require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
echo __FUNCTION__ . '(' . $class_name . ")\n"; echo 'autoload(' . $class_name . ")\n";
} });
var_dump(class_exists('autoload_derived', false)); var_dump(class_exists('autoload_derived', false));
var_dump(class_exists('autoload_derived', false)); var_dump(class_exists('autoload_derived', false));
@ -37,8 +36,8 @@ bool(false)
Test::__destruct Test::__destruct
bool(false) bool(false)
bool(false) bool(false)
__autoload(autoload_root) autoload(autoload_root)
__autoload(autoload_derived) autoload(autoload_derived)
object(autoload_derived)#%d (0) { object(autoload_derived)#%d (0) {
} }
===DONE=== ===DONE===

View file

@ -7,11 +7,10 @@ ZE2 Autoload from destructor
--FILE-- --FILE--
<?php <?php
function __autoload($class_name) spl_autoload_register(function ($class_name) {
{
require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.p5c'); require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.p5c');
echo __FUNCTION__ . '(' . $class_name . ")\n"; echo 'autoload(' . $class_name . ")\n";
} });
var_dump(interface_exists('autoload_interface', false)); var_dump(interface_exists('autoload_interface', false));
var_dump(class_exists('autoload_implements', false)); var_dump(class_exists('autoload_implements', false));
@ -29,8 +28,8 @@ var_dump(class_exists('autoload_implements', false));
--EXPECTF-- --EXPECTF--
bool(false) bool(false)
bool(false) bool(false)
__autoload(autoload_interface) autoload(autoload_interface)
__autoload(Autoload_Implements) autoload(Autoload_Implements)
object(autoload_implements)#%d (0) { object(autoload_implements)#%d (0) {
} }
bool(true) bool(true)

View file

@ -2,11 +2,10 @@
Ensure instanceof does not trigger autoload. Ensure instanceof does not trigger autoload.
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{
echo "In autoload: "; echo "In autoload: ";
var_dump($name); var_dump($name);
} });
$a = new stdClass; $a = new stdClass;
var_dump($a instanceof UndefC); var_dump($a instanceof UndefC);

View file

@ -2,11 +2,10 @@
Ensure catch blocks for unknown exception types do not trigger autoload. Ensure catch blocks for unknown exception types do not trigger autoload.
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{
echo "In autoload: "; echo "In autoload: ";
var_dump($name); var_dump($name);
} });
function f() function f()
{ {

View file

@ -2,11 +2,10 @@
Ensure type hints for unknown types do not trigger autoload. Ensure type hints for unknown types do not trigger autoload.
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{
echo "In autoload: "; echo "In autoload: ";
var_dump($name); var_dump($name);
} });
function f(UndefClass $x) function f(UndefClass $x)
{ {

View file

@ -2,11 +2,10 @@
Ensure implements does trigger autoload. Ensure implements does trigger autoload.
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{
echo "In autoload: "; echo "In autoload: ";
var_dump($name); var_dump($name);
} });
class C implements UndefI class C implements UndefI
{ {

View file

@ -2,11 +2,10 @@
Ensure extends does trigger autoload. Ensure extends does trigger autoload.
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{
echo "In autoload: "; echo "In autoload: ";
var_dump($name); var_dump($name);
} });
class C extends UndefBase class C extends UndefBase
{ {

View file

@ -2,11 +2,10 @@
Ensure callback methods in unknown classes trigger autoload. Ensure callback methods in unknown classes trigger autoload.
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{
echo "In autoload: "; echo "In autoload: ";
var_dump($name); var_dump($name);
} });
call_user_func("UndefC::test"); call_user_func("UndefC::test");
?> ?>
--EXPECTF-- --EXPECTF--

View file

@ -4,11 +4,10 @@ Ensure the ReflectionClass constructor triggers autoload.
<?php extension_loaded('reflection') or die('skip'); ?> <?php extension_loaded('reflection') or die('skip'); ?>
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{
echo "In autoload: "; echo "In autoload: ";
var_dump($name); var_dump($name);
} });
try { try {
new ReflectionClass("UndefC"); new ReflectionClass("UndefC");

View file

@ -4,11 +4,10 @@ Ensure the ReflectionMethod constructor triggers autoload.
<?php extension_loaded('reflection') or die('skip'); ?> <?php extension_loaded('reflection') or die('skip'); ?>
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{
echo "In autoload: "; echo "In autoload: ";
var_dump($name); var_dump($name);
} });
try { try {
new ReflectionMethod("UndefC::test"); new ReflectionMethod("UndefC::test");

View file

@ -4,11 +4,10 @@ Ensure the ReflectionProperty constructor triggers autoload.
<?php extension_loaded('reflection') or die('skip'); ?> <?php extension_loaded('reflection') or die('skip'); ?>
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{
echo "In autoload: "; echo "In autoload: ";
var_dump($name); var_dump($name);
} });
try { try {
new ReflectionProperty('UndefC', 'p'); new ReflectionProperty('UndefC', 'p');

View file

@ -4,11 +4,10 @@ Ensure ReflectionClass::getProperty() triggers autoload
<?php extension_loaded('reflection') or die('skip'); ?> <?php extension_loaded('reflection') or die('skip'); ?>
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{
echo "In autoload: "; echo "In autoload: ";
var_dump($name); var_dump($name);
} });
$rc = new ReflectionClass("stdClass"); $rc = new ReflectionClass("stdClass");

View file

@ -4,11 +4,10 @@ Ensure ReflectionClass::implementsInterface triggers autoload.
<?php extension_loaded('reflection') or die('skip'); ?> <?php extension_loaded('reflection') or die('skip'); ?>
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{
echo "In autoload: "; echo "In autoload: ";
var_dump($name); var_dump($name);
} });
$rc = new ReflectionClass("stdClass"); $rc = new ReflectionClass("stdClass");

View file

@ -2,9 +2,8 @@
Ensure __autoload() allows for recursive calls if the class name differs. Ensure __autoload() allows for recursive calls if the class name differs.
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{ echo "IN: autoload($name)\n";
echo "IN: " . __METHOD__ . "($name)\n";
static $i = 0; static $i = 0;
if ($i++ > 10) { if ($i++ > 10) {
@ -14,35 +13,35 @@ Ensure __autoload() allows for recursive calls if the class name differs.
class_exists('UndefinedClass' . $i); class_exists('UndefinedClass' . $i);
echo "OUT: " . __METHOD__ . "($name)\n"; echo "OUT: autoload($name)\n";
} });
var_dump(class_exists('UndefinedClass0')); var_dump(class_exists('UndefinedClass0'));
?> ?>
--EXPECTF-- --EXPECTF--
IN: __autoload(UndefinedClass0) IN: autoload(UndefinedClass0)
IN: __autoload(UndefinedClass1) IN: autoload(UndefinedClass1)
IN: __autoload(UndefinedClass2) IN: autoload(UndefinedClass2)
IN: __autoload(UndefinedClass3) IN: autoload(UndefinedClass3)
IN: __autoload(UndefinedClass4) IN: autoload(UndefinedClass4)
IN: __autoload(UndefinedClass5) IN: autoload(UndefinedClass5)
IN: __autoload(UndefinedClass6) IN: autoload(UndefinedClass6)
IN: __autoload(UndefinedClass7) IN: autoload(UndefinedClass7)
IN: __autoload(UndefinedClass8) IN: autoload(UndefinedClass8)
IN: __autoload(UndefinedClass9) IN: autoload(UndefinedClass9)
IN: __autoload(UndefinedClass10) IN: autoload(UndefinedClass10)
IN: __autoload(UndefinedClass11) IN: autoload(UndefinedClass11)
-> Recursion detected - as expected. -> Recursion detected - as expected.
OUT: __autoload(UndefinedClass10) OUT: autoload(UndefinedClass10)
OUT: __autoload(UndefinedClass9) OUT: autoload(UndefinedClass9)
OUT: __autoload(UndefinedClass8) OUT: autoload(UndefinedClass8)
OUT: __autoload(UndefinedClass7) OUT: autoload(UndefinedClass7)
OUT: __autoload(UndefinedClass6) OUT: autoload(UndefinedClass6)
OUT: __autoload(UndefinedClass5) OUT: autoload(UndefinedClass5)
OUT: __autoload(UndefinedClass4) OUT: autoload(UndefinedClass4)
OUT: __autoload(UndefinedClass3) OUT: autoload(UndefinedClass3)
OUT: __autoload(UndefinedClass2) OUT: autoload(UndefinedClass2)
OUT: __autoload(UndefinedClass1) OUT: autoload(UndefinedClass1)
OUT: __autoload(UndefinedClass0) OUT: autoload(UndefinedClass0)
bool(false) bool(false)

View file

@ -2,13 +2,12 @@
Ensure __autoload() recursion is guarded for multiple lookups of same class using difference case. Ensure __autoload() recursion is guarded for multiple lookups of same class using difference case.
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{ echo "autoload $name\n";
echo __FUNCTION__ . " $name\n";
class_exists("undefinedCLASS"); class_exists("undefinedCLASS");
} });
class_exists("unDefinedClass"); class_exists("unDefinedClass");
?> ?>
--EXPECTF-- --EXPECTF--
__autoload unDefinedClass autoload unDefinedClass

View file

@ -2,10 +2,9 @@
Ensure __autoload() is triggered during unserialization. Ensure __autoload() is triggered during unserialization.
--FILE-- --FILE--
<?php <?php
function __autoload($name) spl_autoload_register(function ($name) {
{
echo "in autoload: $name\n"; echo "in autoload: $name\n";
} });
var_dump(unserialize('O:1:"C":0:{}')); var_dump(unserialize('O:1:"C":0:{}'));
?> ?>

View file

@ -2,9 +2,9 @@
Validation of class names in the autoload process Validation of class names in the autoload process
--FILE-- --FILE--
<?php <?php
function __autoload($name) { spl_autoload_register(function ($name) {
echo "$name\n"; echo "$name\n";
} });
$a = "../BUG"; $a = "../BUG";
$x = new $a; $x = new $a;
echo "BUG\n"; echo "BUG\n";