Bug #70864 [NEW]: new DateTime in __construct() crashes
From: eric at ericstern dot com
Operating system: Centos 7
PHP version: 7.0.0RC6
Package: Reproducible crash
Bug Type: Bug
Bug description:new DateTime in __construct() crashes
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)
--
Edit bug report at https://bugs.php.net/bug.php?id=70864&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70864&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70864&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70864&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70864&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70864&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70864&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70864&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70864&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70864&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70864&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70864&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70864&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70864&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70864&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70864&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70864&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70864&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70864&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70864&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70864&r=mysqlcfg
Thread (9 messages)
- eric at ericstern dot com