Closed jdarwood007 closed 7 years ago
@Sesquipedalian from PR #3680
What version of PHP?
PHP 7.0.8-0ubuntu0.16.04.3
Thanks, @jdarwood. I am currently travelling, so at the moment I can't directly test any fixes myself. Instead, could you please test what happens if you change line 5799 in your local copy from
$index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex)
to
$index_to_regex = function ($index, $delim) use (&$strlen, &$index_to_regex)
Got the same issue, when i apply your changes i got: Fatal error: Maximum execution time of 30 seconds exceeded in G:\github\SMF2.1\Sources\Subs.php on line 5819
Seems to work if I do this:
// build_regex() returns an array. We only need the first item.
$temp = build_regex($tlds);
$tld_regex = array_shift($temp);
Well, it strikes me as odd that using a temporary variable is not necessary in PHP 5 but is in PHP 7. But hey, if it works, it works. I'll submit a PR including this change early next week (I won't return from my travels until then).
http://stackoverflow.com/questions/28477341/strict-standards-only-variables-should-be-passed-by-reference https://bugs.php.net/bug.php?id=48937
Seems to indicate this is how array_shift works and strict mode throws the warning.
Thanks, @jdarwood007. That explains the issue nicely.
This introduces a new error
Notice : Only variables should be passed by reference in /smf21git/Sources/Subs.php on line 5710
In my Subs 5709 and 10 lines: