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

Work around syntax error caused by the pot-to-php script #1427

Merged
merged 4 commits into from
Sep 13, 2018

Conversation

swissspidy
Copy link
Collaborator

This is an attempt to fix #1416 for the time being.

I still have to look into how the pot-to-php script handles comments exactly and how it can be solved. We likely don't need that script anymore in the long run though.

Also, I need to find some time to look into the WP-CLI command. It should be possible to skip the file comment entirely by using --file-comment="" instead of using a somewhat hacky --file-comment="*/\'\'/*" workaround. This would also mostly eliminate the need to fix the pot-to-php script.

Fixes #1416.

@westonruter
Copy link
Member

@swissspidy the fix doesn't seem to be working:

<?php
/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */
$generated_i18n_strings = array(
	/* translators: *//* */
,

	/* Plugin Name of the plugin */
	__( 'AMP', 'amp' ),

Checking syntax:

php -l build/languages/amp-translations.php
PHP Fatal error:  Cannot use empty array elements in arrays in build/languages/amp-translations.php on line 5

@westonruter
Copy link
Member

Adding more slashes fixes the problem: e301ee6.

@swissspidy
Copy link
Collaborator Author

Thanks for the review!

The slashes might be an environment thing. I thought it worked fine when I tested it the other day...

In the meantime I submitted a PR to the WP-CLI command to make --file-comment="" work: wp-cli/i18n-command#82

@westonruter westonruter added this to the v1.0 milestone Sep 13, 2018
@westonruter westonruter merged commit a688267 into develop Sep 13, 2018
@westonruter westonruter deleted the fix/pot-to-php-syntax-error branch September 13, 2018 06:51
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

Successfully merging this pull request may close these issues.

Syntax error in amp-translations.php can block deployments
2 participants