|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34377 Access to MySQLi object lost in shutdown function
Submitted: 2005-09-05 17:52 UTC Modified: 2005-09-05 18:29 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: freddie at bingham dot net Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.1.0RC1 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: freddie at bingham dot net
New email:
PHP Version: OS:


 [2005-09-05 17:52 UTC] freddie at bingham dot net
This bug ( reports the same php error but involves session handlers.

This bug ( describes a possible reason this problem to be working as designed.

As reported bu the php team:

"This is chicken/egg problem and it cannot be solved. One expect that
destructors are called before session close the other uses object for
save handlers."

Are we to assume that a change has been made that is calling destructors before session close?  Fine, but why is this affecting register_shutdown? If register_shutdown() is part of the request, we expect to have access to the same scope.   Secondly why is this just affecting MySQLi?  Go ahead and reproduce the example code using MySQL and you'll see that it works as expected.

Reproduce code:
function shutdown()
	global $link;
	echo mysqli_real_escape_string($link, 'foo');

$servername = 'localhost';
$username = 'username';
$password = 'password';

$link = mysqli_init();
mysqli_real_connect($link, $servername, $username, $password);

echo mysqli_real_escape_string($link, 'foo') . '<br />';

Expected result:

Actual result:
Warning: Couldn't fetch mysqli in c:\program files\apache
group\Apache\htdocs\foo.php on line 7


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-05 18:29 UTC]
Object destructors are executed before the request shutdown functions set by users. This will not change. Please don't submit any more duplicate reports about this issue.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 01:01:28 2024 UTC