Page MenuHomePhabricator

XHPAST fails to parse quotes nested within an expression nested within quotes.
Closed, InvalidPublic

Description

The following code snippet is valid PHP, but XHPAST cannot parse it. Specifically, the following error is raised: XHPAST Parse Error: syntax error, unexpected T_STRING, expecting ',' or ';' on line 8.

<?php

$user = array(
  'id'   => 123,
  'name' => 'Joe Bloggs',
);

echo "'{$user["name"]}'";

The issue here is that double quotes are nested within an expression that is nested within double quotes. The following modification to the source will parse correctly:

-echo "'{$user["name"]}'";
+echo "'{$user['name']}";

Event Timeline

joshuaspence raised the priority of this task from to Needs Triage.
joshuaspence updated the task description. (Show Details)
joshuaspence added a project: XHPAST.
joshuaspence added a subscriber: joshuaspence.
joshuaspence claimed this task.

I think this was due to a local modification I had forgotten about.