Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
$query = $connection->select('users_data', 'ud')
->fields('ud')
->condition('module', $module);
foreach ($result as $item) {
print_r($item);
}
// $item is object if the connection is Drupal\Core\Database\Connection
stdClass Object
(
[uid] => 1
[module] => foo
[name] => bar
[value] => baz
[serialized] => 0
)
$item is array if the connection is Drupal\Core\Database\Driver\fake\FakeConnection.
Proposed resolution
Support PDO::FETCH_OBJ. Throw exceptions for crazy class fetch modes.
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#3 | 2373613-fake_statement-3.patch | 2.89 KB | vijaycs85 |
Comments
Comment #1
vijaycs85Comment #2
chx CreditAttribution: chx commentedWhile supporting PDO::FETCH_OBJ is not hard ; it's just an object cast wherever we add the result rows. I would say adding the complexity of reflection necessary to support PDO::FETCH_CLASS is simply not worth it.
Comment #3
vijaycs85Initial patch...
Comment #5
vijaycs85Comment #17
larowlanCan we get some info on how you would encounter this bug, thanks
Comment #19
quietone CreditAttribution: quietone at PreviousNext commentedThere is not much discussion here in either years and in #2 it is suggested that making a change is not worth it. More information was asked for 7 months ago and none has been provided. I think it is time to close this one.