php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67333 Seg Fault in modify() to create DateTimeImmutable
Submitted: 2014-05-23 09:00 UTC Modified: 2014-05-23 09:53 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: dev dot php at ange7 dot com Assigned:
Status: Closed Package: date_time (PECL)
PHP Version: 5.4Git-2014-05-23 (snap) OS: Linux Debian Wheezy
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dev dot php at ange7 dot com
New email:
PHP Version: OS:

 

 [2014-05-23 09:00 UTC] dev dot php at ange7 dot com
Description:
------------
I have PHP 5.4.4-14+deb7u9 (cli) (built: Apr 18 2014 14:34:31) on my server and i want use DateTimeImmutable, so i created my «DateTimeImmutable» class which extend «DateTime». 

I overload all public methods to add «clone» on $this object. 

To be sure my class work properly i executed tests date_time_immutable.phpt (https://github.com/php/php-src/blob/94e15ff3877f842e5eb5c89e3aeab214fb4a3a33/ext/date/tests/date_time_immutable.phpt) 


But when i run it i have «Seg fault error». 

Test script:
---------------
PHP Class : http://cloud.myange7.com/public.php?service=files&t=eb4322dbea9beb1f56df440b61d2b0af

PHP Tests : http://cloud.myange7.com/public.php?service=files&t=eca7a5d5d8ed0d131ba5174e1c975fde

Expected result:
----------------
--TEST--
Tests for DateTimeImmutable.
--INI--
date.timezone=Europe/London
--FILE--
modify():
orig: 2012-12-27 16:24:08 Europe/Berlin
copy: 2012-12-27 16:24:08 Europe/Berlin
changed: 2012-12-29 16:24:08 Europe/Berlin
orig: 2012-12-29 16:24:08 Europe/Berlin
copy: 2012-12-29 16:24:08 Europe/Berlin
changed: 2012-12-29 16:24:08 Europe/Berlin

add():
orig: 2012-12-27 16:24:08 Europe/Berlin
copy: 2012-12-27 16:24:08 Europe/Berlin
changed: 2012-12-29 16:24:10 Europe/Berlin
orig: 2012-12-29 16:24:10 Europe/Berlin
copy: 2012-12-29 16:24:10 Europe/Berlin
changed: 2012-12-29 16:24:10 Europe/Berlin

sub():
orig: 2012-12-27 16:24:08 Europe/Berlin
copy: 2012-12-27 16:24:08 Europe/Berlin
changed: 2012-12-25 16:24:06 Europe/Berlin
orig: 2012-12-25 16:24:06 Europe/Berlin
copy: 2012-12-25 16:24:06 Europe/Berlin
changed: 2012-12-25 16:24:06 Europe/Berlin

setTimezone():
orig: 2012-12-27 16:24:08 Europe/Berlin
copy: 2012-12-27 16:24:08 Europe/Berlin
changed: 2012-12-28 00:24:08 Asia/Tokyo
orig: 2012-12-28 00:24:08 Asia/Tokyo
copy: 2012-12-28 00:24:08 Asia/Tokyo
changed: 2012-12-28 00:24:08 Asia/Tokyo
orig: 2012-12-27 16:24:08 Europe/Berlin
copy: 2012-12-27 16:24:08 Europe/Berlin
changed: 2012-12-28 00:24:08 Asia/Tokyo

setTime():
orig: 2012-12-27 16:24:08 Europe/Berlin
copy: 2012-12-27 16:24:08 Europe/Berlin
changed: 2012-12-27 05:07:19 Europe/Berlin
orig: 2012-12-27 05:07:19 Europe/Berlin
copy: 2012-12-27 05:07:19 Europe/Berlin
changed: 2012-12-27 05:07:19 Europe/Berlin

setDate():
orig: 2012-12-27 16:24:08 Europe/Berlin
copy: 2012-12-27 16:24:08 Europe/Berlin
changed: 0005-07-19 16:24:08 Europe/Berlin
orig: 0005-07-19 16:24:08 Europe/Berlin
copy: 0005-07-19 16:24:08 Europe/Berlin
changed: 0005-07-19 16:24:08 Europe/Berlin

setIsoDate():
orig: 2012-12-27 16:24:08 Europe/Berlin
copy: 2012-12-27 16:24:08 Europe/Berlin
changed: 2012-01-14 16:24:08 Europe/Berlin
orig: 2012-01-14 16:24:08 Europe/Berlin
copy: 2012-01-14 16:24:08 Europe/Berlin
changed: 2012-01-14 16:24:08 Europe/Berlin

setTimestamp():
orig: 2012-12-27 16:24:08 Europe/Berlin
copy: 2012-12-27 16:24:08 Europe/Berlin
changed: 2033-10-06 19:57:02 Europe/Berlin
orig: 2033-10-06 19:57:02 Europe/Berlin
copy: 2033-10-06 19:57:02 Europe/Berlin
changed: 2033-10-06 19:57:02 Europe/Berlin
--EXPECT--
modify():
orig: 2012-12-27 16:24:08 Europe/London
copy: 2012-12-27 16:24:08 Europe/London
changed: 2012-12-29 16:24:08 Europe/London
orig: 2012-12-29 16:24:08 Europe/London
copy: 2012-12-29 16:24:08 Europe/London
changed: 2012-12-29 16:24:08 Europe/London

add():
orig: 2012-12-27 16:24:08 Europe/London
copy: 2012-12-27 16:24:08 Europe/London
changed: 2012-12-29 16:24:10 Europe/London
orig: 2012-12-29 16:24:10 Europe/London
copy: 2012-12-29 16:24:10 Europe/London
changed: 2012-12-29 16:24:10 Europe/London

sub():
orig: 2012-12-27 16:24:08 Europe/London
copy: 2012-12-27 16:24:08 Europe/London
changed: 2012-12-25 16:24:06 Europe/London
orig: 2012-12-25 16:24:06 Europe/London
copy: 2012-12-25 16:24:06 Europe/London
changed: 2012-12-25 16:24:06 Europe/London

setTimezone():
orig: 2012-12-27 16:24:08 Europe/London
copy: 2012-12-27 16:24:08 Europe/London
changed: 2012-12-28 01:24:08 Asia/Tokyo
orig: 2012-12-28 01:24:08 Asia/Tokyo
copy: 2012-12-28 01:24:08 Asia/Tokyo
changed: 2012-12-28 01:24:08 Asia/Tokyo
orig: 2012-12-27 16:24:08 Europe/London
copy: 2012-12-27 16:24:08 Europe/London
changed: 2012-12-28 01:24:08 Asia/Tokyo

setTime():
orig: 2012-12-27 16:24:08 Europe/London
copy: 2012-12-27 16:24:08 Europe/London
changed: 2012-12-27 05:07:19 Europe/London
orig: 2012-12-27 05:07:19 Europe/London
copy: 2012-12-27 05:07:19 Europe/London
changed: 2012-12-27 05:07:19 Europe/London

setDate():
orig: 2012-12-27 16:24:08 Europe/London
copy: 2012-12-27 16:24:08 Europe/London
changed: 0005-07-19 16:24:08 Europe/London
orig: 0005-07-19 16:24:08 Europe/London
copy: 0005-07-19 16:24:08 Europe/London
changed: 0005-07-19 16:24:08 Europe/London

setIsoDate():
orig: 2012-12-27 16:24:08 Europe/London
copy: 2012-12-27 16:24:08 Europe/London
changed: 2012-01-14 16:24:08 Europe/London
orig: 2012-01-14 16:24:08 Europe/London
copy: 2012-01-14 16:24:08 Europe/London
changed: 2012-01-14 16:24:08 Europe/London

setTimestamp():
orig: 2012-12-27 16:24:08 Europe/London
copy: 2012-12-27 16:24:08 Europe/London
changed: 2033-10-06 18:57:02 Europe/London
orig: 2033-10-06 18:57:02 Europe/London
copy: 2033-10-06 18:57:02 Europe/London
changed: 2033-10-06 18:57:02 Europe/London


Actual result:
--------------
--TEST--
Tests for DateTimeImmutable.
--INI--
date.timezone=Europe/London
--FILE--
modify():
segmentation fault  


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-23 09:06 UTC] dev dot php at ange7 dot com
In my /etc/php5/conf.d/20-xdebug.ini file i seted :

xdebug.max_nesting_level=100000

If i restore default value or less value (1000, for example) i have this error :

Fatal error: Maximum function nesting level of '1000' reached, aborting! in DateTimeImmutable.php on line 17
 [2014-05-23 09:53 UTC] dev dot php at ange7 dot com
-Status: Open +Status: Closed
 [2014-05-23 09:53 UTC] dev dot php at ange7 dot com
Fixed, it's not a bug from PHP, but of my code.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Sep 22 10:01:26 2019 UTC