A PHP block inside an HTML string breaks the string processing

Bug #434803 reported by Matt
28
This bug affects 6 people
Affects Status Importance Assigned to Milestone
nXhtml
In Progress
Wishlist
Unassigned

Bug Description

When putting a PHP block inside a string in HTML, the mode loses track of the string at the start of PHP mode, and a quote after the ?> will start a new string.

For example, in:

<input type="hidden" name="act" value="act_<?php print $act; ?>" />

act_ is considered one string, and then /> is a new string. Instead, the " after ?> should close the string with act_

This affects syntax highlighting and indenting.

Revision history for this message
lborgman (lennart-borgman) wrote :

Hi Matt,

Thanks for reporting this. It is a known problem that I can not fix in a good way now, see:

  http://ourcomments.org/Emacs/nXhtml/doc/nxhtml-changes.html#php-attribute-values

In the future I hope to fix this, but it requires some rather heavy changes to Emacs. I have some ideas for this and is discussing it with some Emacs developers.

Changed in nxhtml:
importance: Undecided → Medium
status: New → In Progress
Changed in nxhtml:
status: In Progress → Won't Fix
status: Won't Fix → In Progress
importance: Medium → Wishlist
Revision history for this message
Chris Hecker (checker-lp) wrote :

Hi, I tried to register the workaround alt php tags mode in both the nxhtml-mode-hook and the nxhtml-mumamo-mode-hook, but both fail. It activates the alt mode, but it appears to happen before the <? ?> parsing, so the blocks are totally messed up. Is there any way to make this registerable as a hook like so:

(add-hook 'nxhtml-mumamo-mode-hook '(lambda () (mumamo-alt-php-tags-mode t)))

Thanks for the awesome nxhtml-mode, it's amazing!

Chris

Revision history for this message
Chris Hecker (checker-lp) wrote :

> It activates the alt mode, but it appears to happen before the <? ?> parsing, so the blocks are totally messed up.

Hmm, no, it looks like it's just messed up until you save. mumamo-alt-php-tags-mode marks the buffer as modified, and then when you save it seems to work. Is there any way to avoid having to save the buffer?

Thanks,
Chris

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.