Possible bug "Fatal error: Call to a member function getID() on a non-object..."

30 views
Skip to first unread message

Tim

unread,
Sep 4, 2009, 7:14:36 PM9/4/09
to wikitrust-devel
Hello,

I am posting this here before entering a bug just in case this is one
of my other extensions having issues with WikiTrust. I installed the
extension yesterday and had no troubles yesterday, but I didn't try to
edit an article. Today, when I tried to save an edit I received the
following fatal error:

Fatal error: Call to a member function getID() on a non-object in /var/
www/support/extensions/WikiTrust/includes/WikiTrustBase.php on line
408

This is in regards to the ucscArticleSaveComplete() function, $rev_id
= $revision->getID(); member. I am assuming that the reason for this
is that for some reason the &$revision parameter is not being passed
to the function, or that it is being passed but is not an object.

My questions:
Should I report this as a bug?
I am unsure how to debug this, is there any insight that can be given?

Thank you very much for a wonderful extension.

Luca

unread,
Sep 4, 2009, 7:25:18 PM9/4/09
to wikitrust-devel
Thanks, I hope Ian or Bo who work more on the php part can take a look
at it...
Can you tell us (a) which version of mediawiki you are using and (b)
which version of wikitrust?
Many thanks,

Luca

Luca

unread,
Sep 5, 2009, 6:33:38 PM9/5/09
to wikitrust-devel
Tim said: (I may have clicked on the wrong button while moderating the
message):

Hello,

Thanks for the reply. Here's the info:

Product Version
MediaWiki 1.15.0
PHP 5.2.6-3ubuntu4.2 (apache2handler)
MySQL 5.0.75-0ubuntu10.2

Also note that the reason that I didn't report this as a bug is
because I have several other extensions that I have installed. I have
also used some hooks from editpage.php to add my article metadata. I
would rather not make this code public, but I would be happy to supply
it to somebody working on your project. Special:Version was too large
to post here as well, but I will be happy to provide that if
requested. Any more info I can provide, I will be happy to.

Tim

unread,
Sep 5, 2009, 6:11:09 PM9/5/09
to wikitrust-devel

thumper

unread,
Sep 6, 2009, 12:07:01 PM9/6/09
to wikitrust-devel
Hi Tim,

I went and upgraded to mediawiki-1.15.0, but was unable to reproduce
the error.
Since we're tying into the 'ArticleSaveComplete' hook, it doesn't seem
possible
to me that $revision wouldn't be defined.

It sounds like there are lots of different extensions you're using:
* does this happen consistently, every time you edit? Or is it only
on
a particular kind of page (not main namespace, maybe?)

* can you try disabling all extensions except WikiTrust and see if you
still have the problem? (If you have a busy site, maybe you could
make a copy of the database and mirror the installation?) If that
works, you could enable half the extensions, and hopefully narrow
down which one is conflicting...

My guess is that there is some other extension which is running, and
modifying the global $revision variable -- but that seems very odd to
me.
Perhaps you can change the order of inclusion from LocalSettings.php.
That is, if you include WikiTrust last, try making it first... We
don't modify
any of the global variables, so this shouldn't break any of the other
extensions.

-Bo

Tim

unread,
Sep 6, 2009, 12:36:09 PM9/6/09
to wikitrust-devel
Hello,

Thanks for the reply. I'll need to make some time to test this. It
does happen consistently when I have wikitrust enabled (any namespace
or article that I edit - even if I don't change any text). wikitrust
is the first extension required in localsettings.php already, even my
custom extension is after that and I know that I don't edit the
$revision variable. I'll disable all other extensions (one by one)
and test again then write back with the outcome. Thanks for your
attention to this matter.

-Tim

Tim

unread,
Sep 6, 2009, 12:46:27 PM9/6/09
to wikitrust-devel
Hi,

Another quick note - You mentioned that you are using
ArticleSaveComplete - I am also using that for my extension as well
for an auto-protect feature (check the box and it runs $article-
>updateRestrictions() ). To my knowledge, you can have more than one
extension running on the same hook, but I can also try changing to
hook to ArticleSave or something.

-Tim

On Sep 6, 12:07 pm, thumper <thumpe...@gmail.com> wrote:

Tim

unread,
Sep 6, 2009, 1:26:51 PM9/6/09
to wikitrust-devel
Hello again,

Sorry to be so verbose ...but... I have disabled all extensions. I
still have the problem. This time I took screenshots since they don't
take up more than a screen worth of height. I would be happy to try
to debug, but unfortunately I don't know how to get a backtrace or
anything from a fatal error in php (I'll be looking into that too).

http://i392.photobucket.com/albums/pp6/tccroninv/special-version.png
# Special:Version page
http://i392.photobucket.com/albums/pp6/tccroninv/editing.png
# The page being edited
http://i392.photobucket.com/albums/pp6/tccroninv/error.png
# The error directly after hitting "save"

thumper

unread,
Sep 6, 2009, 6:56:09 PM9/6/09
to wikitrust-devel
Crazy - that's strange that I can't reproduce this bug. And I agree,
there shouldn't be any reason to not have multiple extensions tied to
the same hook.

For kicks, I looked up the hook definition, and saw that ours didn't
match the hook, so it's possible that's the problem. I've fixed it on
the 'thumper' branch at Github, if you're handy with git. Otherwise,
I'll post a patch once I'm back from traveling.

-Bo

On Sep 6, 10:26 am, Tim <tccron...@gmail.com> wrote:
> Hello again,
>
> Sorry to be so verbose ...but... I have disabled all extensions.  I
> still have the problem.  This time I took screenshots since they don't
> take up more than a screen worth of height.  I would be happy to try
> to debug, but unfortunately I don't know how to get a backtrace or
> anything from a fatal error in php (I'll be looking into that too).
>
> http://i392.photobucket.com/albums/pp6/tccroninv/special-version.png
> # Special:Version pagehttp://i392.photobucket.com/albums/pp6/tccroninv/editing.png
> # The page being editedhttp://i392.photobucket.com/albums/pp6/tccroninv/error.png

Bo Adler

unread,
Sep 7, 2009, 6:56:26 PM9/7/09
to wikitrust-devel
Hi Tim,

Here is the promised patch that fixes the function definition for our
ArticleSaveComplete hook. Note that I don't try to catch the case
were $revision is null. But perhaps it's not, and it's just a weird
object that doesn't support getID()? This shouldn't be the case, but
perhaps it would be good to rule it out; you can add this line
error_log("revision is [$revision]");
before the call to getID(), and then check your error.log file.

Incidentally, where are you located? Another possibility is for us to
meet and try to debug this together. I tried again to reproduce the
error on another ubuntu installation, but still no luck.

-Bo

0001-mediawiki-fixed-hook-definition.patch

Tim

unread,
Sep 9, 2009, 6:29:21 PM9/9/09
to wikitrust-devel
Thanks, I'll give this a go and let you know.

On Sep 7, 6:56 pm, Bo Adler <thum...@alumni.caltech.edu> wrote:
> Hi Tim,
>
> Here is the promised patch that fixes the function definition for our
> ArticleSaveComplete hook.  Note that I don't try to catch the case
> were $revision is null.  But perhaps it's not, and it's just a weird
> object that doesn't support getID()?  This shouldn't be the case, but
> perhaps it would be good to rule it out; you can add this line
>       error_log("revision is [$revision]");
> before the call to getID(), and then check your error.log file.
>
> Incidentally, where are you located?  Another possibility is for us to
> meet and try to debug this together.  I tried again to reproduce the
> error on another ubuntu installation, but still no luck.
>
> -Bo
>
> On Sun, Sep 6, 2009 at 3:56 PM, thumper <thumpe...@gmail.com> wrote:
>
> > Crazy - that's strange that I can't reproduce this bug.  And I agree,
> > there shouldn't be any reason to not have multiple extensions tied to
> > the same hook.
>
> > For kicks, I looked up the hook definition, and saw that ours didn't
> > match the hook, so it's possible that's the problem.  I've fixed it on
> > the 'thumper' branch at Github, if you're handy with git.  Otherwise,
> > I'll post a patch once I'm back from traveling.
>
> > -Bo
>
> > On Sep 6, 10:26 am, Tim <tccron...@gmail.com> wrote:
> >> Hello again,
>
> >> Sorry to be so verbose ...but... I have disabled all extensions.  I
> >> still have the problem.  This time I took screenshots since they don't
> >> take up more than a screen worth of height.  I would be happy to try
> >> to debug, but unfortunately I don't know how to get a backtrace or
> >> anything from a fatal error in php (I'll be looking into that too).
>
> >>http://i392.photobucket.com/albums/pp6/tccroninv/special-version.png
> >> # Special:Version pagehttp://i392.photobucket.com/albums/pp6/tccroninv/editing.png
> >> # The page being editedhttp://i392.photobucket.com/albums/pp6/tccroninv/error.png
> >> # The error directly after hitting "save"
>
>
>
>  0001-mediawiki-fixed-hook-definition.patch
> 1KViewDownload

Tim

unread,
Sep 11, 2009, 7:23:17 PM9/11/09
to wikitrust-devel
Hello,

Sorry it's taken me so long to get back to you - it's more difficult
to work on this during the work week. I have added the patch, but it
did not resolve the issue. I don't have git so I just added the patch
manually. I added:

&$user, $text, $summary,
&$minoredit, $watchthis,
$sectionanchor, &$flags,
$revision, &$status, $baseRevId)

in place of

&$user, &$text, &$summary,
&$minoredit, &$watchthis,
&$sectionanchor, &$flags,
&$revision)

Hopefully I'll have some more time to mull this one over as a VIP
wants this extension in our wiki. If I find more info, I'll post it.

Thanks, Tim

thumper

unread,
Sep 11, 2009, 8:00:05 PM9/11/09
to wikitrust-devel
No worries. If you're in the Bay Area, I'm willing to come over for
some hands-on debugging.

Otherwise --
* you could add the debugging line
error_log("revision is [$revision]");
at the beginning of that function, but I don't expect this to
reveal anything useful.

* can you set up a test wiki in a VM? It would be helpful to know
if you are able to recreate the bug, because maybe there is some step
in the process which you do differently than I do.

best wishes,
-Bo
Reply all
Reply to author
Forward
0 new messages