• Resolved quppa

    (@quppa)


    I’m getting the following error when trying to activate version 2.8.15 of this plugin with WordPress 5.6 (RC1) and PHP 8.0.0:

    Fatal error:  Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, string given in /var/www/html/blog/wp-content/plugins/urvanov-syntax-highlighter/util/class-urvanov-syntax-highlighter-util.php:663
    Stack trace:
    #0 /var/www/html/blog/wp-content/plugins/urvanov-syntax-highlighter/util/class-urvanov-syntax-highlighter-util.php(672): UrvanovSyntaxHighlighterUtil::version_parts()
    #1 /var/www/html/blog/wp-content/plugins/urvanov-syntax-highlighter/class-urvanov-syntax-highlighter-plugin.php(1134): UrvanovSyntaxHighlighterUtil::version_compare()
    #2 /var/www/html/blog/wp-content/plugins/urvanov-syntax-highlighter/class-urvanov-syntax-highlighter-plugin.php(1326): Urvanov_Syntax_Highlighter_Plugin::update()
    #3 /var/www/html/blog/wp-admin/includes/plugin.php(2299): include('...')
    #4 /var/www/html/blog/wp-admin/plugins.php(191): plugin_sandbox_scrape()
    #5 {main}
      thrown in /var/www/html/blog/wp-content/plugins/urvanov-syntax-highlighter/util/class-urvanov-syntax-highlighter-util.php on line 663

    I don’t see anything in the PHP 8 breaking changes list, but I wonder if they switched this warning to an error: https://wiki.php.net/rfc/counting_non_countables

Viewing 15 replies - 1 through 15 (of 21 total)
  • Plugin Author urvanov

    (@urvanov)

    Strange error. I did not test the plugin in PHP 8 yet.

    Looks that you are right, they changed the behaviour. I cannot fix and make the update right now. But I will try to do something on the weekend.

    Plugin Author urvanov

    (@urvanov)

    I tried it but I couldn’t start a fresh copy of WordPress with PHP 8. Maybe it is too early.

    Thread Starter quppa

    (@quppa)

    I had some issues running WordPress 5.5, but pre-release WordPress 5.6 seems to be working fine.

    Plugin Author urvanov

    (@urvanov)

    @quppa I have installed PHP 8 and wordpress 5.6 with the plugin. But I don’t see the errors. Maybe there some other conditions?

    • This reply was modified 3 years, 11 months ago by urvanov.

    As @quppa mentioned, problems were with WP 5.5 and not 5.6.

    I guess you can mark this as solved because everyone needs to update to the latest version.

    Thank you @quppa for letting @urvanov know.

    Thread Starter quppa

    (@quppa)

    I’m afraid I’m getting the same error with 2.8.16.

    Same problem for me but it appeared after the update updating from 2.8.15 to 2.8.16, now even downgrading doesen’t help :/

    @urvanov You should use this function to prevent this error: https://www.php.net/manual/en/function.is-countable.php

    Problem still exists on version 2.8.17.

    Maybe just use version_compare function from PHP instead of your own function?

    Plugin Author urvanov

    (@urvanov)

    I don’t understand why I don’t see the error. What is the difference between your PHP and mine?

    Plugin Author urvanov

    (@urvanov)

    Maybe some minor version difference

    Plugin Author urvanov

    (@urvanov)

    @beherit , @quppa Tell please. Do you use the version from wordpress plugin repository or from github sources repository?

    @urvanov I use version form wordpress plugin repository. Problem still exists, I can’t even go to site admin page :/

    Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, string given in /.../public_html/wp-content/plugins/urvanov-syntax-highlighter/util/class-urvanov-syntax-highlighter-util.php:664 Stack trace: #0 /.../public_html/wp-content/plugins/urvanov-syntax-highlighter/util/class-urvanov-syntax-highlighter-util.php(673): UrvanovSyntaxHighlighterUtil::version_parts() #1 /.../public_html/wp-content/plugins/urvanov-syntax-highlighter/class-urvanov-syntax-highlighter-plugin.php(1134): UrvanovSyntaxHighlighterUtil::version_compare() #2 /.../public_html/wp-content/plugins/urvanov-syntax-highlighter/class-urvanov-syntax-highlighter-plugin.php(1326): Urvanov_Syntax_Highlighter_Plugin::update() #3 /.../public_html/wp-settings.php(388): include_once('...') #4 /.../public_html/wp-config.php(94): require_once('...') #5 /.../public_html/wp-load.php(37): require_once('...') #6 /.../public_html/wp-admin/admin.php(34): require_once('...') #7 /.../public_html/wp-admin/index.php(10): require_once('...') #8 {main} thrown in /.../public_html/wp-content/plugins/urvanov-syntax-highlighter/util/class-urvanov-syntax-highlighter-util.php on line 664

    Version form github have this same problem.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Uncaught TypeError (PHP 8 issue?)’ is closed to new replies.