#28388 [Opn->Csd]: different output for simple loop in 5.* vs 4.3.*
| From: | curt@php.net | Date: | Wed, 01 Sep 2004 05:58:43 +0000 |
| Subject: | #28388 [Opn->Csd]: different output for simple loop in 5.* vs 4.3.* | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-65544@lists.php.net to get a copy of this message | ||
ID: 28388
Updated by: curt@php.net
Reported By: fire at firepages dot org
-Status: Open
+Status: Closed
Bug Type: Unknown/Other Function
Operating System: win32 XP
PHP Version: 5.0.0RC2
Assigned To: hholzgra
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
This has been fixed as of version of 5.0.1
Previous Comments:
------------------------------------------------------------------------
[2004-05-14 22:35:34] solace at ezmail dot ru
Seems that there is one more 'hidden' char at the end of strings when
accessing by index (probably \0 ?).
This must show false, but it's true:
<?
$word = 'a';
var_dump(empty($word{1}));
?>
------------------------------------------------------------------------
[2004-05-13 20:18:59] fire at firepages dot org
Description:
------------
dunno how to describe , simply put the code below on 4.3.4 / 4.3.5
gives (my) expected answer of '12'
on 5.0.0.b4 && RC2 the answer is '13'
unsure which is the correct behaviour ;)
Reproduce code:
---------------
<?
$word = 'Encyclopedia';
$x = 0;
while (!empty($word[$x])){
$x++;
}
echo "The word <b>$word</b> has $x characters in it.";
?>
Expected result:
----------------
The word Encyclopedia has 12 characters in it.
Actual result:
--------------
The word Encyclopedia has 13 characters in it.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28388&edit=1