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
We have a defacto interface on Statements but the methods where commented out because of a bug in php 5.2. Since we require a more recent version we can put them back on the interface.
Proposed resolution
Uncomment the methods.
Remaining tasks
User interface changes
API changes
I guess its almost an API change because they were not strictly enforced. However, since they were implemented and expected to be implemented it isn't really a change.
Beta phase evaluation
Comment | File | Size | Author |
---|---|---|---|
#16 | uncomment-2521832-16.patch | 14.4 KB | neclimdul |
#16 | 2521832-16.interdiff.txt | 687 bytes | neclimdul |
Comments
Comment #1
neclimdulLets see what testbot says.
Comment #2
neclimdulI assumed our code was following our psuedo interface but it is not.
This fixes the classes to be consistent.
http://3v4l.org/bTuOC
Comment #5
neclimdulWe apparently are not very good about following this interface so this is good for catching some inconsistencies.
This fixes some argument names for some of the statement implementations and PDO is picky about arguments on fetchAll in some cases so this conditionally provides the exact number of arguments given in Statement.php
Note: I implemented proxy methods here similar to other proxy methods on Statement because the argument names do not match \PDOStatement which triggers strict warnings.
Comment #6
Crell CreditAttribution: Crell at Palantir.net commentedSounds like this is actually a bug then, found by enforcing the interface.
Wait, why are we dropping the other two parameters? Don't they serve some purpose in the world?
Comment #8
neclimdulI have no idea...
Tests turned up another bug, fetchall can take 0 arguments.
Comment #9
neclimdulComment #10
Crell CreditAttribution: Crell at Palantir.net commentedHuzzah! Thanks, neclimdul.
Comment #11
alexpottMissing {@inheritdoc} - in fact I think we should fix all the implementations to use the
{inheritdoc}
now that the interface has the methods.In core/lib/Drupal/Core/Database/StatementPrefetch.php can inheritdoc plus the args don't match.
Comment #12
neclimduleverything except the CR
Comment #13
Crell CreditAttribution: Crell at Palantir.net commentedChange notice: https://www.drupal.org/node/2539326
Thanks, neclimdul!
Comment #14
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedWe shouldn't lose this comment, we can either put it back below @inheritdoc or in the function body. Since dreditor context is not helpful, the comment was in the docblock of the current() method.
Comment #15
neclimdulOh, yeah this is actually from \Iterator not our Interfaces so we sort of need that documentation.
Comment #16
neclimdulSorry, and the return(fixed with a return type) to make storm users happy.
Comment #17
Crell CreditAttribution: Crell at Palantir.net commentedBot should be OK.
Comment #18
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedCool :)
Comment #19
alexpottCommitted 42c26e2 and pushed to 8.0.x. Thanks!
Comment #21
chx CreditAttribution: chx commentedI think ... the change record might be slightly misleading? Statements still implements StatementInterface, we just added a few new methods do it so that it mirrors PDOStatement 100% but we do not actually require to implement / extend / whatever PDO itself.
Comment #22
neclimdulThat sounds a lot like what you're saying. Can you help me understand how we could clarify it and I will update it.
Comment #23
chx CreditAttribution: chx commentedI rewrote the CR from ground up from the viewpoint of someone who actually wrote DB drivers :) and changed the title too because the title was very confusing (since PDOStatement doesn't have an interface)