php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60247 Segfault when calling class constructor
Submitted: 2011-11-08 20:22 UTC Modified: 2011-12-05 10:03 UTC
From: simon at simon dot geek dot nz Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 5.4SVN-2011-11-08 (SVN) OS: Mac OS 10.7.2 Server
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
14 + 11 = ?
Subscribe to this entry?

 
 [2011-11-08 20:22 UTC] 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
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-08 23:20 UTC] felipe@php.net
-Status: Open +Status: Feedback
 [2011-11-08 23:20 UTC] felipe@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.4-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2011-11-09 07:50 UTC] 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-18 21:11 UTC] simon at simon dot geek dot nz
-Status: Feedback +Status: Open
 [2011-11-18 21:11 UTC] simon at simon dot geek dot nz
I just updated to SVN revision 319452 (2011-11-18 21:50:29 +1300) and am still 
getting a seg fault.
 [2011-12-05 10:03 UTC] simon at simon dot geek dot nz
This appears to have been fixed by r320403.
 [2011-12-05 10:03 UTC] simon at simon dot geek dot nz
-Status: Open +Status: Closed
 [2022-09-29 16:51 UTC] jimynail466 at gmail dot com
This post is a complete and comprehensive effort. This post is showing you knowledge level and your depth of research. I want you to keep making this type of post more. So, I can increase my knowledge. A lot of prayers thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 14:01:29 2024 UTC