php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3901 Using var will set the correct Count()
Submitted: 2000-03-22 15:27 UTC Modified: 2000-03-24 09:55 UTC
From: aulbach at unter dot franken dot de Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.11 OS: Linux
Private report: No CVE-ID: None
 [2000-03-22 15:27 UTC] aulbach at unter dot franken dot de
Perhaps this bug has been already fixed (I locked arround here and I
found a nearly similar bug depending Count() and Arrays, which was fixed fpr PHP4).

But I search now a longer time (5 months) for a reproduceable example cause the error happens only in very seldom situation.

<?php

class blubb {
        function bla () {
                $y[3][d]="D";
#               $y[xxx][]=$y[0][a];
                return($y);
        }

        function fasel () {
                $x=$this->bla();
                echo "Value is : '". $x[xxx][0] ."' and it is " .
                          ((isset($x[xxx][0]))?"":"not") ." set<br>";
                echo "Count is now ". Count($x[xxx]) ."<br>";
                echo "Value is : '". $x[xxx][0] ."' and it is ".
                          ((isset($x[xxx][0]))?"":"not") ." set<br>";
                echo "Count is now ".Count($x[xxx]) ."<br>";
        }
}

$z=new blubb;
$z->fasel();

?>

Output:
Value is : '' and it is not set
Count is now 1
Value is : '' and it is not set
Count is now 0

Strange, eh? The other way arround I would understand, but this
is unintelligible.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-03-24 09:55 UTC] aulbach at unter dot franken dot de
I just found out, that this bug is fixed in PHP4. So I think this is closed.

 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 13 20:00:02 2026 UTC