Edit report at https://bugs.php.net/bug.php?id=63066&edit=1

 ID:                 63066
 User updated by:    Jared dot Williams1 at ntlworld dot com
 Reported by:        Jared dot Williams1 at ntlworld dot com
 Summary:            Calling an undefined method in a generator results
                     in a seg fault
 Status:             Open
 Type:               Bug
 Package:            Class/Object related
 Operating System:   Linux ubuntu 3.5.0-14-generic #1
 PHP Version:        master-Git-2012-09-11 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

Backtrace of the NON debug seg fault...

jared@ubuntu:~$ gdb ./Development/php-src/sapi/cli/php 
GNU gdb (GDB) 7.5-ubuntu
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/jared/Development/php-src/sapi/cli/php...done.
(gdb) run fatalSegFault.php 
Starting program: /home/jared/Development/php-src/sapi/cli/php fatalSegFault.php
foo
PHP Fatal error:  Call to undefined method stdClass::fatalError() in 
/home/jared/fatalSegFault.php on line 6

Fatal error: Call to undefined method stdClass::fatalError() in 
/home/jared/fatalSegFault.php on line 6

Program received signal SIGSEGV, Segmentation fault.
0x00000000006f36b2 in gc_zval_possible_root (zv=0x7ffff7fcafd8)
    at /home/jared/Development/php-src/Zend/zend_gc.c:143
143                     GC_ZOBJ_CHECK_POSSIBLE_ROOT(zv);
(gdb) bt
#0  0x00000000006f36b2 in gc_zval_possible_root (zv=0x7ffff7fcafd8)
    at /home/jared/Development/php-src/Zend/zend_gc.c:143
#1  0x00000000006f6246 in zend_generator_close 
(generator=generator@entry=0x7ffff7fce180, 
    finished_execution=finished_execution@entry=0 '\000')
    at /home/jared/Development/php-src/Zend/zend_generators.c:148
#2  0x00000000006f63cb in zend_generator_free_storage (generator=0x7ffff7fce180)
    at /home/jared/Development/php-src/Zend/zend_generators.c:181
#3  0x00000000006fc0a8 in zend_objects_store_free_object_storage (
    objects=0xdbae60 <executor_globals+960>)
    at /home/jared/Development/php-src/Zend/zend_objects_API.c:92
#4  0x00000000006c7153 in shutdown_executor ()
    at /home/jared/Development/php-src/Zend/zend_execute_API.c:298
#5  0x00000000006d5646 in zend_deactivate () at 
/home/jared/Development/php-src/Zend/zend.c:938
#6  0x000000000067641d in php_request_shutdown (dummy=dummy@entry=0x0)
    at /home/jared/Development/php-src/main/main.c:1780
#7  0x0000000000781fe0 in do_cli (argc=2, argv=0x7fffffffe118)
    at /home/jared/Development/php-src/sapi/cli/php_cli.c:1171
#8  0x000000000042d56b in main (argc=2, argv=0x7fffffffe118)
    at /home/jared/Development/php-src/sapi/cli/php_cli.c:1364


Previous Comments:
------------------------------------------------------------------------
[2012-09-11 13:46:20] Jared dot Williams1 at ntlworld dot com

It appears that the seg fault doesn't appear in debug builds. 

Recompiled without debug again, and the seg fault is still present


jared@ubuntu:~$ php -v
PHP 5.5.0-dev (cli) (built: Sep 11 2012 14:25:38) (DEBUG)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.5.0-dev, Copyright (c) 1998-2012 Zend Technologies
jared@ubuntu:~$ php fatalSegFault.php 
foo
PHP Fatal error:  Call to undefined method stdClass::fatalError() in 
/home/jared/fatalSegFault.php on line 6

Fatal error: Call to undefined method stdClass::fatalError() in 
/home/jared/fatalSegFault.php on line 6

----

jared@ubuntu:~$ ./Development/php-src/sapi/cli/php -v
PHP 5.5.0-dev (cli) (built: Sep 11 2012 14:41:40) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.5.0-dev, Copyright (c) 1998-2012 Zend Technologies
jared@ubuntu:~$ ./Development/php-src/sapi/cli/php fatalSegFault.php 
foo
PHP Fatal error:  Call to undefined method stdClass::fatalError() in 
/home/jared/fatalSegFault.php on line 6

Fatal error: Call to undefined method stdClass::fatalError() in 
/home/jared/fatalSegFault.php on line 6
Segmentation fault

------------------------------------------------------------------------
[2012-09-11 13:17:14] jared dot williams1 at ntlworld dot com

No APC or XDebug. 

Will recompile with debug and get a bt.

------------------------------------------------------------------------
[2012-09-11 13:13:41] reeze dot xia at gmail dot com

Can't reproduce in Ubuntu too.

parallels@ubuntu:~/php-src$ uname -a
Linux ubuntu 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 
x86_64 
x86_64 x86_64 GNU/Linux


if your are testing the lastest version, Could please provide backtrace?
https://bugs.php.net/bugs-generating-backtrace.php

------------------------------------------------------------------------
[2012-09-11 12:59:13] reeze dot xia at gmail dot com

I could not reproduce it in Mac OS X

do you use any extension like apc, xdebug?

------------------------------------------------------------------------
[2012-09-11 12:49:54] Jared dot Williams1 at ntlworld dot com

Description:
------------
Calling an undefined method in a generator results in an expected fatal error, 
but then a segmentation fault occurs afterwards.

Test script:
---------------
function gen($o)
{
        yield 'foo';
        $o->fatalError();
}

foreach(gen(new stdClass()) as $value)
        echo $value, "\n";

Expected result:
----------------
foo
PHP Fatal error:  Call to undefined method stdClass::fatalError() in 
/home/jared/fatalSegFault.php on line 6

Fatal error: Call to undefined method stdClass::fatalError() in 
/home/jared/fatalSegFault.php on line 6

Actual result:
--------------
foo
PHP Fatal error:  Call to undefined method stdClass::fatalError() in 
/home/jared/fatalSegFault.php on line 6

Fatal error: Call to undefined method stdClass::fatalError() in 
/home/jared/fatalSegFault.php on line 6
Segmentation fault



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



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

Reply via email to