Skip to content

Conversation

@xepozz
Copy link
Contributor

@xepozz xepozz commented May 28, 2025

now just with HEREDOC name

@xepozz xepozz marked this pull request as draft May 28, 2025 18:10
zend_ast_export_str(str, Z_STR_P(zv));
smart_str_appendc(str, '\'');
if (ast->attr & ZEND_NAME_HEREDOC) {
smart_str_appends(str, "<<<HEREDOC\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
smart_str_appends(str, "<<<HEREDOC\n");
smart_str_appends(str, "<<<'EOD'\n");

Comment on lines +9 to +11
<<<HTML
val inside
HTML
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would happen if:

  • The string contains a line HEREDOC?
  • The string contains special characters that would be escaped by zend_ast_export_str()?

Is it guaranteed that the output is valid PHP in all cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll cover these with tests, thanks.

@TimWolla TimWolla changed the title fix: dump heredoc tags zend_ast: Preserve heredocs in zend_ast_export() May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants