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.
The automated tests report some failures on PHP 7.2. I shall look into there and bring it back to 100% pass. https://www.drupal.org/pift-ci-job/873213
Comment | File | Size | Author |
---|---|---|---|
#13 | 2940530-php-7-2-13.patch | 9.37 KB | bucefal91 |
#13 | interdiff.txt | 1.27 KB | bucefal91 |
#10 | 2940530-php-7-2-10.patch | 8.1 KB | bucefal91 |
#10 | interdiff.txt | 476 bytes | bucefal91 |
#8 | interdiff.txt | 3.75 KB | bucefal91 |
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented@bucefal91 Thanks!!!
Comment #3
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedI probably should go one by one with each issue so jrockowitz has better time following the findings and guiding me should I take any wrong decision.
So, let me start with
Drupal\webform\Tests\Element\WebformElementComputedTest
. The testbot complains:This issue is reproducible since PHP 7.1. The changelog: http://php.net/manual/en/migration71.other-changes.php which states that PHP will complain if we ask it to execute a math operation where one operand is a string that does not contain a well formatted number.
The webform
webform.webform.test_element_computed_twig.yml
contains an inline Twig template with the following snippet:{{ webform_token('[webform_submission:values:number]', webform_submission) * 2 }}
. It will execute just fine when you preview or view a webform submission. But if you just open the webform (and you're about to submit something into it), the token cannot determine the value as the webform submission data is still empty. Thus PHP effectively is asked to execute(string) '[webform_submission:values:number]' * 2
and rightfully it complains.The rendered template is hidden on the form view via
#access => FALSE
(it becomes #access => TRUE when we view a submission). But just placing access FALSE is not enough because the rendering still happens. The solution is not to invoke Twig engine at all if #access is FALSE.. anyway Twig's work will not be shown to the end user.I attach the patch that does it.
Implications of the bug: As much as I can judge, from end user perspective there was no real deficiency in performance/features. It's just an internal cleanup.
Comment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedOne option is to add the clear option to the single token by changing
[webform_submission:values:number]
to[webform_submission:values:number:clear]
. I am assuming an empty string would be parsed as 0. If this works we should update the documentation.Comment #5
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedPHP 7.1.* will complain if you do
but the issue is addressed in my patch #2.
Now I am addressing an issue in
WebformEntityElementsValidationTest
. I didn't manage to reproduce it locally but from analyzing the code and the error message, seems like it was just a misspelling in the test case source code. I am uploading the patch to let drupal testbot confirm my assumption about the misspelling.Comment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedBy using #access to disable the calculation could cause unexpected regressions.
For now, how about we just use the below code snippet and define a default value...
{{ (webform_token('[webform_submission:values:number:clear]', webform_submission) ?: 0) * 2 }}
The attached patch contains this change.
Comment #7
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedAlright :) Yes, I took your patch and incorporated into my other progress + reverted my fix through #access flag. Attaching the patch.
Comment #8
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedOkie dokie, the next guy is
./webform/modules/webform_ui/src/Tests/WebformUiElementTest.php
This one fails not because of PHP 7 but because of Drupal core 8.5. WIth D8.5 they have stabilized off_canvas dialogs so webform UI changes a little bit thedata-dialog-*
attributes in the links it generates. The failing test had a too restrictive match and because of the change began to fail on D8.5. I only had to relax a little bit your assert condition. Probably a quick glance at the interdiff.txt will tell you more than my English.Comment #9
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedYour changes make sense especially because we have to support 8.3.x+
I usually cut-n-paste HTML fragments because it is faster and stricter, which I am okay with because it picks up unexpected changes like this one.
Comment #10
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedThe last failing test turned out to be a relatively serious thing. Hehe, let me jump the gun and say that because of those PHP warnings/notices introduced in PHP 7.1 the things I am about to say became visible.
The function
_webform_entity_element_validate_rendering_error_handler()
contained a logical error. Probably a typo. Let me just paste here in-line the interdiff.txt:Instead of supplying the
$error_level
the$message
was supplied. This led drupal standard error handler to believe that the error was not important and it was not logging it anywhere. Some [seems to me] significant errors were unintentionally suppressed that way. One of those is:call_user_func_array() expects parameter 1 to be a valid callback, class 'Drupal\webform\Element\WebformImageFile' does not have a method 'processManagedFile'
. Maybe there are more. I am uploading a patch and will see if drupal test bot finds fails on more of them.Comment #12
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedWow, this is why ignoring broken tests is just a bad idea.
I am willing to bet a $1 that #2922331: Source validation fails on radio component when #required indented too far is related, even though the problem is in PHP 5.6
Comment #13
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedAfter fixing the issue of suppressing errors, an additional error got revealed in the same
WebformUiElementPropertiesTest
test.I am attaching a patch that fixes it. The error was because the test did not install a 'file' core module while poking file-based element types. I also include a few lines comment about a not-so-trivial IF statement because it took me a few hours to "get" it :)
I hope this time we are going to see a 100% pass :)
Comment #14
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedLooks good. Marking this as RTBC and I will commit it later today or tomorrow.
Comment #16
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented