FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=15787&edit=1

ID: 15787
Updated by: borz_off@cs.msu.su
Reported By: pear at laurent-laville dot org
Summary: _parseAttributes with strings trimmed blank of
attribute values
-Status: Verified
+Status: Closed
Type: Bug
Package: HTML_Common
Package Version: 1.2.4
PHP Version: 5.2.8
Assigned To: avb
Roadmap Versions:
New Comment:

-Status: Verified
+Status: Closed

Fixed in release 1.2.5

Note though, that it won't make much difference, as HTML spec [1]
says:
User agents may ignore leading and trailing white space in CDATA
attribute values (e.g., " myval " may be interpreted as "myval").
Authors should not declare attribute values with leading or trailing
white space.

[1] http://www.w3.org/TR/html401/types.html


Previous Comments:
------------------------------------------------------------------------

[2009-02-04 11:57:32] avb

-Status: Open
+Status: Verified
-Assigned To:
+Assigned To: avb

I think Laurent is right and that is definitely a bug that should be
fixed in HTML_Common.

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

[2009-01-28 03:46:07] farell

Daniel,

The migration to HTML_Common2 is not a valid solution.

1. as HTML_Common2 is a pure PHP5 package, the new parseAttributes()
method is protected access and should be call by a parent inherit class

2. parseAttributes() method accept only a string as parameter, while
HTML_Common::_parseAttributes() accept both string and array

Why not just to fix the problem. Have a look at
HTML_Common::_parseAttributes() behavior :
- with array parameter no trim to keys, values
- with string parameter, keys and values are trimmed

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

[2009-01-27 21:32:20] doconnor

Pity that so much depends on this package that won't probably be able
to migrate:
* HTML_CSS
* HTML_Page
* HTML_Page2
* HTML_Progress
* HTML_Progress2
* HTML_QuickForm
* HTML_QuickForm_advmultiselect
* HTML_QuickForm_altselect
* HTML_Select
* HTML_Table

... otherwise I'd suggest its a wontfix -> migrate to HTML_Common2.

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

[2009-01-27 13:05:15] farell

Description:
------------
While it was already fixed in HTML_Common2 (2006-06-23: revision 1.3),
the problem still exists with PHP4 version of this package.

Reason is usage of php trim function.

We should keep the blanks before and after the value of 'value'
attribute.



Test script:
---------------
<?php
require_once 'HTML/Common.php';

$a = 'name="remove" value=" &lt;&lt; " type="button"';
$r = HTML_Common::_parseAttributes($a);
var_export($r);
?>


Expected result:
----------------
array (
'name' => 'remove',
'value' => ' &lt;&lt; ',
'type' => 'button',
)

Actual result:
--------------
array (
'name' => 'remove',
'value' => '&lt;&lt;',
'type' => 'button',
)

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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedApr 3, '09 at 3:29p
activeApr 3, '09 at 3:29p
posts1
users1
websitepear.php.net

1 user in discussion

Borz_off: 1 post

People

Translate

site design / logo © 2022 Grokbase