Problem/Motivation
\Drupal\system\SystemRequirements::phpVersionWithPdoDisallowMultipleStatements() is pointless now PHP5 is not supported.
Proposed resolution
Deprecate \Drupal\system\SystemRequirements as phpVersionWithPdoDisallowMultipleStatements is the only method in the class.
Remaining tasks
- Create a change record
- Add an @trigger_error to main in the class
- Convert \Drupal\Tests\system\Unit\SystemRequirementsTest to a legacy test
User interface changes
None
API changes
\Drupal\system\SystemRequirements is deprecated
Data model changes
None
Release notes snippet
N/a
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 3054060-11.patch | 4.84 KB | alexpott |
| #2 | Deprecate_phpVersionWithPdoDisallowMultipleState()-3054060-2.patch | 3.52 KB | neeravbm |
Comments
Comment #2
neeravbm commentedI have attached the patch that does the following:
1) Adds @trigger_error to main class.
2) Adds @deprecated and @see to phpVersionWithPdoDisallowMultipleStatements() method.
3) Adds @group legacy to SystemRequirementsTest.
Can you let me know how to create a change record?
Also according to Drupal core deprecation policy, it seems that I need to create a new issue to fix the test so that the deprecated code is not exercised. Here's the related issue: https://www.drupal.org/project/drupal/issues/3054243.
Comment #3
alexpott@neeravbm thanks for working on this! You can create change records here - http://drupal.org/list-changes/drupal
Also reviews of parent issue #3053363: Remove support for PHP 5 in Drupal 8.8 are very welcome because then we can unpostpone this one.
I'm interested in why you thought you needed to open #3054243: Remove \Drupal\system\SystemRequirements after reading https://www.drupal.org/core/deprecation - I don't think that it is necessary - this issue should remove all runtime and non-legacy test usages.
Comment #4
alexpottThis change is not quite right - we use other DB drivers than mysql so we need to leave the first part of the if there.
The links here need to be to the change record - not the issue.
The deprecation message can be finessed. All supported PHP versions support disabling multi-statement queries in MySQL making the method irrelevant. So we could say:
The @trigger_error() text should be updated too.
This test needs an @expectedDeprecation annotation.
The test still needs to call the deprecated code. Legacy tests test the deprecated code.
Comment #5
neeravbm commented@alexpott, thanks for the feedback! I'll work on the changes and upload a new patch.
Comment #6
neeravbm commented@alexpott I have a question regarding the following code:
With PHP 7 and above, SystemRequirements::phpVersionWithPdoDisallowMultipleStatements($phpversion) is always TRUE. Which means that the if condition will always return FALSE irrespective of the database driver. So why do we need the first condition if this code is going to run on PHP 7 and above only?
Comment #7
neeravbm commented@alexpott I created https://www.drupal.org/project/drupal/issues/3054243 because https://www.drupal.org/core/deprecation states the following:
Comment #8
neeravbm commented@alexpott Regarding your comment:
I am new to core contribution and it's very difficult to start on any issue that already has numerous comments with differing opinions. Any suggestion on what should I start looking at?
Comment #9
alexpottThe blocker is in!
Comment #10
tstoecklerThere is a now obsolete reference to
\PDO::MYSQL_ATTR_MULTI_STATEMENTSin\Drupal\KernelTests\Core\Database\ConnectionTest::testMultipleStatementsForNewPhp(), as well, should that be removed as part of this patch or do we need a separate issue for that?Comment #11
alexpott@tstoeckler nice find I think it makes sense to do that here. It's all related.
I was wrong about #4.1 - we can completely remove that assertion - there no longer is a requirement warning for
PHP (multiple statement disabling)in the code base.Creating an interdiff is tricky because the original patch was created in an interesting way.
Comment #12
alexpottComment #13
mondrakeI think we could also @expectDeprecation for the SystemRequirements class itself here?
Comment #14
alexpott@mondrake nope well not unless we run the test in isolation - because PHP only loads the class once for all the tests. I felt that that was not worth it. As there is not logic in triggering the class level deprecation.
Comment #15
mondrakeOK, RTBC
Comment #16
catchCommitted 1305cbe and pushed to 8.8.x. Thanks!