|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7736 recode_file generates warning when input fh has received data from remote fh
Submitted: 2000-11-09 23:18 UTC Modified: 2000-11-21 08:32 UTC
From: Assigned:
Status: Closed Package: Recode related
PHP Version: 4.0.3pl1 OS: Mandrake Linux 7.1
Private report: No CVE-ID: None
 [2000-11-09 23:18 UTC]
recode_file() generates a spurious warning when the 'input' file handle has had data sent to it from a file handle that references a remote system. Despite the warning, the recode attempt succeeds - converting between character sets and writing the data to the 'output' file handle

See the script below.

# Open a local file (instead of URL) and no warning is generated
$input = fopen ('', 'r');
$tmp = tmpfile ();

while (! feof ($input))
	fwrite ($tmp, fgets ($input, 1024));

rewind ($tmp);

recode_file ('us..flat', $tmp, tmpfile ());


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-10 17:08 UTC]
I think that problem comes from the fwrite source code 
( however my C skills are minimal and I have not carefully dug through the code :)

It seems that when fwrite gets data from a file handle with issock set, it in turn has issock set - thus making recode unhappy...

(This is my blind guess. Hopefully this helps point out the problem (or at least amuses someone :). If I get a chance, I will try to analyze the problem in more detail - however, I short on skill and time for this kind of work.)
 [2000-11-21 08:32 UTC]
This is not a file problem, this is an us..flat recoding
problem. recode says on that:

recode: Ambiguous output in step `ISO-8859-1..ASCII-BS'.

I guess us..flat recode doesn't like CRs that are many in
Netscape's HTML. This is actually a bug - one shouldn't use
both LF and CR-LF line endings in one text. But it's not a
recode bug, I guess.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Mar 27 22:03:45 2023 UTC