Edit report at http://bugs.php.net/bug.php?id=52064&edit=1
ID: 52064 Updated by: f...@php.net Reported by: developers at proneticas dot net Summary: while loop does not meet conditions -Status: Feedback +Status: Bogus Type: Bug Package: *General Issues Operating System: FreeBSD PHP Version: 5.3.2 New Comment: $ /opt/src/php-5.2.13/sapi/cli/php b52064.php string(52) "ProNeticas has released a visual rapid database desi" $ /opt/src/php-5.3.1/sapi/cli/php b52064.php string(52) "ProNeticas has released a visual rapid database desi" $ /usr/bin/php -v PHP 5.2.6-1+lenny8 with Suhosin-Patch 0.9.6.2 (cli)[...] $ /usr/bin/php b52064.php string(52) "ProNeticas has released a visual rapid database desi" Previous Comments: ------------------------------------------------------------------------ [2010-06-13 00:57:51] developers at proneticas dot net Well really any version of 5.2 was working correctly, but for the sake of debugging, the last version of 5.2 installed was 5.2.12. ------------------------------------------------------------------------ [2010-06-12 18:36:10] fel...@php.net Which 5.2 release are you refering to? ------------------------------------------------------------------------ [2010-06-12 12:51:58] developers at proneticas dot net 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 this bug report at http://bugs.php.net/bug.php?id=52064&edit=1