Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions ext/iconv/tests/bug52211.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,13 @@ iconv
--FILE--
<?php

// According to POSIX 2024, the to/from charset names are
// implementation-defined. To keep this test true to its original
// purpose, we retain the charsets used in bug 52211, but only when
// the implementation is known to support them. Otherwise we default
// both to ASCII, which should be supported everywhere (in particular
// on musl) yet still considers the input invalid.
$from_charset = "ASCII";
$to_charset = "ASCII";

if (ICONV_IMPL == "libiconv" || ICONV_IMPL == "glibc") {
$from_charset = "CP850";
$to_charset = "ISO-8859-1";
}

$str = "PATHOLOGIES MÉDICO-CHIRUR. ADUL. PL";
$str_iconv = iconv($from_charset, $to_charset, $str );
// The input contains an incomplete UTF-8 sequence: 0xC3 must be followed
// by a continuation byte, but is followed by "D". Unlike characters that
// are merely unrepresentable in the target charset (which some iconv
// implementations replace instead of rejecting), an invalid source
// sequence makes every implementation fail.
$str = "PATHOLOGIES M\xC3DICO-CHIRUR. ADUL. PL";
$str_iconv = iconv("UTF-8", "ASCII", $str);
var_dump($str_iconv);

?>
Expand Down
28 changes: 17 additions & 11 deletions ext/standard/tests/file/006_variation2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,26 @@ $perms_array = array(
$count = 1;
foreach($perms_array as $permission) {
echo "-- Iteration $count --\n";

// The sticky bit has platform-specific semantics on regular files and
// is rejected by some systems (e.g. FreeBSD) with EFTYPE. It is still
// tested on the directory below.
$file_permission = is_int($permission) ? $permission & 07777 & ~01000 : $permission;

try {
var_dump( chmod($file_name, $permission) );
var_dump( chmod($file_name, $file_permission) );
clearstatcache();
printf("%o", fileperms($file_name) );
echo "\n";
clearstatcache();
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}

try {
var_dump( chmod($dir_name, $permission) );
clearstatcache();
printf("%o", fileperms($dir_name) );
echo "\n";
clearstatcache();
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
Expand All @@ -83,7 +89,7 @@ rmdir(__DIR__."/006_variation2");
*** Testing fileperms(), chmod() with miscellaneous permissions ***
-- Iteration 1 --
bool(true)
107777
106777
bool(true)
47777
-- Iteration 2 --
Expand All @@ -93,17 +99,17 @@ bool(true)
40000
-- Iteration 3 --
bool(true)
101000
100000
bool(true)
41000
-- Iteration 4 --
bool(true)
101111
100111
bool(true)
41111
-- Iteration 5 --
bool(true)
107001
106001
bool(true)
47001
-- Iteration 6 --
Expand All @@ -113,12 +119,12 @@ bool(true)
40001
-- Iteration 7 --
bool(true)
101411
100411
bool(true)
41411
-- Iteration 8 --
bool(true)
107141
106141
bool(true)
47141
-- Iteration 9 --
Expand All @@ -128,12 +134,12 @@ bool(true)
40637
-- Iteration 10 --
bool(true)
103567
102567
bool(true)
43567
-- Iteration 11 --
bool(true)
103567
102567
bool(true)
43567
-- Iteration 12 --
Expand Down
24 changes: 20 additions & 4 deletions ext/standard/tests/file/chmod_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,28 @@ $filename = __FILE__ . ".tmp";
$fd = fopen($filename, "w+");
fclose($fd);

// Not all platforms allow every mode bit on a regular file. FreeBSD, for
// example, rejects the sticky bit with EFTYPE. Detect the supported bits
// first, so that the test does not depend on platform-specific semantics.
$mode_mask = 0777;
foreach ([04000, 02000, 01000] as $bit) {
@chmod($filename, 0777);
clearstatcache();
if (@chmod($filename, 0777 | $bit)) {
clearstatcache();
if (fileperms($filename) & $bit) {
$mode_mask |= $bit;
}
}
}

for ($perms_to_set = 07777; $perms_to_set >= 0; $perms_to_set--) {
chmod($filename, $perms_to_set);
$set_perms = (fileperms($filename) & MODE_MASK);
$perms = $perms_to_set & $mode_mask;
chmod($filename, $perms);
clearstatcache();
if ($set_perms != $perms_to_set) {
printf("Error: %o does not match %o\n", $set_perms, $perms_to_set);
$set_perms = (fileperms($filename) & MODE_MASK);
if ($set_perms != $perms) {
printf("Error: %o does not match %o\n", $set_perms, $perms);
}
}
var_dump(chmod($filename, 0777));
Expand Down
6 changes: 4 additions & 2 deletions ext/standard/tests/ini_info/php_ini_loaded_file.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ php_ini_loaded_file() function
$args = getenv('TEST_PHP_EXTRA_ARGS');
$code = '"var_dump(php_ini_loaded_file());"';

// No ini file
passthru("$php $args -n -r $code");
// No ini file. Do not pass TEST_PHP_EXTRA_ARGS here: it can contain a
// -c option (e.g. when run-tests.php is invoked with -c, as "make test"
// does) which takes precedence over -n.
passthru("$php -n -r $code");

// Specified ini file
passthru("$php $args -c $inifile -r $code");
Expand Down
Loading