Date: 08/22/98
- Next message: Shane Caraveo: "[PHP-DEV] NSAPI is working"
- Previous message: shane: "[PHP-DEV] CVS update: php31/sapi"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: ben <email protected>
Operating system: Solaris x86 2.5
PHP version: 3.0.3
PHP Bug Type: Misbehaving function
Bug description:
<?php
ereg( "([0-9]{1,2})[^0-9]([0-9]{2,4})", "1/05", $regs );
if ( ($regs[2] <= 50) && ($regs[2] >= 0) )
$regs[2] += 2000;
echo "Year: $regs[2]<br>";
?>
The script is meant to return:
Year: 2005<br>
However, it returns:
Year: 2505<br>
Bizzaaaarrrrrreeee! :)
It only seems to happen if the array is assigned with ereg. A way to get around it is:
$regs[2] = (int)$regs[2] + 2000;
this then returns the correct result.
This error occured on a just-compiled php from the command line with the following configure options:
./configure --with-mod_charset=no --with-gd=no --with-mysql --enable-magic-quotes=yes --disable-debug
Finis!
-- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe <email protected> For help: php-dev-help <email protected>
- Next message: Shane Caraveo: "[PHP-DEV] NSAPI is working"
- Previous message: shane: "[PHP-DEV] CVS update: php31/sapi"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

