Skip to content

Commit ecd939b

Browse files
authored
Fix ZTS detection (#26)
* test: fix PHPUnit ZTS detection * test: ignore phpstan * tests: more instead ZTS detection
1 parent 0f190a8 commit ecd939b

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

ext/tests/php70/array_rand.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ colopl_bc
66
date.timezone=UTC
77
--SKIPIF--
88
<?php
9-
if (PHP_ZTS !== 0) print 'skip ZTS not supported';
9+
if ((bool) PHP_ZTS === true) print 'skip ZTS not supported';
1010
?>
1111
--FILE--
1212
<?php

ext/tests/php70/array_rand_zts.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ colopl_bc
66
date.timezone=UTC
77
--SKIPIF--
88
<?php
9-
if (PHP_ZTS === 0 || PHP_ZTS === false) print 'skip NTS not supported';
9+
if ((bool) PHP_ZTS === false) print 'skip NTS not supported';
1010
?>
1111
--FILE--
1212
<?php

ext/tests/php70/shuffle.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ colopl_bc
66
date.timezone=UTC
77
--SKIPIF--
88
<?php
9-
if (PHP_ZTS !== 0) print 'skip ZTS not supported';
9+
if ((bool) PHP_ZTS === true) print 'skip ZTS not supported';
1010
?>
1111
--FILE--
1212
<?php

ext/tests/php70/shuffle_zts.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ colopl_bc
66
date.timezone=UTC
77
--SKIPIF--
88
<?php
9-
if (PHP_ZTS === 0 || PHP_ZTS === false) print 'skip NTS not supported';
9+
if ((bool) PHP_ZTS === false) print 'skip NTS not supported';
1010
?>
1111
--FILE--
1212
<?php

ext/tests/php70/str_shuffle.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ colopl_bc
66
date.timezone=UTC
77
--SKIPIF--
88
<?php
9-
if (PHP_ZTS !== 0) print 'skip ZTS not supported';
9+
if ((bool) PHP_ZTS === true) print 'skip ZTS not supported';
1010
?>
1111
--FILE--
1212
<?php

ext/tests/php70/str_shuffle_zts.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ colopl_bc
66
date.timezone=UTC
77
--SKIPIF--
88
<?php
9-
if (PHP_ZTS === 0 || PHP_ZTS === false) print 'skip NTS not supported';
9+
if ((bool) PHP_ZTS === false) print 'skip NTS not supported';
1010
?>
1111
--FILE--
1212
<?php

ext/tests/php70/undefined_behavior_compatibility.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ colopl_bc
66
date.timezone=UTC
77
--SKIPIF--
88
<?php
9-
if (PHP_ZTS !== 0) print 'skip ZTS not supported';
9+
if ((bool) PHP_ZTS === true) print 'skip ZTS not supported';
1010
if (PHP_INT_SIZE !== 8) die("skip this test is for 64bit platform only");
1111
?>
1212
--FILE--

tests/Extension/PHP70Test.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testSRand(): void
2121
{
2222
\Colopl\ColoplBc\Php70\srand(1234);
2323

24-
if (\PHP_ZTS === 0) {
24+
if ((bool) \PHP_ZTS === false) {
2525
self::assertSame(\Colopl\ColoplBc\Php70\rand(), 479142414);
2626
} else {
2727
self::assertSame(\Colopl\ColoplBc\Php70\rand(), 1584308507);
@@ -43,7 +43,7 @@ public function testSRandNull(): void
4343
* @psalm-suppress PossiblyNullArgument
4444
*/
4545
\Colopl\ColoplBc\Php70\srand($seed);
46-
if (\PHP_ZTS === 0) {
46+
if ((bool) \PHP_ZTS === false) {
4747
self::assertSame(\Colopl\ColoplBc\Php70\rand(), 1804289383);
4848
} else {
4949
self::assertSame(\Colopl\ColoplBc\Php70\rand(), 1012484);
@@ -53,7 +53,7 @@ public function testSRandNull(): void
5353
public function testRand(): void
5454
{
5555
\Colopl\ColoplBc\Php70\srand(5678);
56-
if (\PHP_ZTS === 0) {
56+
if ((bool) \PHP_ZTS === false) {
5757
self::assertSame(\Colopl\ColoplBc\Php70\rand(), 1860157456);
5858
} else {
5959
self::assertSame(\Colopl\ColoplBc\Php70\rand(), 1173971923);
@@ -71,7 +71,7 @@ public function testShuffle(): void
7171
\Colopl\ColoplBc\Php70\srand(1234);
7272
\Colopl\ColoplBc\Php70\shuffle($arr);
7373

74-
if (\PHP_ZTS === 0) {
74+
if ((bool) \PHP_ZTS === false) {
7575
self::assertSame($arr, [2, 3, 4, 1]);
7676
} else {
7777
self::assertSame($arr, [4, 2, 1, 3]);
@@ -83,7 +83,7 @@ public function testStrShuffle(): void
8383
$str = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
8484
\Colopl\ColoplBc\Php70\srand(1234);
8585

86-
if (\PHP_ZTS === 0) {
86+
if ((bool) \PHP_ZTS === false) {
8787
self::assertSame(
8888
\Colopl\ColoplBc\Php70\str_shuffle($str),
8989
'cfapiqi uogi txnrdaeqvnataten ume v aiisalm isiatdaduaeudr eenteotscdm itdenrieuaicii loi aaot imxll ne luecat uri ipp a l moplaur tsarc.eptuisrccdlotep ecorU oeaceqsuerno .t li sa rerldulidieoor i n nd tloiii eeulds ithsnot btrnf ilm a,nuto umdscd viee.amndrueonmce ns dancratmamo inuios ilmo sg a neo ci. eispiisu pueoe umurt denaamlmiu ,loi ptctaurst lrinm usLrdto gru coaetucnuliittro, npemeDnpt s,efdlq q teoiabuEet ert ioinu tlbxoo o '
@@ -100,7 +100,7 @@ public function testArrayRand(): void
100100
{
101101
\Colopl\ColoplBc\Php70\srand(1234);
102102

103-
if (\PHP_ZTS === 0) {
103+
if ((bool) \PHP_ZTS === false) {
104104
self::assertSame(
105105
\Colopl\ColoplBc\Php70\array_rand([1, 2, 3, 4, 5], 3),
106106
[0, 1, 3]

0 commit comments

Comments
 (0)