• cumthsc

    (@cumthsc)


    To reproduce: visit a page that loads the plugin and runs PHP 7.3.
    Result: No content displayed. From httpd error.log:
    [Sat Mar 16 22:32:52.406315 2019] [php7:warn] [pid 13748] [client 69.201.44.30:54776] PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /var/www/html/coin-or/wordpress/wp-content/plugins/twitter-feed/twitterPlugin.php on line 269, referer: https://www.coin-or.org/

    From diff, the fix:
    # diff -c twitterPlugin.php.orig twitterPlugin.php
    *** twitterPlugin.php.orig 2014-10-24 13:55:25.000000000 -0400
    — twitterPlugin.php 2019-03-16 22:40:41.737995615 -0400
    ***************
    *** 266,272 ****

    function processKeyword( $strContent )
    {
    ! $strContent = preg_replace( “/\[twitter\]/ise”, “displayTwitterPlugin(true)”, $strContent, -1, $intMatches );

    if ( $intMatches > 0 )
    {
    — 266,276 —-

    function processKeyword( $strContent )
    {
    ! $strContent = preg_replace_callback(
    ! “/\[twitter\]/is”,
    ! “displayTwitterPlugin(true)”,
    ! $strContent, -1, $intMatches
    ! );

    if ( $intMatches > 0 )
    {

Viewing 1 replies (of 1 total)
  • Thread Starter cumthsc

    (@cumthsc)

    It’s a bit more complicated than the above patch. With the patch, I get the expected content on the page, but I still get the error:
    [Sat Mar 16 23:12:24.522757 2019] [php7:warn] [pid 15329] [client 69.201.44.30:55718] PHP Warning: preg_replace_callback(): Requires argument 2, ‘displayTwitterPlugin(true)’, to be a valid callback in /var/www/html/coin-or/wordpress/wp-content/plugins/twitter-feed/twitterPlugin.php on line 271,

    Not sure how to fix that one. Wrapping ‘displayTwitterPlugin(true)’ in an anonymous function along the lines of https://secure.php.net/manual/en/function.preg-replace-callback.php doesn’t work. It fixes the error message, but the page is comlpletely blank.

Viewing 1 replies (of 1 total)
  • The topic ‘twitterPlugin crashes with PHP 7.3’ is closed to new replies.