php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51052 mysql vs mysqli within output buffer handler
Submitted: 2010-02-15 22:24 UTC Modified: 2010-02-15 22:56 UTC
From: trobinson at gksystems dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.3.1 OS:
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: trobinson at gksystems dot com
New email:
PHP Version: OS:

 

 [2010-02-15 22:24 UTC] trobinson at gksystems dot com
Description:
------------
I have a templating system which replaces placeholders with MySQL-derived content, using an output buffer handler.

Any html file can be used as a template, by placing one line at the top of the file:  <?php include('mysetup.php'); ?>
The beauty of output control EOF handling is that there is no need to add any PHP code at the *end* of the html file.

mysetup.php connects to a MySQL database, does some db work, then calls ob_start('myhandler');

As of PHP 5.1.x, all objects are destroyed before calling myhandler.

If I used mysqli_connect within mysetup, my db connection has been closed, so I need to reconnect in myhandler. 

However, if I used mysql_connect then my db connection is still valid within myhandler.

I discovered this when upgrading my code to use mysqli. I'm switching back to mysql, to avoid the overhead of connecting to the database twice.

It seems to me that it is a bit heavy-handed to destroy all objects before calling an output handler. It would be more reasonable to destroy just those objects created after registering the output handler.

MY FEATURE REQUEST: Please don't *break* the current behaviour of the mysql extension in a future version of PHP.





Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-15 22:56 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The shutdown order is full of chicken and egg problems and we try to avoid touching it as far as possible. If there ever will be a change it will be well thought ... but I don't expect a change.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu May 26 12:05:49 2022 UTC