php.net |  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
Votes:2
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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: freddie at bingham dot net
New email:
PHP Version: OS:

 

 [2005-09-05 17:52 UTC] freddie at bingham dot net
Description:
------------
This bug (http://bugs.php.net/bug.php?id=33635) reports the same php error but involves session handlers.

This bug (http://bugs.php.net/bug.php?id=33772) 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 />';
register_shutdown_function('shutdown');

Expected result:
----------------
foo
foo

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-05 18:29 UTC] sniper@php.net
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: Mon Oct 14 14:01:27 2024 UTC