Page MenuHomePhabricator

Fatal error: Cannot use object of type stdClass as array in FormatHtml.php on line 96
Closed, ResolvedPublic

Event Timeline

Change 305794 had a related patch set uploaded (by Jean-Frédéric):
Safeguard against non-array $row

https://gerrit.wikimedia.org/r/305794

So I’m a bit confused why this happens:

MariaDB [s51138__heritage_p]> SELECT id,lang,project FROM monuments_all WHERE id='46-101-0959';
+-------------+------+-----------+
| id          | lang | project   |
+-------------+------+-----------+
| 46-101-0959 | uk   | wikipedia |
+-------------+------+-----------+

Thoughts @Lokal_Profil ?

So this appears to have been caused by 96af0dcd.

Echo-ing my way around, turns out $row->project is undefined...

I remember that. It’s because project is not automatically requested >_<

I think I might have spotted it.

$res = $db->select( array_merge( Monuments::$dbPrimaryKey, $props ) is what ensures that lang is always included.

Change 306012 had a related patch set uploaded (by Lokal Profil):
Add project to dbPrimaryKey

https://gerrit.wikimedia.org/r/306012

Change 306012 merged by jenkins-bot:
Add project to dbPrimaryKey

https://gerrit.wikimedia.org/r/306012

Mentioned in SAL [2016-08-31T20:02:46Z] <JeanFred> Deployed latest from Git: 22496d6 (T143481), c964df5, 00ccf8a, 1891ee0, 4458eeb, 55fea41

This is now working! Thanks @Lokal_Profil :)

Change 305794 abandoned by Jean-Frédéric:
Safeguard against non-array $row

Reason:
This was correctly fixed by Lokal_Profil in 306012

https://gerrit.wikimedia.org/r/305794