[PHP-BUG] Bug #51495 [NEW]: errors using variable variables as function arguments

[email protected] ("marco at digitaldruid dot net") Wed, 7 Apr 2010 13:29:28 +0200 (CEST)
Newsgroups php.bugs
Message-ID <[email protected]>
From:             
Operating system: linux/windows
PHP version:      5.3.2
Package:          Variables related
Bug Type:         Bug
Bug description:errors using variable variables as function arguments

Description:
------------
This problem happens with php 5.3, on 5.2 doesn't show up. Tried on linux
(default php 5.3.2 packages from ubuntu 10.04 beta1) and windows (php 5.3.2
from easyphp).

Sometimes when I use a variable variable (name of the variable in curly
brackets) as a function argument the script doesn't work as expected
(execution time or memory limits are reached). This happens only in a few
places in my script (most times the same function with same arguments works
fine) and in those places if I replace the variable variables with normal
variables it works normally.

Test script:
---------------
You can download my script from:

http://www.digitaldruid.net/download/php-residence_1.2.2.zip

Install it (mysql, postgresql or sqlite needed), once you get to "main
menu" click on "configure and customize" --> "internet templates" -->
"availability template", this page will stop loading when the affected
function is reached.

This function is called (twice) in file php-residence/crea_modelli.php from
line 215:

mostra_menu_date("./dati/selectperiodi$anno_modello.1.php","inizioperiodo$num1",${"inizioperiodo".$num1},"","",$id_utente,$tema);
echo " ".mex("al",$pag)." ";
mostra_menu_date("./dati/selectperiodi$anno_modello.1.php","fineperiodo$num1",${"fineperiodo".$num1},"","",$id_utente,$tema);

if I replace the above code with:

$inizioperiodo = ${"inizioperiodo".$num1};
$fineperiodo = ${"fineperiodo".$num1};
mostra_menu_date("./dati/selectperiodi$anno_modello.1.php","inizioperiodo$num1",$inizioperiodo,"","",$id_utente,$tema);
echo " ".mex("al",$pag)." ";
mostra_menu_date("./dati/selectperiodi$anno_modello.1.php","fineperiodo$num1",$fineperiodo,"","",$id_utente,$tema);

then the page loads fine. The function mostra_menu_date is located in file
php-residence/includes/funzioni.php


-- 
Edit bug report at http://bugs.php.net/bug.php?id=51495&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=51495&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=51495&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=51495&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=51495&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51495&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=51495&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=51495&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=51495&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=51495&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=51495&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=51495&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=51495&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=51495&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=51495&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51495&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51495&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=51495&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=51495&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=51495&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=51495&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=51495&r=mysqlcfg