#18655 [NEW]: strtotime() with "next Sunday"

From: Date: Tue, 30 Jul 2002 17:57:20 +0000
Subject: #18655 [NEW]: strtotime() with "next Sunday"
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15612@lists.php.net to get a copy of this message
From: thearcher@comcast.net Operating system: RedHat 6.2 kernel 2.4.18 #3 PHP version: 4.2.2 PHP Bug Type: Date/time related Bug description: strtotime() with "next Sunday" The configure line is: './configure' '--enable-ftp' '--enable-bc-math' '--enable-gd-native-ttf' '--enable-inline-optimization' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-sysvsem' '--enable-sysvshm' '--enable-sockets' '--enable-track-vars' '--enable-trans-sid' '--with-freetype-dir=/usr' '--with-gd=/usr' '--with-imap=/usr' '--with-imlib=/usr' '--with-jpeg-dir=/usr' '--with-kerberos=/usr/kerberos' '--with-mysql=/usr/local/mysql' '--with-openssl=/usr' '--with-png-dir=/usr' '--with-t1lib=/usr' '--with-ttf=/usr' '--with-xml' '--with-xpm-dir=/usr/X11R6' '--with-zlib-dir=/usr' '--with-apache=../apache_1.3.26' '--with-snmp' '--enable-ucd-snmp-hack' I was writing a script that was supposed to determine all the Sundays between an entered date and the current date. I had a loop in which I used "strtotime("next Sunday",$date)". This did not work and just returned the sunday after the current date instead of the Sunday after the timestamp i gave it. I had used an identical expression outside of the loop and it correctly returned the next Sunday of the timestamp i gave it. This script replicates the problem: <? $now=time(); $date=strtotime("November 24, 2002"); while($now<$date) { echo date("l, F j, Y", $now)."<br>"; $now=strtotime("next Sunday", $now); } ?> That loop will never terminate as it logically should. -- Edit bug report at http://bugs.php.net/?id=18655&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=18655&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=18655&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=18655&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=18655&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=18655&r=support Expected behavior: http://bugs.php.net/fix.php?id=18655&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=18655&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=18655&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=18655&r=globals

« previous php.bugs (#15612) next »