ID:               20268
 Comment by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Zend Engine 2 problem
 Operating System: Solaris 9
 PHP Version:      4CVS-2002-11-05
 New Comment:

Oops, looks like I didn't paste my grumbles about fdf.c and
zend_parse_parameters.

Index: Zend/zend_ini.c
===================================================================
RCS file: /repository/Zend/zend_ini.c,v
retrieving revision 1.23
diff -u -r1.23 zend_ini.c
--- Zend/zend_ini.c     23 Sep 2002 12:00:39 -0000      1.23
+++ Zend/zend_ini.c     10 Nov 2002 03:46:13 -0000
@@ -430,6 +430,23 @@
 
 ZEND_API ZEND_INI_MH(OnUpdateInt)
 {
+       int *p;
+#ifndef ZTS
+       char *base = (char *) mh_arg2;
+#else
+       char *base;
+
+       base = (char *) ts_resource(*((int *) mh_arg2));
+#endif
+
+       p = (int *) (base+(size_t) mh_arg1);
+
+       *p = zend_atoi(new_value, new_value_length);
+       return SUCCESS;
+}
+
+ZEND_API ZEND_INI_MH(OnUpdateLong)
+{
        long *p;
 #ifndef ZTS
        char *base = (char *) mh_arg2;
Index: Zend/zend_ini.h
===================================================================
RCS file: /repository/Zend/zend_ini.h,v
retrieving revision 1.21
diff -u -r1.21 zend_ini.h
--- Zend/zend_ini.h     28 Aug 2002 13:19:30 -0000      1.21
+++ Zend/zend_ini.h     10 Nov 2002 03:46:13 -0000
@@ -171,6 +171,7 @@
 /* Standard message handlers */
 ZEND_API ZEND_INI_MH(OnUpdateBool);
 ZEND_API ZEND_INI_MH(OnUpdateInt);
+ZEND_API ZEND_INI_MH(OnUpdateLong);
 ZEND_API ZEND_INI_MH(OnUpdateReal);
 ZEND_API ZEND_INI_MH(OnUpdateString);
 ZEND_API ZEND_INI_MH(OnUpdateStringUnempty);
Index: ext/bz2/bz2.c
===================================================================
RCS file: /repository/php4/ext/bz2/bz2.c,v
retrieving revision 1.61
diff -u -r1.61 bz2.c
--- ext/bz2/bz2.c       5 Oct 2002 16:26:57 -0000       1.61
+++ ext/bz2/bz2.c       10 Nov 2002 03:46:13 -0000
@@ -253,7 +253,7 @@
 PHP_FUNCTION(bzread)
 {
        zval *bz;
-       int len = 1024;
+       long len = 1024;
        php_stream *stream;
 
        if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"r|l", &bz, &len)) {
Index: ext/dio/dio.c
===================================================================
RCS file: /repository/php4/ext/dio/dio.c,v
retrieving revision 1.21
diff -u -r1.21 dio.c
--- ext/dio/dio.c       3 Nov 2002 13:22:49 -0000       1.21
+++ ext/dio/dio.c       10 Nov 2002 03:46:13 -0000
@@ -144,7 +144,7 @@
        php_fd_t *f;
        char     *file_name;
        int       file_name_length;
-       int       flags;
+       long       flags;
        mode_t    mode = 0;
        int       fd;
 
@@ -176,7 +176,7 @@
        zval     *r_fd;
        php_fd_t *f;
        char     *data;
-       int       bytes = 1024;
+       long      bytes = 1024;
        ssize_t   res;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &r_fd,
&bytes) == FAILURE) {
Index: ext/domxml/php_domxml.c
===================================================================
RCS file: /repository/php4/ext/domxml/php_domxml.c,v
retrieving revision 1.218
diff -u -r1.218 php_domxml.c
--- ext/domxml/php_domxml.c     1 Nov 2002 10:06:10 -0000       1.218
+++ ext/domxml/php_domxml.c     10 Nov 2002 03:46:14 -0000
@@ -2042,7 +2042,8 @@
        zval *rv = NULL;
        zval *id;
        xmlNode *n, *node;
-       int ret, recursive = 0;;
+       int ret;
+       long recursive = 0;
 
        DOMXML_GET_THIS_OBJ(n, id, le_domxmlnodep);
 
Index: ext/fdf/fdf.c
===================================================================
RCS file: /repository/php4/ext/fdf/fdf.c,v
retrieving revision 1.66
diff -u -r1.66 fdf.c
--- ext/fdf/fdf.c       23 Oct 2002 01:11:06 -0000      1.66
+++ ext/fdf/fdf.c       10 Nov 2002 03:46:14 -0000
@@ -554,7 +554,8 @@
 PHP_FUNCTION(fdf_get_ap) {
        zval *r_fdf;
        char *fieldname, *filename;
-       int fieldname_len, filename_len, face;
+       int fieldname_len, filename_len;
+       long face;
        FDFDoc fdf;
        FDFErc err;
        FDFAppFace facenr;
@@ -941,7 +942,8 @@
 PHP_FUNCTION(fdf_get_flags) {
        zval *r_fdf;
        char *fieldname;
-       int fieldname_len, whichflags;
+       int fieldname_len;
+       long whichflags;
        FDFDoc fdf;
        FDFErc err;
        ASUns32 flags;
@@ -997,7 +999,8 @@
 PHP_FUNCTION(fdf_get_opt) {
        zval *r_fdf;
        char *fieldname;
-       int fieldname_len, element = -1;
+       int fieldname_len;
+       long element = -1;
        FDFDoc fdf;
        FDFErc err;
 
@@ -1410,12 +1413,12 @@
 PHP_FUNCTION(fdf_remove_item) {
        zval *r_fdf;
        char *fieldname;
-       int fieldname_len;
+       long fieldname_len;
        long item;
        FDFDoc fdf;
        FDFErc err;
        
-       if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsl", &r_fdf, 
+       if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &r_fdf, 
                                                         &fieldname, &fieldname_len
                                                         )
           == FAILURE) {
Index: ext/ftp/php_ftp.c
===================================================================
RCS file: /repository/php4/ext/ftp/php_ftp.c,v
retrieving revision 1.74
diff -u -r1.74 php_ftp.c
--- ext/ftp/php_ftp.c   3 Oct 2002 11:33:05 -0000       1.74
+++ ext/ftp/php_ftp.c   10 Nov 2002 03:46:14 -0000
@@ -145,7 +145,8 @@
 {
        ftpbuf_t        *ftp;
        char            *host;
-       int                     host_len, port = 0;
+       int                     host_len;
+       long            port = 0;
        long            timeout_sec = FTP_DEFAULT_TIMEOUT;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &host,
&host_len, &port, &timeout_sec) == FAILURE) {
@@ -181,7 +182,8 @@
 {
        ftpbuf_t        *ftp;
        char            *host;
-       int                     host_len, port = 0;
+       int                     host_len;
+       long            port = 0;
        long            timeout_sec = FTP_DEFAULT_TIMEOUT;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &host,
&host_len, &port, &timeout_sec) == FAILURE) {
@@ -468,7 +470,8 @@
        ftptype_t       xtype;
        php_stream      *stream;
        char            *file;
-       int                     file_len, mode, resumepos=0;
+       int                     file_len;
+       long            mode, resumepos=0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l",
&z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
                return;
@@ -511,7 +514,8 @@
        ftptype_t       xtype;
        php_stream      *stream;
        char            *file;
-       int                     file_len, mode, resumepos=0, ret;
+       int                     file_len, mode;
+       long            resumepos=0, ret;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l",
&z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
                return;
@@ -580,7 +584,8 @@
        ftptype_t       xtype;
        php_stream      *outstream;
        char            *local, *remote;
-       int                     local_len, remote_len, mode, resumepos=0;
+       int                     local_len, remote_len;
+       long            mode, resumepos=0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l",
&z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) ==
FAILURE) {
                return;
@@ -636,7 +641,8 @@
        ftptype_t       xtype;
        php_stream      *outstream;
        char            *local, *remote;
-       int                     local_len, remote_len, mode, resumepos=0, ret;
+       int                     local_len, remote_len, ret;
+       long            mode, resumepos=0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l",
&z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) ==
FAILURE) {
                return;
@@ -735,7 +741,8 @@
        zval            *z_ftp, *z_file;
        ftpbuf_t        *ftp;
        ftptype_t       xtype;
-       int                     mode, remote_len, startpos=0;
+       int                     remote_len;
+       long            mode, startpos=0;
        php_stream      *stream;
        char            *remote;
 
@@ -781,7 +788,8 @@
        zval            *z_ftp, *z_file;
        ftpbuf_t        *ftp;
        ftptype_t       xtype;
-       int                     mode, remote_len, startpos=0, ret;
+       int                     remote_len, ret;
+       long            mode, startpos=0;
        php_stream      *stream;
        char            *remote;
 
@@ -833,7 +841,8 @@
        ftpbuf_t        *ftp;
        ftptype_t       xtype;
        char            *remote, *local;
-       int                     remote_len, local_len, mode, startpos=0;
+       int                     remote_len, local_len;
+       long            mode, startpos=0;
        php_stream * instream;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l",
&z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) ==
FAILURE) {
@@ -887,7 +896,8 @@
        ftpbuf_t        *ftp;
        ftptype_t       xtype;
        char            *remote, *local;
-       int                     remote_len, local_len, mode, startpos=0, ret;
+       int                     remote_len, local_len, ret;
+       long            mode, startpos=0;
        php_stream * instream;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l",
&z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) ==
FAILURE) {
Index: ext/iconv/iconv.c
===================================================================
RCS file: /repository/php4/ext/iconv/iconv.c,v
retrieving revision 1.63
diff -u -r1.63 iconv.c
--- ext/iconv/iconv.c   6 Nov 2002 16:54:18 -0000       1.63
+++ ext/iconv/iconv.c   10 Nov 2002 03:46:14 -0000
@@ -383,7 +383,8 @@
        char *out_buffer, *content_type, *mimetype = NULL, *s;
        zval *zv_string;
        unsigned int out_len;
-       int status, mimetype_alloced  = 0;
+       long status;
+       int mimetype_alloced  = 0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl",
&zv_string, &status) == FAILURE)
                return;
Index: ext/ldap/ldap.c
===================================================================
RCS file: /repository/php4/ext/ldap/ldap.c,v
retrieving revision 1.130
diff -u -r1.130 ldap.c
--- ext/ldap/ldap.c     5 Nov 2002 14:18:20 -0000       1.130
+++ ext/ldap/ldap.c     10 Nov 2002 03:46:14 -0000
@@ -200,7 +200,7 @@
 /* {{{ PHP_INI_BEGIN
  */
 PHP_INI_BEGIN()
-       STD_PHP_INI_ENTRY_EX("ldap.max_links",          "-1",   PHP_INI_SYSTEM,        
         OnUpdateInt,            max_links,                      zend_ldap_globals,    
          ldap_globals,   display_link_numbers)
+       STD_PHP_INI_ENTRY_EX("ldap.max_links",          "-1",   PHP_INI_SYSTEM,        
+         OnUpdateLong,           max_links,                      zend_ldap_globals,   
+           ldap_globals,   display_link_numbers)
 PHP_INI_END()
 /* }}} */
 
@@ -288,7 +288,7 @@
        php_info_print_table_row(2, "LDAP Support", "enabled" );
        php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.130
2002/11/05 14:18:20 edink Exp $" );
 
-       if (LDAPG(max_links) == -1) {
+       if (LDAPG(max_links) < 0) {
                snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links));
        } else {
                snprintf(tmp, 31, "%ld/%ld", LDAPG(num_links), LDAPG(max_links));
@@ -345,11 +345,11 @@
 {
        char *host = NULL;
        int hostlen;
-       int port = 389; /* Default port */
+       long port = 389; /* Default port */
 #ifdef HAVE_ORALDAP
        char *wallet, *walletpasswd;
        int walletlen, walletpasswdlen;
-       int authmode;
+       long authmode;
        int ssl=0;
 #endif
        ldap_linkdata *ld;
@@ -373,7 +373,7 @@
        }
 #endif
 
-       if (LDAPG(max_links) != -1 && LDAPG(num_links) >= LDAPG(max_links))
{
+       if (LDAPG(max_links) > -1 && LDAPG(num_links) >= LDAPG(max_links)) {
                php_error(E_WARNING, "%s(): Too many open links (%d)",
get_active_function_name(TSRMLS_C), LDAPG(num_links));
                RETURN_FALSE;
        }
Index: ext/mbstring/mbstring.c
===================================================================
RCS file: /repository/php4/ext/mbstring/mbstring.c,v
retrieving revision 1.128
diff -u -r1.128 mbstring.c
--- ext/mbstring/mbstring.c     3 Nov 2002 08:50:43 -0000       1.128
+++ ext/mbstring/mbstring.c     10 Nov 2002 03:46:14 -0000
@@ -2568,7 +2568,7 @@
 PHP_FUNCTION(mb_convert_case)
 {
        char *str, *from_encoding =
(char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding));
-       long str_len, from_encoding_len;
+       int str_len, from_encoding_len;
        long case_mode = 0;
        char *newstr;
        size_t ret_len;
@@ -2592,7 +2592,7 @@
 PHP_FUNCTION(mb_strtoupper)
 {
        char *str, *from_encoding =
(char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding));
-       long str_len, from_encoding_len;
+       int str_len, from_encoding_len;
        char *newstr;
        size_t ret_len;
 
@@ -2615,7 +2615,7 @@
 PHP_FUNCTION(mb_strtolower)
 {
        char *str, *from_encoding =
(char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding));
-       long str_len, from_encoding_len;
+       int str_len, from_encoding_len;
        char *newstr;
        size_t ret_len;
 
Index: ext/mbstring/php_mbregex.c
===================================================================
RCS file: /repository/php4/ext/mbstring/php_mbregex.c,v
retrieving revision 1.18
diff -u -r1.18 php_mbregex.c
--- ext/mbstring/php_mbregex.c  2 Nov 2002 13:38:32 -0000       1.18
+++ ext/mbstring/php_mbregex.c  10 Nov 2002 03:46:14 -0000
@@ -595,7 +595,8 @@
        mb_regex_t re;
        struct mbre_registers regs = {0, 0, 0, 0};
        char *string;
-       int n, err, count, string_len, pos;
+       int n, err, string_len, pos;
+       long count;
 
        count = -1;
 
Index: ext/mysql/php_mysql.c
===================================================================
RCS file: /repository/php4/ext/mysql/php_mysql.c,v
retrieving revision 1.169
diff -u -r1.169 php_mysql.c
--- ext/mysql/php_mysql.c       24 Oct 2002 13:14:39 -0000      1.169
+++ ext/mysql/php_mysql.c       10 Nov 2002 03:46:14 -0000
@@ -349,15 +349,15 @@
 
 /* {{{ PHP_INI */
 PHP_INI_BEGIN()
-       STD_PHP_INI_BOOLEAN("mysql.allow_persistent",   "1",    PHP_INI_SYSTEM,        
 OnUpdateInt,            allow_persistent,       zend_mysql_globals,             
mysql_globals)
-       STD_PHP_INI_ENTRY_EX("mysql.max_persistent",    "-1",   PHP_INI_SYSTEM,        
 OnUpdateInt,            max_persistent,         zend_mysql_globals,             
mysql_globals,  display_link_numbers)
-       STD_PHP_INI_ENTRY_EX("mysql.max_links",                 "-1",   
PHP_INI_SYSTEM,         OnUpdateInt,            max_links,                      
zend_mysql_globals,             mysql_globals,  display_link_numbers)
+       STD_PHP_INI_BOOLEAN("mysql.allow_persistent",   "1",    PHP_INI_SYSTEM,        
+ OnUpdateLong,           allow_persistent,       zend_mysql_globals,             
+mysql_globals)
+       STD_PHP_INI_ENTRY_EX("mysql.max_persistent",    "-1",   PHP_INI_SYSTEM,        
+ OnUpdateLong,           max_persistent,         zend_mysql_globals,             
+mysql_globals,  display_link_numbers)
+       STD_PHP_INI_ENTRY_EX("mysql.max_links",                 "-1",   
+PHP_INI_SYSTEM,         OnUpdateLong,           max_links,                      
+zend_mysql_globals,             mysql_globals,  display_link_numbers)

        STD_PHP_INI_ENTRY("mysql.default_host",                 NULL,   PHP_INI_ALL,   
         OnUpdateString,         default_host,           zend_mysql_globals,           
  mysql_globals)

        STD_PHP_INI_ENTRY("mysql.default_user",                 NULL,   PHP_INI_ALL,   
         OnUpdateString,         default_user,           zend_mysql_globals,           
  mysql_globals)

        STD_PHP_INI_ENTRY("mysql.default_password",             NULL,   PHP_INI_ALL,   
         OnUpdateString,         default_password,       zend_mysql_globals,           
  mysql_globals)

        PHP_INI_ENTRY("mysql.default_port",                             NULL,   
PHP_INI_ALL,            OnMySQLPort)

        STD_PHP_INI_ENTRY("mysql.default_socket",               NULL,   PHP_INI_ALL,   
         OnUpdateStringUnempty,  default_socket, zend_mysql_globals,             
mysql_globals)
-       STD_PHP_INI_ENTRY_EX("mysql.connect_timeout",   "-1",   PHP_INI_SYSTEM,        
 OnUpdateInt,            connect_timeout,
        zend_mysql_globals,             mysql_globals, display_link_numbers)
+       STD_PHP_INI_ENTRY_EX("mysql.connect_timeout",   "-1",   PHP_INI_SYSTEM,        
+ OnUpdateLong,           connect_timeout,
        zend_mysql_globals,             mysql_globals, display_link_numbers)
 PHP_INI_END()
 /* }}} */
 
Index: ext/openssl/openssl.c
===================================================================
RCS file: /repository/php4/ext/openssl/openssl.c,v
retrieving revision 1.51
diff -u -r1.51 openssl.c
--- ext/openssl/openssl.c       10 Aug 2002 20:19:46 -0000      1.51
+++ ext/openssl/openssl.c       10 Nov 2002 03:46:14 -0000
@@ -692,7 +692,7 @@
        BIO * bio_out;
        long certresource;
        char * filename;
-       long filename_len;
+       int filename_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|b", &zcert,
&filename, &filename_len, &notext) == FAILURE)
                return;
@@ -972,7 +972,7 @@
        STACK_OF(X509) * untrustedchain = NULL;
        long purpose;
        char * untrusted = NULL;
-       long untrusted_len;
+       int untrusted_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl|a!s",
&zcert, &purpose, &zcainfo, &untrusted, &untrusted_len)
                        == FAILURE)
@@ -1305,7 +1305,7 @@
        X509_REQ * csr;
        zval * zcsr = NULL;
        zend_bool notext = 1;
-       char * filename = NULL; long filename_len;
+       char * filename = NULL; int filename_len;
        BIO * bio_out;
        long csr_resource;
 
@@ -1774,8 +1774,8 @@
 {
        struct php_x509_request req;
        zval * zpkey, * args = NULL;
-       char * passphrase = NULL; long passphrase_len = 0;
-       char * filename = NULL; long filename_len = 0;
+       char * passphrase = NULL; int passphrase_len = 0;
+       char * filename = NULL; int filename_len = 0;
        long key_resource = -1;
        EVP_PKEY * key;
        BIO * bio_out = NULL;
@@ -1826,7 +1826,7 @@
 {
        struct php_x509_request req;
        zval * zpkey, * args = NULL, *out;
-       char * passphrase = NULL; long passphrase_len = 0;
+       char * passphrase = NULL; int passphrase_len = 0;
        long key_resource = -1;
        EVP_PKEY * key;
        BIO * bio_out = NULL;
@@ -1918,7 +1918,7 @@
        zval *cert;
        EVP_PKEY *pkey;
        char * passphrase = "";
-       long passphrase_len;
+       int passphrase_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|s", &cert,
&passphrase, &passphrase_len) == FAILURE)
                return;
@@ -1948,9 +1948,9 @@
        PKCS7 * p7 = NULL;
        BIO * in = NULL, * datain = NULL;
        long flags = 0;
-       char * filename; long filename_len;
-       char * extracerts = NULL; long extracerts_len;
-       char * signersfilename = NULL; long signersfilename_len;
+       char * filename; int filename_len;
+       char * extracerts = NULL; int extracerts_len;
+       char * signersfilename = NULL; int signersfilename_len;
        
        RETVAL_LONG(-1);
 
@@ -2037,8 +2037,8 @@
        uint strindexlen;
        ulong intindex;
        char * strindex;
-       char * infilename = NULL;       long infilename_len;
-       char * outfilename = NULL;      long outfilename_len;
+       char * infilename = NULL;       int infilename_len;
+       char * outfilename = NULL;      int outfilename_len;
        
        RETVAL_FALSE;
 
@@ -2159,9 +2159,9 @@
        uint strindexlen;
        HashPosition hpos;
        char * strindex;
-       char * infilename;      long infilename_len;
-       char * outfilename;     long outfilename_len;
-       char * extracertsfilename = NULL; long extracertsfilename_len;
+       char * infilename;      int infilename_len;
+       char * outfilename;     int outfilename_len;
+       char * extracertsfilename = NULL; int extracertsfilename_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sszza!|ls",
                                &infilename, &infilename_len, &outfilename, 
&outfilename_len,
@@ -2255,8 +2255,8 @@
        long certresval, keyresval;
        BIO * in = NULL, * out = NULL, * datain = NULL;
        PKCS7 * p7 = NULL;
-       char * infilename;      long infilename_len;
-       char * outfilename;     long outfilename_len;
+       char * infilename;      int infilename_len;
+       char * outfilename;     int outfilename_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssz|z",
&infilename, &infilename_len,
                                &outfilename, &outfilename_len, &recipcert, &recipkey) 
==
FAILURE)
@@ -2318,7 +2318,8 @@
        int successful = 0;
        long keyresource = -1;
        char * data;
-       long data_len, padding = RSA_PKCS1_PADDING;
+       int data_len;
+       long  padding = RSA_PKCS1_PADDING;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &data,
&data_len, &crypted, &key, &padding) == FAILURE)
                return;
@@ -2376,7 +2377,7 @@
        long padding = RSA_PKCS1_PADDING;
        long keyresource = -1;
        char * data;
-       long data_len;
+       int data_len;
        
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &data,
&data_len, &crypted, &key, &padding) == FAILURE)
                return;
@@ -2440,7 +2441,7 @@
        long keyresource = -1;
        long padding = RSA_PKCS1_PADDING;
        char * data;
-       long data_len;
+       int data_len;
        
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &data,
&data_len, &crypted, &key, &padding) == FAILURE)
                return;
@@ -2498,7 +2499,7 @@
        long keyresource = -1;
        long padding = RSA_PKCS1_PADDING;
        char * data;
-       long data_len;
+       int data_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &data,
&data_len, &crypted, &key, &padding) == FAILURE)
                return;
@@ -2584,7 +2585,7 @@
        int siglen;
        unsigned char *sigbuf;
        long keyresource = -1;
-       char * data;    long data_len;
+       char * data;    int data_len;
        EVP_MD_CTX md_ctx;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz", &data,
&data_len, &signature, &key) == FAILURE)
@@ -2624,8 +2625,8 @@
        int err;
        EVP_MD_CTX     md_ctx;
        long keyresource = -1;
-       char * data;    long data_len;
-       char * signature;       long signature_len;
+       char * data;    int data_len;
+       char * signature;       int signature_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssz", &data,
&data_len,
                                &signature, &signature_len, &key) == FAILURE)
@@ -2659,7 +2660,7 @@
        long * key_resources;   /* so we know what to cleanup */
        int i, len1, len2, *eksl, nkeys;
        unsigned char *buf = NULL, **eks;
-       char * data;    long data_len;
+       char * data;    int data_len;
        EVP_CIPHER_CTX ctx;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szza/",
@@ -2787,8 +2788,8 @@
        unsigned char *buf;
        long keyresource = -1;
        EVP_CIPHER_CTX ctx;
-       char * data;    long data_len;
-       char * ekey;    long ekey_len;
+       char * data;    int data_len;
+       char * ekey;    int ekey_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szsz", &data,
&data_len,
                                &opendata, &ekey, &ekey_len, &privkey) == FAILURE)
Index: ext/sockets/sockets.c
===================================================================
RCS file: /repository/php4/ext/sockets/sockets.c,v
retrieving revision 1.125
diff -u -r1.125 sockets.c
--- ext/sockets/sockets.c       28 Oct 2002 03:05:04 -0000      1.125
+++ ext/sockets/sockets.c       10 Nov 2002 03:46:15 -0000
@@ -555,7 +555,8 @@
        struct timeval *tv_p = NULL;
        fd_set                  rfds, wfds, efds;
        SOCKET                  max_fd = 0;
-       int                             retval, sets = 0, usec = 0;
+       int                             retval, sets = 0;
+       long                    usec = 0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!a!z!|l",
&r_array, &w_array, &e_array, &sec, &usec) == FAILURE)
                return;
@@ -602,7 +603,7 @@
 PHP_FUNCTION(socket_create_listen)
 {
        php_socket      *php_sock;
-       int                     port, backlog = 128;
+       long                    port, backlog = 128;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &port,
&backlog) == FAILURE)
                return;
@@ -702,7 +703,7 @@
 {
        zval            *arg1;
        php_socket      *php_sock;
-       int                     backlog = 0;
+       long                    backlog = 0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1,
&backlog) == FAILURE)
                return;
@@ -739,7 +740,8 @@
 {
        zval            *arg1;
        php_socket      *php_sock;
-       int                     retval, str_len, length;
+       int                     retval, str_len;
+       long            length;
        char            *str;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1,
&str, &str_len, &length) == FAILURE)
@@ -776,7 +778,8 @@
        php_socket      *php_sock;
        read_func       read_function = (read_func) recv;
        char            *tmpbuf;
-       int                     retval, length, type = PHP_BINARY_READ;
+       int                     retval;
+       long            length, type = PHP_BINARY_READ;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &arg1,
&length, &type) == FAILURE)
                return;
@@ -922,7 +925,7 @@
    Creates an endpoint for communication in the domain specified by
domain, of type specified by type */
 PHP_FUNCTION(socket_create)
 {
-       int                     arg1, arg2, arg3;
+       long                    arg1, arg2, arg3;
        php_socket      *php_sock = (php_socket*)emalloc(sizeof(php_socket));
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &arg1,
&arg2, &arg3) == FAILURE) {
@@ -964,7 +967,8 @@
        struct sockaddr_in      sin;
        struct sockaddr_un      s_un;
        char                            *addr;
-       int                                     retval, addr_len, port;
+       int                                     retval, addr_len;
+       long                            port;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1,
&addr, &addr_len, &port) == FAILURE)
                return;
@@ -1014,7 +1018,7 @@
    Returns a string describing an error */
 PHP_FUNCTION(socket_strerror)
 {
-       int     arg1;
+       long    arg1;
        
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg1) ==
FAILURE)
                return;
@@ -1032,7 +1036,8 @@
        struct sockaddr                 *sock_type = (struct sockaddr*) &sa_storage;
        php_socket                              *php_sock;
        char                                    *addr;
-       int                                             addr_len, port = 0;
+       int                                             addr_len;
+       long                                    port = 0;
        long                                    retval = 0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1,
&addr, &addr_len, &port) == FAILURE)
@@ -1129,7 +1134,7 @@
 {
        zval                    *iovec_id;
        php_iovec_t             *vector;
-       unsigned int    iovec_position;
+       unsigned long   iovec_position;
        
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &iovec_id,
&iovec_position) == FAILURE)
                return;
@@ -1152,7 +1157,7 @@
        zval                    *iovec_id;
        php_iovec_t             *vector;
        int                             new_val_len;
-       unsigned int    iovec_position;
+       unsigned long   iovec_position;
        char                    *new_val;
        
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls",
&iovec_id, &iovec_position, &new_val, &new_val_len) == FAILURE)
@@ -1183,7 +1188,7 @@
        zval                    *iovec_id;
        php_iovec_t             *vector;
        struct iovec    *vector_array;
-       int                             iov_len;
+       long                            iov_len;
        
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &iovec_id,
&iov_len) == FAILURE)
                return;
@@ -1311,7 +1316,8 @@
        zval            *php_sock_res, *buf;
        char            *recv_buf;
        php_socket      *php_sock;
-       int                     retval, len, flags;
+       int                     retval;
+       long            len, flags;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzll",
&php_sock_res, &buf, &len, &flags) == FAILURE)
                return;
@@ -1352,7 +1358,8 @@
 {
        zval            *arg1;
        php_socket      *php_sock;
-       int                     buf_len, len, flags, retval;
+       int                     buf_len, retval;
+       long            len, flags;
        char            *buf;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsll", &arg1,
&buf, &buf_len, &len, &flags) == FAILURE)
@@ -1380,7 +1387,8 @@
        struct sockaddr_un      s_un;
        struct sockaddr_in      sin;
        socklen_t                       slen;
-       int                                     retval, arg3, arg4;
+       int                                     retval;
+       long                            arg3, arg4;
        char                            *recv_buf, *address;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzllz|z",
&arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE)
@@ -1456,7 +1464,8 @@
        php_socket                      *php_sock;
        struct sockaddr_un      s_un;
        struct sockaddr_in      sin;
-       int                                     retval, buf_len, len, flags, addr_len, 
port = 0;
+       int                                     retval, buf_len, addr_len;
+       long                            len, flags, port = 0;
        char                            *buf, *addr;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rslls|l",
&arg1, &buf, &buf_len, &len, &flags, &addr, &addr_len, &port) ==
FAILURE)
@@ -1664,7 +1673,8 @@
        struct sockaddr sa;
        char                    *addr;
        socklen_t               salen;
-       int                             flags, addr_len, port;
+       int                             addr_len;
+       long                    flags, port;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrls|l", &arg1,
&arg2, &flags, &addr, &addr_len, &port) == FAILURE)
                return;
@@ -1749,7 +1759,8 @@
        struct timeval          tv;
        socklen_t               optlen;
        php_socket              *php_sock;
-       int                             other_val, level, optname;
+       int                             other_val;
+       long                    level, optname;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &arg1,
&level, &optname) == FAILURE)
                return;
@@ -1812,7 +1823,8 @@
        struct linger   lv;
        struct timeval tv;
        php_socket              *php_sock;
-       int                             ov, optlen, retval, level, optname;
+       int                             ov, optlen, retval;
+       long                    level, optname;
        void                    *opt_ptr;
        
        HashTable               *opt_ht;
@@ -1904,7 +1916,7 @@
        zval            *retval[2], *fds_array_zval;
        php_socket      *php_sock[2];
        SOCKET          fds_array[2];
-       int                     domain, type, protocol;
+       long                    domain, type, protocol;
        
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lllz", &domain,
&type, &protocol, &fds_array_zval) == FAILURE)
                return;
@@ -1961,7 +1973,7 @@
 PHP_FUNCTION(socket_shutdown)
 {
        zval            *arg1;
-       int                     how_shutdown = 2;
+       long                    how_shutdown = 2;
        php_socket      *php_sock;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1,
&how_shutdown) == FAILURE)
Index: ext/standard/fsock.c
===================================================================
RCS file: /repository/php4/ext/standard/fsock.c,v
retrieving revision 1.106
diff -u -r1.106 fsock.c
--- ext/standard/fsock.c        24 Oct 2002 13:14:42 -0000      1.106
+++ ext/standard/fsock.c        10 Nov 2002 03:46:15 -0000
@@ -136,7 +136,7 @@
 {
        char *host;
        int host_len;
-       int port = -1;
+       long port = -1;
        zval *zerrno = NULL, *zerrstr = NULL;
        double timeout = FG(default_socket_timeout);
        unsigned long conv;
Index: ext/standard/html.c
===================================================================
RCS file: /repository/php4/ext/standard/html.c,v
retrieving revision 1.61
diff -u -r1.61 html.c
--- ext/standard/html.c 29 Oct 2002 15:05:07 -0000      1.61
+++ ext/standard/html.c 10 Nov 2002 03:46:15 -0000
@@ -818,7 +818,8 @@
 {
        char *str, *hint_charset = NULL;
        int str_len, hint_charset_len = 0;
-       int len, quote_style = ENT_COMPAT;
+       int len;
+       long quote_style = ENT_COMPAT;
        char *replaced;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str,
&str_len,
@@ -859,7 +860,8 @@
 PHP_FUNCTION(html_entity_decode)
 {
        char *str, *hint_charset = NULL;
-       int str_len, hint_charset_len, len, quote_style = ENT_COMPAT;
+       int str_len, hint_charset_len, len;
+       long quote_style = ENT_COMPAT;
        char *replaced;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str,
&str_len,
@@ -885,7 +887,7 @@
    Returns the internal translation table used by htmlspecialchars and
htmlentities */
 PHP_FUNCTION(get_html_translation_table)
 {
-       int which = HTML_SPECIALCHARS, quote_style = ENT_COMPAT;
+       long which = HTML_SPECIALCHARS, quote_style = ENT_COMPAT;
        int i, j;
        char ind[2];
        enum entity_charset charset = determine_charset(NULL TSRMLS_CC);
Index: ext/standard/metaphone.c
===================================================================
RCS file: /repository/php4/ext/standard/metaphone.c,v
retrieving revision 1.21
diff -u -r1.21 metaphone.c
--- ext/standard/metaphone.c    20 Mar 2002 08:17:06 -0000      1.21
+++ ext/standard/metaphone.c    10 Nov 2002 03:46:15 -0000
@@ -35,7 +35,8 @@
 {
        char *str;
        char *result = 0;
-       int phones = 0, str_len;
+       long phones = 0;
+       int str_len;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str,
&str_len,
                                                          &phones) == FAILURE) {
Index: ext/standard/string.c
===================================================================
RCS file: /repository/php4/ext/standard/string.c,v
retrieving revision 1.333
diff -u -r1.333 string.c
--- ext/standard/string.c       5 Nov 2002 13:52:11 -0000       1.333
+++ ext/standard/string.c       10 Nov 2002 03:46:15 -0000
@@ -202,7 +202,8 @@
 static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int
behavior)
 {
        char *s11, *s22;
-       long len1, len2, start, len;
+       int len1, len2;
+       long start, len;
        
        start = 0;
        len = 0;
@@ -1210,7 +1211,7 @@
        zval *tmp;
        char *path, *ret = NULL;
        int path_len;
-       int opt = PHP_PATHINFO_ALL;
+       long opt = PHP_PATHINFO_ALL;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path,
&path_len, &opt) == FAILURE) {
                return;
Index: ext/sysvsem/sysvsem.c
===================================================================
RCS file: /repository/php4/ext/sysvsem/sysvsem.c,v
retrieving revision 1.41
diff -u -r1.41 sysvsem.c
--- ext/sysvsem/sysvsem.c       27 Sep 2002 10:24:54 -0000      1.41
+++ ext/sysvsem/sysvsem.c       10 Nov 2002 03:46:15 -0000
@@ -161,7 +161,7 @@
    Return an id for the semaphore with the given key, and allow
max_acquire (default 1) processes to acquire it simultaneously */
 PHP_FUNCTION(sem_get)
 {
-       int key, max_acquire, perm, auto_release = 1;
+       long key, max_acquire, perm, auto_release = 1;
     int semid;
        struct sembuf sop[3];
        int count;
Index: ext/zip/zip.c
===================================================================
RCS file: /repository/php4/ext/zip/zip.c,v
retrieving revision 1.33
diff -u -r1.33 zip.c
--- ext/zip/zip.c       17 Oct 2002 04:42:22 -0000      1.33
+++ ext/zip/zip.c       10 Nov 2002 03:46:15 -0000
@@ -285,7 +285,7 @@
        zval             *zzip_ent;
        php_zzip_dirent  *entry = NULL;
        char             *buf   = NULL;
-       int               len   = 1024;
+       long              len   = 1024;
        int               ret   = 0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l",
&zzip_ent, &len) == FAILURE) {
Index: ext/zlib/zlib.c
===================================================================
RCS file: /repository/php4/ext/zlib/zlib.c,v
retrieving revision 1.153
diff -u -r1.153 zlib.c
--- ext/zlib/zlib.c     3 Nov 2002 20:31:00 -0000       1.153
+++ ext/zlib/zlib.c     10 Nov 2002 03:46:15 -0000
@@ -794,7 +794,7 @@
 {
        char *data, *s2;
        int data_len;
-       int level = Z_DEFAULT_COMPRESSION, coding = CODING_GZIP;
+       long level = Z_DEFAULT_COMPRESSION, coding = CODING_GZIP;
        int status;
        z_stream stream;
 
Index: main/output.c
===================================================================
RCS file: /repository/php4/main/output.c,v
retrieving revision 1.142
diff -u -r1.142 output.c
--- main/output.c       7 Oct 2002 11:21:06 -0000       1.142
+++ main/output.c       10 Nov 2002 03:46:15 -0000
@@ -713,7 +713,7 @@
 PHP_FUNCTION(ob_start)
 {
        zval *output_handler=NULL;
-       uint chunk_size=0;
+       ulong chunk_size=0;
        zend_bool erase=1;
        int argc = ZEND_NUM_ARGS();
        
Index: main/streams.c
===================================================================
RCS file: /repository/php4/main/streams.c,v
retrieving revision 1.124
diff -u -r1.124 streams.c
--- main/streams.c      6 Nov 2002 00:15:24 -0000       1.124
+++ main/streams.c      10 Nov 2002 03:46:15 -0000
@@ -1420,7 +1420,7 @@
                        }
                        if (ret) {
                                fflush(data->file);
-                               *ret = (void*)fd;
+                               *(int*)ret = fd;
                        }
                        return SUCCESS;
                default:


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

[2002-11-09 21:51:55] [EMAIL PROTECTED]

Furthermore, there are some show-stoppers with OnUpdateInt and
zend_parse_parameters.

The LDAP module specifies longs rather than ints for its globals that
are being set via the INI mechanism. Same for some of the database
exts. To cope with this, I now have both OnUpdateInt and OnUpdateLong
into zend_ini.[ch].

Some potential affected files are:
php_ldap.h php_fbsql.h php_informix.h php_ii.h php_interbase.h
php_mssql.h php_mysql.h php_sybase_ct.h

However, in the case of the LDAP problem, there was some comparison
logic at 'fault', too. In ldap.c there was logic that said 'if x == -1,
then y is unlimited, otherwise actual y must be less than x'. This
fails (does not work and does not produce a warning) if x is < -1.
Other parts of ldap.c do use 'if x > -1' rather than 'if x == -1'. One
actualy advantage of the 'error' is that it did at least cause the
module to output a message along the lines of 'already have the maximum
of 0 connections open', which is an obvious sign that there's problem.

Also, for some reason configure doesn't add -lldap to LIBS for me, no
matter what combination of libtool/autoconf/automake I have used with
PHP 4.3*.

And now...it gets worse. There are heaps of instances where
zend_parse_parameters has been used to assign to ints instead of longs
(the documentation seems to say 'l' is for long, so people should be
assigning to longs, right?). BUT, for example, in php4/ext/dio/dio.c
the assignment is to type mode_t (rather than obviously int or long).
So it's a bit messy, but I basically changed int occurrences to longs
for make PHP work for me. There are some files like mcrypt.c where I
didn't even attempt it (even though I do use mcrypt so I'll have to
have it fixed sometime, if it needs fixing). Looks like all use of
zend_parse_parameters needs to be reviewed for type safety.

Also, there seems to be a bug in php4/ext/fdf/fdf.c's fdf_remove_item
(see what is passes to zend_parse_parameters, below).

Patches that made PHP stop crashing for the time being:

Index: ext/ldap/ldap.c
===================================================================
RCS file: /repository/php4/ext/ldap/ldap.c,v
retrieving revision 1.130
diff -u -r1.130 ldap.c
--- ext/ldap/ldap.c     5 Nov 2002 14:18:20 -0000       1.130
+++ ext/ldap/ldap.c     10 Nov 2002 03:46:14 -0000
@@ -200,7 +200,7 @@
 /* {{{ PHP_INI_BEGIN
  */
 PHP_INI_BEGIN()
-       STD_PHP_INI_ENTRY_EX("ldap.max_links",          "-1",   PHP_INI_SYSTEM,        
         OnUpdateInt,            max_links,                      zend_ldap_globals,    
          ldap_globals,   display_link_numbers)
+       STD_PHP_INI_ENTRY_EX("ldap.max_links",          "-1",   PHP_INI_SYSTEM,        
+         OnUpdateLong,           max_links,                      zend_ldap_globals,   
+           ldap_globals,   display_link_numbers)
 PHP_INI_END()
 /* }}} */
 
@@ -288,7 +288,7 @@
        php_info_print_table_row(2, "LDAP Support", "enabled" );
        php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.130
2002/11/05 14:18:20 edink Exp $" );
 
-       if (LDAPG(max_links) == -1) {
+       if (LDAPG(max_links) < 0) {
                snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links));
        } else {
                snprintf(tmp, 31, "%ld/%ld", LDAPG(num_links), LDAPG(max_links));
@@ -345,11 +345,11 @@
 {
        char *host = NULL;
        int hostlen;
-       int port = 389; /* Default port */
+       long port = 389; /* Default port */
 #ifdef HAVE_ORALDAP
        char *wallet, *walletpasswd;
        int walletlen, walletpasswdlen;
-       int authmode;
+       long authmode;
        int ssl=0;
 #endif
        ldap_linkdata *ld;
@@ -373,7 +373,7 @@
        }
 #endif
 
-       if (LDAPG(max_links) != -1 && LDAPG(num_links) >= LDAPG(max_links))
{
+       if (LDAPG(max_links) > -1 && LDAPG(num_links) >= LDAPG(max_links)) {
                php_error(E_WARNING, "%s(): Too many open links (%d)",
get_active_function_name(TSRMLS_C), LDAPG(num_links));
                RETURN_FALSE;
        }

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

[2002-11-07 03:20:33] [EMAIL PROTECTED]

Hi,

I found this same problem under Solaris 8 using PHP 4.3.0pre2. For me,
this is due to 64-bit uncleanliness.

Since the CLI is required during PEAR installation, I did get an
obvious interruption to `make install`. Therefore, `make install` is
the "litmus test" I used to find the following three problems.

(1) One problem seems to be an inconsistency between Zend and PHP.
There are many 'globals' structs in PHP that specify int storage for
configuration values, along with the OnUpdateInt callback. However,
Zend defines OnUpdateInt to operate on longs. OnUpdateINT sounds like a
misnomer for something that works with longs. Also, OnUpdateInt uses
zend_atoi, which returns an int type, not long. So perhaps it really is
a Zend problem. This matters (e.g. on LP64 platforms) where
sizeof(int)!=sizeof(long).

I changed OnUpdateInt in zend_ini.c by modifying p from long* to int*
and loading of config now works fine for me.

--- Zend/zend_ini.c     2002-09-23 20:00:39.000000000 +0800
+++ Zend/zend_ini.c     2002-11-07 15:16:29.521055000 +0800
@@ -429,18 +429,18 @@
 
 
 ZEND_API ZEND_INI_MH(OnUpdateInt)
 {
-       long *p;
+       int *p;
 #ifndef ZTS
        char *base = (char *) mh_arg2;
 #else
        char *base;
 
        base = (char *) ts_resource(*((int *) mh_arg2));
 #endif
 
-       p = (long *) (base+(size_t) mh_arg1);
+       p = (int *) (base+(size_t) mh_arg1);
 
        *p = zend_atoi(new_value, new_value_length);
        return SUCCESS;
 }

(2) Another problem shown in this pstack during PEAR installation:
100114084 php_stdiop_cast (ffffffff, 3, 7fff6734, 100114040, 100113fa0,
1005e2388) + 44
100114790 _php_stream_cast (1005e2388, 1, 7fff6734, 1, 2, 2) + 1b0
10009a95c zif_flock (2, 1005de668, 0, 1, 7fff75b0, 10009a8e0) + 7c
100146af8 execute (100343728, 7fff7dd0, 100338c50, 7fff7eb8, 1002cf700,
100343728) + 2278
100146870 execute (10057e6c8, 7fff8430, a8, 7fff84e0, 1002cf700,
10057e6c8) + 1ff0
100146870 execute (1003434a8, 7fff9a80, 7e0, 7fffa268, 1002cf700,
1003434a8) + 1ff0
100146870 execute (100536a58, 7fffa540, 100338c18, 7fffb5e8, 1002cf700,
100536a58) + 1ff0
100146870 execute (10033fae8, 100144880, 10011dd80, 1, 0, 0) + 1ff0
100137700 zend_execute_scripts (8, 0, 3, 7ffff7c0, 1002cf700, 7fffd818)
+ e0
100109114 php_execute_script (0, 1002cf700, 10033f528, 0, 2f, 2d) +
1d4
10014bcf0 main (0, 7ffff8b8, 7ffff8e8, 1002c9990, 100000000, 0) + 910
100021abc _start (0, 0, 0, 0, 0, 0) + 7c

(Note that I have actually trimmed the address widths down for
readability, though the stack itself is unmodified.)

`truss` indicated that the value of third argument ("ret") to
main/stream.c's php_stdiop_cast was an unusable address. That is also
the third argument to _php_stream_cast. So, we're zif_flock, expanded
from PHP_FUNCTION(flock) in ext/standard/file.[ch].  Now, fd is an int
and its address is passed as a void**. So php_stdiop_cast dereferences
it to a void* and then to store the int value, it is cast as (void*) to
be compatible at compile time. Since sizeof(int)!=sizeof(void*), we
have a problem. So I cast the point as an int* instead.

--- streams.c   2002-10-24 21:14:47.000000000 +0800
+++ streams.c   2002-11-07 17:10:27.015969000 +0800
@@ -1401,7 +1401,7 @@
                        }
                        if (ret) {
                                fflush(data->file);
-                               *ret = (void*)fd;
+                               *(int*)ret = fd;
                        }
                        return SUCCESS;
                default:

(3) Guess what. Argh. Now in php_strspn part of
./ext/standard/string.c. The last two arguments are bogus (we do have
less than 6 TB of RAM in this machine). Hmmm. zend_parse_parameters
returns junk into len1 and len2. Chapter 33 of the manual seems to
indicate that string length is returned as an int (and in zend_API.c
that does seem to be the case) so this was a bug in string.c. But this
is a bit odd, since zend_parse_parameters has 'l' for electing a long
argument but not an int argument. So there is this mixture of integer
lengths around. I knew nothing about Zend until today so I don't know
what supposed to happen here, simply that this is a way that made it
work for me:

--- string.c    2002-10-26 04:09:53.000000000 +0800
+++ string.c    2002-11-07 17:11:18.988027000 +0800
@@ -202,7 +202,8 @@
 static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int
behavior)
 {
        char *s11, *s22;
-       long len1, len2, start, len;
+       int len1, len2;
+       long start, len;
        
        start = 0;
        len = 0;

Although I have applied (1), (2), and (3) and found that PHP now
functions (in the five minutes since the compile finished and when I
wrote this message, at least), there could be similar timebombs lurking
inside if the motifs such as (2) are present in other locations.

--end--

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

[2002-11-05 16:29:21] [EMAIL PROTECTED]

The CVS version (and the 4.3.0pre2 version, same error and backtrace)
core dumps on startup with this error:

Bus Error (core dumped)

My configure:

CFLAGS="-g -m64" ./configure --with-apache=../apache_1.3.27  --with-xml
--with-oci8=/usr/local/oracle/OraHome --with-zlib
--enable-inline-optimization --enable-bcmath --enable-debug
--with-curl

Here is the backtrace:

bash-2.05# gdb /usr/local/bin/php ,/core
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "sparc-sun-solaris2.9"...
/export/home/bdabney/php4/,/core: No such file or directory.
(gdb) quit
bash-2.05# gdb /usr/local/bin/php ./core 
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "sparc-sun-solaris2.9"...
Core was generated by `/export/home/bdabney/php4/sapi/cli/php -d
safe_mode=0 -d open_basedir= /export/'.
Program terminated with signal 10, Bus error.
Reading symbols from /usr/lib/64/libz.so.1...done.
Loaded symbols for /usr/lib/64/libz.so.1
Reading symbols from /usr/lib/64/libdl.so.1...done.
Loaded symbols for /usr/lib/64/libdl.so.1
Reading symbols from /usr/lib/64/libsocket.so.1...done.
Loaded symbols for /usr/lib/64/libsocket.so.1
Reading symbols from /usr/lib/64/libnsl.so.1...done.
Loaded symbols for /usr/lib/64/libnsl.so.1
Reading symbols from /usr/lib/64/libcrypt_i.so.1...done.
Loaded symbols for /usr/lib/64/libcrypt_i.so.1
Reading symbols from /usr/lib/64/libresolv.so.2...done.
Loaded symbols for /usr/lib/64/libresolv.so.2
Reading symbols from /usr/lib/64/libm.so.1...done.
Loaded symbols for /usr/lib/64/libm.so.1
Reading symbols from /usr/local/lib/libcurl.so.2...done.
Loaded symbols for /usr/local/lib/libcurl.so.2
Reading symbols from /usr/lib/64/libgen.so.1...done.
Loaded symbols for /usr/lib/64/libgen.so.1
Reading symbols from
/usr/local/oracle/OraHome/lib/libclntsh.so.9.0...done.
Loaded symbols for /usr/local/oracle/OraHome/lib/libclntsh.so.9.0
Reading symbols from /usr/lib/64/libc.so.1...done.
Loaded symbols for /usr/lib/64/libc.so.1
Reading symbols from /usr/lib/64/libmp.so.2...done.
Loaded symbols for /usr/lib/64/libmp.so.2
Reading symbols from /usr/local/oracle/OraHome/lib/libwtc9.so...done.
Loaded symbols for /usr/local/oracle/OraHome/lib/libwtc9.so
---Type <return> to continue, or q <return> to quit---
Reading symbols from /usr/lib/64/libaio.so.1...done.
Loaded symbols for /usr/lib/64/libaio.so.1
Reading symbols from /usr/lib/64/librt.so.1...done.
Loaded symbols for /usr/lib/64/librt.so.1
Reading symbols from /usr/lib/64/libmd5.so.1...done.
Loaded symbols for /usr/lib/64/libmd5.so.1
Reading symbols from
/usr/platform/SUNW,Sun-Blade-100/lib/sparcv9/libc_psr.so.1...done.
Loaded symbols for
/usr/platform/SUNW,Sun-Blade-100/lib/sparcv9/libc_psr.so.1
#0  0x100265bd0 in OnUpdateInt (entry=0x100407fb0, 
    new_value=0x1002ad390 "1024", new_value_length=4, mh_arg1=0x4c, 
    mh_arg2=0x1003f2e50, mh_arg3=0x0, stage=1)
    at /export/home/bdabney/php4/Zend/zend_ini.c:444
444             *p = zend_atoi(new_value, new_value_length);
(gdb) bt
#0  0x100265bd0 in OnUpdateInt (entry=0x100407fb0, 
    new_value=0x1002ad390 "1024", new_value_length=4, mh_arg1=0x4c, 
    mh_arg2=0x1003f2e50, mh_arg3=0x0, stage=1)
    at /export/home/bdabney/php4/Zend/zend_ini.c:444
#1  0x100264cbc in zend_register_ini_entries (ini_entry=0x1003ec008, 
    module_number=0) at /export/home/bdabney/php4/Zend/zend_ini.c:157
#2  0x1001ea968 in php_module_startup (sf=0x1003f1e00,
additional_modules=0x0, 
    num_additional_modules=0) at
/export/home/bdabney/php4/main/main.c:1068
#3  0x10027644c in main (argc=9, argv=0xffffffff7ffffad8)
    at /export/home/bdabney/php4/sapi/cli/php_cli.c:443
(gdb)

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


-- 
Edit this bug report at http://bugs.php.net/?id=20268&edit=1

Reply via email to