From: Operating system: FreeBSD PHP version: 5.3.2 Package: *General Issues Bug Type: Bug Bug description:while loop does not meet conditions
Description: ------------ I am seeing a bug in PHP 5.3 where the WHILE LOOP is not meeting all of the conditions. The same code was working great in PHP 5.2 but broke after a PHP upgrade. I reviewed the PHP 5.3 change-log and nothing is mentioned for changes in WHILE LOOP conditions. Test script: --------------- <?php function cutTextPer($string, $setlength) { $rlength = $setlength; if($rlength<strlen($string)){ while (($string{$rlength} != '.') && ($rlength > 0)) { $rlength--; } if ($rlength== 0) { return substr($string, 0, $setlength); } else { return substr($string, 0, $rlength).'.'; } }else { return $string; } } $mstr = 'ProNeticas has released a visual rapid database design tool. This allows you to generate online programs in rapid time, without any programming.'; print cutTextPer( (String)$mstr, 52); ?> [OUTPUT IN PHP 5.2] ProNeticas has released a visual rapid database design tool. [OUTPUT IN PHP 5.3] ProNeticas has released a visual rapid database de Expected result: ---------------- ProNeticas has released a visual rapid database design tool. Actual result: -------------- ProNeticas has released a visual rapid database de -- Edit bug report at http://bugs.php.net/bug.php?id=52064&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52064&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52064&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52064&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52064&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52064&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52064&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52064&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52064&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52064&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52064&r=support Expected behavior: http://bugs.php.net/fix.php?id=52064&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52064&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52064&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52064&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52064&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52064&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52064&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52064&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52064&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52064&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52064&r=mysqlcfg