iliaa           Tue Oct  7 14:35:04 2008 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src    NEWS 
    /php-src/ext/openssl        xp_ssl.c 
    /php-src/ext/xmlwriter      php_xmlwriter.c 
    /php-src/ext/pgsql  pgsql.c 
  Log:
  MFB:
   Fixed bug #46042 (memory leaks with reflection of mb_convert_encoding())
   Fixed bug #46110 (XMLWriter - openmemory() and openuri() leak memory on
    multiple calls).
   Fixed bug #46206 (pg_query_params/pg_execute convert passed values to
    strings).
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1243&r2=1.2027.2.547.2.1244&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1243 php-src/NEWS:1.2027.2.547.2.1244
--- php-src/NEWS:1.2027.2.547.2.1243    Mon Oct  6 15:11:43 2008
+++ php-src/NEWS        Tue Oct  7 14:35:03 2008
@@ -20,11 +20,15 @@
   (Christian Seiler)
 - Fixed bug #46215 (json_encode mutates its parameter and has some 
   class-specific state). (Felipe)
+- Fixed bug #46206 (pg_query_params/pg_execute convert passed values to
+  strings). (Ilia)
 - Fixed bug #46191 (BC break: DOMDocument saveXML() doesn't accept null). (Rob)
 - Fixed bug #46164 (stream_filter_remove() closes the stream). (Arnaud)
 - Fixed bug #46157 (PDOStatement::fetchObject prototype error). (Felipe)
 - Fixed bug #46147 (after stream seek, appending stream filter reads 
   incorrect data). (Greg)
+- Fixed bug #46110 (XMLWriter - openmemory() and openuri() leak memory on
+  multiple calls). (Ilia)
 - Fixed bug #46088 (RegexIterator::accept - segfault). (Felipe)
 - Fixed bug #46059 (Compile failure under IRIX 6.5.30 building posix.c). 
   (Arnaud)
@@ -77,6 +81,7 @@
 - Fixed bug #45405 (snmp extension memory leak). (Federico Cuello, Rodrigo
   Campos)
 - Fixed bug #45392 (ob_start()/ob_end_clean() and memory_limit). (Arnaud)
+- Fixed bug #45382 (timeout bug in stream_socket_enable_crypto). (Ilia)
 - Fixed bug #45373 (php crash on query with errors in params). (Felipe)
 - Fixed bug #45352 (Segmentation fault because of tick function on second
   request). (Dmitry)
http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.22.2.3.2.12&r2=1.22.2.3.2.13&diff_format=u
Index: php-src/ext/openssl/xp_ssl.c
diff -u php-src/ext/openssl/xp_ssl.c:1.22.2.3.2.12 
php-src/ext/openssl/xp_ssl.c:1.22.2.3.2.13
--- php-src/ext/openssl/xp_ssl.c:1.22.2.3.2.12  Wed May  7 20:01:56 2008
+++ php-src/ext/openssl/xp_ssl.c        Tue Oct  7 14:35:04 2008
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: xp_ssl.c,v 1.22.2.3.2.12 2008/05/07 20:01:56 bjori Exp $ */
+/* $Id: xp_ssl.c,v 1.22.2.3.2.13 2008/10/07 14:35:04 iliaa Exp $ */
 
 #include "php.h"
 #include "ext/standard/file.h"
@@ -417,7 +417,7 @@
                                n = SSL_connect(sslsock->ssl_handle);
                                gettimeofday(&tve, &tz);
 
-                               timeout -= (tve.tv_sec + tve.tv_usec / 1000000) 
- (tvs.tv_sec + tvs.tv_usec / 1000000);
+                               timeout -= (tve.tv_sec + (float) tve.tv_usec / 
1000000) - (tvs.tv_sec + (float) tvs.tv_usec / 1000000);
                                if (timeout < 0) {
                                        php_error_docref(NULL TSRMLS_CC, 
E_WARNING, "SSL: connection timeout");
                                        return -1;
http://cvs.php.net/viewvc.cgi/php-src/ext/xmlwriter/php_xmlwriter.c?r1=1.20.2.12.2.17&r2=1.20.2.12.2.18&diff_format=u
Index: php-src/ext/xmlwriter/php_xmlwriter.c
diff -u php-src/ext/xmlwriter/php_xmlwriter.c:1.20.2.12.2.17 
php-src/ext/xmlwriter/php_xmlwriter.c:1.20.2.12.2.18
--- php-src/ext/xmlwriter/php_xmlwriter.c:1.20.2.12.2.17        Mon Dec 31 
07:20:14 2007
+++ php-src/ext/xmlwriter/php_xmlwriter.c       Tue Oct  7 14:35:04 2008
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: php_xmlwriter.c,v 1.20.2.12.2.17 2007/12/31 07:20:14 sebastian Exp $ */
+/* $Id: php_xmlwriter.c,v 1.20.2.12.2.18 2008/10/07 14:35:04 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1483,6 +1483,9 @@
        intern->uri_output = out_buffer;
 #else
        if (this) {
+               if (ze_obj->xmlwriter_ptr) {
+                       xmlwriter_free_resource_ptr(ze_obj->xmlwriter_ptr 
TSRMLS_CC);
+               }
                ze_obj->xmlwriter_ptr = intern;
                RETURN_TRUE;
        } else
@@ -1533,6 +1536,9 @@
        intern->uri_output = NULL;
 #else
        if (this) {
+               if (ze_obj->xmlwriter_ptr) {
+                       xmlwriter_free_resource_ptr(ze_obj->xmlwriter_ptr 
TSRMLS_CC);
+               }
                ze_obj->xmlwriter_ptr = intern;
                RETURN_TRUE;
        } else
http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.28&r2=1.331.2.13.2.29&diff_format=u
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.28 
php-src/ext/pgsql/pgsql.c:1.331.2.13.2.29
--- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.28   Mon May 19 15:18:39 2008
+++ php-src/ext/pgsql/pgsql.c   Tue Oct  7 14:35:04 2008
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
  
-/* $Id: pgsql.c,v 1.331.2.13.2.28 2008/05/19 15:18:39 iliaa Exp $ */
+/* $Id: pgsql.c,v 1.331.2.13.2.29 2008/10/07 14:35:04 iliaa Exp $ */
 
 #include <stdlib.h>
 
@@ -1199,6 +1199,10 @@
 static void _php_pgsql_free_params(char **params, int num_params)
 {
        if (num_params > 0) {
+               int i;
+               for (i = 0; i < num_params; i++) {
+                       efree(params[i]);
+               }
                efree(params);
        }
 }
@@ -1216,7 +1220,6 @@
        int leftover = 0;
        int num_params = 0;
        char **params = NULL;
-       unsigned char otype;
        PGconn *pgsql;
        PGresult *pgsql_result;
        ExecStatusType status;
@@ -1276,19 +1279,20 @@
                                RETURN_FALSE;
                        }
 
-                       otype = (*tmp)->type;
-                       convert_to_string_ex(tmp);
-                       if (Z_TYPE_PP(tmp) != IS_STRING) {
-                               php_error_docref(NULL TSRMLS_CC, 
E_WARNING,"Error converting parameter");
-                               _php_pgsql_free_params(params, num_params);
-                               RETURN_FALSE;
-                       }
-
-                       if (otype == IS_NULL) {
+                       if (Z_TYPE_PP(tmp) == IS_NULL) {
                                params[i] = NULL;
-                       }
-                       else {
-                               params[i] = Z_STRVAL_PP(tmp);
+                       } else {
+                               zval tmp_val = **tmp;
+                               zval_copy_ctor(&tmp_val);
+                               convert_to_string(&tmp_val);
+                               if (Z_TYPE(tmp_val) != IS_STRING) {
+                                       php_error_docref(NULL TSRMLS_CC, 
E_WARNING,"Error converting parameter");
+                                       zval_dtor(&tmp_val);
+                                       _php_pgsql_free_params(params, 
num_params);
+                                       RETURN_FALSE;
+                               }
+                               params[i] = estrndup(Z_STRVAL(tmp_val), 
Z_STRLEN(tmp_val));
+                               zval_dtor(&tmp_val);
                        }
 
                        zend_hash_move_forward(Z_ARRVAL_PP(pv_param_arr));
@@ -1439,7 +1443,6 @@
        int leftover = 0;
        int num_params = 0;
        char **params = NULL;
-       unsigned char otype;
        PGconn *pgsql;
        PGresult *pgsql_result;
        ExecStatusType status;
@@ -1500,19 +1503,20 @@
                                RETURN_FALSE;
                        }
 
-                       otype = (*tmp)->type;
-                       SEPARATE_ZVAL(tmp);
-                       convert_to_string_ex(tmp);
-                       if (Z_TYPE_PP(tmp) != IS_STRING) {
-                               php_error_docref(NULL TSRMLS_CC, 
E_WARNING,"Error converting parameter");
-                               _php_pgsql_free_params(params, num_params);
-                               RETURN_FALSE;
-                       }
-
-                       if (otype == IS_NULL) {
+                       if (Z_TYPE_PP(tmp) == IS_NULL) {
                                params[i] = NULL;
                        } else {
-                               params[i] = Z_STRVAL_PP(tmp);
+                               zval tmp_val = **tmp;
+                               zval_copy_ctor(&tmp_val);
+                               convert_to_string(&tmp_val);
+                               if (Z_TYPE(tmp_val) != IS_STRING) {
+                                       php_error_docref(NULL TSRMLS_CC, 
E_WARNING,"Error converting parameter");
+                                       zval_dtor(&tmp_val);
+                                       _php_pgsql_free_params(params, 
num_params);
+                                       RETURN_FALSE;
+                               }
+                               params[i] = estrndup(Z_STRVAL(tmp_val), 
Z_STRLEN(tmp_val));
+                               zval_dtor(&tmp_val);
                        }
 
                        zend_hash_move_forward(Z_ARRVAL_PP(pv_param_arr));
@@ -4048,7 +4052,6 @@
        zval **pv_param_arr, **tmp;
        int num_params = 0;
        char **params = NULL;
-       unsigned char otype;
        zval **query;
        int id = -1;
        PGconn *pgsql;
@@ -4097,20 +4100,20 @@
                                RETURN_FALSE;
                        }
 
-                       otype = (*tmp)->type;
-                       SEPARATE_ZVAL(tmp);
-                       convert_to_string_ex(tmp);
-                       if (Z_TYPE_PP(tmp) != IS_STRING) {
-                               php_error_docref(NULL TSRMLS_CC, 
E_WARNING,"Error converting parameter");
-                               _php_pgsql_free_params(params, num_params);
-                               RETURN_FALSE;
-                       }
-
-                       if (otype == IS_NULL) {
+                       if (Z_TYPE_PP(tmp) == IS_NULL) {
                                params[i] = NULL;
-                       }
-                       else {
-                               params[i] = Z_STRVAL_PP(tmp);
+                       } else {
+                               zval tmp_val = **tmp;
+                               zval_copy_ctor(&tmp_val);
+                               convert_to_string(&tmp_val);
+                               if (Z_TYPE(tmp_val) != IS_STRING) {
+                                       php_error_docref(NULL TSRMLS_CC, 
E_WARNING,"Error converting parameter");
+                                       zval_dtor(&tmp_val);
+                                       _php_pgsql_free_params(params, 
num_params);
+                                       RETURN_FALSE;
+                               }
+                               params[i] = estrndup(Z_STRVAL(tmp_val), 
Z_STRLEN(tmp_val));
+                               zval_dtor(&tmp_val);
                        }
 
                        zend_hash_move_forward(Z_ARRVAL_PP(pv_param_arr));
@@ -4194,7 +4197,6 @@
        zval **pv_param_arr, **tmp;
        int num_params = 0;
        char **params = NULL;
-       unsigned char otype;
        zval **stmtname;
        int id = -1;
        PGconn *pgsql;
@@ -4241,19 +4243,20 @@
                                RETURN_FALSE;
                        }
 
-                       otype = (*tmp)->type;
-                       convert_to_string(*tmp);
-                       if (Z_TYPE_PP(tmp) != IS_STRING) {
-                               php_error_docref(NULL TSRMLS_CC, 
E_WARNING,"Error converting parameter");
-                               _php_pgsql_free_params(params, num_params);
-                               RETURN_FALSE;
-                       }
-
-                       if (otype == IS_NULL) {
+                       if (Z_TYPE_PP(tmp) == IS_NULL) {
                                params[i] = NULL;
-                       }
-                       else {
-                               params[i] = Z_STRVAL_PP(tmp);
+                       } else {
+                               zval tmp_val = **tmp;
+                               zval_copy_ctor(&tmp_val);
+                               convert_to_string(&tmp_val);
+                               if (Z_TYPE(tmp_val) != IS_STRING) {
+                                       php_error_docref(NULL TSRMLS_CC, 
E_WARNING,"Error converting parameter");
+                                       zval_dtor(&tmp_val);
+                                       _php_pgsql_free_params(params, 
num_params);
+                                       RETURN_FALSE;
+                               }
+                               params[i] = estrndup(Z_STRVAL(tmp_val), 
Z_STRLEN(tmp_val));
+                               zval_dtor(&tmp_val);
                        }
 
                        zend_hash_move_forward(Z_ARRVAL_PP(pv_param_arr));

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to