DatabseBase::select behaving broken

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

DatabseBase::select behaving broken

Jeroen De Dauw-2
Hey,

For some reason DatabseBase::select is returning false sometimes when it
encounters a database error rather then throwing an error as you'd expect
since it's documented to always return a ResultWrapper. I ran into this
issue several times as getting the rather obscure error "expected
ResultWrapper, got boolean" in random places using this result. Calling
lastError on the DatabaseBase object clearly shows there in fact was an SQL
error.

I have all SQL debug settings I'm aware off on:

$wgShowSQLErrors        = true;
$wgShowDBErrorBacktrace = true;
$wgDebugDumpSql         = true;

Plus the usual bunch of dev settings.

So this smells like a regression to me, or something that always was broken
but not noticed due to people not using type hinting. Anyone an idea where
this is coming from? I had a look but it's not clear to me.

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil.
--
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: DatabseBase::select behaving broken

Niklas Laxström
On 3 September 2012 12:32, Jeroen De Dauw <[hidden email]> wrote:
> Hey,
>
> For some reason DatabseBase::select is returning false sometimes when it
> encounters a database error rather then throwing an error as you'd expect
> since it's documented to always return a ResultWrapper. I ran into this
> issue several times as getting the rather obscure error "expected
> ResultWrapper, got boolean" in random places using this result. Calling
> lastError on the DatabaseBase object clearly shows there in fact was an SQL
> error.

So what was the error? It is not unusual that SQL errors turn up in
unexpected places, see for example
https://bugzilla.wikimedia.org/39287
  -Niklas

--
Niklas Laxström

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: DatabseBase::select behaving broken

Jeroen De Dauw-2
Hey,

> So what was the error?

Non-existing field or table. Happens because of not running update.php.
Getting some weird type error at some random location does not really
suggest that though, so is likely result into one wasting time trying to
find the issue.

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil.
--
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: DatabseBase::select behaving broken

Brion Vibber
On Mon, Sep 3, 2012 at 9:50 AM, Jeroen De Dauw <[hidden email]>wrote:

> > So what was the error?
> Non-existing field or table. Happens because of not running update.php.
> Getting some weird type error at some random location does not really
> suggest that though, so is likely result into one wasting time trying to
> find the issue.
>

Are the Database object's flags set to ignore errors? (DBO_IGNORE in the
flags, or something calling $db->ignoreErrors(true)?)

Otherwise, it looks like it shouldn't happen... Throw some debugging
statements into Database::query and Database::reportQueryError to see if
anything stands out.

-- brion
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l