php.net |  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: zak@php.net Assigned:
Status: Closed Package: Recode related
PHP Version: 4.0.3pl1 OS: Mandrake Linux 7.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zak@php.net
New email:
PHP Version: OS:

 

 [2000-11-09 23:18 UTC] zak@php.net
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 ('http://www.netscape.com/', 'r');
$tmp = tmpfile ();

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

rewind ($tmp);

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-10 17:08 UTC] zak@php.net
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] stas@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 10:01:30 2024 UTC