Bug #68612 [Fbk->Csd]: Testing variable
Edit report at https://bugs.php.net/bug.php?id=68612&edit=1
ID: 68612
User updated by: standus at post dot cz
Reported by: standus at post dot cz
Summary: Testing variable
-Status: Feedback
+Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: Win32, CentOS
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
For me it looks good too and in my original code too. Was some my mistake or bug in my code. Sorry
and forget it.
Previous Comments:
------------------------------------------------------------------------
[2014-12-16 01:05:23] requinix@php.net
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.
------------------------------------------------------------------------
[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)