$user is display twice in globals page (api.drupal.org)
lilou - October 11, 2008 - 14:40
| Project: | API |
| Version: | HEAD |
| Component: | Parser |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Description
| Project: | API |
| Version: | HEAD |
| Component: | Parser |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
#1
Weird. The line that was picked up is in modules/php/php.module:
<?php$output .= '<li>' . t('<p>To display the name of a registered user, use this instead:</p>
<pre>
global $user;
if ($user->uid) {
print t(\'Welcome @name! Thank you for visiting.\', array(\'@name\' => $user->name));
}
else {
print t(\'Welcome visitor! Thank you for visiting.\');
}
</pre>') . '</li></ul>';
?>
Is this a bug that can be easily fixed in the API module? I'm not sure. Here's a patch that should fix this within the PHP module. The output is exactly the same, but it changes the string to use a surrounding double quote, so we can escape the $ characters in the example.
#2
The last submitted patch failed testing.
#3
Failed due to #74645: modify file_scan_directory to include a regex for the nomask.. Setting back to code needs review.
#4
Moving to api.module.
#5
This still applies. Hopefully gets retested soon.
#6
This caused by API's regular-expression-powered PHP parser, which does not know enough about PHP syntax. The issue for that is #300031: Rework PHP parser.