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

  ID: 70864
  Updated by: rasmus@php.net
  Reported by: eric@ericstern.com
  Summary: new DateTime in __construct() crashes
  Status: Feedback
  Type: Bug
  Package: Reproducible crash
  Operating System: Centos 7
  PHP Version: 7.0.0RC6
  Block user comment: N
  Private report: N

  New Comment:

Unable to reproduce on Debian plus it is valgrind-clean. It sounds like it is related to the distro-specific patches that I know RedHat/Centos do to support the system tz lib. You could help us verify that by building from our source on that box and testing a non-modified build.


Previous Comments:
------------------------------------------------------------------------
[2015-11-06 08:40:17] laruence@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.



------------------------------------------------------------------------
[2015-11-05 21:56:59] fabian@tag1consulting.com

Note: I tested it on Ubuntu. I did miss that its only crashing on Centos 7.

------------------------------------------------------------------------
[2015-11-05 21:54:44] fabian@tag1consulting.com

FWIW: The test script works for me on latest PHP-7.0 git checkout.

------------------------------------------------------------------------
[2015-11-05 20:39:40] eric@ericstern.com

Update - this doesn't even need to be in an object's constructor, as I initially discovered it. Simply `<?php new DateTime();` will reproduce the issue!

------------------------------------------------------------------------
[2015-11-05 20:34:24] eric@ericstern.com

Description:
------------
Instantiating a DateTime object in a constructor causes an engine crash, printing either "Segmentation Fault" or "zend_mm_heap corrupted".

This only seems to happen in Centos7 with PHP7RC6 installed from the Webtatic-Testing repo; I can NOT reproduce it on OS X using the same version installed via homebrew. In that environment, I have disabled all extensions by renaming /etc/php.d to /etc/php.d.disabled and the crash still occurs.

Originally found under nginx/php-fpm, but happens under cli as well.

I can privately provide access to the server which reproduces this if helpful.

Test script:
---------------
<?php
class X {
   private $date;
   public function __construct() {
     $this->date = new DateTime();
   }
}
$x = new X();
var_dump($x);

Expected result:
----------------
object(X)#1 (1) {
   ["date":"X":private]=>
   object(DateTime)#2 (3) {
     ["date"]=>
     string(26) "2015-11-05 20:24:38.000000"
     ["timezone_type"]=>
     int(3)
     ["timezone"]=>
     string(3) "UTC"
   }
}

(exit 0)

Actual result:
--------------
object(X)#1 (1) {
   ["date":"X":private]=>
   object(DateTime)#2 (3) {
     ["date"]=>
     string(26) "2015-11-05 20:31:09.000000"
     ["timezone_type"]=>
     int(3)
     ["timezone"]=>
     string(3) "UTC"
   }
}
Segmentation fault

(exit 139)


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

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 6 of 9 | next ›
Discussion Overview
groupphp-bugs @
categoriesphp
postedNov 5, '15 at 8:34p
activeNov 6, '15 at 8:51p
posts9
users4
websitephp.net

People

Translate

site design / logo © 2017 Grokbase