laruence                                 Wed, 24 Aug 2011 08:00:23 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=315410

Log:
Apply r315270 to 5.3
Fixed test script failed when host mysql doesn't listen on 3306
Fxied test script failed due to mysql_pconnect trigger a warning

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysql/tests/bug55473.phpt
    U   php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_pconn_kill.phpt
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c

Modified: php/php-src/branches/PHP_5_3/ext/mysql/tests/bug55473.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysql/tests/bug55473.phpt  2011-08-24 
07:29:23 UTC (rev 315409)
+++ php/php-src/branches/PHP_5_3/ext/mysql/tests/bug55473.phpt  2011-08-24 
08:00:23 UTC (rev 315410)
@@ -15,6 +15,11 @@
 <?php
        include "connect.inc";

+    if ($socket)
+        $host = sprintf("%s:%s", $host, $socket);
+    else if ($port)
+        $host = sprintf("%s:%s", $host, $port);
+
        $tmp    = NULL;
        $link   = NULL;

@@ -68,4 +73,4 @@
 Warning: mysql_ping(): MySQL server has gone away in %s on line %d
 reconnect
 OK
-done!
\ No newline at end of file
+done!

Modified: php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_pconn_kill.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_pconn_kill.phpt  
2011-08-24 07:29:23 UTC (rev 315409)
+++ php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_pconn_kill.phpt  
2011-08-24 08:00:23 UTC (rev 315410)
@@ -64,7 +64,9 @@

        mysql_close($plink);

-       if (!($plink = mysql_pconnect($myhost, $user, $passwd)))
+       /* mysql_pconnect cound generate a warning when linked against mysqlnd
+       PHP Warning:  mysql_pconnect(): MySQL server has gone away */
+       if (!($plink = @mysql_pconnect($myhost, $user, $passwd)))
                printf("[009] Cannot create new persistent connection, [%d] 
%s\n", mysql_errno(), mysql_error());
        mysql_select_db($db, $plink);


Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c      2011-08-24 
07:29:23 UTC (rev 315409)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c      2011-08-24 
08:00:23 UTC (rev 315410)
@@ -120,6 +120,17 @@

        net->packet_no = net->compressed_envelope_packet_no = 0;

+       if (net->stream) {
+               /* close before opening a new one */
+               DBG_INF_FMT("Freeing stream. abstract=%p", 
net->stream->abstract);
+               if (net->persistent) {
+                       php_stream_free(net->stream, 
PHP_STREAM_FREE_CLOSE_PERSISTENT | PHP_STREAM_FREE_RSRC_DTOR);
+               } else {
+                       php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE);
+               }
+               net->stream = NULL;
+       }
+
        if (net->options.timeout_connect) {
                tv.tv_sec = net->options.timeout_connect;
                tv.tv_usec = 0;

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

Reply via email to