php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39526 > sign escapes from PHP
Submitted: 2006-11-15 22:44 UTC Modified: 2006-11-16 12:47 UTC
From: dereks at x-no-archive dot co dot uk Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.0 OS: Win XP Pro SP2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dereks at x-no-archive dot co dot uk
New email:
PHP Version: OS:

 

 [2006-11-15 22:44 UTC] dereks at x-no-archive dot co dot uk
Description:
------------
This might be something I've got wrong, but in PHP5 it appears that if you use the shorthand <? to start a php script, if you have a > sign anywhere before the closing ?>, PHP escapes and starts processing the rest of the script as HTML as if ?>; has been entered.

This didn't happen in 4.x, and feels like a bug rather than a feature.

This is with PHP Windows NT 5.1.6 build 2600, dated Aug 23 2006 16:31:18.  I would have upgraded in order to retest, but am unable to due to client's requirements.

Reproduce code:
---------------
<?

/*
 *  test break out of php with greater than sign
 *
 */
function somefunction($x) {
  if ($x > 100) {
    do_something();
  }
}
?>



Expected result:
----------------
Running this script on it's own should produce no output.

Actual result:
--------------
Actual output is:

100) { do_something(); } } ?>



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-15 22:52 UTC] tony2001@php.net
short_open_tag = On
 [2006-11-16 01:29 UTC] dereks at x-no-archive dot co dot uk
That was quick.  However: this is new behaviour; this did not happen in 4.x.  Perhaps it is "bogus" but "short_tag_open = On" doesn't really explain the change.  Can you elucidate?
 [2006-11-16 12:37 UTC] mgf@php.net
The behaviour you report is what we would expect with short_open_tag = Off in your php.ini.  For your short-tags example, you need short_open_tag = On.  Please check your configuration with <?php phpinfo() ?>
 [2006-11-16 12:47 UTC] dereks at x-no-archive dot co dot uk
Mea culpa.  I'll go to the bottom of the class.  Many thanks for the explanation, and apologies for wasting people's time.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 05:01:33 2025 UTC