Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#45482 closed defect (bug) (wontfix)

PHP 5.2.17 Bug Workaround

Reported by: nimce's profile nimce Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.8
Component: Editor Keywords: has-patch reporter-feedback
Focuses: Cc:

Description (last modified by swissspidy)

For WordPress installations on PHP 5.2.17,
WordPress fails to run correctly because of a PHP bug, PHP reports this error:

Backend fatal error: PHP Fatal error:  Cannot use assign-op operators with overloaded objects nor string offsets in /wp-includes/functions.php on line 3346

Those lines are causing the problems:

$mce_init['plugins'] .= ',directionality';
$mce_init['toolbar1'] .= ',ltr';

Changing those lines to:

$mce_init['plugins'] = $mce_init['plugins'] . ',directionality';
$mce_init['toolbar1'] = $mce_init['toolbar1'] . ',ltr';

Respectively, fixes the issues for this PHP version.
It is a PHP 5.2 bug, but the workaround fixes the issue for PHP 5.2, and it doesn't affect newer versions of PHP, perhaps consider to change those 2 lines in the next release?

Thanks

Change History (8)

#1 @swissspidy
5 years ago

  • Description modified (diff)

#2 @joyously
5 years ago

WordPress works with PHP 5.2.4+

#3 follow-up: @dd32
5 years ago

  • Component changed from General to Editor
  • Keywords reporter-feedback added

@nimce Can this be duplicated without any plugins installed?

The code in question has been there since WordPress 2.5 (a time where PHP 5.2.x was much more common) in some form. Looking at the error message, it appears that it could be caused by a plugin either unsetting those array indicies or maybe inserting an array instead of a string.

Although this only affects RTL & PHP 5.2, it seems unlikely that this is something that wouldn't have been noticed sooner.

#4 in reply to: ↑ 3 @nimce
5 years ago

Replying to dd32:

@nimce Can this be duplicated without any plugins installed?

The code in question has been there since WordPress 2.5 (a time where PHP 5.2.x was much more common) in some form. Looking at the error message, it appears that it could be caused by a plugin either unsetting those array indicies or maybe inserting an array instead of a string.

Although this only affects RTL & PHP 5.2, it seems unlikely that this is something that wouldn't have been noticed sooner.

Yeah, I can confirm this happens with a clear WordPress installation as well.
This happened to me so far with PHP 5.2.17 only.

#5 @nimce
5 years ago

I'd also like to add this is the latest 5.2 version of PHP as far as I know.

#6 follow-up: @dd32
5 years ago

Thanks @nimce, can you debug what the $mce_init values are at on the preceding lines at all?

I don't have access to a PHP 5.2 environment at present, but can only duplicate the issue in all versions of PHP by setting $mce_init to a string rather than an array:
https://3v4l.org/ZVCKP

#7 in reply to: ↑ 6 @nimce
5 years ago

Replying to dd32:

Thanks @nimce, can you debug what the $mce_init values are at on the preceding lines at all?

I don't have access to a PHP 5.2 environment at present, but can only duplicate the issue in all versions of PHP by setting $mce_init to a string rather than an array:
https://3v4l.org/ZVCKP

Sure, here is the code you provided running on PHP 5.2.17 (I have disabled reporting of notices):
https://www.profity.co.il/php-bug.php

Thanks!

#8 @pento
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Closing this ticket, as we no longer support PHP 5.2.

Note: See TracTickets for help on using tickets.