Bug #55159 [Csd->Bgs]: fopen encodes ampersand '&' as '&'

From: Date: Mon, 11 Jul 2011 00:47:31 +0000
Subject: Bug #55159 [Csd->Bgs]: fopen encodes ampersand '&' as '&'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-161774@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55159&edit=1

 ID:                 55159
 Updated by:         cataphract@php.net
 Reported by:        knappster_1 at hotmail dot com
 Summary:            fopen encodes ampersand '&' as '&'
-Status:             Closed
+Status:             Bogus
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Unix
 PHP Version:        5.2.17
 Block user comment: N
 Private report:     N

 New Comment:

Closed is for fixed issues. Changing to Bogus.


Previous Comments:
------------------------------------------------------------------------
[2011-07-08 10:35:25] knappster_1 at hotmail dot com

I have tried your script on 2 Windows machines with Apache 2.2.11 and PHP 5.2.17 and my results
match yours.  I was sure I saw it when I first upgraded to 5.2.17 on my machine, but this now seems
to be an issue with the web host rather than a bug in php.  Sorry for the red herring.  I am
changing the status to closed.

------------------------------------------------------------------------
[2011-07-07 20:24:23] lonnyk at gmail dot com

I tested this on the 5.4 alpha and did not have this problem.

Here is my test script:
----------------------
<?php
error_reporting(E_ALL);
$fh = fopen("http://finance.yahoo.com/d/quotes.csv?
s=ABT&f=sl1d1t1c1ohgvpnbaejkr&o=t", "r");
while( !feof( $fh ) ){
        echo fgets( $fh ) . "\n";
}

Result:
---------------------

"ABT",53.54,"7/7/2011","4:01pm",+0.26,53.49,53.60,53.24,4932482,53.28,"Abbott

Laboratori",N/A,N/A,2.87,44.59,54.24,18.56

------------------------------------------------------------------------
[2011-07-07 16:32:41] knappster_1 at hotmail dot com

Description:
------------
---
From manual page: http://www.php.net/function.fopen%23Parameters
---
The function used to return a csv file with a stock quote with PHP 5.2.9.  However, now with 5.2.17
the function will replace '&' with '&amp;' and it returns a csv file
with just the text: "Missing Format Variable".

It is easy to verify by using a malformed URL with '&' in it and on the resulting
html, view source and the error message will show '&amp;' where '&'
should be.  I have been unable to locate a workaround.  

Test script:
---------------
fopen("http://finance.yahoo.com/d/quotes.csv?s=ABT&f=sl1d1t1c1ohgvpnbaejkr&o=t",
"r");



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55159&edit=1


Thread (4 messages)

« previous php.bugs (#161774) next »