php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70893 Segfault on new DateTimeZone('leap-seconds.list')
Submitted: 2015-11-11 15:49 UTC Modified: 2016-10-06 12:08 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: royanee at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: Reproducible crash
PHP Version: 5.6.15 OS: Debian
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: royanee at gmail dot com
New email:
PHP Version: OS:

 

 [2015-11-11 15:49 UTC] royanee at gmail dot com
Description:
------------
I have a script that loops through all of the DateTimeZone identifiers and creates a DateTimeZone instance of each one for use later in the script. I noticed that it was triggering a segmentation fault while trying to get another application working.

Here's how I identified that the "leap-seconds.list" timezone was breaking it:

<?php
foreach (DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC) as $tz) {
    echo $tz . PHP_EOL;
    $dtz = new DateTimeZone($tz);
}
echo 'Success' . PHP_EOL;

Test script:
---------------
<?php
$tz = 'leap-seconds.list';
$dtz = new DateTimeZone($tz);
echo 'Success' . PHP_EOL;

Expected result:
----------------
Success

Actual result:
--------------
Segmentation fault

(gdb) bt
#0  __memcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:116
#1  0x000000000048ca86 in memcpy (__len=8148847036, __src=0x7ffff7ff002c, __dest=0x7ffe08580010) at /usr/include/x86_64-linux-gnu/bits/string3.h:51
#2  read_transistions (tz=0x11c4020, tzf=0x7fffffffa618) at /build/php5-z1CRVw/php5-5.6.14+dfsg/ext/date/lib/parse_tz.c:134
#3  timelib_parse_tzfile (timezone=timezone@entry=0x11c4000 "leap-seconds.list", tzdb=tzdb@entry=0x11bd530) at /build/php5-z1CRVw/php5-5.6.14+dfsg/ext/date/lib/parse_tz.c:881
#4  0x00000000004677ab in php_date_parse_tzfile (formal_tzname=0x11c4000 "leap-seconds.list", tzdb=0x11bd530) at /build/php5-z1CRVw/php5-5.6.14+dfsg/ext/date/php_date.c:926
#5  0x00000000004708ad in timelib_parse_zone (ptr=ptr@entry=0x7fffffffa728, dst=dst@entry=0x7fffffffa730, t=t@entry=0x7ffff7fc7858, tz_not_found=tz_not_found@entry=0x7fffffffa734, tzdb=<optimized out>, tz_wrapper=tz_wrapper@entry=0x467830 <php_date_parse_tzfile_wrapper>)
    at /build/php5-z1CRVw/php5-5.6.14+dfsg/ext/date/lib/parse_date.c:782
#6  0x000000000046727a in timezone_initialize (tzobj=0x7ffff7fc7638, tz=0x7ffff7ec5079 "", tz_len=17) at /build/php5-z1CRVw/php5-5.6.14+dfsg/ext/date/php_date.c:3713
#7  0x00000000004673aa in zim_DateTimeZone___construct (ht=1, return_value=<optimized out>, return_value_ptr=<optimized out>, this_ptr=0x7ffff7fc5900, return_value_used=<optimized out>) at /build/php5-z1CRVw/php5-5.6.14+dfsg/ext/date/php_date.c:3758
#8  0x00000000006dae1a in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=<optimized out>, return_value_used=<optimized out>) at /build/php5-z1CRVw/php5-5.6.14+dfsg/Zend/zend_dtrace.c:97
#9  0x000000000079a4f7 in zend_do_fcall_common_helper_SPEC (execute_data=<optimized out>) at /build/php5-z1CRVw/php5-5.6.14+dfsg/Zend/zend_vm_execute.h:560
#10 0x0000000000729520 in execute_ex (execute_data=execute_data@entry=0x7ffff7f92190) at /build/php5-z1CRVw/php5-5.6.14+dfsg/Zend/zend_vm_execute.h:363
#11 0x00000000006dacc1 in dtrace_execute_ex (execute_data=0x7ffff7f92190) at /build/php5-z1CRVw/php5-5.6.14+dfsg/Zend/zend_dtrace.c:73
#12 0x00000000006ed7d0 in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at /build/php5-z1CRVw/php5-5.6.14+dfsg/Zend/zend.c:1341
#13 0x0000000000688840 in php_execute_script (primary_file=primary_file@entry=0x7fffffffce40) at /build/php5-z1CRVw/php5-5.6.14+dfsg/main/main.c:2597
#14 0x000000000079c441 in do_cli (argc=2, argv=0xeb0e70) at /build/php5-z1CRVw/php5-5.6.14+dfsg/sapi/cli/php_cli.c:994
#15 0x000000000046237e in main (argc=2, argv=0xeb0e70) at /build/php5-z1CRVw/php5-5.6.14+dfsg/sapi/cli/php_cli.c:1378


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-11-17 11:14 UTC] derick@php.net
-Status: Open +Status: Feedback
 [2015-11-17 11:14 UTC] derick@php.net
I can't reproduce this. Are you sure this is stock PHP, and not a PHP that has weird patches for using the timezone database from the OS?
 [2015-11-19 20:42 UTC] royanee at gmail dot com
-Status: Feedback +Status: Open
 [2015-11-19 20:42 UTC] royanee at gmail dot com
I'm so sorry Derick! I just found your discussion from 2008 about the distributions using the central tzdata. I'll reference this issue in the bug report I file with Debian.
 [2016-10-05 14:35 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-10-05 14:35 UTC] cmb@php.net
So, has this issue been resolved in the meantime?
 [2016-10-05 22:53 UTC] royanee at gmail dot com
It's still an issue on PHP 7.0.11 from Debian. Here it is on the Debian bug tracker: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=805591
 [2016-10-06 12:08 UTC] cmb@php.net
-Status: Feedback +Status: Not a bug
 [2016-10-06 12:08 UTC] cmb@php.net
It seems to me that PHP's behavior is fine, see
<https://3v4l.org/jR9Ih>. If there is a segfault in a Debian
package, this is not our concern.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 20:01:35 2025 UTC