Bug #67683 [Opn->Fbk]: var_dump() makes the following codes execute twice
| From: | requinix@php.net | Date: | Fri, 25 Jul 2014 16:34:53 +0000 |
| Subject: | Bug #67683 [Opn->Fbk]: var_dump() makes the following codes execute twice | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186815@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67683&edit=1
ID: 67683
Updated by: requinix@php.net
Reported by: enadiz at foxmail dot com
Summary: var_dump() makes the following codes execute twice
-Status: Open
+Status: Feedback
Type: Bug
Package: Output Control
Operating System: Linux 3.13.0-24-generic #Ubuntu
PHP Version: 5.5.15
Block user comment: N
Private report: N
New Comment:
If you're only seeing the "int(0) test" once then the script is only executing once.
It may have executed previously, like if you forgot that test.txt is being appended to, or the
browser may have executed it twice (Chrome sometimes does this), but PHP itself is not doing it.
What if you dump $_SERVER["REQUEST_TIME_FLOAT"] to the file? Does it put the same number
or two different numbers? What do your server access logs show?
Previous Comments:
------------------------------------------------------------------------
[2014-07-25 11:11:59] enadiz at foxmail dot com
Description:
------------
The example A runs correctly .It's output on browse is like this
: int(0) test
and the output in file "test.txt" is
:
1406285601
The example B doesn't runs correctly .It's output on browse is
: int(0) test
which with no problem
but the output in file "test.txt" is like that
:
1406285917
1406285919
it means that all the codes executed twice except the line contains "echo".I try
replaced "file_put_contents " to other operation likes mysql's insert ,it still
executed twice and the database inserted two records;
Test script:
---------------
<?php //example A
sleep(2);
echo 'test';
file_put_contents("test.txt",time()."\r\n", FILE_APPEND);
?>
<?php // example B which some codes execute twice
var_dump(0);
sleep(2);
echo 'test';
file_put_contents("test.txt",time()."\r\n", FILE_APPEND);
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67683&edit=1