Edit report at http://bugs.php.net/bug.php?id=52064&edit=1
ID: 52064 Updated by: fel...@php.net Reported by: developers at proneticas dot net Summary: while loop does not meet conditions -Status: Open +Status: Feedback Type: Bug Package: *General Issues Operating System: FreeBSD PHP Version: 5.3.2 New Comment: Which 5.2 release are you refering to? Previous Comments: ------------------------------------------------------------------------ [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