Edit report at https://bugs.php.net/bug.php?id=60247&edit=1
ID: 60247
User updated by: simon at simon dot geek dot nz
Reported by: simon at simon dot geek dot nz
Summary: Segfault when calling class constructor
-Status: Feedback
+Status: Open
Type: Bug
Package: Reproducible crash
Operating System: Mac OS 10.7.2 Server
PHP Version: 5.4SVN-2011-11-08 (SVN)
Block user comment: N
Private report: N
New Comment:
I just updated to SVN revision 319452 (2011-11-18 21:50:29 +1300) and am still
getting a seg fault.
Previous Comments:
------------------------------------------------------------------------
[2011-11-09 07:50:14] simon at simon dot geek dot nz
A segfault is still produced:
(gdb) run sapphire/cli-script.php Signup
Starting program: /Users/simon/Downloads/php5.4-201111090730/sapi/cli/php
sapphire/cli-script.php Signup
Reading symbols for shared libraries
++++++++++++++++++++++...........................................................
............................................................... done
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x0000000100883cd8 in ZEND_FETCH_CLASS_SPEC_CONST_HANDLER
(execute_data=0x101504220) at zend_vm_execute.h:1174
1174 CACHE_PTR(opline->op2.literal-
>cache_slot, EX_T(opline->result.var).class_entry);
(gdb) bt
#0 0x0000000100883cd8 in ZEND_FETCH_CLASS_SPEC_CONST_HANDLER
(execute_data=0x101504220) at zend_vm_execute.h:1174
#1 0x000000010087d782 in execute (op_array=0x102269e38) at
zend_vm_execute.h:410
#2 0x000000010082a1ab in zend_execute_scripts (type=8, retval=0x0,
file_count=3)
at zend.c:1272
#3 0x000000010076c8e3 in php_execute_script (primary_file=0x7fff5fbff7b0) at
main.c:2414
#4 0x00000001009ff473 in do_cli (argc=3, argv=0x7fff5fbffa60) at php_cli.c:983
#5 0x0000000100a011b5 in main (argc=3, argv=0x7fff5fbffa60) at php_cli.c:1356
(gdb) p *opline->op2.literal
$1 = {
constant = {
value = {
lval = 4317707856,
dval = 2.1332311204284639e-314,
str = {
val = 0x1015afe50 "Page",
len = 4
},
ht = 0x1015afe50,
obj = {
handle = 22740560,
handlers = 0x4
}
},
refcount__gc = 2,
type = 6 '\006',
is_ref__gc = 1 '\001'
},
hash_value = 0,
cache_slot = 0
}
------------------------------------------------------------------------
[2011-11-08 23:20:25] [email protected]
Please try using this snapshot:
http://snaps.php.net/php5.4-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2011-11-08 20:22:26] simon at simon dot geek dot nz
Description:
------------
This is constantly reproducible on PHP 5.4 (SVN r318919). It does not occur
with
PHP 5.3.
I am using the SilverStripe framework (http://silverstripe.org). The segfault
is
happening when trying to execute line 41 of
sapphire/core/control/ContentController.php
(http://svn.simon.geek.nz/silverstripe/sapphire/branches/2.4/core/control/Content
Controller.php,
$dataRecord = new Page();) when creating a new Signup controller by direct URL
access (http://localhost/silverstripe/Signup).
The segfault also occurs when simulating a request using the cli (php
sapphire/cli-script.php Signup). The backtrace provided is for this case.
Test script:
---------------
// Signup.php
<?php
class Signup extends LoginPage_Controller {}
// LoginPage.php
<?php
class LoginPage_Controller extends ContentController {
}
Expected result:
----------------
The page displays properly, as it does under PHP 5.3
Actual result:
--------------
Backtrace from gdb:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x0000000100882248 in ZEND_FETCH_CLASS_SPEC_CONST_HANDLER
(execute_data=0x1013a8220) at zend_vm_execute.h:1174
1174 CACHE_PTR(opline->op2.literal-
>cache_slot, EX_T(opline->result.var).class_entry);
(gdb) bt
#0 0x0000000100882248 in ZEND_FETCH_CLASS_SPEC_CONST_HANDLER
(execute_data=0x1013a8220) at zend_vm_execute.h:1174
#1 0x000000010087bcf2 in execute (op_array=0x102229e38) at
zend_vm_execute.h:410
#2 0x00000001008287fb in zend_execute_scripts (type=8, retval=0x0,
file_count=3)
at zend.c:1272
#3 0x000000010076b093 in php_execute_script (primary_file=0x7fff5fbff7f0) at
main.c:2414
#4 0x00000001009fd9e3 in do_cli (argc=3, argv=0x7fff5fbffaa8) at php_cli.c:983
#5 0x00000001009ff725 in main (argc=3, argv=0x7fff5fbffaa8) at php_cli.c:1356
(gdb) p *opline->op2.literal
$2 = {
constant = {
value = {
lval = 4317445712,
dval = 2.1331016040838005e-314,
str = {
val = 0x10156fe50 "Page",
len = 4
},
ht = 0x10156fe50,
obj = {
handle = 22478416,
handlers = 0x4
}
},
refcount__gc = 2,
type = 6 '\006',
is_ref__gc = 1 '\001'
},
hash_value = 0,
cache_slot = 0
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60247&edit=1