note 69360 rejected from ref.pcntl by betz
| From: | betz@php.net | Date: | Sat, 02 Sep 2006 11:53:39 +0000 |
| Subject: | note 69360 rejected from ref.pcntl by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-116621@lists.php.net to get a copy of this message | ||
Note Submitter: codeslinger at compsalot dot com
----
A Warning about undocumented behavior of declare(ticks=1); -- Functions must come first.
I took a program that was working and did a substantial rewrite and code reorg. After I was done
the program wouldn't run. It kept complaining about undefined functions. After 5 hours of
head banging. I finally managed to isolate what specifically had broken my program and then found
the following bug entry:
http://bugs.php.net/bug.php?id=20924
The problem is that declare(ticks=1); modifies the compilation behavior of php and it introduces an
undocumented constraint.
When ticks are enabled, you MUST define all of your functions prior to using them. I am spoiled by
the ease of forward references and usually prefer to put my functions at the end of the program.
But when using ticks you can not do this, the functions must come before the code that calls them.