Running static analysis (phpcf) against Webform 3.x yields these two errors:
7.0 | /webform/i../webform.export.inc:99 | method_name | Method name webform_exporter_delimited:webform_exporter_delimited (@php4_constructors) is deprecated.
7.0 | /web../in../webform.export.inc:159 | method_name | Method name webform_exporter_excel:webform_exporter_excel (@php4_constructors) is deprecated.
Fix is to rename the constructors to __construct.
This has already been done in the 7.x-4.x branch.
This issue is to do the same in the 7.x-3.x branch for those users not ready to upgrade to Webform 4.x, but who are being forced to upgrade to PHP 7 due to PHP 5.6 EOL.
Comments
Comment #2
josephr5000 commentedHere's a patch.
Comment #3
josephr5000 commentedComment #4
josephr5000 commentedOops, missed a parent:: constructor reference. Here's an updated patch.
Comment #5
josephr5000 commentedComment #6
liam morlandWebform 3 receives critical bug fixes only. If the WF3 community gets this to RTBC, I will commit it.
Comment #7
calebtr commentedThe patch applies, fixes the "deprecated" messages and doesn't break any other stuff.
I note there is a nearly identical solution posted in a related issue (https://www.drupal.org/project/webform/issues/2938667#comment-12988014) - which is what makes me RTBC this.
Is hiding a bunch of error messages "critical" enough? If not, I am okay with closing this issue instead.
Comment #8
calebtr commentedRethinking this. It is all fine for Webform to update its own constructors, but what about making them backwards-compatible for contrib and custom modules that might have extended these export handlers?
We could create constructors that just call the old constructors as regular old public methods. It's not pretty, but it suppresses the warnings and supports legacy code.
Comment #9
liam morlandThat sounds reasonable to me.
Comment #10
caschbre commentedHere's a patch to match the latest security release.
I took the patch from #4 but implemented as noted in #8.
Comment #11
liam morlandThanks for the patch. I think it would be better if they were the other way around, that is, the __construct() methods contain the actual function and the old function names are wrappers with @deprecated comments.
Comment #12
mradcliffeI think this is what you're looking for @Liam Morland.
Comment #13
liam morlandYes, that is the idea. We just need someone else to review and test.
Comment #14
dasginganinjaWe are now using this at Lehigh University and it is in place for ~120 sites without issues.
Comment #16
liam morlandThanks everyone.