diff options
Diffstat (limited to 'ext/spl/tests/spl_autoload_005.phpt')
-rw-r--r-- | ext/spl/tests/spl_autoload_005.phpt | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/ext/spl/tests/spl_autoload_005.phpt b/ext/spl/tests/spl_autoload_005.phpt index ccebf91f04..6fe71434f8 100644 --- a/ext/spl/tests/spl_autoload_005.phpt +++ b/ext/spl/tests/spl_autoload_005.phpt @@ -9,23 +9,20 @@ class MyAutoLoader { function autoLoad($className) { - echo __METHOD__ . "($className)\n"; + echo __METHOD__ . "($className)\n"; } function autoThrow($className) { - echo __METHOD__ . "($className)\n"; - throw new Exception("Unavailable"); + echo __METHOD__ . "($className)\n"; + throw new Exception("Unavailable"); } } -try -{ - spl_autoload_register(array('MyAutoLoader', 'autoLoad'), true); -} -catch(Exception $e) -{ - echo 'Exception: ' . $e->getMessage() . "\n"; +try { + spl_autoload_register(array('MyAutoLoader', 'autoLoad'), true); +} catch(\TypeError $e) { + echo $e->getMessage() . \PHP_EOL; } // and @@ -37,19 +34,16 @@ spl_autoload_register(array($myAutoLoader, 'autoThrow')); try { - var_dump(class_exists("TestClass", true)); + var_dump(class_exists("TestClass", true)); } catch(Exception $e) { - echo 'Exception: ' . $e->getMessage() . "\n"; + echo 'Exception: ' . $e->getMessage() . "\n"; } ?> -===DONE=== -<?php exit(0); ?> --EXPECT-- -Exception: Passed array specifies a non static method but no object (non-static method MyAutoLoader::autoLoad() should not be called statically) +spl_autoload_register(): Argument #1 ($autoload_function) must be a valid callback, non-static method MyAutoLoader::autoLoad() cannot be called statically MyAutoLoader::autoLoad(TestClass) MyAutoLoader::autoThrow(TestClass) Exception: Unavailable -===DONE=== |