php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19956 readfile()/fread() screws up HTML attribute quoting
Submitted: 2002-10-17 11:05 UTC Modified: 2002-10-17 11:10 UTC
From: bcd at vineyard dot net Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.2.2 OS: FreeBSD4.5
Private report: No CVE-ID: None
 [2002-10-17 11:05 UTC] bcd at vineyard dot net
This is -very- wierd - this seems to happen when using
PHP to load HTML templates. Somewhere, in fread(), HTML attributes are being modified ever-so-slightly:

<a href = "foo-bar.html"> 

gets translated to:

<a href =" foo-bar.html">

This happens for double and single-quotes, and only when whitespace exists to the right of the equal sign of an html attribute. 

If there is multiple white-space, the whitespace is all moved to the beginning of the HTML attribute value: ie,

<a href =       "foo-bar.html">

becomes:

<a href ="       foo-bar.html">


There are more examples at the following URL:

http://www.vineyard.net/vni/php-test.php

PHP is setup normally on our systems (Default everything), and I've found no related bugs in the bug archive, so I think I am the first one to see this bug (If it is a bug?)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-17 11:10 UTC] sander@php.net
This is probably done by the (session) url rewriter.
Either disable it in your php.ini, or fix your HTML:
<a href = "foo-bar.html">
is not valid HTML.
 [2002-10-17 11:11 UTC] bcd at vineyard dot net
This also happens in readfile(), which I'm sure uses fread() internally -
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 12:01:27 2024 UTC