php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24787 one out two echo-statements results in output
Submitted: 2003-07-24 02:40 UTC Modified: 2003-07-24 15:31 UTC
From: per dot funke at ub dot oru dot se Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.3.2 OS: Linux
Private report: No CVE-ID: None
 [2003-07-24 02:40 UTC] per dot funke at ub dot oru dot se
Description:
------------
In script run from the shell, only one out of
two echo-statements results in a printed line.

Reproduce code:
---------------
#!/usr/local/php/bin/php
<?php
//#################################################################
echo "\nImport started. Infile is /usr/local/apache/htdocs/nweb/stdweb/vis/out.skv";
$a_compiled_collection[0]="";
   //$fp2 = fopen("/usr/local/apache/htdocs/nweb/stdweb/vis/out.skv","r");
$fp3 = fopen("/usr/local/apache/htdocs/nweb/stdweb/vis/imported_lines","r");
$last_read=fgets ($fp3);
$done=fclose($fp3);

echo "\nlast_read 1 ".$last_read;

   //fclose($fp2);
exit;
//#################################################################
?>




Expected result:
----------------
$ ./test.php


Import started. Infile is /usr/local/apache/htdocs/nweb/stdweb/vis/out.skv
last_read 1 500
last_read 2 500
$





Actual result:
--------------
$ ./test.php


Import started. Infile is /usr/local/apache/htdocs/nweb/stdweb/vis/out.skv
last_read 1 500
$


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-24 02:45 UTC] per dot funke at ub dot oru dot se
there is a line missing from the submitted code:
the line should read:

echo "\nlast_read 2 ".$last_read;

and should be inserted immediately after the line

echo "\nlast_read 1 ".$last_read;

(Sorry...)
 [2003-07-24 03:18 UTC] meebey@php.net
with PHP 4.3.2 cli my output with the last_read 2 echo is:
Import started. Infile is
test.txt
last_read 1 123

last_read 2 123

like it should be....
 [2003-07-24 06:14 UTC] sniper@php.net
You're either doing something wrong, or you have some weird
php.ini options set. Try error_reporting(E_ALL); as first line in your script. Also, ditch the hashbang line (#!..) and run the script with CLI: # sapi/cli/php -n test.php

 [2003-07-24 15:31 UTC] per dot funke at ub dot oru dot se
Thanks for your prompt attention. I'm sorry to say that I can't reproduce the error either. It has gone away after using up the better part of my working hours before lunch. I'm really sorry to have been using up your valuable time and I will now go and hit myself hard on the head w. a hammer (after having a look at the cli documentation though, it's new to me..). Humbly your's Per F.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 13:01:30 2024 UTC