Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Warning for make-pot command: Empty needle for strpos() #125

Closed
westonruter opened this issue Dec 19, 2018 · 2 comments
Closed

PHP Warning for make-pot command: Empty needle for strpos() #125

westonruter opened this issue Dec 19, 2018 · 2 comments

Comments

@westonruter
Copy link

I've noticed a PHP warning being raised when running the make-pot command:

Warning: strpos(): Empty needle in phar:///.../wp/vendor/wp-cli/i18n-command/src/IterableCodeExtractor.php on line 175
PHP Warning:  strpos(): Empty needle in phar:///.../wp/vendor/wp-cli/i18n-command/src/IterableCodeExtractor.php on line 175

You can see this from a Travis build of the AMP plugin as well: https://travis-ci.org/ampproject/amp-wp/jobs/467674548#L355-L380

@swissspidy
Copy link
Member

Never ran into this, but it should be an easy fix.

Code in question:

$base = current( explode( '*', $path_or_file ) );
// If start of the path matches the start of the matcher until the first wildcard.
// Or the start of the matcher until the first wildcard matches the start of the path.
if (
0 === strpos( $base, $root_relative_path ) ||
0 === strpos( $root_relative_path, $base )
) {
return true;
}

Seems like the following command was run on Travis:

wp i18n make-pot . languages/amp-js.pot --include="*.js" --file-comment="*/null/*"

@westonruter Out of curiosity, why does the plugin still use make-pot and pot-to-php? Just for WP 4.9 + Gutenberg compatibility? Because with WordPress 5.0 it shouldn't be needed anymore.

@westonruter
Copy link
Author

@swissspidy Good question. The plugin is using make-pot because it hasn't been updated since the last time you changed it in ampproject/amp-wp#1427 😄 You can see that is where you added the above --file-comment.

schlessera pushed a commit that referenced this issue Jan 6, 2022
Kept getting this warning when doing `--include="*.blade.php"`, among other things

Related to #125 and #129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants