Bug #54637 [NEW]: Null src value causes script to run twice
| From: | thomas dot roberts at texaswww dot net | Date: | Fri, 29 Apr 2011 19:38:54 +0000 |
| Subject: | Bug #54637 [NEW]: Null src value causes script to run twice | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-160457@lists.php.net to get a copy of this message | ||
From:
Operating system: Debian
PHP version: 5.2.17
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Null src value causes script to run twice
Description:
------------
PHP Version 5.2.6-1+lenny10
System Linux mycomputer 2.6.26-2-amd64 #1 SMP Tue Jan 25 05:59:43 UTC 2011
x86_64
Output:
1
Page Source:
<html><head><script type='text/javascript'
src=''></script></head><body>2</body></html>
* Leaving the script src='' (See code below) causes the entire script to
run twice, thus causing the session variable to double increment.
* The page source will show a value +1 higher than displayed value
* [Refresh] will output '3', then '5', ... with the Page Source showing
'4', '6', ...
* Adding a valid src file prevents the bug
Test script:
---------------
<?php
session_start();
++$_SESSION['count'];
echo "<html><head>";
echo "<script type='text/javascript' src=''></script>";
echo "</head><body>";
echo $_SESSION['count'];
echo "</body></html>";
?>
Expected result:
----------------
Output:
1
Page Source:
<html><head><script type='text/javascript'
src=''></script></head><body>1</body></html>
The script should only run once. The page source should match the actual
page output.
Actual result:
--------------
Output:
1
Page Source:
<html><head><script type='text/javascript'
src=''></script></head><body>2</body></html>
[Page Refresh]
Output:
3
Page Source:
<html><head><script type='text/javascript'
src=''></script></head><body>4</body></html>
--
Edit bug report at http://bugs.php.net/bug.php?id=54637&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54637&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54637&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54637&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54637&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54637&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54637&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54637&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54637&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54637&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54637&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54637&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54637&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54637&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54637&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54637&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54637&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54637&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54637&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54637&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54637&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54637&r=mysqlcfg