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 functions prefixed with a slash are being ignored #284

Closed
dgwyer opened this issue Nov 16, 2022 · 3 comments
Closed

PHP functions prefixed with a slash are being ignored #284

dgwyer opened this issue Nov 16, 2022 · 3 comments

Comments

@dgwyer
Copy link

dgwyer commented Nov 16, 2022

I thought this issue was directly related to wp-cli and so I posted the original message there: wp-cli/i18n-command#344

Basically when prefixing a PHP i18n with a slash it gets ignored.

e.g.

<?php
// wp i18n make-pot . --domain=bar
\esc_html__('foo', 'bar'); // ignored
esc_html__('baz', 'bar'); // processed
@oscarotero
Copy link
Member

This is in Gettext 4, right?

I'm not working on maintaining this version (not enough time) but accept PR. If you want to work on that, I guess this can be fixed somewhere here: https://github.com/php-gettext/Gettext/blob/4.x/src/Utils/PhpFunctionsScanner.php#L117

@remcotolsma
Copy link

It might be good to know that this seems to work well on PHP 7.4, but it goes wrong in PHP 8:

remcotolsma added a commit to remcotolsma/Gettext that referenced this issue Dec 7, 2022
oscarotero added a commit that referenced this issue Dec 7, 2022
Handle PHP 8 `T_NAME_FULLY_QUALIFIED` to fix issue #284
@oscarotero
Copy link
Member

Fixed and released in v4.8.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants