php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38927 Passing strtotime a string containing non-separated keywords can crash php
Submitted: 2006-09-22 14:11 UTC Modified: 2006-09-22 21:22 UTC
From: starson dot hochschild at mtginfo dot com Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 5.1.6 OS: Win32/Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: starson dot hochschild at mtginfo dot com
New email:
PHP Version: OS:

 

 [2006-09-22 14:11 UTC] starson dot hochschild at mtginfo dot com
Description:
------------
I know:
php5.1.0 has this problem
php5.1.6 has this problem
php5.0.5 does not have this problem
php5.2-win32-200609211830 does not have this problem
php6.0-win32-200609211630 does not have this problem

I assume:
php >= 5.1.0 <= 5.1.6 has this problem
php4.x does not have this problem
php >= 5.0.0 < 5.1.0 does not have this problem

I have tested this on both Win32 and Linux.

Reproduce code:
---------------
<?php
echo "before\n";

// Any of these lines should reproduce the segfault
echo strtotime( "lastyear" );
echo strtotime( "skdfhakshdlastyearslkdjflksjd" );
echo strtotime( "lastyearslkdjflksjd" );
echo strtotime( "skdfhakshdlastyear" );
echo strtotime( "thisthursday" );
echo strtotime( "nextyear" );
echo strtotime( "lastmonth" );
echo strtotime( "lastsecond" );

echo "\nafter\n";
?>


Expected result:
----------------
Depending on the line above and how it is determined to handle non-separated keywords:

before
1127397439
after

---- OR ----

before

after


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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-22 21:09 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

Seems to work in latest CVS, no memory errors are being 
reported by valgrind either.
 [2006-09-22 21:15 UTC] starson dot hochschild at mtginfo dot com
As noted in my original description I know that it works in 5.2.x.  I submitted this as a bug for 5.1.6 so if there is another revision on the 5.1 line the fix would be in it.  The moment 5.2.0 is officially released this issue is void.
 [2006-09-22 21:18 UTC] iliaa@php.net
5.2.0 is the next 5.X release, there is not going to be 5.1.7
 [2006-09-22 21:22 UTC] starson dot hochschild at mtginfo dot com
Thank you
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 07 09:01:33 2025 UTC