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

ID: 18182
Updated by: k.znamenskiy@gmail.com
Reported By: k dot znamenskiy at gmail dot com
Summary: Problem with quotes in preg_replace
Status: Open
Type: Bug
Package: HTML_QuickForm2
Operating System: Ubuntu
Package Version: 0.5.0
PHP Version: 5.3.1
Roadmap Versions:
New Comment:

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


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

[2011-01-10 01:41:01] helloworld

Description:
------------
In file Group.php:256 need change this

$name = preg_replace('/^' . $this->getName() . '\
[([^\]]*)\]/', '\1', $element->getName());

to this

$name = preg_replace('/^' . preg_quote($this->getName()) .
'\[([^\]]*)\]/', '\1', $element->getName());

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

Search Discussions

  • Php at Jan 10, 2011 at 8:54 am
    Edit report at http://pear.php.net/bugs/bug.php?id=18182&edit=1

    ID: 18182
    Updated by: php@mamasam.net
    Reported By: k dot znamenskiy at gmail dot com
    Summary: Problem with quotes in preg_replace
    -Status: Open
    +Status: Closed
    Type: Bug
    Package: HTML_QuickForm2
    Operating System: Ubuntu
    Package Version: 0.5.0
    PHP Version: 5.3.1
    -Assigned To:
    +Assigned To: mansion
    Roadmap Versions:
    New Comment:

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: mansion
    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.




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

    [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

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

    [2011-01-10 01:41:01] helloworld

    Description:
    ------------
    In file Group.php:256 need change this

    $name = preg_replace('/^' . $this->getName() . '\
    [([^\]]*)\]/', '\1', $element->getName());

    to this

    $name = preg_replace('/^' . preg_quote($this->getName()) .
    '\[([^\]]*)\]/', '\1', $element->getName());

    ------------------------------------------------------------------------
  • Php at Jan 10, 2011 at 9:06 am
    Edit report at http://pear.php.net/bugs/bug.php?id=18182&edit=1

    ID: 18182
    Updated by: php@mamasam.net
    Reported By: k dot znamenskiy at gmail dot com
    Summary: Problem with quotes in preg_replace
    -Status: Closed
    +Status: Open
    Type: Bug
    Package: HTML_QuickForm2
    Operating System: Ubuntu
    Package Version: 0.5.0
    PHP Version: 5.3.1
    Assigned To: mansion
    Roadmap Versions:
    New Comment:

    -Status: Closed
    +Status: Open
    Actually, I couldn't reproduce this, can you post an example please ?


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

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

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: mansion
    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

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

    [2011-01-10 01:41:01] helloworld

    Description:
    ------------
    In file Group.php:256 need change this

    $name = preg_replace('/^' . $this->getName() . '\
    [([^\]]*)\]/', '\1', $element->getName());

    to this

    $name = preg_replace('/^' . preg_quote($this->getName()) .
    '\[([^\]]*)\]/', '\1', $element->getName());

    ------------------------------------------------------------------------
  • K Znamenskiy at Jan 11, 2011 at 12:59 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=18182&edit=1

    ID: 18182
    Comment by: k.znamenskiy@gmail.com
    Reported By: k dot znamenskiy at gmail dot com
    Summary: Problem with quotes in preg_replace
    Status: Assigned
    Type: Bug
    Package: HTML_QuickForm2
    Operating System: Ubuntu
    Package Version: 0.5.0
    PHP Version: 5.3.1
    Assigned To: mansion
    Roadmap Versions:
    New Comment:

    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;


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

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

    -Status: Closed
    +Status: Open
    Actually, I couldn't reproduce this, can you post an example please ?

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

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

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: mansion
    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

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

    [2011-01-10 01:41:01] helloworld

    Description:
    ------------
    In file Group.php:256 need change this

    $name = preg_replace('/^' . $this->getName() . '\
    [([^\]]*)\]/', '\1', $element->getName());

    to this

    $name = preg_replace('/^' . preg_quote($this->getName()) .
    '\[([^\]]*)\]/', '\1', $element->getName());

    ------------------------------------------------------------------------
  • Borz_off at Jan 11, 2011 at 9:09 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=18182&edit=1

    ID: 18182
    Updated by: borz_off@cs.msu.su
    Reported By: k dot znamenskiy at gmail dot com
    Summary: Problem with quotes in preg_replace
    -Status: Assigned
    +Status: Closed
    Type: Bug
    Package: HTML_QuickForm2
    Operating System: Ubuntu
    Package Version: 0.5.0
    PHP Version: 5.3.1
    -Assigned To: mansion
    +Assigned To: avb
    Roadmap Versions:
    New Comment:

    -Status: Assigned
    +Status: Closed
    -Assigned To: mansion
    +Assigned To: avb
    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.


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

    [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

    -Status: Closed
    +Status: Open
    Actually, I couldn't reproduce this, can you post an example please ?

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

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

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: mansion
    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

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

    [2011-01-10 01:41:01] helloworld

    Description:
    ------------
    In file Group.php:256 need change this

    $name = preg_replace('/^' . $this->getName() . '\
    [([^\]]*)\]/', '\1', $element->getName());

    to this

    $name = preg_replace('/^' . preg_quote($this->getName()) .
    '\[([^\]]*)\]/', '\1', $element->getName());

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJan 10, '11 at 12:44a
activeJan 11, '11 at 9:09p
posts5
users4
websitepear.php.net

People

Translate

site design / logo © 2022 Grokbase