|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28388 different output for simple loop in 5.* vs 4.3.*
Submitted: 2004-05-13 20:18 UTC Modified: 2004-09-01 07:58 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: fire at firepages dot org Assigned: hholzgra (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: 5.0.0RC2 OS: win32 XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: fire at firepages dot org
New email:
PHP Version: OS:


 [2004-05-13 20:18 UTC] fire at firepages dot org
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])){
    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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-14 22:35 UTC] 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';
 [2004-09-01 07:58 UTC]
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
Thank you for the report, and for helping us make PHP better.

This has been fixed as of version of 5.0.1
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Aug 18 01:05:45 2022 UTC