Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.4

Bug #1066 Values are not trimmed
Submitted: 2004-03-24 18:27 UTC
From: jausions Assigned: thesaur
Status: Closed Package: HTML_CSS
PHP Version: Irrelevant OS: All
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 40 + 23 = ?

 
 [2004-03-24 18:27 UTC] jausions
Description: ------------ Property values are not trimmed by parseString(). Solution: add trim() around $value. .diff file has been posted to pear-dev@lists.php.net list. Thanks, -Philippe Reproduce code: --------------- <?php require_once('HTML/CSS.php'); $oCSS = new HTML_CSS(); $sCSS = <<<__CSS__ html { display: block; /* 8 spaces after colon */ } __CSS__; $oCSS->parseString($sCSS); print_r($oCSS->toArray()); ?> Expected result: ---------------- Array ( [html] => Array ( [display] => block ) ) Actual result: -------------- Array ( [html] => Array ( [display] => block ) ) // 1 + 8 spaces after ">" (just in case web browser collapses them) // 1 space is added by print_r function

Comments

 [2004-03-24 19:24 UTC] neufeind at php dot net
Patch provided by <Philippe.Jausions@11abacus.com>: ? HTML_CSS.diff ? test_HTML_CSS.php Index: CSS.php =================================================================== RCS file: /repository/pear/HTML_CSS/CSS.php,v retrieving revision 1.24 diff -u -r1.24 CSS.php --- CSS.php 28 Jan 2004 20:24:58 -0000 1.24 +++ CSS.php 24 Mar 2004 18:25:39 -0000 @@ -584,7 +584,7 @@ foreach ($codes as $code) { if (strlen($code) > 0) { list($property,$value) = explode(":",trim($code)); - $this->setGroupStyle($group, $property, $value); + $this->setGroupStyle($group, $property, trim($value)); } } } else { @@ -597,7 +597,7 @@ foreach ($codes as $code) { if (strlen($code) > 0) { list($property,$value) = explode(":",trim($code)); - $this->setStyle($key, $property, $value); + $this->setStyle($key, $property, trim($value)); } } }
 [2004-03-24 19:43 UTC] thesaur at php dot net
I've committed the fix to CVS. It will appear in the next version. Thanks for pointing this out!