Bug #68612 [Opn->Fbk]: Testing variable

From: Date: Tue, 16 Dec 2014 01:05:24 +0000
Subject: Bug #68612 [Opn->Fbk]: Testing variable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189078@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68612&edit=1

 ID:                 68612
 Updated by:         requinix@php.net
 Reported by:        standus at post dot cz
 Summary:            Testing variable
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Win32, CentOS
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

Code provided works fine. http://3v4l.org/UeKui

Note that isset() will return false if the variable exists but has the value null.


Previous Comments:
------------------------------------------------------------------------
[2014-12-16 00:41:56] standus at post dot cz

Description:
------------
I have singleton class and inside some protected variables.
In one function I have test check for existing of variables.
 All variables are tested OK except one with name: '_banners'.


Test script:
---------------
My test code is like this: 
Class Variables {
...
protected static $_banners=array();
protected static $instance = null;
protected function __clone() {}
protected static function getInstance($reInit=false)
    {
        if(self::$instance==null) { self::$instance = new self(); }
        if($reInit) {self::$instance = new self();}
        return self::$instance;
    }
public static function setVar($name='',$value='') {
if(!isset(self::${$name})) {return false;}
self::${$name}=$value;
return true;
}
}
Variable::setVar('_offline'); -> return true-> OK
Variable::setVar('_banners'); -> return false-> BAD

Expected result:
----------------
Expected result is return true .

Actual result:
--------------
Now function for return false for variable name "_banners"


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=68612&edit=1


Thread (4 messages)

« previous php.bugs (#189078) next »