(Pierre)
- Fixed bug #50023 (pdo_mysql doesn't use PHP_MYSQL_UNIX_SOCK_ADDR). (Ilia)
+- Fixed bug #49908 (throwing exception in __autoload crashes when interface
+ is not defined). (Felipe)
- Fixed bug #49719 (ReflectionClass::hasProperty returns true for a private
property in base class). (Felipe)
- Fixed bug #49142 (crash when exception thrown from __tostring()).
--- /dev/null
+--TEST--
+Bug #49908 (throwing exception in __autoload crashes when interface is not defined)
+--FILE--
+<?php
+
+function __autoload($className) {
+ var_dump($className);
+
+ if ($className == 'Foo') {
+ class Foo implements Bar {};
+ } else {
+ throw new Exception($className);
+ }
+}
+
+new Foo;
+
+?>
+--EXPECTF--
+%unicode|string%(3) "Foo"
+%unicode|string%(3) "Bar"
+
+Fatal error: Uncaught exception 'Exception' with message 'Bar' in %s:%d
+Stack trace:
+#0 %s(7): __autoload('Bar')
+#1 %s(13): __autoload('Foo')
+#2 {main}
+ thrown in %s on line %d
zend_class_entry *ce = EX_T(opline->op1.u.var).class_entry;
zend_class_entry *iface = zend_fetch_class(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), opline->extended_value TSRMLS_CC);
- if (!(iface->ce_flags & ZEND_ACC_INTERFACE)) {
- zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name, iface->name);
+ if (iface) {
+ if (!(iface->ce_flags & ZEND_ACC_INTERFACE)) {
+ zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name, iface->name);
+ }
+ zend_do_implement_interface(ce, iface TSRMLS_CC);
}
- zend_do_implement_interface(ce, iface TSRMLS_CC);
-
ZEND_VM_NEXT_OPCODE();
}
zend_class_entry *ce = EX_T(opline->op1.u.var).class_entry;
zend_class_entry *iface = zend_fetch_class(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), opline->extended_value TSRMLS_CC);
- if (!(iface->ce_flags & ZEND_ACC_INTERFACE)) {
- zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name, iface->name);
+ if (iface) {
+ if (!(iface->ce_flags & ZEND_ACC_INTERFACE)) {
+ zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name, iface->name);
+ }
+ zend_do_implement_interface(ce, iface TSRMLS_CC);
}
- zend_do_implement_interface(ce, iface TSRMLS_CC);
-
ZEND_VM_NEXT_OPCODE();
}