php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #31284 php mime/type
Submitted: 2004-12-24 12:04 UTC Modified: 2014-11-01 23:18 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: teunkloosterman at gmail dot com Assigned:
Status: Wont fix Package: *General Issues
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-12-24 12:04 UTC] teunkloosterman at gmail dot com
Description:
------------
when making a php document with the <script></script> construct, you recommend typing: <script language="php"></script> but this is widely deprecated in html and xhtml. I think it's better to use <script type="text/php"></script> since this is more relevant because it's used everywhere

PS. I've also tried: application/x-httpd-php as mime/type

Reproduce code:
---------------
<html>
 <head>
  <title></title>
 </head>
 <body>
  <script type="text/php">
   echo "hello";
  </script>
 </body>
</html>

Expected result:
----------------
hello

Actual result:
--------------
javascript error

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-17 23:32 UTC] ne01026 at shark dot 2a dot pl
Actually, you get hit by this problem only if your script embedded in HTML 4.01 code contains GREATER-THAN SIGN (>) because that is when you cannot use the processing instruction syntax.

I think full HTML syntax should be supported, 
with comment stripping and trailing comments, that is

<SCRIPT TYPE="text/php" RUNAT=SERVER ><!-- This is a PHP script
//--></SCRIPT >
 [2014-11-01 23:18 UTC] requinix@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2014-11-01 23:18 UTC] requinix@php.net
<script> support is being removed entirely in PHP 7.
https://wiki.php.net/rfc/remove_alternative_php_tags
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 15:01:30 2024 UTC