|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-06-12 18:36 UTC] felipe@php.net
-Status: Open
+Status: Feedback
[2010-06-12 18:36 UTC] felipe@php.net
[2010-06-13 00:57 UTC] developers at proneticas dot net
[2010-06-14 10:58 UTC] fa@php.net
-Status: Feedback
+Status: Bogus
[2010-06-14 10:58 UTC] fa@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 09:00:01 2025 UTC |
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