Zend Framework

"does not have a valid MatchPattern set." error in Zend_Filter_PregReplace

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.10.1
  • Fix Version/s: 1.10.2
  • Component/s: Zend_Filter
  • Labels:
    None

Description

Extending Zend_Filter_PregReplace like the following code will throw fatal error "does not have a valid MatchPattern set". Passing null as options to the constrcutor should not set matchPattern property to NULL, while this property is set in the child class

require_once 'Zend/Filter/PregReplace.php';

class Ms_View_Filter_LinkArrows extends Zend_Filter_PregReplace{
	 
    /**
     * Pattern to match
     * @var mixed
     */
    protected $_matchPattern = array('~(>){3,}~i');

    /**
     * Replacement pattern
     * @var mixed
     */
    protected $_replacement = '<i class="arrow-next">&nbsp;</i>';

}
  1. PregReplace.patch
    18/Feb/10 2:21 AM
    1.0 kB
    Ramon Henrique Ornelas
  2. PregReplaceTest.patch
    18/Feb/10 11:24 AM
    0.9 kB
    Ramon Henrique Ornelas

Activity

Hide
Ramon Henrique Ornelas added a comment -

Attached the patch, after I will attach the file with unit tests.

Show
Ramon Henrique Ornelas added a comment - Attached the patch, after I will attach the file with unit tests.
Hide
Ramon Henrique Ornelas added a comment -

This problem may also occur in:
Zend_Filter_StringTrim
Zend_Filter_StripTags

I will also review the Validators.

Show
Ramon Henrique Ornelas added a comment - This problem may also occur in: Zend_Filter_StringTrim Zend_Filter_StripTags I will also review the Validators.
Hide
Ramon Henrique Ornelas added a comment -

Attached file with test unit.

Show
Ramon Henrique Ornelas added a comment - Attached file with test unit.
Hide
Thomas Weidner added a comment -

Fixed with r21086

Show
Thomas Weidner added a comment - Fixed with r21086

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: