johannes                Tue Feb 12 20:43:42 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/mysql  php_mysql.c 
  Log:
  - MFH: Make clear what's going on and avoid overwriting parameters
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/php_mysql.c?r1=1.213.2.6.2.16.2.9&r2=1.213.2.6.2.16.2.10&diff_format=u
Index: php-src/ext/mysql/php_mysql.c
diff -u php-src/ext/mysql/php_mysql.c:1.213.2.6.2.16.2.9 
php-src/ext/mysql/php_mysql.c:1.213.2.6.2.16.2.10
--- php-src/ext/mysql/php_mysql.c:1.213.2.6.2.16.2.9    Tue Feb 12 10:11:55 2008
+++ php-src/ext/mysql/php_mysql.c       Tue Feb 12 20:43:42 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
  
-/* $Id: php_mysql.c,v 1.213.2.6.2.16.2.9 2008/02/12 10:11:55 felipe Exp $ */
+/* $Id: php_mysql.c,v 1.213.2.6.2.16.2.10 2008/02/12 20:43:42 johannes Exp $ */
 
 /* TODO:
  *
@@ -643,10 +643,19 @@
                hashed_details_length = spprintf(&hashed_details, 0, 
"mysql__%s_", user);
                client_flags = CLIENT_INTERACTIVE;
        } else {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"|s!s!s!bl", &host_and_port, &host_len,
-                                                                       &user, 
&user_len, &passwd, &passwd_len, 
-                                                                       
&new_link, &client_flags)==FAILURE) {
-                       return;
+               /* mysql_pconnect does not support new_link parameter */
+               if (persistent) {
+                       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"|s!s!s!l", &host_and_port, &host_len,
+                                                                       &user, 
&user_len, &passwd, &passwd_len,
+                                                                       
&client_flags)==FAILURE) {
+                               return;
+               }
+               } else {
+                       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"|s!s!s!bl", &host_and_port, &host_len,
+                                                                               
&user, &user_len, &passwd, &passwd_len, 
+                                                                               
&new_link, &client_flags)==FAILURE) {
+                               return;
+                       }
                }
 
                if (!host_and_port) {
@@ -659,11 +668,6 @@
                        passwd = MySG(default_password);
                }
 
-               /* mysql_pconnect does not support new_link parameter */
-               if (persistent) {
-                       client_flags= new_link;
-               }
-
                /* disable local infile option for open_basedir */
                if (((PG(open_basedir) && PG(open_basedir)[0] != '\0') || 
PG(safe_mode)) && (client_flags & CLIENT_LOCAL_FILES)) {
                        client_flags ^= CLIENT_LOCAL_FILES;

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

Reply via email to