summaryrefslogtreecommitdiff
path: root/ext/spl/tests
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-01-09 15:11:33 +0300
committerDmitry Stogov <dmitry@zend.com>2017-01-09 15:11:33 +0300
commit4f1b24d97447434973a06bdc70fc1670de17bd80 (patch)
tree6570522246baddfa9dab10feb4fea219a42aee8e /ext/spl/tests
parent63e08cbef73120ae2b1cbe0a4fc89bc9d7ef0187 (diff)
downloadphp-git-4f1b24d97447434973a06bdc70fc1670de17bd80.tar.gz
Fixed bug #73896 (spl_autoload() crashes when calls magic _call())
Diffstat (limited to 'ext/spl/tests')
-rw-r--r--ext/spl/tests/bug73896.phpt38
1 files changed, 38 insertions, 0 deletions
diff --git a/ext/spl/tests/bug73896.phpt b/ext/spl/tests/bug73896.phpt
new file mode 100644
index 0000000000..08d8f1e6c8
--- /dev/null
+++ b/ext/spl/tests/bug73896.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Bug #73896 (spl_autoload() crashes when calls magic _call())
+--FILE--
+<?php
+class Registrator {
+ public static function call($callable, array $args) {
+ return call_user_func_array($callable, [$args]);
+ }
+}
+
+class teLoader {
+ public function __construct() {
+ Registrator::call('spl_autoload_register', [$this, 'autoload']);
+ }
+
+ public function __call($method, $args) {
+ $this->doSomething();
+ }
+
+ protected function autoload($class) {
+ die("Protected autoload() called!\n");
+ }
+
+ public function doSomething() {
+ throw new teException();
+ }
+}
+
+$teLoader = new teLoader();
+
+try {
+ new teChild();
+} catch (Throwable $e) {
+ echo "Exception: ", $e->getMessage() , "\n";
+}
+?>
+--EXPECT--
+Exception: Class 'teException' not found