ID:               26866
 Updated by:       [EMAIL PROTECTED]
-Summary:          -> causes error message, while exception was raised in
                   __get
 Reported By:      davojan at mail dot ru
 Status:           Verified
 Bug Type:         Zend Engine 2 problem
 Operating System: *
-PHP Version:      5CVS-2004-01-13
+PHP Version:      5CVS-2004-02-09
 New Comment:

The example script causess a segfault now:

0x082c1cc9 in _zend_is_inconsistent (ht=0x1b, file=0x84030a0
"/usr/src/web/php/php5/Zend/zend_hash.c", line=841)
    at /usr/src/web/php/php5/Zend/zend_hash.c:53
53              if (ht->inconsistent==HT_OK) {
(gdb) bt
#0  0x082c1cc9 in _zend_is_inconsistent (ht=0x1b, file=0x84030a0
"/usr/src/web/php/php5/Zend/zend_hash.c", line=841)
    at /usr/src/web/php/php5/Zend/zend_hash.c:53
#1  0x082c3df8 in zend_hash_find (ht=0x1b, arKey=0x40e44a48 "__get",
nKeyLength=6, pData=0xbfffd478)
    at /usr/src/web/php/php5/Zend/zend_hash.c:841
#2  0x082b24b5 in zend_call_function (fci=0xbfffd520, fci_cache=0x0)
    at /usr/src/web/php/php5/Zend/zend_execute_API.c:619
#3  0x082b205f in call_user_function_ex (function_table=0x0,
object_pp=0xbfffd5c0, function_name=0xbfffd590, 
    retval_ptr_ptr=0xbfffd5a8, param_count=1, params=0xbfffd5ac,
no_separation=0, symbol_table=0x0)
    at /usr/src/web/php/php5/Zend/zend_execute_API.c:517
#4  0x082cbf70 in zend_std_call_getter (object=0x40e44910,
member=0x40e42c40)
    at /usr/src/web/php/php5/Zend/zend_object_handlers.c:78
#5  0x082cc31f in zend_std_read_property (object=0x40e44910,
member=0x40e42c40, silent=0 '\0')
    at /usr/src/web/php/php5/Zend/zend_object_handlers.c:291
#6  0x082d9cdf in zend_fetch_property_address_read (result=0x40e42c14,
op1=0x40e42c28, op2=0x40e42c3c, Ts=0xbfffd6a0, 
    type=0) at /usr/src/web/php/php5/Zend/zend_execute.c:1064
#7  0x082dbde5 in zend_fetch_obj_r_handler (execute_data=0xbfffd7c0,
opline=0x40e42c10, op_array=0x40e42674)
    at /usr/src/web/php/php5/Zend/zend_execute.c:1960
#8  0x082da498 in execute (op_array=0x40e42674) at
/usr/src/web/php/php5/Zend/zend_execute.c:1272
#9  0x082bcad3 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /usr/src/web/php/php5/Zend/zend.c:1051
#10 0x08285fd8 in php_execute_script (primary_file=0xbffffbc0) at
/usr/src/web/php/php5/main/main.c:1641
#11 0x080b776c in main (argc=2, argv=0xbffffc54) at
/usr/src/web/php/php5/sapi/cli/php_cli.c:941



Previous Comments:
------------------------------------------------------------------------

[2004-01-10 18:44:57] davojan at mail dot ru

Description:
------------
As I imagine, PHP must not check bar's type in $foo->bar->get_name()
call, if bar is a result of __get() function and an exception was
raised in it. However it does so.

The example below works fine, if we comment the "throw" line - the
result in browser is 'bar'.

Reproduce code:
---------------
<?
class bar {
        function get_name() {
                return 'bar';
        }
}
class foo {
        function __get($sName) {
                throw new Exception('Exception!');
                return new bar();
        }
}
$foo = new foo();
try {
        echo $foo->bar->get_name();
}
catch (Exception $E) {
        echo 'Exception raised!';
}
?>

Expected result:
----------------
Exception raised!

Actual result:
--------------
Fatal error: Call to a member function get_name() on a non-object in
/usr/local/www/data-dist/ils/admin/test/get_ex.php on line 15



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=26866&edit=1

Reply via email to