#20924 [Com]: Functions inside declare(ticks=1) cannot be used prior to definition

From: Date: Tue, 24 Dec 2002 17:44:24 +0000
Subject: #20924 [Com]: Functions inside declare(ticks=1) cannot be used prior to definition
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-28327@lists.php.net to get a copy of this message
ID: 20924 Comment by: a_villacis@palosanto.com Reported By: a_villacis@palosanto.com Status: Open Bug Type: Scripting Engine problem Operating System: Linux 2.4.7-10 PHP Version: 4.3.0RC2 New Comment: Same problem with 4.3.0RC4. Previous Comments: ------------------------------------------------------------------------ [2002-12-12 11:46:22] a_villacis@palosanto.com I just upgraded to version 4.3.0RC3 with the same configure command, but the script gives the same message as in the original posting. This behavior is rather annoying, but a workaround is to declare the troublesome procedure *outside* the scope of the 'declare(ticks=1) {}' block. However, this does not seem to help if the new syntax 'declare(ticks=1);' is used to cover the entire script under the declare() scope. Alex Villacis Lasso a_villacis@palosanto.com ------------------------------------------------------------------------ [2002-12-10 13:38:41] a_villacis@palosanto.com My configuration (as reported by phpinfo()): ./configure --with-apxs=/opt/httpd/bin/apxs --with-mysql=/usr --with-gd --with-curl=/opt/curl-7.10.1/ --with-pdflib=/opt/pdflib/ --with-zlib --enable-inline-optimizations --enable-pcntl --enable-dio --with-ncurses --enable-sockets What I did (filename 'ticks_bug_php'): --------------- CUT HERE -------------------- #!/usr/local/bin/php <?php function predefined_out() { echo "Inside predefined_out()\n"; } predefined_out(); postdefined_out(); function postdefined_out() { echo "Inside postdefined_out()\n"; } declare(ticks = 1) { function predefined_in() { echo "Inside predefined_in()\n"; } predefined_in(); postdefined_in(); function postdefined_in() { echo "Inside postdefined_in()\n"; } } ?> --------------- CUT HERE -------------------- What I expected: [avillaci@srv64 practica]$ ./ticks_bug_php Inside predefined_out() Inside postdefined_out() Inside predefined_in() Inside postdefined_in() [avillaci@srv64 practica]$ What I got instead: [avillaci@srv64 practica]$ ./ticks_bug_php Inside predefined_out() Inside postdefined_out() Inside predefined_in() Fatal error: Call to undefined function: postdefined_in() in /home/avillaci/programa/practica/ticks_bug_php on line 25 [avillaci@srv64 practica]$ PHP refuses to call postdefined_in() before its definition inside the scope of 'declare(ticks=1){}', but has no problem calling postdefined_out() before its definition, outside the scope of 'declare(ticks=1){}'. Any hints in solving this issue will be greatly appreciated. Alex Villacis Lasso a_villacis@palosanto.com ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20924&edit=1

« previous php.bugs (#28327) next »