Edit report at https://bugs.php.net/bug.php?id=55741&edit=1

 ID:               55741
 Updated by:       [email protected]
 Reported by:      patrick_adrichem at hotmail dot com
 Summary:          Warning thrown
-Status:           Feedback
+Status:           No Feedback
 Type:             Bug
 Package:          MySQL related
 Operating System: linux
 PHP Version:      5.3SVN-2011-09-20 (SVN)
 Assigned To:      mysql

 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


Previous Comments:
------------------------------------------------------------------------
[2011-10-18 20:16:57] [email protected]

Hi,
I wasn't able to reproduce with 5.3-svn and two builds:
- mysqlnd
- libmysql

Here is my mysqlnd output:
$ ./php -r 
'error_reporting(E_ALL);$c=mysql_connect("127.0.0.1","root","root");var_dump($c);var_dump(mysql_query("set
 @@wait_timeout=5",$c));sleep(7);var_dump(mysql_ping($c));'
resource(6) of type (mysql link)
bool(true)

Warning: mysql_ping(): MySQL server has gone away in Command line code on line 1
bool(false)


Here is my libmysql output:
$ ./php -r 
'error_reporting(E_ALL);$c=mysql_connect("127.0.0.1","root","root");var_dump($c);var_dump(mysql_query("set
 @@wait_timeout=5",$c));sleep(7);var_dump(mysql_ping($c));'
resource(4) of type (mysql link)
bool(true)
bool(false)

I suspect how it could be shut up, but I can't reproduce it to be able to test 
it.

------------------------------------------------------------------------
[2011-09-20 14:50:21] [email protected]

ulf, plz look at this.

------------------------------------------------------------------------
[2011-09-20 14:47:19] patrick_adrichem at hotmail dot com

Description:
------------
---
>From manual page: 
>http://www.php.net/function.mysql-ping#refsect1-function.mysql-ping-description
---


Mysql_ping is in my vision used to check wether your connection is still alive, 
by pinging the server since PHP 5.0.38 this function no longer autoreconnects, 
so its a real "Check if connection is alive" function. However if the 
connection is not alive it still throws a warning:

mysql_ping(): 8 is not a valid MySQL-Link resource

Which is obvious, because thats why you use this function...

Test script:
---------------
<?php

error_reporting(E_ALL);

$rConnection = mysql_connect("host", "user", "pass") or die("Could not 
connect");

sleep(60);

if (false === mysql_ping($rConnection))
{
echo "Connection gone";
}
else
{
echo "Connection alive";
}

Expected result:
----------------
Connection gone

Actual result:
--------------
mysql_ping(): 8 is not a valid MySQL-Link resource
Connection gone


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



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

Reply via email to