php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64105 Connection err dont work correctly
Submitted: 2013-01-30 14:45 UTC Modified: 2013-10-15 11:54 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: giovanni dot cupini at tin dot it Assigned:
Status: No Feedback Package: MySQLi related
PHP Version: 5.4.11 OS: Debian - ver. Raspberry
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: giovanni dot cupini at tin dot it
New email:
PHP Version: OS:

 

 [2013-01-30 14:45 UTC] 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 
---------------------------------------------------------------------------


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-03-13 11:28 UTC] uw@php.net
-Status: Open +Status: Feedback
 [2013-03-13 11:28 UTC] uw@php.net
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.
 [2013-10-15 11:54 UTC] php-bugs at lists dot php dot net
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 "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 12:01:31 2024 UTC