| Conditions | 4 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function update($input) { |
||
| 15 | |||
| 16 | // let parent do basic checks, value, not changed, etc. |
||
| 17 | $local = $this->local; |
||
| 18 | if(!parent::update($input)) return false; |
||
| 19 | $this->local = $local; |
||
| 20 | |||
| 21 | // see if the regex compiles and runs (we don't check for effectiveness) |
||
| 22 | $regex = $this->delimiter . $input . $this->delimiter . $this->pregflags; |
||
| 23 | $lastError = error_get_last(); |
||
| 24 | @preg_match($regex, 'testdata'); |
||
|
1 ignored issue
–
show
|
|||
| 25 | if(preg_last_error() != PREG_NO_ERROR || error_get_last() != $lastError) { |
||
| 26 | $this->input = $input; |
||
| 27 | $this->error = true; |
||
| 28 | return false; |
||
| 29 | } |
||
| 30 | |||
| 31 | $this->local = $input; |
||
| 32 | return true; |
||
| 33 | } |
||
| 34 | } |
||
| 35 |
If you suppress an error, we recommend checking for the error condition explicitly: