From: wizanda at yahoo dot co dot uk
Operating system: all
PHP version: 5.2.9
PHP Bug Type: Feature/Change Request
Bug description: Isset doesn't function as expected
Description:
------------
Since PHP 5 most PHP systems will be storing masses of data, due to isset
and empty no longer assessing the full variable, yet running code once for
each item within it.
Reproduce code:
---------------
---
>From manual page: function.isset
---
function &loadHandler($name){static $handler;
if(!isset($handler[$name])){$FileName = "core/core.".$name.".php";
require_once $FileName;
$ClassName = "SmartyCore_".$name;
$handler[$name] = new $ClassName();}
$classes = $handler[$name];
return $classes;}
Expected result:
----------------
This should check $handler, see if it's empty the first time; check $name
and see this is an empty array, attempt to fill it and thus setting the
$handler as being a container for the array and then check for each $name
as a separate array within it.
Actual result:
--------------
What this appears to be doing is checking $handler and running it, then
checking $name and running it... So when you var_dump the $handler it has
multiple copies of the variable set.
This can be slightly resolved by making the array set the original
$handler variable, which reduces the copies made.
$handler = array($name => new $ClassName());}
...Yet there should be only one copy set.
--
Edit bug report at http://bugs.php.net/?id=48135&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48135&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48135&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48135&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48135&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48135&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48135&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48135&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48135&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48135&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48135&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48135&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48135&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48135&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48135&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48135&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48135&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48135&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48135&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48135&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48135&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48135&r=mysqlcfg