Problem/Motivation
On #3137713: [D8 only] Update deprecation notices in NodeNewComments constructor, we noticed some deprecation notices that were missing E_USER_DEPRECATED
. See the discussion on that issue for the importance of setting the error code.
There are ten other deprecation notices that need a similar fix. The first two are in core/modules/config/src/Form/ConfigSync.php
:
public static function processBatch(ConfigImporter $config_importer, $sync_step, &$context) {
@trigger_error('\Drupal\config\Form\ConfigSync::processBatch() deprecated in Drupal 8.6.0 and will be removed before 9.0.0. Use \Drupal\Core\Config\Importer\ConfigImporterBatch::process() instead. See https://www.drupal.org/node/2897299');
ConfigImporterBatch::process($config_importer, $sync_step, $context);
}
and
public static function finishBatch($success, $results, $operations) {
@trigger_error('\Drupal\config\Form\ConfigSync::finishBatch() deprecated in Drupal 8.6.0 and will be removed before 9.0.0. Use \Drupal\Core\Config\Importer\ConfigImporterBatch::finish() instead. See https://www.drupal.org/node/2897299');
ConfigImporterBatch::finish($success, $results, $operations);
}
All eight methods in core/tests/Drupal/FunctionalJavascriptTests/WebDriverWebAssert.php
have similar code and also need to be fixed.
This issue is for D8 only since the deprecation notices, and the code that triggers them, have already been removed from Drupal 9.
Proposed resolution
In each call to trigger_error()
,
- Add
E_USER_DEPRECATED
as a second argument. - Change the references to "Drupal 8.6.0" and "9.0.0" to "drupal:8.6.0" and "drupal:9.0.0".
See the Drupal core deprecation policy for the definition and examples of the correct format for the deprecation notice.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#11 | interdiff_8-11.txt | 1.74 KB | ankitsingh0188 |
#11 | 3138591-11.patch | 6.29 KB | ankitsingh0188 |
Comments
Comment #2
benjifisherHere is a start:
At least the first two look like actual problems.
Probably the tests are OK.
Some of those are not deprecation notices, and the last two may be OK depending on the next couple of lines.
I will have another look within the next day unless someone beats me to it.
Comment #3
benjifisherI am not sure whether we need
E_USER_DEPRECATED
incore/tests/Drupal/FunctionalJavascriptTests/WebDriverWebAssert.php
. Is generatingE_USER_NOTICE
in a test enough to make the test fail? That entire file was added in #2827014: Throw an exception when testing status code or response headers in functional JavaScript tests and the follow-up issue #2928522: \Drupal\FunctionalJavascriptTests\WebDriverWebAssert misses some deprecations. I do not see any discussion of the error level, but early versions of the patch (including the one in #2827014-41: Throw an exception when testing status code or response headers in functional JavaScript tests, which was committed and then reverted) threw exceptions instead of triggering errors.I guess these errors are OK as is. I hope that someone can confirm when reviewing this issue.
I am adding #2856744: [META] Add trigger_error(..., E_USER_DEPRECATED) to deprecated code as a parent issue.
Comment #4
benjifisherI checked the remaining deprecation notices listed in #2. Of the 15 uses of
@trigger_error
listed there,WebDriverWebAssert.php
. See #3.trigger_error()
, andE_USER_DEPRECATED
is used on a following line.That leaves two to be fixed, both in
core/modules/config/src/Form/ConfigSync.php
. I will update the Proposed resolution in the issue summary and mark this as a Novice task. I am also setting the Component to "config.module" since that is where these deprecation notices are.These two deprecation notices were added in #2788777: Allow a site-specific profile to be installed from existing config.
Comment #5
mikelutz@benji_fisher - a normal trigger_error would still cause a test to fail, but the leading @ suppresses the triggered error, so the tests will complete. Our custom error handler finds and logs the E_USER_DEPRECATED errors inside the trigger_error call for testing purposes and to trigger tests to fail, but any other error code is ignored completely due to the error suppression by calling a function preceded with @
Comment #6
benjifisher@mikelutz:
It makes no difference whether the
@trigger_error()
is in the actual test class? The issues that added those deprecation notices tocore/tests/Drupal/FunctionalJavascriptTests/WebDriverWebAssert.php
are all about deprecation. It would be surprising if all the people working on that issue failed to notice that the errors did not work.But I cannot think of why it would be any different in a test class, which is why I asked.
OK, I will add the 8 deprecation messages in that class to the issue description. 5x as much work, but still a Novice task.
Comment #7
benjifisherOn Slack, @xjm suggested adding the "Drupal 9" and "beta target" issue tags.
Comment #8
ankitsingh0188Created the patch with the latest code of the module.
Created a patch to
Add missing E_USER_DEPRECATED to deprecation notices.
Comment #9
benjifisher@ankit.singh:
Thanks for taking on this issue! Even though I marked it as a Novice issue, it is pretty urgent to get this fixed, since our automated tests could miss code that uses these deprecated functions.
I reviewed the patch, and it correctly adds
E_USER_DEPRECATED
to all the places I identified. I repeated the test in Comment #2, and there are no other instances of@trigger_error()
missing the error code.You missed the second part of the proposed resolution, so I am setting the status to NW for that.
Comment #10
ankitsingh0188Created the patch with the latest code of the module.
Created a patch to
Change the references to "Drupal 8.6.0" and "9.0.0" to "drupal:8.6.0" and "drupal:9.0.0".
Comment #11
ankitsingh0188Updated the patch with the latest code of the module.
Updated a patch to Change the references to "Drupal 8.6.0" and "9.0.0" to "drupal:8.6.0" and "drupal:9.0.0".
Comment #12
benjifisherThanks for the quick update!
Also, you are following the process well. Your patches are properly formed, and you remembered (both times) to set the issue status to NR.
I was about to say the following, but I see you already caught the mistake and uploaded a new patch:
However, the patch in #10 only fixes
ConfigSync.php
. Id does not include the changes forWebDriverWebAssert.php
. I am setting the status back to NW for that.Also, when you post an updated patch, please also attach an interdiff. In this case, ignore the patch in #10 and make an interdiff comparing to the patch in #8. There are instructions here: Creating an interdiff. Personally, I recommend using the
interdiff
utility. I think there is less room for making mistakes.+1 for the interdiff comparing #8 to #11.
My last request is that you give more thought to your comments. The line "Updated the patch with the latest code of the module." is not helpful. If you made a mistake, as you did in #10, then say so, and explain why your interdiff compares to #8 instead of #10. Reviewers read these comments, and we should try to help them understand the history of the issue.
I checked that the patch in #11 fixes all the problems for t his issue. RTBC. I am updating the Remaining Tasks in the issue description.
Comment #13
xjmI swear I remember commenting on this issue before. Was there a similar issue? Very confused ATM...
Comment #14
xjmIt was #3137713: [D8 only] Update deprecation notices in NodeNewComments constructor.
Please tell me these aren't being filed on a per-module basis. See: https://www.drupal.org/core/scope#files
All of core should be fixed in a single patch.
Comment #15
andypost@xjm no, this issue is only one to fix all, as it was discussed in parent #3137713: [D8 only] Update deprecation notices in NodeNewComments constructor
Comment #18
xjmAlright, I checked with the patch applied:
I confirmed that the first two and last two there are just weirdly formatted on multiple lines, and the middle is just a comment. Same results on 8.8.x. So, for the same reasons as #3137713: [D8 only] Update deprecation notices in NodeNewComments constructor, I've committed this to 8.9.x and cherry-picked it to 8.8.x. Thanks!
Comment #19
xjmComment #20
xjm