jerodsanto / wordpress-console

An interactive console for WordPress developers
MIT License
66 stars 9 forks source link

"Error: get_class() expects parameter 1 to be object, string given" #7

Open gertvs opened 12 years ago

gertvs commented 12 years ago

I installed the plugin following the instructions, activated it. It displays correctly but any php code I execute, even the simplest results in: "Error: get_class() expects parameter 1 to be object, string given" Any hits as to what could be wrong? Anything I can do to debug this error? Here's my environment info:

Wordpress version: 3.2.1 wordpress-console version: 0.3.7 Server version: Apache/2.2.20 (Ubuntu) built: Nov 7 2011 22:48:05 PHP version: 5.3.6-13ubuntu3.2 with Suhosin-Patch (cli) (built: Oct 13 2011 23:19:13)

jerodsanto commented 12 years ago

Hmm I've never seen this one before. The only place the plugin calls get_class is in the parse function. Can you try isolating a call to that function to see if you get the same error?

To do this, drop a test.php file in the plugin's root directory that looks something like this:

<?php
require("common.php");
parse( "echo 'test';");
?>

Then run it from the command line by doing php test.php.

Let me know what happens. Thanks.

gertvs commented 12 years ago

Hi Jerod,

Thanks for your suggestions. I ran the test you suggested. Same result. Anything that I type, apart from the help commands, results in the same message:

"Error: get_class() expects parameter 1 to be object, string given"

I also installed wordpress and the console plugin on a Windows 7 system. There the console activates and is present in the left side Dashboard menu, but even fails to draw the black console background. Everything stays white except for the [WordPress Console: "?" for help menu] title. There is no black box and no command line.

Since both are fresh installs on completely different platforms, could it be that the latest wordpress version breaks the plugin?

I can give you access to either or both of these systems if that would help.

Thanks again,

Gert

On 07/12/11 02:32, Jerod Santo wrote:

Hmm I've never seen this one before. The only place the plugin calls get_class is in the parse function. Can you try isolating a call to that function to see if you get the same error?

To do this, drop a test.php file in the plugin's root directory that looks something like this:

<?php
require("common.php");
parse( "echo 'test';");
?>

Then run it from the command line by doing php test.php.

Let me know what happens. Thanks.


Reply to this email directly or view it on GitHub: https://github.com/sant0sk1/wordpress-console/issues/7#issuecomment-3042391

jerodsanto commented 12 years ago

The Windows machine may have the problem described in issue #6.

For your Linux box: there are 3 lines in common.php that call get_class, and they're all in the case that a method being called doesn't exist. Could you try adding a print statement before each of the throw clauses that use this method and output the $object and $method` that does not exist?

That might help us track it down. Thanks.

gertvs commented 12 years ago

Hi Jerod,

Sorry for the delay. Xmas and things.

I did as you suggested:

                if (!method_exists($object, $method)) {
        printf("Variable %s doesn't have a method\
        named '%s'", $objname, $method);
                    throw new Exception(sprintf("Variable %s \
        (Class '%s') doesn't have a method named '%s'",
                        $objname, get_class($object), $method));
                }

But the behaviour is exactly the same and don't see any debug output.

I installed the same plugin on our hosted web site too and there it works as expected. It seems that my Ubuntu server has some unsatisfied PHP dependencies, although I have no idea which.

If you want me to do some more tests please let me know.

Thanks.

Gert

On 10/12/11 23:44, Jerod Santo wrote:

The Windows machine may have the problem described in issue #6.

For your Linux box: there are 3 lines in common.php that call get_class, and they're all in the case that a method being called doesn't exist. Could you try adding a print statement before each of the throw clauses that use this method and output the $object and $method` that does not exist?

That might help us track it down. Thanks.


Reply to this email directly or view it on GitHub: https://github.com/sant0sk1/wordpress-console/issues/7#issuecomment-3094667

pyronaur commented 12 years ago

Have the same issue here. Mac OS X, PHP 5.3.6, Wordpress 3.3.1