[PEAR-BUG] Bug #1743 [WFx->Csd]: declare+pcntl_signal semantics cause fatal error in Net_SmartIRC

[email protected] Mon, 27 Oct 2014 06:13:52 +0000 (GMT)
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at https://pear.php.net/bugs/bug.php?id=1743&edit=1

 ID:               1743
 Updated by:       [email protected]
 Reported By:      zancarius at zancarius dot com
 Summary:          declare+pcntl_signal semantics cause fatal error in
                    Net_SmartIRC
-Status:           Wont fix
+Status:           Closed
 Type:             Bug
 Package:          Net_SmartIRC
 Operating System: FreeBSD 5.1
 PHP Version:      4.3.7
-Assigned To:      amir
+Assigned To:      garrettw
 Roadmap Versions: 
 New Comment:

-Status:      Wont fix
+Status:      Closed
-Assigned To: amir
+Assigned To: garrettw
This has been fixed, but it really doesn't matter anymore since the
package now 
requires PHP 5.3+.


Previous Comments:
------------------------------------------------------------------------

[2007-08-20 18:14:10] amir

Conflicts with php4 when using pcntl stuff, this is not really a
developer issue as already fixed in php5.

------------------------------------------------------------------------

[2007-08-19 05:09:48] amir

Mostly a php4 problem as works smoothly with 5.
It's analyzed and verified.

------------------------------------------------------------------------

[2005-07-08 19:20:31] 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.

------------------------------------------------------------------------

[2004-06-29 21:37:27] 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

------------------------------------------------------------------------


-- 
Edit this bug report at https://pear.php.net/bugs/bug.php?id=1743&edit=1