From:             [EMAIL PROTECTED]
Operating system: Linux 2.4.7-10
PHP version:      4.3.0RC2
PHP Bug Type:     Scripting Engine problem
Bug description:  Functions inside declare(ticks=1) cannot be used prior to definition

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
[EMAIL PROTECTED]


-- 
Edit bug report at http://bugs.php.net/?id=20924&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=20924&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=20924&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=20924&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=20924&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=20924&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=20924&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=20924&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=20924&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=20924&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=20924&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20924&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=20924&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=20924&r=isapi

Reply via email to