Bug #16039 [Opn->Fbk]: getAttributesString() uses ENT_QUOTES which breaks IE

From: Date: Fri, 03 Apr 2009 17:42:01 +0000
Subject: Bug #16039 [Opn->Fbk]: getAttributesString() uses ENT_QUOTES which breaks IE
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-297@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=16039&edit=1 ID: 16039 Updated by: borz_off@cs.msu.su Reported By: cweiske at php dot net Summary: getAttributesString() uses ENT_QUOTES which breaks IE -Status: Open +Status: Feedback Type: Bug Package: HTML_Common2 Package Version: 2.0.0beta1 PHP Version: 5.2.9 Roadmap Versions: New Comment: -Status: Open +Status: Feedback Can you please give a complete example? The first obvious attempt to reproduce the problem works correctly in IE 6: ---------------------------------------- require_once 'HTML/Common2.php'; class Bug16039 extends HTML_Common2 { public function __toString() { return '<input' . $this->getAttributes(true) . ' />'; } } $bug = new Bug16039(array( 'type' => 'button', 'value' => 'Click me', 'onclick' => "alert('Clicked me, you did!');" )); echo $bug; ---------------------------------------- Previous Comments: ------------------------------------------------------------------------ [2009-03-17 09:08:22] cweiske This problem occured when using attributes like the following: 'onchange' => 'document.getElementById(\'showCabins\').click()', ------------------------------------------------------------------------ [2009-03-17 09:07:46] cweiske Description: ------------ HTML_Common2::getAttributesString() uses > htmlspecialchars($value, ENT_QUOTES, $charset) This is breaks Javascript onchange actions in Internet Explorer 6 at least because single quotes get escaped as '''. This is technically correct, but buggy in IE. When changing it to ENT_COMPAT, it works in IE. There should be also no problems since double quotes get still escaped - and HTML_Common2 uses double quotes as attribute delimiters. ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=16039&edit=1

« previous php.pear.bugs (#297) next »