Update crashed my website
-
Hi,
today I’ve wanted to make the update to the last version of footnotes 2.6.3. Sadly it crashed my whole website. With the recovery mode of wordpress I’ve been able to deactivate the plugin. If I’m trying to re-activate the plugin I get the following error message:
Parse error: syntax error, unexpected ‘)’ in /var/www/html/wp-content/plugins/footnotes/class/task.php on line 1227
Would be great if I could use the plugin again.
-
I got absolutely same problem
Exactly the same here!
WordPress version 5.7
Current theme: OnePress Child (version 1.0.0)
Current plugin: footnotes (version 2.6.3)
PHP version 7.2.34Error Details
=============
An error of type E_PARSE was caused in line 1227 of the file /home2/****/public_html/wp-content/plugins/footnotes/class/task.php. Error message: syntax error, unexpected ‘)’`-
This reply was modified 5 years, 2 months ago by
bluebeatweb.
@scroom, @copylefter, @lagoon24,
I’ve immediately released the fix when seeing your bug reports. I didn’t get the error message because all my sandboxes are running PHP 7.3 or higher.
Best regards.
@scroom, @copylefter, @lagoon24,
Apologies for this. Per WordPress Coding Standards we are encouraged to end each line with a comma in multiline array notation. In the new excerpt function with footnotes, some function calls are so long I’ve ended up breaking them in lines, then unfortunately added those commas.
This article https://laravel-news.com/php-trailing-commas-functions published in June 2018 states that “PHP 7.3 won’t have arrow functions (that would be dreamy). However, trailing commas in function calls is an excellent addition coming to PHP 7.3. In PHP 7.3, trailing commas in function calls will be valid syntax. That is to say, you can use trailing commas when calling functions, but not defining them. Trailing commas in function calls are specifically useful for variadic functions: [examples] Importantly, this change only affects call syntax, not function declaration!”
I definitely call the functions:
// Safeguard the footnotes. preg_match_all( '#' . self::$a_str_start_tag_regex . '.+?' . self::$a_str_end_tag_regex . '#', $p_str_content, $p_arr_saved_footnotes, );Also the next:
// Prevent the footnotes from altering the excerpt: previously hard-coded '5ED84D6'. $l_int_placeholder = '@' . mt_rand( 100000000, 2147483647 ) . '@'; $p_str_content = preg_replace( '#' . self::$a_str_start_tag_regex . '.+?' . self::$a_str_end_tag_regex . '#', $l_int_placeholder, $p_str_content, );And below too:
// Readd footnotes in excerpt. $l_int_index = 0; while ( 0 !== preg_match( '#' . $l_int_placeholder . '#', $p_str_content ) ) { $p_str_content = preg_replace( '#' . $l_int_placeholder . '#', $p_arr_saved_footnotes[0][ $l_int_index ], $p_str_content, 1, ); $l_int_index++; }These three commas have now been removed, and v2.6.4 released in urgency.
I’m sad about screwing things up, and since three months I tried to hand the plugin over to experienced programmers, after failing the first time when @misfist was perhaps ready to relay me. Because I really joined in only because there were so many bugs in a plugin that I considered indispensable. Months ago I just customized it to get it to work, and documented the fixes for others to use the patches.
So I’ll be careful with commas when calling functions.
Sorry again!
-
This reply was modified 5 years, 2 months ago by
pewgeuges.
Thanks for your quick response. On my website (with PHP7.2.24) the problem is solved.
@pewgeuges
Thank you for your transparency and the prompt resolution! Fixed also for me 🙂Just saw this thread. Our website is NOT fixed. The latest version is 2.6.4 and it continues to break the site.
I’m horrified. What do you see? I don’t have a chance to get this displayed despite I’m constantly in debugging mode.
Thanks for your feedback, glad to hear it’s fixed. I was going to post some thoughts about it, but now I need to investigate the problem that @mmallett is experiencing!
@mmallett Please help me with some more details. Glad to learn you’re using 2.6.4 as this version is fixing many bugs old and new.
But what do you get displayed please? Any console error or PHP compiler warnings?
Please see https://ww.wp.xz.cn/support/topic/broken-662/#post-14261745 for follow-up.
@scroom, @copylefter, @lagoon24, @heikofromhamburg,
I didn’t know that commas after last function arguments are recent syntax, only found out about it afterwards. The Footnotes plugin doesn’t require PHP above version 5.6, so I was totally mistaken and apologize again.
Now I also see the point in avoiding extra commas in function calls: Unlike PHP arrays and JSON objects, function arguments have a predefined order, they cannot be raised. Trailing commas might only be left over in multiline calls after removing the last argument. My adding commas was totally stupid, I must confess in retrospect.
To account for inadvertence and to avoid screwing things up, the tendency is to allow trailing commas though.
Above all I need to mention that while this time, I luckily saw your bugreports rather timely, on March 1st I was unable to see anything during 3½ hours of crashed websites, because I didn’t trigger the disaster and ignored that it would happen and when, and had retired to rest.
Best regards.
-
This reply was modified 5 years, 2 months ago by
pewgeuges.
-
This reply was modified 5 years, 2 months ago by
The topic ‘Update crashed my website’ is closed to new replies.