[PEAR-BUG] Bug #18182 [Com]: Problem with quotes in preg_replace

[email protected] ("pagenotes")
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at http://pear.php.net/bugs/bug.php?id=18182&edit=1

 ID:               18182
 Comment by:       pagenotes
 Reported By:      jim at jgwilliamsdesign dot com
 Summary:          Problem with quotes in preg_replace
 Status:           Closed
 Type:             Bug
 Package:          HTML_QuickForm2
 Operating System: Ubuntu
 Package Version:  0.5.0
 PHP Version:      5.3.1
 Assigned To:      avb
 New Comment:

This bug is still in version 5.3.5, as packaged with XAMPP 1.7.4 on
Windows XP home edition.  Even some very simple examples exhibit the
problem, e.g.,

    $pattern = '/^[\w_-. ]+$/';
    $uid = 'guest';
    if (preg_match($pattern, $uid)) echo 
      ("<style> p { text-decoration:line-through } </style>");


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

[2011-01-11 22:11:07] avb

<div id="changeset">
<span class="removed">-Status:      Assigned</span>
<span class="added">+Status:      Closed</span>
<span class="removed">-Assigned To: mansion</span>
<span class="added">+Assigned To: avb</span>
</div>Hierselect triggered this because it does appendChild() /
removeChild() in its render method.

I added a method to check for this to a unit test for Group class and
changed the provided fix a bit.

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

[2011-01-11 14:01:16] helloworld

Sorry, I'm not explain so accurate.

If use simple group then all ok, but if use hierselect then we get this
problem.

I'm not find how attach file, so example below:

require_once('HTML/QuickForm2.php');
require_once('HTML/QuickForm2/Renderer.php');
$form = new HTML_QuickForm2('example');
$el = $form->addElement('hierselect', 'aa[c-b]', array('style' =>
'width: 300px;'), array('label' => 'Example', 'separator' => '<br/>'));
$el->loadOptions(array(
												array('1', '2', '3'),
												array( array('11','12','13'), array('21','22','23'),
array('31','32','33') )
												));	
$renderer = HTML_QuickForm2_Renderer::factory('default');
$form->render($renderer);
echo $renderer->getJavascriptBuilder()->getLibraries(true, true);
echo $renderer;

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

[2011-01-10 10:08:34] mansion

<div id="changeset">
<span class="removed">-Status: Closed</span>
<span class="added">+Status: Open</span>
</div>Actually, I couldn't reproduce this, can you post an example
please ?

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

[2011-01-10 09:56:14] mansion

<div id="changeset">
<span class="removed">-Status:      Open</span>
<span class="added">+Status:      Closed</span>
<span class="removed">-Assigned To:</span>
<span class="added">+Assigned To: mansion</span>
</div>This bug has been fixed in SVN.

If this was a documentation problem, the fix will appear on pear.php.net
by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

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

[2011-01-10 01:46:13] helloworld

Becase if use name group name like "aa[c-b]" then get warning 
WARNING: preg_replace(): Compilation failed: range out of order in
character class at 
offset 7

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=18182

-- 
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18182&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.