Home » Networking » Net_SmartIRC » Bug #1743
declare+pcntl_signal semantics cause fatal error in Net_SmartIRC
Details
| Submitted | 2004-06-30 01:37 UTC |
|---|---|
| From | zancarius at zancarius dot com |
| Assigned | garrettw |
| Status | Closed |
| Package | Net_SmartIRC |
| PHP Version | 4.3.7 |
| OS | FreeBSD 5.1 |
| Roadmaps | (Not assigned) |
Comments
[2004-06-30 01:37 UTC] zancarius at zancarius dot com
Description:
------------
When using declare(ticks=1); to use functions such as pcntl's pcntl_signal(), Net_SmartIRC dies with a fatal error on include. This appears to be due to the include/class declaration order which PHP is not normally particularly anal about without declare().
Version affected: Net_SmartIRC 0.5.5p1
PHP Version: 4.3.7
Configure Command => './configure' '--with-pgsql' '--with-mysql=/db/mysql' '--with-gd' '--enable-exif' '--with-freetype-dir=/usr' '--enable-gd-native-ttf' '--enable-gd-imgstrttf' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-zlib' '--with-gmp' '--enable-bcmath' '--enable-calendar' '--with-bz2' '--with-xml' '--with-dom=/usr' '--with-gettext' '--with-mcrypt' '--with-mhash' '--with-pspell' '--with-readline' '--enable-sockets' '--enable-pcntl' '--with-ncurses'
Reproduce code:
---------------
#!/usr/local/bin/php -q
<?php
declare(ticks=1);
include 'Net/SmartIRC.php';
function testhandler()
{
print "Exiting...\n";
exit (0);
}
pcntl_signal(SIGINT, 'testhandler');
while (true) { }
?>
--
A unified diff of changes made to the class declaration and include order may be found here:
http://sagittarius.destrealm.org/bshelton/SmartIRC.pcntl.patch
WARNING! The patch has NOT been tested exhaustively; however, it only changes the order in which classes are declared and included.
Expected result:
----------------
[sagittarius:test]$ ./test.php
^CExiting...
Actual result:
--------------
[sagittarius:test]$ ./test.php
Fatal error: Class net_smartirc_irccommands: Cannot inherit from undefined class net_smartirc_base in /usr/local/lib/php/Net.orig/SmartIRC/irccommands.php on line 28
[2005-07-08 23:20 UTC] a_stevenson2000 at hotmail dot com
I also am having a simliar problem. If I put declare(ticks=1) in my code, then there is a function in an include file that is no longer found, and php quits with a fatal error.
It doesn't matter where I put declare(ticks=1) it always fails, and runs just perfectly without that statement.