mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Deprecate __autoload()
This commit is contained in:
parent
eaeecc523b
commit
162aa1a5fc
83 changed files with 465 additions and 498 deletions
|
@ -1,24 +1,21 @@
|
|||
--TEST--
|
||||
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--
|
||||
<?php
|
||||
|
||||
function __autoload($name)
|
||||
{
|
||||
spl_autoload_register(function ($name) {
|
||||
echo __METHOD__ . "($name)\n";
|
||||
var_dump(class_exists('NotExistingClass'));
|
||||
echo __METHOD__ . "($name), done\n";
|
||||
}
|
||||
});
|
||||
|
||||
var_dump(class_exists('NotExistingClass'));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
__autoload(NotExistingClass)
|
||||
{closure}(NotExistingClass)
|
||||
bool(false)
|
||||
__autoload(NotExistingClass), done
|
||||
{closure}(NotExistingClass), done
|
||||
bool(false)
|
||||
===DONE===
|
||||
|
|
|
@ -5,8 +5,7 @@ Bug #31102 (Exception not handled when thrown inside __autoload())
|
|||
|
||||
$test = 0;
|
||||
|
||||
function __autoload($class)
|
||||
{
|
||||
spl_autoload_register(function ($class) {
|
||||
global $test;
|
||||
|
||||
echo __METHOD__ . "($class,$test)\n";
|
||||
|
@ -22,7 +21,7 @@ function __autoload($class)
|
|||
case 3:
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
while($test++ < 5)
|
||||
{
|
||||
|
@ -39,11 +38,11 @@ while($test++ < 5)
|
|||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
__autoload(Test1,1)
|
||||
{closure}(Test1,1)
|
||||
Caught: Test1::__construct
|
||||
__autoload(Test2,2)
|
||||
Caught: __autoload
|
||||
__autoload(Test3,3)
|
||||
{closure}(Test2,2)
|
||||
Caught: {closure}
|
||||
{closure}(Test3,3)
|
||||
|
||||
Fatal error: Uncaught Error: Class 'Test3' not found in %sbug31102.php(%d) : eval()'d code:1
|
||||
Stack trace:
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
Bug #33116 (crash when assigning class name to global variable in __autoload)
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($class)
|
||||
{
|
||||
spl_autoload_register(function ($class) {
|
||||
$GLOBALS['include'][] = $class;
|
||||
eval("class DefClass{}");
|
||||
}
|
||||
});
|
||||
|
||||
$a = new DefClass;
|
||||
print_r($a);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Bug #37138 (__autoload tries to load callback'ed self and parent)
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload ($CN) {var_dump ($CN);}
|
||||
spl_autoload_register(function ($CN) { var_dump ($CN); });
|
||||
class st {
|
||||
public static function e () {echo ("EHLO\n");}
|
||||
public static function e2 () {call_user_func (array ('self', 'e'));}
|
||||
|
|
|
@ -10,10 +10,9 @@ class ClassName
|
|||
|
||||
function test (OtherClassName $object) { }
|
||||
|
||||
function __autoload($class)
|
||||
{
|
||||
spl_autoload_register(function ($class) {
|
||||
var_dump("__autload($class)");
|
||||
}
|
||||
});
|
||||
|
||||
$obj = new ClassName;
|
||||
test($obj);
|
||||
|
|
|
@ -10,11 +10,11 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
|
|||
set_include_path(dirname(__FILE__).'/bug39542:.');
|
||||
}
|
||||
|
||||
function __autoload($class) {
|
||||
spl_autoload_register(function ($class) {
|
||||
if (!require_once($class.'.php')) {
|
||||
error_log('Error: Autoload class: '.$class.' not found!');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
new bug39542();
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
Bug #42798 (_autoload() not triggered for classes used in method signature)
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($className) {
|
||||
spl_autoload_register(function ($className) {
|
||||
print "$className\n";
|
||||
exit();
|
||||
}
|
||||
});
|
||||
|
||||
function foo($c = ok::constant) {
|
||||
}
|
||||
|
|
|
@ -3,12 +3,13 @@ Bug #46665 (Triggering autoload with a variable classname causes truncated autol
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
$baz = '\\Foo\\Bar\\Baz';
|
||||
new $baz();
|
||||
function __autoload($class) {
|
||||
spl_autoload_register(function ($class) {
|
||||
var_dump($class);
|
||||
require __DIR__ .'/bug46665_autoload.inc';
|
||||
}
|
||||
});
|
||||
|
||||
$baz = '\\Foo\\Bar\\Baz';
|
||||
new $baz();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
|
|
@ -10,11 +10,7 @@ function au($class) {
|
|||
}');
|
||||
}
|
||||
|
||||
function __autoload($class) {
|
||||
au($class);
|
||||
}
|
||||
|
||||
//spl_autoload_register('au');
|
||||
spl_autoload_register('au');
|
||||
|
||||
set_exception_handler(function($exception) {
|
||||
$h = new handler();
|
||||
|
|
|
@ -3,7 +3,7 @@ Bug #49908 (throwing exception in __autoload crashes when interface is not defin
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($className) {
|
||||
spl_autoload_register(function ($className) {
|
||||
var_dump($className);
|
||||
|
||||
if ($className == 'Foo') {
|
||||
|
@ -11,7 +11,7 @@ function __autoload($className) {
|
|||
} else {
|
||||
throw new Exception($className);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
new Foo;
|
||||
|
||||
|
@ -22,7 +22,9 @@ string(3) "Bar"
|
|||
|
||||
Fatal error: Uncaught Exception: Bar in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(7): __autoload('Bar')
|
||||
#1 %s(13): __autoload('Foo')
|
||||
#2 {main}
|
||||
#0 [internal function]: {closure}('Bar')
|
||||
#1 %s(%d): spl_autoload_call('Bar')
|
||||
#2 [internal function]: {closure}('Foo')
|
||||
#3 %s(%d): spl_autoload_call('Foo')
|
||||
#4 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -3,10 +3,10 @@ Bug #55007 (compiler fail after previous fail)
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($classname) {
|
||||
spl_autoload_register(function ($classname) {
|
||||
if ('CompileErrorClass'==$classname) eval('class CompileErrorClass { function foo() { $a[]; } }');
|
||||
if ('MyErrorHandler'==$classname) eval('class MyErrorHandler { function __construct() { print "My error handler runs.\n"; } }');
|
||||
}
|
||||
});
|
||||
|
||||
function shutdown() {
|
||||
new MyErrorHandler();
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
Bug #61011 (Crash when an exception is thrown by __autoload accessing a static property)
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name) {
|
||||
spl_autoload_register(function ($name) {
|
||||
throw new Exception($name);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
echo AAA::$a; //zend_fetch_var_address_helper
|
||||
} catch (Exception $e) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Bug #62907 (Double free when use traits)
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name) {
|
||||
spl_autoload_register(function ($name) {
|
||||
if ($name == "B") {
|
||||
eval ("abstract class B extends A { }");
|
||||
} else if ($name == "A") {
|
||||
|
@ -11,7 +11,7 @@ function __autoload($name) {
|
|||
eval ("trait T { public function __construct() { } }");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
});
|
||||
|
||||
class C extends B {
|
||||
public function __construct() {
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
Bug #63305 (zend_mm_heap corrupted with traits)
|
||||
--FILE--
|
||||
<?php
|
||||
new Attachment("");
|
||||
|
||||
function __autoload($class) {
|
||||
spl_autoload_register(function ($class) {
|
||||
switch ($class) {
|
||||
case "Attachment":
|
||||
eval(<<<'PHP'
|
||||
|
@ -36,7 +35,9 @@ PHP
|
|||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
});
|
||||
|
||||
new Attachment("");
|
||||
echo "okey";
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
Bug #65254 (Exception not catchable when exception thrown in autoload with a namespace)
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($class)
|
||||
{
|
||||
spl_autoload_register(function ($class) {
|
||||
eval("namespace ns_test; class test {}");
|
||||
|
||||
throw new \Exception('abcd');
|
||||
}
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
Bug #71163 (Segmentation Fault (cleanup_unfinished_calls))
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name) {
|
||||
spl_autoload_register(function ($name) {
|
||||
eval ("class $name extends Exception { public static function foo() {}}");
|
||||
throw new Exception("boom");
|
||||
}
|
||||
});
|
||||
|
||||
function test2() {
|
||||
try {
|
||||
|
|
|
@ -3,9 +3,9 @@ Testing call_user_func() with autoload and passing invalid params
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($class) {
|
||||
spl_autoload_register(function ($class) {
|
||||
var_dump($class);
|
||||
}
|
||||
});
|
||||
|
||||
call_user_func(array('foo', 'bar'));
|
||||
call_user_func(array('', 'bar'));
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
catch shouldn't call __autoload
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name) {
|
||||
|
||||
spl_autoload_register(function ($name) {
|
||||
echo("AUTOLOAD '$name'\n");
|
||||
eval("class $name {}");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
try {
|
||||
} catch (A $e) {
|
||||
|
|
|
@ -3,9 +3,9 @@ Testing class_alias() using autoload
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($a) {
|
||||
spl_autoload_register(function ($a) {
|
||||
class foo { }
|
||||
}
|
||||
});
|
||||
|
||||
class_alias('foo', 'bar', 1);
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
instanceof shouldn't call __autoload
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name) {
|
||||
spl_autoload_register(function ($name) {
|
||||
echo("AUTOLOAD '$name'\n");
|
||||
eval("class $name {}");
|
||||
}
|
||||
});
|
||||
|
||||
class A {
|
||||
}
|
||||
|
|
|
@ -4,10 +4,10 @@ is_a() and is_subclass_of() shouldn't call __autoload
|
|||
error_reporting=14335
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name) {
|
||||
spl_autoload_register(function ($name) {
|
||||
echo("AUTOLOAD '$name'\n");
|
||||
eval("class $name {}");
|
||||
}
|
||||
});
|
||||
|
||||
class BASE {
|
||||
}
|
||||
|
|
|
@ -5523,11 +5523,13 @@ 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)
|
||||
&& zend_ast_get_list(params_ast)->children != 1
|
||||
) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "%s() must take exactly 1 argument",
|
||||
ZEND_AUTOLOAD_FUNC_NAME);
|
||||
if (zend_string_equals_literal(lcname, ZEND_AUTOLOAD_FUNC_NAME)) {
|
||||
if (zend_ast_get_list(params_ast)->children != 1) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "%s() must take exactly 1 argument",
|
||||
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);
|
||||
|
|
|
@ -13,6 +13,7 @@ files/pear2coverage.phar.php
|
|||
--EXPECTHEADERS--
|
||||
Content-type: text/html; charset=UTF-8
|
||||
--EXPECTF--
|
||||
Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in %s on line %d
|
||||
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
|
||||
|
|
|
@ -53,10 +53,9 @@ function test($class)
|
|||
echo "\n";
|
||||
}
|
||||
|
||||
function __autoload($class)
|
||||
{
|
||||
spl_autoload_register(function ($class) {
|
||||
echo __FUNCTION__ . "($class)\n";
|
||||
}
|
||||
});
|
||||
|
||||
test('Class_does_not_exist');
|
||||
|
||||
|
@ -94,7 +93,7 @@ test('WithCtorWithArgs');
|
|||
--EXPECTF--
|
||||
|
||||
====>Class_does_not_exist
|
||||
__autoload(Class_does_not_exist)
|
||||
{closure}(Class_does_not_exist)
|
||||
string(41) "Class Class_does_not_exist does not exist"
|
||||
====>NoCtor
|
||||
====>newInstance()
|
||||
|
|
|
@ -3,8 +3,7 @@ Reflection Bug #26640 (__autoload() not invoked by Reflection classes)
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($c)
|
||||
{
|
||||
spl_autoload_register(function ($c) {
|
||||
class autoload_class
|
||||
{
|
||||
public function __construct()
|
||||
|
@ -12,7 +11,7 @@ function __autoload($c)
|
|||
print "autoload success\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$a = new ReflectionClass('autoload_class');
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
Reflection Bug #29268 (__autoload() not called with reflectionProperty->getClass())
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($classname) {
|
||||
spl_autoload_register(function ($classname) {
|
||||
echo "__autoload($classname)\n";
|
||||
eval("class $classname {}");
|
||||
}
|
||||
});
|
||||
|
||||
class B{
|
||||
public function doit(A $a){
|
||||
|
|
|
@ -4,13 +4,13 @@ Bug #28751 (SoapServer does not call _autoload())
|
|||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($className) {
|
||||
spl_autoload_register(function ($className) {
|
||||
class SoapServerActions {
|
||||
function test() {
|
||||
return "Hello World";
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$server = new SoapServer(NULL, array('uri'=>"http://testuri.org"));
|
||||
$server->setClass("SoapServerActions");
|
||||
|
|
|
@ -15,15 +15,14 @@ class fs {}
|
|||
var_dump(class_implements(new fs));
|
||||
var_dump(class_implements('fs'));
|
||||
|
||||
spl_autoload_register(function ($classname) {
|
||||
echo "attempting to autoload $classname\n";
|
||||
});
|
||||
|
||||
echo "\n--- testing autoload ---\n";
|
||||
var_dump(class_implements('non_existent'));
|
||||
var_dump(class_implements('non_existent2', false));
|
||||
|
||||
|
||||
function __autoload($classname) {
|
||||
echo "attempting to autoload $classname\n";
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
|
|
|
@ -15,15 +15,14 @@ class fs {}
|
|||
var_dump(class_uses(new fs));
|
||||
var_dump(class_uses('fs'));
|
||||
|
||||
spl_autoload_register(function ($classname) {
|
||||
echo "attempting to autoload $classname\n";
|
||||
});
|
||||
|
||||
echo "\n--- testing autoload ---\n";
|
||||
var_dump(class_uses('non_existent'));
|
||||
var_dump(class_uses('non_existent2', false));
|
||||
|
||||
|
||||
function __autoload($classname) {
|
||||
echo "attempting to autoload $classname\n";
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
SPL: class_parents() and class_implements()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
spl_autoload_register(function ($cname) {
|
||||
var_dump($cname);
|
||||
});
|
||||
|
||||
class a{}
|
||||
class b extends a{}
|
||||
class c extends b{}
|
||||
|
@ -24,10 +29,6 @@ var_dump(class_implements(new a),
|
|||
class_implements("bbb", 0)
|
||||
);
|
||||
|
||||
function __autoload($cname) {
|
||||
var_dump($cname);
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
"access a property of an incomplete object. " \
|
||||
"Please ensure that the class definition \"%s\" 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 "
|
||||
"unserialize() gets called or provide an autoloader " \
|
||||
"to load the class definition"
|
||||
|
||||
static zend_object_handlers php_incomplete_object_handlers;
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ Test class_exists() function : basic functionality
|
|||
|
||||
echo "*** Testing class_exists() : basic functionality ***\n";
|
||||
|
||||
function __autoload($className) {
|
||||
echo "In __autoload($className)\n";
|
||||
}
|
||||
spl_autoload_register(function ($className) {
|
||||
echo "In autoload($className)\n";
|
||||
});
|
||||
|
||||
echo "Calling class_exists() on non-existent class with autoload explicitly enabled:\n";
|
||||
var_dump( class_exists('C', true) );
|
||||
|
@ -34,7 +34,7 @@ echo "Done";
|
|||
--EXPECTF--
|
||||
*** Testing class_exists() : basic functionality ***
|
||||
Calling class_exists() on non-existent class with autoload explicitly enabled:
|
||||
In __autoload(C)
|
||||
In autoload(C)
|
||||
bool(false)
|
||||
|
||||
Calling class_exists() on existing class with autoload explicitly enabled:
|
||||
|
@ -47,9 +47,9 @@ Calling class_exists() on existing class with autoload explicitly disabled:
|
|||
bool(true)
|
||||
|
||||
Calling class_exists() on non-existent class with autoload unspecified:
|
||||
In __autoload(E)
|
||||
In autoload(E)
|
||||
bool(false)
|
||||
|
||||
Calling class_exists() on existing class with autoload unspecified:
|
||||
bool(true)
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -8,9 +8,9 @@ Test class_exists() function : usage variations - unexpected types for argument
|
|||
* Alias to functions:
|
||||
*/
|
||||
|
||||
function __autoload($className) {
|
||||
echo "In __autoload($className)\n";
|
||||
}
|
||||
spl_autoload_register(function ($className) {
|
||||
echo "In autoload($className)\n";
|
||||
});
|
||||
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
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)
|
||||
|
||||
Arg value 0
|
||||
In __autoload(0)
|
||||
In autoload(0)
|
||||
bool(false)
|
||||
|
||||
Arg value 1
|
||||
In __autoload(1)
|
||||
In autoload(1)
|
||||
bool(false)
|
||||
|
||||
Arg value 12345
|
||||
In __autoload(12345)
|
||||
In autoload(12345)
|
||||
bool(false)
|
||||
|
||||
Arg value -2345
|
||||
|
@ -109,7 +109,7 @@ Arg value -10.5
|
|||
bool(false)
|
||||
|
||||
Arg value 101234567000
|
||||
In __autoload(101234567000)
|
||||
In autoload(101234567000)
|
||||
bool(false)
|
||||
|
||||
Arg value 1.07654321E-9
|
||||
|
@ -150,14 +150,14 @@ Arg value
|
|||
bool(false)
|
||||
|
||||
Arg value 1
|
||||
In __autoload(1)
|
||||
In autoload(1)
|
||||
bool(false)
|
||||
|
||||
Arg value
|
||||
bool(false)
|
||||
|
||||
Arg value 1
|
||||
In __autoload(1)
|
||||
In autoload(1)
|
||||
bool(false)
|
||||
|
||||
Arg value
|
||||
|
@ -179,4 +179,4 @@ bool(false)
|
|||
|
||||
Arg value
|
||||
bool(false)
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -8,9 +8,9 @@ Test class_exists() function : usage variations - unexpected types for argument
|
|||
* Alias to functions:
|
||||
*/
|
||||
|
||||
function __autoload($className) {
|
||||
echo "In __autoload($className)\n";
|
||||
}
|
||||
spl_autoload_register(function ($className) {
|
||||
echo "In autoload($className)\n";
|
||||
});
|
||||
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
|
@ -95,35 +95,35 @@ Arg value 0
|
|||
bool(false)
|
||||
|
||||
Arg value 1
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value 12345
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value -2345
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value 10.5
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value -10.5
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value 101234567000
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value 1.07654321E-9
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value 0.5
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d)
|
||||
|
||||
|
@ -158,14 +158,14 @@ Arg value
|
|||
bool(false)
|
||||
|
||||
Arg value 1
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value
|
||||
bool(false)
|
||||
|
||||
Arg value 1
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value
|
||||
|
@ -178,11 +178,11 @@ Arg value
|
|||
bool(false)
|
||||
|
||||
Arg value string
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value string
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
Error: 4096 - Object of class stdClass could not be converted to string, %s(80)
|
||||
|
||||
|
@ -195,4 +195,4 @@ bool(false)
|
|||
|
||||
Arg value
|
||||
bool(false)
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -11,9 +11,9 @@ Test get_declared_classes() function : testing autoloaded classes
|
|||
|
||||
echo "*** Testing get_declared_classes() : testing autoloaded classes ***\n";
|
||||
|
||||
function __autoload($class_name) {
|
||||
spl_autoload_register(function ($class_name) {
|
||||
require_once $class_name . '.inc';
|
||||
}
|
||||
});
|
||||
|
||||
echo "\n-- before instance is declared --\n";
|
||||
var_dump(in_array('AutoLoaded', get_declared_classes()));
|
||||
|
|
|
@ -11,9 +11,9 @@ Test get_declared_interfaces() function : autoloading of interfaces
|
|||
|
||||
echo "*** Testing get_declared_interfaces() : autoloading of interfaces ***\n";
|
||||
|
||||
function __autoload($class_name) {
|
||||
spl_autoload_register(function ($class_name) {
|
||||
require_once $class_name . '.inc';
|
||||
}
|
||||
});
|
||||
|
||||
echo "\n-- before interface is used --\n";
|
||||
var_dump(in_array('AutoInterface', get_declared_interfaces()));
|
||||
|
|
|
@ -11,9 +11,9 @@ Test get_declared_traits() function : testing autoloaded traits
|
|||
|
||||
echo "*** Testing get_declared_traits() : testing autoloaded traits ***\n";
|
||||
|
||||
function __autoload($trait_name) {
|
||||
spl_autoload_register(function ($trait_name) {
|
||||
require_once $trait_name . '.inc';
|
||||
}
|
||||
});
|
||||
|
||||
echo "\n-- before instance is declared --\n";
|
||||
var_dump(in_array('AutoTrait', get_declared_traits()));
|
||||
|
|
|
@ -8,9 +8,9 @@ Test get_parent_class() function : usage variations - unexpected argument type.
|
|||
* Alias to functions:
|
||||
*/
|
||||
|
||||
function __autoload($className) {
|
||||
echo "In __autoload($className)\n";
|
||||
}
|
||||
spl_autoload_register(function ($className) {
|
||||
echo "In autoload($className)\n";
|
||||
});
|
||||
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
|
@ -160,11 +160,11 @@ Arg value
|
|||
bool(false)
|
||||
|
||||
Arg value string
|
||||
In __autoload(string)
|
||||
In autoload(string)
|
||||
bool(false)
|
||||
|
||||
Arg value String
|
||||
In __autoload(String)
|
||||
In autoload(String)
|
||||
bool(false)
|
||||
Error: 4096 - Object of class stdClass could not be converted to string, %s(77)
|
||||
|
||||
|
@ -176,4 +176,4 @@ bool(false)
|
|||
|
||||
Arg value
|
||||
bool(false)
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -10,9 +10,9 @@ Test interface_exists() function : autoloaded interface
|
|||
|
||||
echo "*** Testing interface_exists() : autoloaded interface ***\n";
|
||||
|
||||
function __autoload($class_name) {
|
||||
spl_autoload_register(function ($class_name) {
|
||||
require_once $class_name . '.inc';
|
||||
}
|
||||
});
|
||||
|
||||
echo "\n-- no autoloading --\n";
|
||||
var_dump(interface_exists("AutoInterface", false));
|
||||
|
@ -32,4 +32,4 @@ bool(false)
|
|||
-- with autoloading --
|
||||
bool(true)
|
||||
|
||||
DONE
|
||||
DONE
|
||||
|
|
|
@ -10,10 +10,9 @@ Test interface_exists() function : test autoload default value
|
|||
|
||||
echo "*** Testing interface_exists() : test autoload default value ***\n";
|
||||
|
||||
function __autoload($class_name) {
|
||||
spl_autoload_register(function ($class_name) {
|
||||
require_once $class_name . '.inc';
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var_dump(interface_exists("AutoInterface"));
|
||||
|
||||
|
@ -24,4 +23,4 @@ echo "\nDONE\n";
|
|||
*** Testing interface_exists() : test autoload default value ***
|
||||
bool(true)
|
||||
|
||||
DONE
|
||||
DONE
|
||||
|
|
|
@ -60,13 +60,10 @@ $t->test();
|
|||
$t = new derived_a();
|
||||
$t->test();
|
||||
|
||||
eval('
|
||||
function __autoload($name)
|
||||
{
|
||||
echo ">>>> In __autoload: ";
|
||||
var_dump($name);
|
||||
}
|
||||
');
|
||||
spl_autoload_register(function ($name) {
|
||||
echo ">>>> In autoload: ";
|
||||
var_dump($name);
|
||||
});
|
||||
|
||||
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,false) = no
|
||||
>>> With Undefined
|
||||
>>>> In __autoload: string(6) "undefB"
|
||||
>>>> In autoload: string(6) "undefB"
|
||||
is_a( STRING:undefB, base,true) = no
|
||||
is_a( STRING:undefB, base) = 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
|
||||
|
||||
>>> 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,false) = no
|
||||
>>> 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) = 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
|
||||
|
||||
>>> 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,false) = no
|
||||
>>> 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) = 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
|
||||
|
||||
>>> 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,false) = no
|
||||
>>> With Undefined
|
||||
>>>> In __autoload: string(6) "undefB"
|
||||
>>>> In autoload: string(6) "undefB"
|
||||
is_a( STRING:undefB, undefA,true) = no
|
||||
is_a( STRING:undefB, undefA) = 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
|
||||
|
||||
|
||||
|
@ -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,false) = no
|
||||
>>> With Undefined
|
||||
>>>> In __autoload: string(6) "undefB"
|
||||
>>>> In autoload: string(6) "undefB"
|
||||
is_a( STRING:undefB, base,true) = no
|
||||
is_a( STRING:undefB, base) = 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
|
||||
|
||||
>>> 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,false) = no
|
||||
>>> 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) = 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
|
||||
|
||||
>>> 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,false) = no
|
||||
>>> 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) = 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
|
||||
|
||||
>>> 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,false) = no
|
||||
>>> With Undefined
|
||||
>>>> In __autoload: string(6) "undefB"
|
||||
>>>> In autoload: string(6) "undefB"
|
||||
is_a( STRING:undefB, undefA,true) = no
|
||||
is_a( STRING:undefB, undefA) = 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
|
||||
|
||||
|
||||
|
@ -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,false) = no
|
||||
>>> With Undefined
|
||||
>>>> In __autoload: string(6) "undefB"
|
||||
>>>> In autoload: string(6) "undefB"
|
||||
is_a( STRING:undefB, base,true) = no
|
||||
is_a( STRING:undefB, base) = 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
|
||||
|
||||
>>> 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,false) = no
|
||||
>>> 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) = 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
|
||||
|
||||
>>> 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,false) = no
|
||||
>>> 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) = 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
|
||||
|
||||
>>> 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,false) = no
|
||||
>>> With Undefined
|
||||
>>>> In __autoload: string(6) "undefB"
|
||||
>>>> In autoload: string(6) "undefB"
|
||||
is_a( STRING:undefB, undefA,true) = no
|
||||
is_a( STRING:undefB, undefA) = 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
|
||||
|
|
|
@ -8,9 +8,9 @@ Test is_subclass_of() function : usage variations - unexpected type for arg 1
|
|||
* Alias to functions:
|
||||
*/
|
||||
// Note: basic use cases in Zend/tests/is_a.phpt
|
||||
function __autoload($className) {
|
||||
echo "In __autoload($className)\n";
|
||||
}
|
||||
spl_autoload_register(function ($className) {
|
||||
echo "In autoload($className)\n";
|
||||
});
|
||||
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
|
@ -161,11 +161,11 @@ Arg value
|
|||
bool(false)
|
||||
|
||||
Arg value string
|
||||
In __autoload(string)
|
||||
In autoload(string)
|
||||
bool(false)
|
||||
|
||||
Arg value String
|
||||
In __autoload(String)
|
||||
In autoload(String)
|
||||
bool(false)
|
||||
|
||||
Arg value
|
||||
|
@ -173,4 +173,4 @@ bool(false)
|
|||
|
||||
Arg value
|
||||
bool(false)
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -8,9 +8,9 @@ Test is_subclass_of() function : usage variations - unexpected type for arg 2
|
|||
* Alias to functions:
|
||||
*/
|
||||
|
||||
function __autoload($className) {
|
||||
echo "In __autoload($className)\n";
|
||||
}
|
||||
spl_autoload_register(function ($className) {
|
||||
echo "In autoload($className)\n";
|
||||
});
|
||||
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
|
@ -173,4 +173,4 @@ bool(false)
|
|||
|
||||
Arg value
|
||||
bool(false)
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -8,9 +8,9 @@ Test is_subclass_of() function : usage variations - unexpected type for arg 1 w
|
|||
* Alias to functions:
|
||||
*/
|
||||
// Note: basic use cases in Zend/tests/is_a.phpt
|
||||
function __autoload($className) {
|
||||
echo "In __autoload($className)\n";
|
||||
}
|
||||
spl_autoload_register(function ($className) {
|
||||
echo "In autoload($className)\n";
|
||||
});
|
||||
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
|
@ -161,11 +161,11 @@ Arg value
|
|||
bool(false)
|
||||
|
||||
Arg value string
|
||||
In __autoload(string)
|
||||
In autoload(string)
|
||||
bool(false)
|
||||
|
||||
Arg value String
|
||||
In __autoload(String)
|
||||
In autoload(String)
|
||||
bool(false)
|
||||
|
||||
Arg value
|
||||
|
@ -173,4 +173,4 @@ bool(false)
|
|||
|
||||
Arg value
|
||||
bool(false)
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -8,15 +8,15 @@ method_exists() on non-existent class, with __autoload().
|
|||
* Alias to functions:
|
||||
*/
|
||||
|
||||
function __autoload($name) {
|
||||
echo "In __autoload($name)\n";
|
||||
}
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "In autoload($name)\n";
|
||||
});
|
||||
|
||||
var_dump(method_exists('UndefC', 'func'));
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
In __autoload(UndefC)
|
||||
In autoload(UndefC)
|
||||
bool(false)
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -8,9 +8,9 @@ Test method_exists() function : usage variations - unexpected type for arg 1
|
|||
* Alias to functions:
|
||||
*/
|
||||
|
||||
function __autoload($className) {
|
||||
echo "In __autoload($className)\n";
|
||||
}
|
||||
spl_autoload_register(function ($className) {
|
||||
echo "In autoload($className)\n";
|
||||
});
|
||||
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
|
@ -160,11 +160,11 @@ Arg value
|
|||
bool(false)
|
||||
|
||||
Arg value string
|
||||
In __autoload(string)
|
||||
In autoload(string)
|
||||
bool(false)
|
||||
|
||||
Arg value String
|
||||
In __autoload(String)
|
||||
In autoload(String)
|
||||
bool(false)
|
||||
|
||||
Arg value
|
||||
|
@ -172,4 +172,4 @@ bool(false)
|
|||
|
||||
Arg value
|
||||
bool(false)
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -8,9 +8,9 @@ Test method_exists() function : usage variations - unexpected type for arg 2
|
|||
* Alias to functions:
|
||||
*/
|
||||
|
||||
function __autoload($className) {
|
||||
echo "In __autoload($className)\n";
|
||||
}
|
||||
spl_autoload_register(function ($className) {
|
||||
echo "In autoload($className)\n";
|
||||
});
|
||||
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
|
@ -173,4 +173,4 @@ bool(false)
|
|||
|
||||
Arg value
|
||||
bool(false)
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -10,9 +10,9 @@ Test property_exists() function : class auto loading
|
|||
|
||||
echo "*** Testing property_exists() : class auto loading ***\n";
|
||||
|
||||
function __autoload($class_name) {
|
||||
spl_autoload_register(function ($class_name) {
|
||||
require_once $class_name . '.inc';
|
||||
}
|
||||
});
|
||||
|
||||
echo "\ntesting property in autoloaded class\n";
|
||||
var_dump(property_exists("AutoTest", "bob"));
|
||||
|
@ -30,4 +30,4 @@ bool(true)
|
|||
|
||||
testing __get magic method
|
||||
bool(false)
|
||||
===DONE===
|
||||
===DONE===
|
||||
|
|
|
@ -10,9 +10,9 @@ Test trait_exists() function : basic functionality
|
|||
|
||||
echo "*** Testing trait_exists() : basic functionality ***\n";
|
||||
|
||||
function __autoload($traitName) {
|
||||
echo "In __autoload($traitName)\n";
|
||||
}
|
||||
spl_autoload_register(function ($traitName) {
|
||||
echo "In autoload($traitName)\n";
|
||||
});
|
||||
|
||||
trait MyTrait {}
|
||||
|
||||
|
@ -36,7 +36,7 @@ echo "Done";
|
|||
--EXPECTF--
|
||||
*** Testing trait_exists() : basic functionality ***
|
||||
Calling trait_exists() on non-existent trait with autoload explicitly enabled:
|
||||
In __autoload(C)
|
||||
In autoload(C)
|
||||
bool(false)
|
||||
|
||||
Calling trait_exists() on existing trait with autoload explicitly enabled:
|
||||
|
@ -49,9 +49,9 @@ Calling trait_exists() on existing trait with autoload explicitly disabled:
|
|||
bool(true)
|
||||
|
||||
Calling trait_exists() on non-existent trait with autoload unspecified:
|
||||
In __autoload(E)
|
||||
In autoload(E)
|
||||
bool(false)
|
||||
|
||||
Calling trait_exists() on existing trait with autoload unspecified:
|
||||
bool(true)
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -8,9 +8,9 @@ Test trait_exists() function : usage variations - unexpected types for argument
|
|||
* Alias to functions:
|
||||
*/
|
||||
|
||||
function __autoload($traitName) {
|
||||
echo "In __autoload($traitName)\n";
|
||||
}
|
||||
spl_autoload_register(function ($traitName) {
|
||||
echo "In autoload($traitName)\n";
|
||||
});
|
||||
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
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)
|
||||
|
||||
Arg value 0
|
||||
In __autoload(0)
|
||||
In autoload(0)
|
||||
bool(false)
|
||||
|
||||
Arg value 1
|
||||
In __autoload(1)
|
||||
In autoload(1)
|
||||
bool(false)
|
||||
|
||||
Arg value 12345
|
||||
In __autoload(12345)
|
||||
In autoload(12345)
|
||||
bool(false)
|
||||
|
||||
Arg value -2345
|
||||
|
@ -109,7 +109,7 @@ Arg value -10.5
|
|||
bool(false)
|
||||
|
||||
Arg value 101234567000
|
||||
In __autoload(101234567000)
|
||||
In autoload(101234567000)
|
||||
bool(false)
|
||||
|
||||
Arg value 1.07654321E-9
|
||||
|
@ -150,14 +150,14 @@ Arg value
|
|||
bool(false)
|
||||
|
||||
Arg value 1
|
||||
In __autoload(1)
|
||||
In autoload(1)
|
||||
bool(false)
|
||||
|
||||
Arg value
|
||||
bool(false)
|
||||
|
||||
Arg value 1
|
||||
In __autoload(1)
|
||||
In autoload(1)
|
||||
bool(false)
|
||||
|
||||
Arg value
|
||||
|
@ -179,4 +179,4 @@ bool(false)
|
|||
|
||||
Arg value
|
||||
bool(false)
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -8,9 +8,9 @@ Test trait_exists() function : usage variations - unexpected types for argument
|
|||
* Alias to functions:
|
||||
*/
|
||||
|
||||
function __autoload($traitName) {
|
||||
echo "In __autoload($traitName)\n";
|
||||
}
|
||||
spl_autoload_register(function ($traitName) {
|
||||
echo "In autoload($traitName)\n";
|
||||
});
|
||||
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
|
@ -95,35 +95,35 @@ Arg value 0
|
|||
bool(false)
|
||||
|
||||
Arg value 1
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value 12345
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value -2345
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value 10.5
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value -10.5
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value 101234567000
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value 1.07654321E-9
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value 0.5
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d)
|
||||
|
||||
|
@ -158,14 +158,14 @@ Arg value
|
|||
bool(false)
|
||||
|
||||
Arg value 1
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value
|
||||
bool(false)
|
||||
|
||||
Arg value 1
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value
|
||||
|
@ -178,11 +178,11 @@ Arg value
|
|||
bool(false)
|
||||
|
||||
Arg value string
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
|
||||
Arg value string
|
||||
In __autoload(string_val)
|
||||
In autoload(string_val)
|
||||
bool(false)
|
||||
Error: 4096 - Object of class stdClass could not be converted to string, %s(80)
|
||||
|
||||
|
@ -195,4 +195,4 @@ bool(false)
|
|||
|
||||
Arg value
|
||||
bool(false)
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -8,8 +8,7 @@ class test2 {
|
|||
}
|
||||
}
|
||||
|
||||
function __autoload($class)
|
||||
{
|
||||
spl_autoload_register(function ($class) {
|
||||
eval('class test1 extends test2 {}');
|
||||
|
||||
test1::use_stack(
|
||||
|
@ -17,7 +16,7 @@ function __autoload($class)
|
|||
11,12,13,14,15,16,17,18,19,20,
|
||||
21,22,23,24,25,26,27,28,29,30
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
call_user_func(array('test1', 'use_stack'),
|
||||
1,2,3,4,5,6,7,8,9,10,
|
||||
|
|
|
@ -31,12 +31,11 @@ function unserializer($class_name)
|
|||
eval("class TestNANew2 extends TestNew {}");
|
||||
break;
|
||||
default:
|
||||
echo "Try __autoload()\n";
|
||||
if (!function_exists('__autoload'))
|
||||
{
|
||||
eval('function __autoload($class_name) { do_autoload($class_name); }');
|
||||
echo "Try autoloader\n";
|
||||
if (!spl_autoload_functions()) {
|
||||
spl_autoload_register(function ($class_name) { do_autoload($class_name); });
|
||||
}
|
||||
__autoload($class_name);
|
||||
spl_autoload_call($class_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +122,7 @@ var_dump(unserialize('C:10:"TestNANew2":0:{}'));
|
|||
echo "===AutoOld===\n";
|
||||
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
|
||||
// becomes an incomplete class instance.
|
||||
|
||||
|
@ -168,7 +167,7 @@ object(TestNANew2)#%d (0) {
|
|||
}
|
||||
===AutoOld===
|
||||
unserializer(autoload_implements)
|
||||
Try __autoload()
|
||||
Try autoloader
|
||||
do_autoload(autoload_interface)
|
||||
do_autoload(autoload_implements)
|
||||
object(autoload_implements)#%d (0) {
|
||||
|
@ -176,7 +175,7 @@ object(autoload_implements)#%d (0) {
|
|||
===AutoNA===
|
||||
do_autoload(autoload_not_available)
|
||||
unserializer(autoload_not_available)
|
||||
Try __autoload()
|
||||
Try autoloader
|
||||
do_autoload(autoload_not_available)
|
||||
do_autoload(autoload_not_available)
|
||||
|
||||
|
|
|
@ -7,11 +7,10 @@ Bug #30234 (__autoload() not invoked for interfaces)
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($class_name)
|
||||
{
|
||||
spl_autoload_register(function ($class_name) {
|
||||
require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.p5c');
|
||||
echo __FUNCTION__ . '(' . $class_name . ")\n";
|
||||
}
|
||||
});
|
||||
|
||||
var_dump(interface_exists('autoload_interface', false));
|
||||
var_dump(class_exists('autoload_implements', false));
|
||||
|
@ -30,8 +29,8 @@ var_dump(class_exists('autoload_implements', false));
|
|||
--EXPECTF--
|
||||
bool(false)
|
||||
bool(false)
|
||||
__autoload(autoload_interface)
|
||||
__autoload(Autoload_Implements)
|
||||
{closure}(autoload_interface)
|
||||
{closure}(Autoload_Implements)
|
||||
object(autoload_implements)#%d (0) {
|
||||
}
|
||||
bool(true)
|
||||
|
|
|
@ -3,10 +3,10 @@ Bug #62836 (Seg fault or broken object references on unserialize())
|
|||
--FILE--
|
||||
<?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;}';
|
||||
function __autoload($name) {
|
||||
spl_autoload_register(function ($name) {
|
||||
unserialize("i:4;");
|
||||
eval("class $name {} ");
|
||||
}
|
||||
});
|
||||
|
||||
print_r(unserialize($serialized_object));
|
||||
echo "okey";
|
||||
|
|
|
@ -13,4 +13,4 @@ Exception in %s:%d
|
|||
Stack trace:
|
||||
#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
|
||||
|
|
|
@ -6,9 +6,9 @@ Bug #70213: Unserialize context shared on double class lookup
|
|||
ini_set('unserialize_callback_func', 'evil');
|
||||
|
||||
function evil() {
|
||||
function __autoload($arg) {
|
||||
spl_autoload_register(function ($arg) {
|
||||
var_dump(unserialize('R:1;'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var_dump(unserialize('a:2:{i:0;i:42;i:1;O:4:"evil":0:{}}'));
|
||||
|
@ -23,7 +23,7 @@ array(2) {
|
|||
[0]=>
|
||||
int(42)
|
||||
[1]=>
|
||||
object(__PHP_Incomplete_Class)#1 (1) {
|
||||
object(__PHP_Incomplete_Class)#2 (1) {
|
||||
["__PHP_Incomplete_Class_Name"]=>
|
||||
string(4) "evil"
|
||||
}
|
||||
|
|
|
@ -17,11 +17,11 @@ echo "Done\n";
|
|||
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
|
||||
|
||||
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
|
||||
Done
|
||||
|
|
|
@ -90,31 +90,31 @@ object(__PHP_Incomplete_Class)#%d (2) {
|
|||
}
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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"
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
|
|
@ -23,6 +23,6 @@ echo "Done";
|
|||
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
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -13,9 +13,9 @@ Ensure __autoload is called twice if unserialize_callback_func is defined.
|
|||
* Alias to functions:
|
||||
*/
|
||||
|
||||
function __autoload($name) {
|
||||
echo "in __autoload($name)\n";
|
||||
}
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "in autoload($name)\n";
|
||||
});
|
||||
|
||||
ini_set('unserialize_callback_func','check');
|
||||
|
||||
|
@ -30,13 +30,13 @@ var_dump($o);
|
|||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
in __autoload(FOO)
|
||||
in autoload(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
|
||||
object(__PHP_Incomplete_Class)#%d (1) {
|
||||
["__PHP_Incomplete_Class_Name"]=>
|
||||
string(3) "FOO"
|
||||
}
|
||||
Done
|
||||
Done
|
||||
|
|
|
@ -5,10 +5,10 @@ Bug #33853 (php:function call __autoload with lowercase param)
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($className) {
|
||||
spl_autoload_register(function ($className) {
|
||||
var_dump($className);
|
||||
exit();
|
||||
}
|
||||
});
|
||||
|
||||
$xsl = new DomDocument();
|
||||
$xsl->loadXML('<?xml version="1.0" encoding="iso-8859-1" ?>
|
||||
|
|
|
@ -7,17 +7,16 @@ ZE2 Autoload and class_exists
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($class_name)
|
||||
{
|
||||
spl_autoload_register(function ($class_name) {
|
||||
require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
|
||||
echo __FUNCTION__ . '(' . $class_name . ")\n";
|
||||
}
|
||||
echo 'autoload(' . $class_name . ")\n";
|
||||
});
|
||||
|
||||
var_dump(class_exists('autoload_root'));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
__autoload(autoload_root)
|
||||
autoload(autoload_root)
|
||||
bool(true)
|
||||
===DONE===
|
||||
|
|
|
@ -7,18 +7,17 @@ ZE2 Autoload and get_class_methods
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($class_name)
|
||||
{
|
||||
spl_autoload_register(function ($class_name) {
|
||||
require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
|
||||
echo __FUNCTION__ . '(' . $class_name . ")\n";
|
||||
}
|
||||
echo 'autoload(' . $class_name . ")\n";
|
||||
});
|
||||
|
||||
var_dump(get_class_methods('autoload_root'));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
__autoload(autoload_root)
|
||||
autoload(autoload_root)
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(12) "testFunction"
|
||||
|
|
|
@ -7,18 +7,17 @@ ZE2 Autoload and derived classes
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($class_name)
|
||||
{
|
||||
spl_autoload_register(function ($class_name) {
|
||||
require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
|
||||
echo __FUNCTION__ . '(' . $class_name . ")\n";
|
||||
}
|
||||
echo 'autoload(' . $class_name . ")\n";
|
||||
});
|
||||
|
||||
var_dump(class_exists('autoload_derived'));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
__autoload(autoload_root)
|
||||
__autoload(autoload_derived)
|
||||
autoload(autoload_root)
|
||||
autoload(autoload_derived)
|
||||
bool(true)
|
||||
===DONE===
|
||||
|
|
|
@ -7,12 +7,11 @@ ZE2 Autoload and recursion
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($class_name)
|
||||
{
|
||||
spl_autoload_register(function ($class_name) {
|
||||
var_dump(class_exists($class_name));
|
||||
require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
|
||||
echo __FUNCTION__ . '(' . $class_name . ")\n";
|
||||
}
|
||||
echo 'autoload(' . $class_name . ")\n";
|
||||
});
|
||||
|
||||
var_dump(class_exists('autoload_derived'));
|
||||
|
||||
|
@ -21,7 +20,7 @@ var_dump(class_exists('autoload_derived'));
|
|||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
__autoload(autoload_root)
|
||||
__autoload(autoload_derived)
|
||||
autoload(autoload_root)
|
||||
autoload(autoload_derived)
|
||||
bool(true)
|
||||
===DONE===
|
||||
|
|
|
@ -7,12 +7,11 @@ ZE2 Autoload from destructor
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($class_name)
|
||||
{
|
||||
spl_autoload_register(function ($class_name) {
|
||||
var_dump(class_exists($class_name, false));
|
||||
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));
|
||||
|
@ -37,8 +36,8 @@ bool(false)
|
|||
Test::__destruct
|
||||
bool(false)
|
||||
bool(false)
|
||||
__autoload(autoload_root)
|
||||
__autoload(autoload_derived)
|
||||
autoload(autoload_root)
|
||||
autoload(autoload_derived)
|
||||
object(autoload_derived)#%d (0) {
|
||||
}
|
||||
===DONE===
|
||||
|
|
|
@ -7,11 +7,10 @@ ZE2 Autoload from destructor
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($class_name)
|
||||
{
|
||||
spl_autoload_register(function ($class_name) {
|
||||
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(class_exists('autoload_implements', false));
|
||||
|
@ -29,8 +28,8 @@ var_dump(class_exists('autoload_implements', false));
|
|||
--EXPECTF--
|
||||
bool(false)
|
||||
bool(false)
|
||||
__autoload(autoload_interface)
|
||||
__autoload(Autoload_Implements)
|
||||
autoload(autoload_interface)
|
||||
autoload(Autoload_Implements)
|
||||
object(autoload_implements)#%d (0) {
|
||||
}
|
||||
bool(true)
|
||||
|
|
|
@ -2,14 +2,13 @@
|
|||
Ensure instanceof does not trigger autoload.
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name)
|
||||
{
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
}
|
||||
|
||||
$a = new stdClass;
|
||||
var_dump($a instanceof UndefC);
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
});
|
||||
|
||||
$a = new stdClass;
|
||||
var_dump($a instanceof UndefC);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
|
|
|
@ -2,25 +2,24 @@
|
|||
Ensure catch blocks for unknown exception types do not trigger autoload.
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name)
|
||||
{
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
}
|
||||
|
||||
function f()
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
try {
|
||||
f();
|
||||
}
|
||||
catch (UndefC $u) {
|
||||
echo "In UndefClass catch block.\n";
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo "In Exception catch block. Autoload should not have been triggered.\n";
|
||||
}
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
});
|
||||
|
||||
function f()
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
try {
|
||||
f();
|
||||
}
|
||||
catch (UndefC $u) {
|
||||
echo "In UndefClass catch block.\n";
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo "In Exception catch block. Autoload should not have been triggered.\n";
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
In Exception catch block. Autoload should not have been triggered.
|
||||
|
|
|
@ -2,16 +2,15 @@
|
|||
Ensure type hints for unknown types do not trigger autoload.
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name)
|
||||
{
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
}
|
||||
|
||||
function f(UndefClass $x)
|
||||
{
|
||||
}
|
||||
f(new stdClass);
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
});
|
||||
|
||||
function f(UndefClass $x)
|
||||
{
|
||||
}
|
||||
f(new stdClass);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught TypeError: Argument 1 passed to f() must be an instance of UndefClass, instance of stdClass given, called in %s on line %d and defined in %s:%d
|
||||
|
|
|
@ -2,15 +2,14 @@
|
|||
Ensure implements does trigger autoload.
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name)
|
||||
{
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
}
|
||||
|
||||
class C implements UndefI
|
||||
{
|
||||
}
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
});
|
||||
|
||||
class C implements UndefI
|
||||
{
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
In autoload: string(6) "UndefI"
|
||||
|
|
|
@ -2,15 +2,14 @@
|
|||
Ensure extends does trigger autoload.
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name)
|
||||
{
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
}
|
||||
|
||||
class C extends UndefBase
|
||||
{
|
||||
}
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
});
|
||||
|
||||
class C extends UndefBase
|
||||
{
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
In autoload: string(9) "UndefBase"
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
Ensure callback methods in unknown classes trigger autoload.
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name)
|
||||
{
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
}
|
||||
call_user_func("UndefC::test");
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
});
|
||||
call_user_func("UndefC::test");
|
||||
?>
|
||||
--EXPECTF--
|
||||
In autoload: string(6) "UndefC"
|
||||
|
|
|
@ -4,18 +4,17 @@ Ensure the ReflectionClass constructor triggers autoload.
|
|||
<?php extension_loaded('reflection') or die('skip'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name)
|
||||
{
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
}
|
||||
|
||||
try {
|
||||
new ReflectionClass("UndefC");
|
||||
}
|
||||
catch (ReflectionException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
});
|
||||
|
||||
try {
|
||||
new ReflectionClass("UndefC");
|
||||
}
|
||||
catch (ReflectionException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
In autoload: string(6) "UndefC"
|
||||
|
|
|
@ -4,18 +4,17 @@ Ensure the ReflectionMethod constructor triggers autoload.
|
|||
<?php extension_loaded('reflection') or die('skip'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name)
|
||||
{
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
}
|
||||
|
||||
try {
|
||||
new ReflectionMethod("UndefC::test");
|
||||
}
|
||||
catch (ReflectionException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
});
|
||||
|
||||
try {
|
||||
new ReflectionMethod("UndefC::test");
|
||||
}
|
||||
catch (ReflectionException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
In autoload: string(6) "UndefC"
|
||||
|
|
|
@ -4,18 +4,17 @@ Ensure the ReflectionProperty constructor triggers autoload.
|
|||
<?php extension_loaded('reflection') or die('skip'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name)
|
||||
{
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
}
|
||||
|
||||
try {
|
||||
new ReflectionProperty('UndefC', 'p');
|
||||
}
|
||||
catch (ReflectionException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
});
|
||||
|
||||
try {
|
||||
new ReflectionProperty('UndefC', 'p');
|
||||
}
|
||||
catch (ReflectionException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
In autoload: string(6) "UndefC"
|
||||
|
|
|
@ -4,19 +4,18 @@ Ensure ReflectionClass::getProperty() triggers autoload
|
|||
<?php extension_loaded('reflection') or die('skip'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name)
|
||||
{
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
}
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
});
|
||||
|
||||
$rc = new ReflectionClass("stdClass");
|
||||
|
||||
try {
|
||||
$rc->getProperty("UndefC::p");
|
||||
} catch (ReflectionException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
$rc = new ReflectionClass("stdClass");
|
||||
|
||||
try {
|
||||
$rc->getProperty("UndefC::p");
|
||||
} catch (ReflectionException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
In autoload: string(6) "undefc"
|
||||
|
|
|
@ -4,19 +4,18 @@ Ensure ReflectionClass::implementsInterface triggers autoload.
|
|||
<?php extension_loaded('reflection') or die('skip'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name)
|
||||
{
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
}
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "In autoload: ";
|
||||
var_dump($name);
|
||||
});
|
||||
|
||||
$rc = new ReflectionClass("stdClass");
|
||||
|
||||
try {
|
||||
$rc->implementsInterface("UndefI");
|
||||
} catch (ReflectionException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
$rc = new ReflectionClass("stdClass");
|
||||
|
||||
try {
|
||||
$rc->implementsInterface("UndefI");
|
||||
} catch (ReflectionException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
In autoload: string(6) "UndefI"
|
||||
|
|
|
@ -2,47 +2,46 @@
|
|||
Ensure __autoload() allows for recursive calls if the class name differs.
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name)
|
||||
{
|
||||
echo "IN: " . __METHOD__ . "($name)\n";
|
||||
|
||||
static $i = 0;
|
||||
if ($i++ > 10) {
|
||||
echo "-> Recursion detected - as expected.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
class_exists('UndefinedClass' . $i);
|
||||
|
||||
echo "OUT: " . __METHOD__ . "($name)\n";
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "IN: autoload($name)\n";
|
||||
|
||||
static $i = 0;
|
||||
if ($i++ > 10) {
|
||||
echo "-> Recursion detected - as expected.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
var_dump(class_exists('UndefinedClass0'));
|
||||
class_exists('UndefinedClass' . $i);
|
||||
|
||||
echo "OUT: autoload($name)\n";
|
||||
});
|
||||
|
||||
var_dump(class_exists('UndefinedClass0'));
|
||||
?>
|
||||
--EXPECTF--
|
||||
IN: __autoload(UndefinedClass0)
|
||||
IN: __autoload(UndefinedClass1)
|
||||
IN: __autoload(UndefinedClass2)
|
||||
IN: __autoload(UndefinedClass3)
|
||||
IN: __autoload(UndefinedClass4)
|
||||
IN: __autoload(UndefinedClass5)
|
||||
IN: __autoload(UndefinedClass6)
|
||||
IN: __autoload(UndefinedClass7)
|
||||
IN: __autoload(UndefinedClass8)
|
||||
IN: __autoload(UndefinedClass9)
|
||||
IN: __autoload(UndefinedClass10)
|
||||
IN: __autoload(UndefinedClass11)
|
||||
IN: autoload(UndefinedClass0)
|
||||
IN: autoload(UndefinedClass1)
|
||||
IN: autoload(UndefinedClass2)
|
||||
IN: autoload(UndefinedClass3)
|
||||
IN: autoload(UndefinedClass4)
|
||||
IN: autoload(UndefinedClass5)
|
||||
IN: autoload(UndefinedClass6)
|
||||
IN: autoload(UndefinedClass7)
|
||||
IN: autoload(UndefinedClass8)
|
||||
IN: autoload(UndefinedClass9)
|
||||
IN: autoload(UndefinedClass10)
|
||||
IN: autoload(UndefinedClass11)
|
||||
-> Recursion detected - as expected.
|
||||
OUT: __autoload(UndefinedClass10)
|
||||
OUT: __autoload(UndefinedClass9)
|
||||
OUT: __autoload(UndefinedClass8)
|
||||
OUT: __autoload(UndefinedClass7)
|
||||
OUT: __autoload(UndefinedClass6)
|
||||
OUT: __autoload(UndefinedClass5)
|
||||
OUT: __autoload(UndefinedClass4)
|
||||
OUT: __autoload(UndefinedClass3)
|
||||
OUT: __autoload(UndefinedClass2)
|
||||
OUT: __autoload(UndefinedClass1)
|
||||
OUT: __autoload(UndefinedClass0)
|
||||
OUT: autoload(UndefinedClass10)
|
||||
OUT: autoload(UndefinedClass9)
|
||||
OUT: autoload(UndefinedClass8)
|
||||
OUT: autoload(UndefinedClass7)
|
||||
OUT: autoload(UndefinedClass6)
|
||||
OUT: autoload(UndefinedClass5)
|
||||
OUT: autoload(UndefinedClass4)
|
||||
OUT: autoload(UndefinedClass3)
|
||||
OUT: autoload(UndefinedClass2)
|
||||
OUT: autoload(UndefinedClass1)
|
||||
OUT: autoload(UndefinedClass0)
|
||||
bool(false)
|
||||
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
Ensure __autoload() recursion is guarded for multiple lookups of same class using difference case.
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name)
|
||||
{
|
||||
echo __FUNCTION__ . " $name\n";
|
||||
class_exists("undefinedCLASS");
|
||||
}
|
||||
|
||||
class_exists("unDefinedClass");
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "autoload $name\n";
|
||||
class_exists("undefinedCLASS");
|
||||
});
|
||||
|
||||
class_exists("unDefinedClass");
|
||||
?>
|
||||
--EXPECTF--
|
||||
__autoload unDefinedClass
|
||||
autoload unDefinedClass
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
Ensure __autoload() is triggered during unserialization.
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name)
|
||||
{
|
||||
echo "in autoload: $name\n";
|
||||
}
|
||||
|
||||
var_dump(unserialize('O:1:"C":0:{}'));
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "in autoload: $name\n";
|
||||
});
|
||||
|
||||
var_dump(unserialize('O:1:"C":0:{}'));
|
||||
?>
|
||||
--EXPECTF--
|
||||
in autoload: C
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
Validation of class names in the autoload process
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name) {
|
||||
spl_autoload_register(function ($name) {
|
||||
echo "$name\n";
|
||||
}
|
||||
});
|
||||
$a = "../BUG";
|
||||
$x = new $a;
|
||||
echo "BUG\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue