Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-7312

& symbol is replaced by & when highlighting PHP code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 3.0.2
    • 3.0.1
    • Viewing posts
    • None
    • PHP Environment:
      Database:

      When you want to show some PHP code in a post, like this

      <php
         echo "<a href=\"javascript:history.back()\">";
      ?php

      it will show : instead of : after javascript

      <php   echo "<a href=\"javascript&#058;history.back()\">";?php

      that's because the function highlight_string replaces & by & so : becomes &#058;

      In order to fix this I did the same

      OPEN
      includes/message_parser.php

      SEARCH

      $code = highlight_string($code, true);

      REPLACE WITH

      $code = str_replace("&amp;", "&amp;amp;", $code);
      $code = highlight_string($code, true);
      $code = str_replace("&amp;", "&", $code);

            Acyd Burn Meik Sievertsen [X] (Inactive)
            codebirth codebirth
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: