Following code:

function parseUrl ( $url )
{
    $r  = '!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?';
    $r .= '(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))?!i';

    preg_match ( $r, $url, $out );

    return $out;
}

pasted in php tags, it's not viewed properly, even there is no ending tag.

Example:

function parseUrl ( $url )
{
    $r  = '!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?';
    $r .= '(?:\:(\d*))?([^#

+)?(?:\?([^#]+))?(?:#(.+$))?!i';

preg_match ( $r, $url, $out );

return $out;
}
?>

Comments

damien tournoud’s picture

Project: Drupal core » Code Filter
Version: 6.10 » 6.x-1.x-dev
Component: filter.module » Code

Interesting bug ;)

Drupal core has no PHP code filter, so I believe this belongs in the code filter project.

kenorb’s picture

Ah, sorry;)

fgm’s picture

Version: 6.x-1.x-dev » 8.x-1.x-dev
Issue summary: View changes

But is still present on 8.x (just checked).

joachim’s picture

Status: Active » Postponed (maintainer needs more info)

Is the problem that the blank lines of code get turned into P tags?

It would be helpful if the code sample didn't have the regexes in, as those make it look like there's a nasty problem there!