1

I'm using PHPStorm 6.0.3. Max for 6.x.

There's a random bug with syntax highlighting when PHP is inside HTML:

enter image description here

On some lines it works, on some it doesn't...

Text code for Copy/Paste:

        <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
        <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135"
             alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
    </a>
<?php if ($is_packs) { ?>
    <div class="pictos">
        <?php
          if ($_product->getAttributeText('heure_conso'))
            echo '<div class="heure-conso">'.$_product->getAttributeText('heure_conso').'</div>';
          if ($_product->getAttributeText('pack_spec'))
            echo '<div class="pack_spec">'.$_product->getAttributeText('pack_spec').'</div>';
          echo '<div class="nb-plats">'.$_product->getAttributeText('pack_spec').'</div>';
          if (Mage::helper('tbm/data')->productIsOkForCustomerPhase($_product))
            echo '<div class="phase-ok">'.$this->__('Adapté à votre phase').'</div>';
        ?>
    </div>
    <div class="description">
        <?php echo $_product->getShortDescription() ?>
    </div>
<?php } ?>

Any idea ?

10
  • Could you add the source along with the image so that someone could try it out to check if there's an issue with the code or your highlighter? Commented Nov 13, 2014 at 10:30
  • Add it to the bug tracker Commented Nov 13, 2014 at 10:31
  • Where is the bug exactly? -- I see none so far -- colloring is done accordingly to your (weird?) settings. Commented Nov 13, 2014 at 10:36
  • @LazyOne Can't you see the image ? Commented Nov 13, 2014 at 10:38
  • I see the image -- I just do not see a bug. Are you talking about that light green background? If yes -- it's your settings and not a bug (but yes -- from your point of view it could be treated as bug if you do not remember how you have configured that). Commented Nov 13, 2014 at 10:38

1 Answer 1

4

Not a bug -- it's your custom settings.

For whatever reason / somehow (does not actually matter) you have injected custom language (most likely HTML) into all DIV tags (the light green background). Now everything in such tags is forcibly treated as that language (HTML?) -- PHP is ignored completely.

Settings (Preferences on Mac) | Language Injections -- find and delete offending rule. It should have "project" or "global" in most right column (Scope) -- do not touch "bundled" ones.

Alternatively -- Alt + Enter while having caret inside problematic place and choose "Uninject xxx" from popup menu.

Sign up to request clarification or add additional context in comments.

1 Comment

All right, it was an injection for Derby language (??) that was applied to all files... I didn't do that, probably some WTF plugin... Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.