Jump to content

PhP bug? Or i am nuts?


sangoku

Recommended Posts

Hy i was making some class.... and i had a structure where i did the folowing

class a {
    
   public $t;
   function buga(){
       $this->t = 'buga';
   }
   function bla(){
       
       $b &=$this->t;
       echo $b;
   }
}

$a= new a;
$a->buga();
$a->bla(); //this outputs Notice: Undefined variable: b in C:\...\test.php on line 20

 

Either I am nuts or is this a bug.... Will ask on php bug report...

 

i posted it here http://bugs.php.net/bug.php?id=51555

 

can someone reproduce the error and tell me the OP and the version to.. so i can confirm it...

Link to comment
https://forums.phpfreaks.com/topic/198511-php-bug-or-i-am-nuts/
Share on other sites

Hy i was making some class.... and i had a structure where i did the folowing

class a {
    
   public $t;
   function buga(){
       $this->t = 'buga';
   }
   function bla(){
       
       $b &=$this->t;
       echo $b;
   }
}

$a= new a;
$a->buga();
$a->bla(); //this outputs Notice: Undefined variable: b in C:\...\test.php on line 20

 

Either I am nuts or is this a bug.... Will ask on php bug report...

 

i posted it here http://bugs.php.net/bug.php?id=51555

 

can someone reproduce the error and tell me the OP and the version to.. so i can confirm it...

 

define the $b as var $b in the start of the class

Not a bug, just a confused developer.  I believe, like Rasmus said in your bug report, that you wanted to do an assignment by reference but what you were actually doing is a 'bitwise and' assignment.  Your code tries to do: $b = $b & $this->t and because $b has not been defined before trying to be used (to the right of the =) that is the cause of the error.

 

As stated, you probably wanted to use $b = &$this->t instead.

Lol yup confused C or C++ and PhP... how to remove the false report...?

 

As was mentioned, the report is flagged as "bogus" which means it's not a bug at all. It will remain in the system so that anyone else wishing to submit a similar report in the future might stumble upon yours and notice their error.

Shame on me Q.Q.... :wtf: :'(

 

By the way thanks for the compliment i am taking that as a compliment when someone calls me buts XD

At least you had a privilege to be answered by Rasmus

i don`t see any rasmus in this thread?

 

edit again... a mean the one who told me i had an memory corruption  in my CPU....  Who is he?

know know, but why? is he famous? i see he has a big php message count.... and? is he fames programmer... a php developer???

 

And Maq if someone tells you are nuts, why duos he say it... think about it and then you will see it is actually a compliment if you understands from whom it comes.

know know, but why is he famous? i see he has a big php message count.... and? is he fames programmer... a php developer???

As you can see from the link provided he's the creator of PHP.

[size=18pt]W[/size]oW  I am really honored. Really.... really really....

 

And one side note mean the philosophical not medical definition of nuts. And yes this is becoming a spam thread... but it is fun  ::)... am i riiiiiiiiight  ;D

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.