Support » Developing with WordPress » WP-CLI progress ticker throws a syntax error

  • I’m using progress tickers in my plugin (Relevanssi) and they work great – except when they don’t. Some people are complaining that this line:

    $progress = \WP_CLI\Utils\make_progress_bar( 'Indexing posts', count($content) );

    throws an unexpected T_STRING parse error. This doesn’t happen for everybody, and I can’t reproduce it on my sites. The code is taken from the WP CLI instructions, so should be correct (and works fine on my test environments, and for most users).

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Tim Nash

    (@tnash)

    Volunteer Moderator and spam hunter

    What version of PHP are the users using, as wp-cli is namespaced older versions of PHP won’t work with it, though I would have expected other errors to manifest themselves well before then.

    Also what’s in the $content variable, is it always numeric? though T_STRING is normally a syntax error, missing ; or similar.

    The $content variable shouldn’t be an issue; this code is not actually run, it’s a parse error.

    Namespace sounds like a good explanation, except that some people have complained about the issue with PHP 5.4, which should support namespaces. But I’ll try removing the first \, doesn’t seem to hurt and maybe it helps.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WP-CLI progress ticker throws a syntax error’ is closed to new replies.