Problem
You cannot install Drupal 8 on sqlite and enable locale module. It whitescreens. The bug was introduced with new code in #1785086: Introduce a generic API for interface translation strings almost 2 months ago. Nobody noticed because people don't run tests (or Drupal 8 sites) on sqlite. In #1854752: Re-Add PDO::FETCH_PROPS_LATE to PDO::FETCH_CLASS Damien Tournoud suggests it is a foolish thing to use fetchObject() with a class name. It is not only that the core PHP implementation is broken, the PDO implementation is broken in a different way too.
Suggested solution
Grab the result set as an array and instantiate the object with that. This was suggested over in #1854752: Re-Add PDO::FETCH_PROPS_LATE to PDO::FETCH_CLASS by Damien.
The existing tests should already cover this extensively, but they did not fail before since obviously they run on MySQL and the PDO implementation did not have the same bugs as our PHP implementation has.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | fetchobject-foolish-08.patch | 2.3 KB | jose reyero |
| #6 | fetchobject-foolish-06.patch | 2.32 KB | jose reyero |
| fetchobject-foolish.patch | 1.56 KB | gábor hojtsy |
Comments
Comment #1
gábor hojtsyComment #2
damien tournoud commentedConsider that RTBCed from here if it returns green.
Comment #3
jose reyero commentedThe patch looks good to me so I'd RTBC as soon as the test is green.
Comment #4
jose reyero commentedUm, after reading the related issue I think we should replace occurrences of setFetchMode(PDO::FETCH_CLASS, ..) too, that's in dbStringLoad()
Comment #5
gábor hojtsyBTW I also checked the interface to see if it is properly implemented this way, and indeed, if there was no string, NULL should be returned, which is what the code does with the patch.
Comment #6
jose reyero commentedThis one removes setFetchMode(PDO::FETCH_CLASS) too.
Comment #7
gábor hojtsySeems to me like we should fetch/instantiate one by one instead of fetching a big array and then processing that to avoid using up twice the memory footprint? Should be a minor change.
Comment #8
damien tournoud commentedYou can and should use
foreach($result)directly.Comment #9
jose reyero commentedYes Sir :-)
Comment #10
gábor hojtsyLooks good to me, RTBC when green :)
Comment #11
gábor hojtsyComment #12
webchickCommitted and pushed to 8.x. Thanks so much for all of the investigation here, folks. Sorry it caused such a frackas. :(
Comment #13
gábor hojtsyThanks!