Skip to content

Commit 1e0c8ba

Browse files
committed
tree: drop non canonical casts and ZPP tests
1 parent 14034ad commit 1e0c8ba

24 files changed

+70
-1117
lines changed

Zend/tests/assert/expect_012.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ zend.assertions=1
55
assert.exception=1
66
--FILE--
77
<?php
8-
var_dump((integer)ini_get("zend.assertions"));
8+
var_dump((int)ini_get("zend.assertions"));
99
ini_set("zend.assertions", 0);
10-
var_dump((integer)ini_get("zend.assertions"));
10+
var_dump((int)ini_get("zend.assertions"));
1111
assert(false);
1212
ini_set("zend.assertions", 1);
13-
var_dump((integer)ini_get("zend.assertions"));
13+
var_dump((int)ini_get("zend.assertions"));
1414
assert(true);
1515
var_dump(true);
1616
?>

Zend/tests/oct_overflow.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ precision=14
55
--FILE--
66
<?php
77

8-
$doubles = array(
8+
$floats = array(
99
076545676543223,
1010
032325463734,
1111
0777777,
1212
07777777777777,
1313
033333333333333,
1414
);
1515

16-
foreach ($doubles as $d) {
17-
$l = (double)$d;
16+
foreach ($floats as $d) {
17+
$l = (float)$d;
1818
var_dump($l);
1919
}
2020

ext/pdo_mysql/tests/pdo_mysql_types.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ MySQLPDOTest::skip();
105105
test_type($db, 90, 'MEDIUMINT UNSIGNED', 16777215, ($is_mysqlnd) ? 16777215 : '16777215');
106106

107107
test_type($db, 100, 'INT', -2147483648,
108-
($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? (int)-2147483648 : (double)-2147483648) : '-2147483648',
108+
($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? (int)-2147483648 : (float)-2147483648) : '-2147483648',
109109
NULL, ($is_mysqlnd) ? 'integer' : NULL);
110110

111111
test_type($db, 110, 'INT UNSIGNED', 4294967295, ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? 4294967295 : '4294967295') : '4294967295');

ext/phar/shortarc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ static function go($return = false)
114114
{
115115
$fp = fopen(__FILE__, 'rb');
116116
fseek($fp, self::LEN);
117-
$L = unpack('V', $a = (binary)fread($fp, 4));
118-
$m = (binary)'';
117+
$L = unpack('V', $a = (string)fread($fp, 4));
118+
$m = '';
119119

120120
do {
121121
$read = 8192;
122122
if ($L[1] - strlen($m) < 8192) {
123123
$read = $L[1] - strlen($m);
124124
}
125-
$last = (binary)fread($fp, $read);
125+
$last = (string)fread($fp, $read);
126126
$m .= $last;
127127
} while (strlen($last) && strlen($m) < $L[1]);
128128

@@ -268,7 +268,7 @@ static function extractFile($path, $entry, $fp)
268268
$entry[0] . ")");
269269
}
270270

271-
if ($entry[3] != sprintf("%u", crc32((binary)$data) & 0xffffffff)) {
271+
if ($entry[3] != sprintf("%u", crc32($data) & 0xffffffff)) {
272272
die("Invalid internal .phar file (checksum error)");
273273
}
274274

ext/phar/tests/cache_list/files/phar_test.inc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
date_default_timezone_set('UTC');
44

5-
$manifest = (binary)'';
5+
$manifest = '';
66
$glags = 0;
77

88
foreach($files as $name => $cont)
@@ -34,12 +34,12 @@ foreach($files as $name => $cont)
3434
if (empty($comp)) $comp = $cont;
3535
if (empty($ulen)) $ulen = strlen($cont);
3636
if (empty($clen)) $clen = strlen($comp);
37-
if (empty($crc32))$crc32= crc32((binary)$cont);
37+
if (empty($crc32))$crc32= crc32($cont);
3838
if (isset($meta)) $meta = serialize($meta);
3939

4040
// write manifest entry
41-
$manifest .= pack('V', strlen($name)) . (binary)$name;
42-
$manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . (binary)$meta;
41+
$manifest .= pack('V', strlen($name)) . $name;
42+
$manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . $meta;
4343

4444
// globals
4545
$gflags |= $flags;
@@ -50,13 +50,13 @@ if (!isset($alias)) $alias = 'hio';
5050

5151
if (isset($pmeta)) $pmeta = serialize($pmeta); else $pmeta = '';
5252

53-
$manifest = pack('VnVV', count($files), isset($hasdir) ? 0x1110 : 0x1000, $gflags, strlen($alias)) . (binary)$alias . pack('V', strlen($pmeta)) . (binary)$pmeta . $manifest;
54-
$file = (binary)$file;
53+
$manifest = pack('VnVV', count($files), isset($hasdir) ? 0x1110 : 0x1000, $gflags, strlen($alias)) . $alias . pack('V', strlen($pmeta)) . $pmeta . $manifest;
54+
$file = $file;
5555
$file .= pack('V', strlen($manifest)) . $manifest;
5656

5757
foreach($files as $cont)
5858
{
59-
$file .= (binary)$cont;
59+
$file .= $cont;
6060
}
6161

6262
file_put_contents($fname, $file);

ext/phar/tests/files/phar_oo_test.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ini_set('date.timezone', 'GMT');
55
$tname = basename(current(get_included_files()), ".php");
66
$fname = dirname(__FILE__) . "/$tname.phar.php";
77
$pname = 'phar://' . $fname;
8-
$file = (binary)'<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
8+
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
99

1010
$files = array();
1111

ext/phar/tests/files/phar_test.inc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
date_default_timezone_set('UTC');
44

5-
$manifest = (binary)'';
5+
$manifest = '';
66
$gflags = 0;
77

88
foreach($files as $name => $cont)
@@ -34,12 +34,12 @@ foreach($files as $name => $cont)
3434
if (empty($comp)) $comp = $cont;
3535
if (empty($ulen)) $ulen = strlen($cont);
3636
if (empty($clen)) $clen = strlen($comp);
37-
if (empty($crc32))$crc32= crc32((binary)$cont);
37+
if (empty($crc32))$crc32= crc32($cont);
3838
$meta = isset($meta) ? serialize($meta) : "";
3939

4040
// write manifest entry
41-
$manifest .= pack('V', strlen($name)) . (binary)$name;
42-
$manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . (binary)$meta;
41+
$manifest .= pack('V', strlen($name)) . $name;
42+
$manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . $meta;
4343

4444
// globals
4545
$gflags |= $flags;
@@ -50,13 +50,13 @@ if (!isset($alias)) $alias = 'hio';
5050

5151
if (isset($pmeta)) $pmeta = serialize($pmeta); else $pmeta = '';
5252

53-
$manifest = pack('VnVV', count($files), isset($hasdir) ? 0x1110 : 0x1000, $gflags, strlen($alias)) . (binary)$alias . pack('V', strlen($pmeta)) . (binary)$pmeta . $manifest;
54-
$file = (binary)$file;
53+
$manifest = pack('VnVV', count($files), isset($hasdir) ? 0x1110 : 0x1000, $gflags, strlen($alias)) . $alias . pack('V', strlen($pmeta)) . $pmeta . $manifest;
54+
$file = $file;
5555
$file .= pack('V', strlen($manifest)) . $manifest;
5656

5757
foreach($files as $cont)
5858
{
59-
$file .= (binary)$cont;
59+
$file .= $cont;
6060
}
6161

6262
file_put_contents($fname, $file);

ext/phar/tests/tar/files/make.dangerous.tar.php.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,16 @@ class danger_tarmaker
108108

109109
$checksum = pack('a8', sprintf('%6s ', decoct($checksum)));
110110

111-
fwrite($this->tmp, (binary)$block . $checksum . $blockend, 512);
111+
fwrite($this->tmp, $block . $checksum . $blockend, 512);
112112
if (is_resource($fileOrStream)) {
113113
stream_copy_to_stream($fileOrStream, $this->tmp);
114114
if ($stat['size'] % 512) {
115-
fwrite($this->tmp, (binary)str_repeat("\0", 512 - $stat['size'] % 512));
115+
fwrite($this->tmp, str_repeat("\0", 512 - $stat['size'] % 512));
116116
}
117117
} else {
118-
fwrite($this->tmp, (binary)$fileOrStream);
118+
fwrite($this->tmp, $fileOrStream);
119119
if (strlen($fileOrStream) % 512) {
120-
fwrite($this->tmp, (binary)str_repeat("\0", 512 - strlen($fileOrStream) % 512));
120+
fwrite($this->tmp, str_repeat("\0", 512 - strlen($fileOrStream) % 512));
121121
}
122122
}
123123
}

ext/phar/tests/tar/files/make_invalid_tar.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include dirname(__FILE__) . '/tarmaker.php.inc';
33
class corrupter extends tarmaker {
44
function close()
55
{
6-
fwrite($this->tmp, (binary)'oopsie');
6+
fwrite($this->tmp, 'oopsie');
77
fclose($this->tmp);
88
}
99
}

ext/phar/tests/tar/files/tarmaker.php.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,16 @@ class tarmaker
107107

108108
$checksum = pack('a8', sprintf('%6s ', decoct($checksum)));
109109

110-
fwrite($this->tmp, (binary)$block . $checksum . $blockend, 512);
110+
fwrite($this->tmp, $block . $checksum . $blockend, 512);
111111
if (is_resource($fileOrStream)) {
112112
stream_copy_to_stream($fileOrStream, $this->tmp);
113113
if ($stat['size'] % 512) {
114-
fwrite($this->tmp, (binary)str_repeat("\0", 512 - $stat['size'] % 512));
114+
fwrite($this->tmp, str_repeat("\0", 512 - $stat['size'] % 512));
115115
}
116116
} else {
117-
fwrite($this->tmp, (binary)$fileOrStream);
117+
fwrite($this->tmp, $fileOrStream);
118118
if (strlen($fileOrStream) % 512) {
119-
fwrite($this->tmp, (binary)str_repeat("\0", 512 - strlen($fileOrStream) % 512));
119+
fwrite($this->tmp, str_repeat("\0", 512 - strlen($fileOrStream) % 512));
120120
}
121121
}
122122
}

0 commit comments

Comments
 (0)