Edit report at http://bugs.php.net/bug.php?id=51495&edit=1
ID: 51495
Updated by: mike@php.net
Reported by: marco at digitaldruid dot net
Summary: errors using variable variables as function arguments
-Status: Open
+Status: Feedback
Type: Bug
Package: Variables related
Operating System: linux/windows
PHP Version: 5.3.2
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.
Previous Comments:
------------------------------------------------------------------------
[2010-04-08 09:46:47] marco at digitaldruid dot net
Please note that the arguments of function mostra_menu_date are NOT
passed by reference, so I think there should be the same behaviour when
using ${"inizioperiodo".$num1} or $inizioperiodo as an argument, if they
contain the same value.
------------------------------------------------------------------------
[2010-04-07 13:29:27] marco at digitaldruid dot net
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 this bug report at http://bugs.php.net/bug.php?id=51495&edit=1