Fatal error: Call to undefined function: MDB2_Driver_MYSQL::getAll() - php

I am upgrading a site from Fedora 14, PHP4, and PEAR DB to Fedora 16, PHP 5.4 and PEAR MDB2 2.5.0b3, and I am getting the error
Fatal error: Call to undefined function: MDB2_Driver_MYSQL::getAll(). in /usr/share/php/MDB2.php on line 1892
Obviously, I've checked line 1892 of the MDB2.php file, and it contains the error reporting code for the __call magic method (allows you to call a specific function by passing it into __call)
I have checked for usages of __call, and there don't seem to be any. Likewise, when I try to find where MDB2_Driver_MYSQL is coming from, the only place it is even mentioned is in MDB2.php (as a comment about the driver for MySQL), in the class declaration (class MDB2_Driver_mysql extends MDB2_Driver_Common), and the description title in the .xml file.
I have manually included the /usr/share/php/MDB2/Extended.php file in the file where the MDB2_Driver_mysql class is defined, and that didn't help (not that this would have been a permanant fix...)
Has anyone encountered this error, and if so, what did you do to fix it? Google has proved nearly useless, as the only place it is specifically mentioned doesn't really deal with fixing it.

change getAll() in your class, to queryAll(), cause there some difference between DB & MDB2, and the same with getOne, getRow - they all changed to queryOne, queryRow. Here you can read about it http://www.phpied.com/db-2-mdb2/

Make sure you load the extended module in your code prior to making a query, similar to below:
$db->loadModule('Extended');

Related

Call to undefined function bi_to_str() after upgrading php from 5.2 to 5.5

After upgrading php to 5.5, the following error occurs:
PHP Fatal error: Call to undefined function bi_to_str() in /var/www/index.php
I know that it's not a coding error, but it could be a missing library. But could an empty value cause that error? Is there an easy way to load that library using apt-get in Debian?
Well with the help I received in the comments, I was able to come up with a solution.
It seems that it's just the function that is missing. I was able to create a file called big_int.php, fill it with the contents found here, and just link to it using require_once in index.php, like this:
require_once('big_int.php');
All is well. Many thanks to Barmar for the helpful tip.

Class not found after "require_once"

I get the following error:
`Fatal error: Class 'DummyClass' not found in...`
<?php
require_once("3rdparty/simplesaml/lib/_autoload.php");
class login extends DummyClass { (this is the line the error refers to)
[...]
}
?>
If I comment out the require_once it works perfectly fine.
DummyClass is defined externally and can be found in the prepend-file. (I don't think it matters for this problem as it works as expected if I comment out require_once)
The path to the file should also be correct as it gives me a "Failed opening required..." Error if I change the path.
I also tried switching between PHP 5.6 and 7 - no difference.
So, I would like to ask you for help. Do you have any hints / ideas, why I might get that error?
Problem solved.
The old framework was using the old __autoload function, which is deprecated.
SimpleSAMLPHP used the new function. Those autoload-combinations cause one of them to override the other.
Solution:
Switch from __autoload to spl_autoload_register.
Similar Question: Override vendor autoload composer

Class "String" not found error in PayPal core sdk

I am getting the following error all of sudden
Fatal error: Class 'string' not found in
\vendor\paypal\sdk-core-php\lib\PayPal\Common\PPModel.php on line 51
Did anything change in recent Wordpress update?
Around March, 2015, PayPal made some big
changes with PHP-SDK 1.0.0
Part of that change was renaming some classes;
PPModel.php was changed to PayPalModel.php
There were a lot of other files renamed.
Here is a link to all the breaking changes.
https://github.com/paypal/PayPal-PHP-SDK/wiki/Breaking-Changes---1.0.0
You will probably have a lot more work to do, other than just
PPModel. I know I had
to change 23 files and 73 lines of code. This is
because a lot of class files were renamed.
Well, I'm not sure why it's started happening to you right now, but I can see the bug:
the line mentioned initialises a class based on some reflected parameters
the reflection helper it calls defaults to returning "string", which isn't a valid class name
A couple of old closed bugs (#7, #34) mention Zend Optimizer, which is now known as OpCache, which could well be your culprit - it has a pair of settings opcache.save_comments and opcache.load_comments which must be set to On to save docblocks (/** ... */ comments) in memory. Since the Annotations relied on by the SDK are in such docblocks, if you've installed OpCache, or changed the value of that setting, your application will break.

PHPUnit does not work with IntelliJ Idea 13.1.3

I get the following exception while using Idea 13.1.3 with PHPUnit 4.5.0. In some other threads I have seen it was a bug but I this seems to be a problem with latest version also.
Testing started at 17:06 ...
Fatal error: Class IDE_PHPUnit_Framework_TestListener contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PHPUnit_Framework_TestListener::addRiskyTest) in /private/var/folders/yc/cc0z8db95hx4l_d0fvtrx2yxsjjh3x/T/ide-phpunit.php on line 504
Call Stack:
0.0014 854704 1. {main}() /private/var/folders/yc/cc0z8db95hx4l_d0fvtrx2yxsjjh3x/T/ide-phpunit.php:0
Variables in local scope (#1):
$PHPUnitVersionId = *uninitialized*
Process finished with exit code 255
Found from IntelliJ forum that IntelliJ 13 is only compatible with PHPUnit 3.x.
However instead of downgrading, I managed to patch the framework itself for now in this way.
go to /plugins/php/lib
make a backup of php.jar
Use whatever tool you have to open the file, usually zip or other compress tools or under ubuntu the file roller.
Go to scripts/phpunit.php
Modify it, searching for the "IDE_PHPUnit_Framework_TestListener" class and adding there the following line:
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception
$e, $time) {}
save the file and update the php.jar

Can no longer install WordPress on MAMP- "Fatal error: Cannot redeclare class wpdb"

I've been developing WordPress sites for a long time on my local MAMP server. Now all of a sudden, it won't let me create any new sites. Whenever I set up a new one, instead of running the install script I get:
Fatal error: Cannot redeclare class
wpdb in
/Applications/MAMP/htdocs/[my_site]/wp-includes/wp-db.php
on line 52
This happens with all WordPress versions. I cannot thing of anything that would have caused this. I've done everything short of re-install MAMP. Does anyone have any ideas? I'm desperate at this point..
Check out the include path for php. It's likely that a second instance of wordpress is on the include path and is therefore conflicting with the one you're trying to load. It's also possible that a different package on the include path has a class called wpdb and is therefore causing a conflict.
wpdb is being created again some where, if this happened all of a sudden i suggest that you disable any plugins you've recently added. Or even better do a global find for the term class wpdb and see if that appears within more than 1 file. Also, check your functions.php file for a loop that might be loading wp-db.php more than once.
A workaround fix is to wrap the wpdp class in wp-includes/wp-db.php in the following:
Line 52:
if(class_exists('wpdb') != true)
{
class wpdb {
...
}
}
This solved the install issue- You could probably remove it after that, although it can't hurt to leave it I guess.
Still don't understand why this problem has popped up- If someone has an explanation I'd be eager to hear it.

Categories