From:             [EMAIL PROTECTED]
Operating system: Linux 2.4.12
PHP version:      4.2.3
PHP Bug Type:     Zend Engine 2 problem
Bug description:  zend_get_parameters_ex segfault PHP on script end

I have an extension which is working well in PHP 4.2.2 but when I compile
it with PHP 4.2.3. The scripting engin crash on the end of the script
several times. I comment out the zend_get_parameters_ex and put static
parameters and the script work well.

There is the function in my extension (every function using parameter may
crash PHP)

PHP_FUNCTION(ia_open)
{
   zval **spHost_arg, **spPort_arg;
   char *spHost = NULL;
   char *spPort = NULL;
    TIA_Stream* olStream;
    TIA_Stream* olResStream;
    TIA_Writer* olWriter;
    TIA_Reader* olReader;
    int sockfd;
    int nlRes=-1;
//If I use this it may crash PHP
#if 0
   if (ZEND_NUM_ARGS() != 2 || /*this part may crash
PHP*/zend_get_parameters_ex(2, &spHost_arg, &spPort_arg) == FAILURE){
      WRONG_PARAM_COUNT;
   }
   convert_to_string_ex(spHost_arg);
   spHost = Z_STRVAL_PP(spHost_arg);
   convert_to_string_ex(spPort_arg);
   spPort = Z_STRVAL_PP(spPort_arg);
#else //It's ok with this code
   spHost = "xxxxx";
   spPort = "1111";
#endif
    sockfd = connecttounix();
    olStream = new TIA_Stream();
    olWriter = new TIA_Writer(olStream);
    olWriter->WriteInteger (knIA_Open);
    olWriter->WriteString (spHost);
    olWriter->WriteString (spPort);
    delete olWriter;
    olResStream = new TIA_Stream();
    if ( request(sockfd, olStream, olResStream) == 0)
    {
        olReader = new TIA_Reader(olResStream);
        nlRes = olReader->ReadInteger();
        delete olReader;
    }
    delete olResStream;
    delete olStream;
    disconnectfromunix(sockfd);
    RETURN_LONG (nlRes);
}

There is some output of PHPINFO
System Linux orion 2.4.12 #1 Wed Oct 24 03:59:50 EDT 2001 i686 unknown 
Build Date Oct 28 2002 09:54:34 
Configure Command './configure' '--with-mysql=/usr' '--with-apxs'
'--with-interbase=/opt/interbase' '--with-gettext' '--with-xml'
'--with-gd' '--with-png-dir=/usr' '--with-zlib-dir=/usr'
'--with-imap=../imap-2002.RC8' '--with-imap-ssl=../imap-2002.RC8' 
Server API Apache 
Virtual Directory Support disabled 
Configuration File (php.ini) Path /usr/local/lib/php.ini 
Debug Build no 
Thread Safety disabled 
-- 
Edit bug report at http://bugs.php.net/?id=20193&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=20193&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=20193&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=20193&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=20193&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=20193&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=20193&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=20193&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=20193&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=20193&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=20193&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20193&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=20193&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=20193&r=isapi

Reply via email to