- Fixed bug #39504 (xmlwriter_write_dtd_entity() creates Attlist tag,
not entity). (Hannes)
- Fixed bug #39394 (Missing check for older variants of openssl). (Ilia)
+- Fixed bug #38325 (spl_autoload_register() gaves wrong line for "class
+ not found"). (Ilia)
04 Jan 2007, PHP 5.2.1RC2
- Small optimization of the date() function (Matt,Ilia)
EG(function_state_ptr) = original_function_state_ptr;
if (!found && !SPL_G(autoload_running)) {
- zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Class %s could not be loaded", class_name);
+ /* For internal errors, we generate E_ERROR, for direct calls an exception is thrown.
+ * The "scope" is determined by an opcode, if it is ZEND_FETCH_CLASS we know function was called indirectly by
+ * the Zend engine.
+ */
+ if (active_opline->opcode != ZEND_FETCH_CLASS) {
+ zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Class %s could not be loaded", class_name);
+ } else {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s could not be loaded", class_name);
+ }
}
} /* }}} */
--- /dev/null
+--TEST--
+Bug #38325 (spl_autoload_register() gaves wrong line for "class not found")
+--SKIPIF--
+<?php if (!extension_loaded("spl")) print "skip"; ?>
+--FILE--
+<?php
+spl_autoload_register();
+new Foo();
+?>
+--EXPECTF--
+Fatal error: spl_autoload(): Class Foo could not be loaded in %s on line 3