diff options
author | Simon Holywell <[email protected]> | 2012-11-14 16:13:28 +0000 |
---|---|---|
committer | Simon Holywell <[email protected]> | 2012-11-14 16:13:28 +0000 |
commit | 47f6dea624516fb2f6a2b1907ee4be0f9671b40d (patch) | |
tree | ae8ffcee0341f4d3f95fad5cecbe466ccbb176ee /idiorm.php | |
parent | 318d7cdd5ccd2d686cbd6915ff3f58486248c02c (diff) |
Correct replace_outside_quotes error handling
Diffstat (limited to 'idiorm.php')
-rw-r--r-- | idiorm.php | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1459,8 +1459,9 @@ )* # Zero or more string chunks. \z # Anchor to end of string. /sx'; - if (!preg_match($re_valid, $this->subject)) // Exit if string is invalid. - exit("Error! String not valid."); + if (!preg_match($re_valid, $this->subject)) { + throw new IdiormStringException("Subject string is not valid in the replace_outside_quotes context."); + } $re_parse = '/ # Match one chunk of a valid string having embedded quoted substrings. ( # Either $1: Quoted chunk. @@ -1487,4 +1488,9 @@ return preg_replace('/'. preg_quote($this->search, '/') .'/', $this->replace, $matches[2]); } - }
\ No newline at end of file + } + + /** + * A placeholder for exceptions eminating from the IdiormString class + */ + class IdiormStringException {}
\ No newline at end of file |