From: giovanni dot cupini at tin dot it
Operating system: Debian - ver. Raspberry
PHP version: 5.4.11
Package: MySQLi related
Bug Type: Bug
Bug description:Connection err dont work correctly
Description:
------------
Msqli extension work correctly in procedural mode but NON work correctly
width mode OOP. EXEMPLE CODE:
<?php
// FIRST CONNECTION Procedural
$mysqli = mysqli_connect("error", "root", "dolfomon", "test"); // HOST
(1)"localhost" (2)"error"
// ===================INFO MySqli & PHP ==============
echo 'Current PHP version: ' . phpversion() . "<br>";
echo 'MySqli Client library version: ' . mysqli_get_client_version() .
"<br>";
echo 'MySqli Server version: ' . mysqli_get_client_version() . "<br>";
//===============================================
if (mysqli_connect_errno($mysqli)) {
echo "Connection failed (mode PROC) MySQL: " . mysqli_connect_error()
."<br>";
}
echo "<br>";
$res = mysqli_query($mysqli, "SELECT 'Ok connection (PROC) width test ' AS
_msg FROM DUAL");
$row = mysqli_fetch_assoc($res);
echo $row['_msg'];
// second CONNECTION OOP
$my = new mysqli("error", "root", "dolfomon", "test"); // HOST
(3)"localhost" (4)"error"
// print_r($my); echo "<br>"; // (5) comment
(6) active statement
echo "<br>";
if ($my->connect_errno) {
echo "Connection failed (mode OOP) MySQL: " . $my->connect_error;
}
echo "<br>";
$res = $my->query("SELECT 'Ok connection (OOP) width test' AS _msg FROM
DUAL");
$row = $res->fetch_assoc();
echo $row['_msg'];
?>
Test script:
---------------
COMMENT:
if HOST option (1) and HOST option (3) and option (5) all OK it will
output:
--------------------------------------
Current PHP version: 5.4.4-11
MySqli Client library version: 50528
MySqli Server version: 50528
Ok connection (PROC) width test
Ok connection (OOP) width test
--------------------------------------
If HOST option (2) and HOST option (4) and option (6) all OK it will
output:
-----------------------------------------------------------------------------
Current PHP version: 5.4.4-11
MySqli Client library version: 50528
MySqli Server version: 50528
Connection failed (mode PROC) MySQL: Unknown MySQL server host 'error'
(20)
mysqli Object ( [affected_rows] => [client_info] => [client_version] =>
50528 [connect_errno] => 2005 [connect_error] => Unknown MySQL server host
'error' (20) [errno] => [error] => [error_list] => [field_count] =>
[host_info] => [info] => [insert_id] => [server_info] => [server_version]
=> [stat] => [sqlstate] => [protocol_version] => [thread_id] =>
[warning_count] => )
Connection failed (mode OOP) MySQL: Unknown MySQL server host 'error' (20)
----------------------------------------------------------------------------
if HOST option (2) and HOST option (4) and option (5) NOT WORK will
output:
-----------------------------------------------------------------------------
Host HTTP error 500
-----------------------------------------------------------------------------
if HOST option (2) and HOST option (3) and option (5) Procedural work OK
will output:
-------------------------------------------------------------------------------
Current PHP version: 5.4.4-11
MySqli Client library version: 50528
MySqli Server version: 50528
Connection failed (mode PROC) MySQL: Unknown MySQL server host 'error'
(20)
Ok connection (OOP) width test
---------------------------------------------------------------------------
--
Edit bug report at https://bugs.php.net/bug.php?id=64105&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=64105&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=64105&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=64105&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64105&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64105&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64105&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64105&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64105&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64105&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64105&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=64105&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=64105&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64105&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64105&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64105&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64105&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64105&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64105&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64105&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64105&r=mysqlcfg