summaryrefslogtreecommitdiff
path: root/idiorm.php
diff options
context:
space:
mode:
authorSimon Holywell <[email protected]>2012-11-14 16:13:28 +0000
committerSimon Holywell <[email protected]>2012-11-14 16:13:28 +0000
commit47f6dea624516fb2f6a2b1907ee4be0f9671b40d (patch)
treeae8ffcee0341f4d3f95fad5cecbe466ccbb176ee /idiorm.php
parent318d7cdd5ccd2d686cbd6915ff3f58486248c02c (diff)
Correct replace_outside_quotes error handling
Diffstat (limited to 'idiorm.php')
-rw-r--r--idiorm.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/idiorm.php b/idiorm.php
index d2b4b17..9d93f59 100644
--- a/idiorm.php
+++ b/idiorm.php
@@ -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