Skip to content

Commit e432e11

Browse files
committed
Reproduce bug 12629
1 parent e52dec7 commit e432e11

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed

.github/workflows/e2e-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ jobs:
322322
- script: |
323323
cd e2e/bug-11819
324324
../../bin/phpstan
325+
- script: |
326+
cd e2e/bug-12629
327+
../../bin/phpstan
325328
326329
steps:
327330
- name: "Checkout"

e2e/bug-12629/phpstan-baseline.neon

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Method Bug12629\\Bug12629\:\:is_macintosh_enc\(\) has no return type specified\.$#'
5+
identifier: missingType.return
6+
count: 1
7+
path: src/bug-12629.php
8+
9+
-
10+
message: '#^Method Bug12629\\Bug12629\:\:is_macintosh_enc\(\) has parameter \$s with no type specified\.$#'
11+
identifier: missingType.parameter
12+
count: 1
13+
path: src/bug-12629.php
14+
15+
-
16+
message: '#^Method Bug12629\\Bug12629\:\:is_macintosh_enc\(\) is unused\.$#'
17+
identifier: method.unused
18+
count: 1
19+
path: src/bug-12629.php
20+
21+
-
22+
message: '#^Regex pattern is invalid\: Compilation failed\: UTF\-8 error\: byte 2 top bits not 0x80 at offset 0 in pattern\: \!Ã\[€\-Ÿ\]\!u$#'
23+
identifier: regexp.pattern
24+
count: 1
25+
path: src/bug-12629.php
26+
27+
-
28+
message: '#^Regex pattern is invalid\: Compilation failed\: UTF\-8 error\: isolated byte with 0x80 bit set at offset 1 in pattern\: \!\[€\-Ÿ\]\!u$#'
29+
identifier: regexp.pattern
30+
count: 1
31+
path: src/bug-12629.php

e2e/bug-12629/phpstan.neon

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
4+
parameters:
5+
level: 8
6+
paths:
7+
- src

e2e/bug-12629/src/bug-12629.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Bug12629;
4+
5+
class Bug12629 {
6+
private function is_macintosh_enc($s) {
7+
8+
if(!is_string($s)) {
9+
return false;
10+
}
11+
12+
preg_match_all("![\x80-\x9f]!u", $s, $matchesMacintosh);
13+
preg_match_all("!\xc3[\x80-\x9f]!u", $s, $matchesUtf8);
14+
15+
return count($matchesMacintosh[0]) > 0 && 0 == count($matchesUtf8[0]);
16+
}
17+
}

0 commit comments

Comments
 (0)