| @@ 43-50 (lines=8) @@ | ||
| 40 | '|(.{1}))'; # invalid byte |
|
| 41 | $pos = 0; |
|
| 42 | $badList = array(); |
|
| 43 | while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) { |
|
| 44 | $bytes = strlen($matches[0]); |
|
| 45 | if ( isset($matches[2])) { |
|
| 46 | return $pos; |
|
| 47 | } |
|
| 48 | $pos += $bytes; |
|
| 49 | $str = substr($str,$bytes); |
|
| 50 | } |
|
| 51 | return FALSE; |
|
| 52 | } |
|
| 53 | ||
| @@ 79-86 (lines=8) @@ | ||
| 76 | '|(.{1}))'; # invalid byte |
|
| 77 | $pos = 0; |
|
| 78 | $badList = array(); |
|
| 79 | while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) { |
|
| 80 | $bytes = strlen($matches[0]); |
|
| 81 | if ( isset($matches[2])) { |
|
| 82 | $badList[] = $pos; |
|
| 83 | } |
|
| 84 | $pos += $bytes; |
|
| 85 | $str = substr($str,$bytes); |
|
| 86 | } |
|
| 87 | if ( count($badList) > 0 ) { |
|
| 88 | return $badList; |
|
| 89 | } |
|