Bug #64105 [Opn->Fbk]: Connection err dont work correctly
Edit report at https://bugs.php.net/bug.php?id=64105&edit=1
ID: 64105
Updated by: uw@php.net
Reported by: giovanni dot cupini at tin dot it
Summary: Connection err dont work correctly
-Status: Open
+Status: Feedback
Type: Bug
Package: MySQLi related
Operating System: Debian - ver. Raspberry
PHP Version: 5.4.11
Block user comment: N
Private report: N
New Comment:
I fail to parse this report, could someone help me understanding what's requested?
All I get is that there is a combination which gives an internal server error from the webserver:
if HOST option (2) and HOST option (4) and option (5) NOT WORK will output:
-----------------------------------------------------------------------------
Host HTTP error 500
As far as I understand this is equivalent to the below sequence in which all error messages are
ignored, no proper error handling is done, a fatal error gets thrown and script execution stops.
Potentially giving 500 through webserver...
/* Throws E_WARNING */
$mysqli = mysqli_connect("error", "root", "dolfomon",
"test");
var_dump(mysqli_connect_errno($mysqli));
/* Throws E_WARNING */
$res = mysqli_query($mysqli, "SELECT 'Ok connection (PROC) width test ' AS _msg FROM
DUAL");
/* Throws E_FATAL */
$row = mysqli_fetch_assoc($res);
Due to the E_FATAL the OOP variant should never be executed. Sorry, I fail to undertstand the
report.
Previous Comments:
------------------------------------------------------------------------
[2013-01-30 14:45:37] giovanni dot cupini at tin dot it
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 this bug report at https://bugs.php.net/bug.php?id=64105&edit=1
Thread (3 messages)