php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68612 Testing variable
Submitted: 2014-12-16 00:41 UTC Modified: 2014-12-16 18:15 UTC
From: standus at post dot cz Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: Irrelevant OS: Win32, CentOS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: standus at post dot cz
New email:
PHP Version: OS:

 

 [2014-12-16 00:41 UTC] 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"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-16 01:05 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2014-12-16 01:05 UTC] 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 13:31 UTC] standus at post dot cz
-Status: Feedback +Status: Closed
 [2014-12-16 13:31 UTC] standus at post dot cz
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.
 [2014-12-16 18:15 UTC] ab@php.net
-Status: Closed +Status: Not a bug
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 05:00:01 2026 UTC