Replacing PEAR: MDB2 with PHP 5.3

I have been using pear packages in php for many years. I am in the process of updating / moving sites using the MDB2 pear package, and it has not been updated for PHP 5.3.X.

In 5.3, MDB2 returns these new annoying errors.

Unknown: Assigning the return value of new by reference is deprecated in /usr/local/lib/php/MDB2.php on line 390 

I know that I can change the settings for error reporting to get rid of them, but I would rather not make any exceptions. Anyway, does anyone else use MDB2 these days and have a solution? Are there any similar database packages that you recommend?

+9
php mysql mdb2 pear
07 Oct '09 at 7:39
source share
7 answers

I would definitely go for ORM, at least if you are working on a large project for which you do not want to directly use mysqli_* functions or PDO / methods - Doctrine is the most developed / used at the moment (this is ORM ORM Symfony Framework and can easily integrated into the Zend Framework).

About E_DEPRECATED errors: PHP 5.3 is quite young, and many libraries / software / projects have not yet been adapted - you will probably have many of these in the next couple of months :-(

+9
Oct 07 '09 at 10:28
source share

You can also upgrade to beta using the command line

 pear upgrade MDB2-beta pear upgrade MDB2_Driver_Mysql-beta 

Explanation why the current stable version does not correspond to strict error messages: http://pear.php.net/bugs/bug.php?id=9756

Source for team:
http://pear.php.net/bugs/bug.php?id=18050

+9
Apr 13 '12 at 18:05
source share

I am going to comment on this, since it rises high in Google search results for the problem.

I contacted the lead developer for MDB2, who said:

please see a copy of MDB2 from SVN, fully compatible with PHP5.3, with many performance improvements. I'm currently waiting for some fixes for the new SQL Server driver (Microsoft is working on this this week) and then I will click on the new stable release.

(Edit, 4 years later: this is no longer the case, do not do this)

+7
May 17 '10 at 10:57
source share

I just sent and downloaded the latest version of MDB2 (MDB2-2.5.0b3) from here http://pear.php.net/package/MDB2/download , and it got rid of all my errors. Seems to work well with PHP version 5.3.5

+3
Aug 05 2018-11-11T00:
source share

You can use Zend Framework database support or use ORM like Doctrine or Propel

+1
07 Oct '09 at 7:42
source share

I went around all the obsolete errors and warnings using MDB2 and PHP 5.3, but I have some really weird errors on MDB2, so it’s interesting what’s under the hood. My environment is CentOS, PHP 5.3, MDB2-2.4.1, MySQL 5.0.77

Anytime I use autoExecute 2x in a php file, the second one is unsuccessful (the same thing happens if I try to use prepare and then execute). I registered in the MySQL query log, and while a successful INSERT shows the values, a failed INSERT will always only have placeholders. i.e.: values ​​(?,?,?,?). And MDB2_Error will always mention RECURSION

lastInsertID () never worked with MySQL tables and auto-increment fields (with the mysqli driver) I did enough debugging on it, delving into the call stack, and the result was so complete in Object that you can’t say what it is until the very end . I would like to use MDB2 more, but actually I had to go back to direct mysql, many times because of these problems. Perhaps Lucas or other developers can shed light on this topic or point us in the right direction.

0
Sep 23 2018-11-11T00:
source share

If you use only MDB2 for MySQL, you can replace it and save most functions with MDBDid: http://azure-dev.kiao.net/648-mdb2 You will have little code to adapt.

0
Jan 15 '16 at 12:47
source share



All Articles