catch operator shouldn't call __autoload () too

This commit is contained in:
Dmitry Stogov 2005-09-08 10:32:28 +00:00
parent 90b45fcbbd
commit a082983adb
3 changed files with 32 additions and 2 deletions

4
NEWS
View File

@ -2,8 +2,8 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 6.0
- Unicode support. (Andrei, Dmitriy, et al)
- Changed "instanceof" operator, is_a() and is_subclass_of() functions to not
call __autoload(). (Dmitry)
- Changed "instanceof" and "catch" operators, is_a() and is_subclass_of()
functions to not call __autoload(). (Dmitry)
- Added optional parameter to http_build_query() to allow specification of
string separator.
- cURL improvements: (Ilia)

23
Zend/tests/catch.phpt Executable file
View File

@ -0,0 +1,23 @@
--TEST--
catch shouldn't call __autoload
--FILE--
<?php
function __autoload($name) {
echo("AUTOLOAD '$name'\n");
eval("class $name {}");
}
try {
} catch (A $e) {
}
try {
throw new Exception();
} catch (B $e) {
} catch (Exception $e) {
echo "ok\n";
}
?>
--EXPECT--
ok

View File

@ -1791,6 +1791,13 @@ void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var,
long catch_op_number = get_next_op_number(CG(active_op_array));
zend_op *opline;
if (catch_op_number > 0) {
opline = &CG(active_op_array)->opcodes[catch_op_number-1];
if (opline->opcode == ZEND_FETCH_CLASS) {
opline->extended_value |= ZEND_FETCH_CLASS_NO_AUTOLOAD;
}
}
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->opcode = ZEND_CATCH;
opline->op1 = *catch_class;