Bug #54637 [Opn]: Null src value causes script to run twice
| From: | thomas dot roberts at texaswww dot net | Date: | Fri, 29 Apr 2011 20:18:00 +0000 |
| Subject: | Bug #54637 [Opn]: Null src value causes script to run twice | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-160459@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54637&edit=1
ID: 54637
User updated by: thomas dot roberts at texaswww dot net
Reported by: thomas dot roberts at texaswww dot net
Summary: Null src value causes script to run twice
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: Debian
PHP Version: 5.2.17
Block user comment: N
Private report: N
New Comment:
Makes sense. Thank you.
Previous Comments:
------------------------------------------------------------------------
[2011-04-29 22:13:53] felipecg00 at gmail dot com
Well it's just sending another request to the same address.
Not a bug neither PHP related I guess.
------------------------------------------------------------------------
[2011-04-29 21:38:53] thomas dot roberts at texaswww dot net
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 this bug report at http://bugs.php.net/bug.php?id=54637&edit=1