#36638 [NEW]: strtotime unconditional false return on now = 0
From: mikeb at tracersinfo dot com Operating system: Win32 (XP2) and Linux PHP version: 5.1.2 PHP Bug Type: Date/time related Bug description: strtotime unconditional false return on now = 0 Description: Despite recent modifications to the date functions that now allow negative timestamps in both of my environments (Win32 and Linux) [THANK YOU, btw!], strtotime() returns false any time the now parameter evaluates to 0 or less, even when it clearly demonstrates it can perform the calculation requested and the date/time in question is within reasonable bounds. Reproduce code: --- ?php $a[mktime(1, 2, 3, 4, 5, 1967)] = mktime(1, 2, 3, 4, 5, 1967); $a[strtotime('-10 years', 0)] = strtotime('-10 years', 0); $a[strtotime('-10 years', 1)] = strtotime('-10 years', 1); $a[strtotime('+10 years', 0)] = strtotime('+10 years', 0); $a[strtotime('+10 years', 1)] = strtotime('+10 years', 1); $a[gmmktime(0, 0, 0, 1, 1, 1970)] = gmmktime(0, 0, 0, 1, 1, 1970); $a[strtotime('-10 years', gmmktime(0, 0, 0, 1, 1, 1970))] = strtotime('-10 years', gmmktime(0, 0, 0, 1, 1, 1970)); $a[strtotime('12/31/1969 19:00:00 -10 years')] = strtotime('12/31/1969 19:00:00 -10 years'); $a[strtotime('+10 years', gmmktime(0, 0, 0, 1, 1, 1965))] = strtotime('+10 years', gmmktime(0, 0, 0, 1, 1, 1965)); $a[strtotime('12/31/1964 19:00:00 +10 years')] = strtotime('12/31/1964 19:00:00 +10 years'); var_dump($a); ? Expected result: array(10) { [mktime(1, 2, 3, 4, 5, 1967)]= int(-86551077) [strtotime('-10 years', 0)]= int(-315619200) -- [strtotime('-10 years', 1)]= int(-315619199) [strtotime('+10 years', 0)]= int(315532800) --- [strtotime('+10 years', 1)]= int(315532801) [gmmktime(0, 0, 0, 1, 1, 1970)]= int(0) [strtotime('-10 years', gmmktime(0, 0, 0, 1, 1, 1970))]= int(-315619200) -- [strtotime('12/31/1969 19:00:00 -10 years')]= int(-315619200) [strtotime('+10 years', gmmktime(0, 0, 0, 1, 1, 1965))]= int(157766400) -- [strtotime('12/31/1964 19:00:00 +10 years')]= int(157766400) } Actual result: -- array(10) { [mktime(1, 2, 3, 4, 5, 1967)]= int(-86551077) [strtotime('-10 years', 0)]= bool(false) -- [strtotime('-10 years', 1)]= int(-315619199) [strtotime('+10 years', 0)]= bool(false) -- [strtotime('+10 years', 1)]= int(315532801) [gmmktime(0, 0, 0, 1, 1, 1970)]= int(0) [strtotime('-10 years', gmmktime(0, 0, 0, 1, 1, 1970))]= bool(false) -- [strtotime('12/31/1969 19:00:00 -10 years')]= int(-315619200) [strtotime('+10 years', gmmktime(0, 0, 0, 1, 1, 1965))]= bool(false) -- [strtotime('12/31/1964 19:00:00 +10 years')]= int(157766400) } -- Edit bug report at http://bugs.php.net/?id=36638edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36638r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36638r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36638r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36638r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36638r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36638r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=36638r=needscript Try newer version:http://bugs.php.net/fix.php?id=36638r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36638r=support Expected behavior:http://bugs.php.net/fix.php?id=36638r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36638r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36638r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36638r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36638r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36638r=dst IIS Stability:http://bugs.php.net/fix.php?id=36638r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36638r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36638r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36638r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=36638r=mysqlcfg
#36267 [Fbk-Opn]: Crash (segfault) not reproducible under Win32
ID: 36267 User updated by: mikeb at tracersinfo dot com Reported By: mikeb at tracersinfo dot com -Status: Feedback +Status: Open Bug Type: PCRE related Operating System: Linux PHP Version: 5.1.2 New Comment: I recompiled PHP 5.1.2 with --enable-debug added to my config options on my home machine from the available sources on your site. Despite this, I wasn't able to get a core file as described in your documentation on backtrace. However, running the CLI under gdb, I did get the following: - (gdb) run testpregfault2.txt Starting program: /usr/local/bin/php testpregfault2.txt [Thread debugging using libthread_db enabled] [New Thread -1215732032 (LWP 18908)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1215732032 (LWP 18908)] 0x080a293c in match ( eptr=0x85f480f vv w x y z\na b c d e f g hhh i j k l m\nn o p q r s t u v w x y z\na b c..., ecode=0x858121a \027A, offset_top=2, md=0xbfb7d274, ims=5, eptrb=0xbf3803d0, flags=2) at /home/mikeb/src/php-5.1.2/ext/pcre/pcrelib/pcre_exec.c:357 357 { -- Attempts to bt from here yielded thousands (I killed it sometime after 5000) frames similar to: --- #5835 0x080a67bd in match ( eptr=0x85f3145 m\nn o p q r s t u v w x y z\na b c d e f g hhh i j k l m\nn o p q r sss..., ecode=0x8581217 J, offset_top=2, md=0xbfb7d274, ims=5, eptrb=0xbf726970, flags=Variable flags is not available. ) at /home/mikeb/src/php-5.1.2/ext/pcre/pcrelib/pcre_exec.c:975 with the subject string growing one character at a time to the left (next was 'l', etc.) The final commands listed at the bottom of your generating a gdb backtrace page yielded the following results: (gdb) print (char *)(executor_globals.function_state_ptr-function)-common.function_name $1 = 0x8372d23 preg_replace (gdb) print (char *)executor_globals.active_op_array-function_name $2 = 0x0 (gdb) print (char *)executor_globals.active_op_array-filename $3 = 0x8584bfc /home/mikeb/temp/testpregfault2.txt - I'll be happy to do anything I can to give you more information on this, but there's no telling how many more thousands of match() frames there were, and it seems pretty clear that the last execute() was preg_replace. Frankly, I'm most puzzled by the fact that this works properly on every Windows machine I've tried it on, and fails consistently identically on at least three separately-compiled Linux machines. Thanks for your help. Mike Previous Comments: [2006-02-02 21:18:48] [EMAIL PROTECTED] 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. This is all I can get with valgrind and I can't reproduce the segfault without it. ==3882== Process terminating with default action of signal 11 (SIGSEGV) ==3882== Access not within mapped region at address 0xBE7FFF24 ==3882==at 0x806D2FD: match (pcre_exec.c:517) ==3882== Stack overflow in thread 1: can't grow stack to 0xBE7FFEAC [2006-02-02 21:15:49] [EMAIL PROTECTED] the url you refer above doesn't work (error 403). please change the permissions. [2006-02-02 21:06:42] mikeb at tracersinfo dot com Description: I use PCRE's every day to harvest information from webpages (i.e., not a newbie, and I use many very complex expressions regularly). I recently ran into a problem with an expression I needed to use (essentially, to select a particular table, its contents, and everything that follows it on page full of tables -- specifically without allowing an intervening table or /table tag) that worked perfectly throughout my development under Windows XP Home SP2. As soon as I ported the script to GNU/Linux (3 different machines: Mandrake 10 [2.6.8 kernel]; 2 Ubuntu 5.10 [2.6.12 kernel]), it segfaults both under the CLI and Apache (1.3.33) SAPI. (The use of once-only subpattern is not significant -- same result is obtained using merely non-matching
#28676 [NEW]: Segmentation fault/crash while destroying large arrays at end of execution
From: mikeb at tracersinfo dot com Operating system: WinXP; Mandrake Linux 2.4.22-26 PHP version: 4.3.7 PHP Bug Type: Reproducible crash Bug description: Segmentation fault/crash while destroying large arrays at end of execution Description: In WinXP, crash occurs at $howmany = 65537; in Mandrake Linux, crash (specifying Segmentation fault) occurs at $howmany = 131073. Note that crash only occurs *after* all statements are performed. I have been able to reproduce this everywhere, with any 4.3.2+ version of PHP on all platforms, regardless of configuration or state of php.ini. Reproduce code: --- ?php $string = X; $howmany = 65537; $b4guts = mktime(); $guts = array(); for ( $x = 0; $x $howmany; $x++ ) { $guts[$x] = $string; } $afterguts = mktime(); $gutstime = $afterguts - $b4guts; echo \nGuts built. Time $gutstime seconds. , count($guts), elements\n; ? Expected result: Normal program termination. Actual result: -- Windows generates a GPF requiring close of the process. Mandrake Linux generates a Segmentation fault. -- Edit bug report at http://bugs.php.net/?id=28676edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28676r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28676r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28676r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28676r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28676r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28676r=needscript Try newer version: http://bugs.php.net/fix.php?id=28676r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=28676r=support Expected behavior: http://bugs.php.net/fix.php?id=28676r=notwrong Not enough info:http://bugs.php.net/fix.php?id=28676r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=28676r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28676r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28676r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28676r=dst IIS Stability: http://bugs.php.net/fix.php?id=28676r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=28676r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28676r=float