mirror of
https://github.com/php/php-src.git
synced 2026-04-17 13:01:02 +02:00
This deprecates passing null to non-nullable scale arguments of internal functions, with the eventual goal of making the behavior consistent with userland functions, where null is never accepted for non-nullable arguments. This change is expected to cause quite a lot of fallout. In most cases, calling code should be adjusted to avoid passing null. In some cases, PHP should be adjusted to make some function arguments nullable. I have already fixed a number of functions before landing this, but feel free to file a bug if you encounter a function that doesn't accept null, but probably should. (The rule of thumb for this to be applicable is that the function must have special behavior for 0 or "", which is distinct from the natural behavior of the parameter.) RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg Closes GH-6475.
53 lines
1.8 KiB
PHP
53 lines
1.8 KiB
PHP
--TEST--
|
|
Phar: Bug #79082: Files added to tar with Phar::buildFromIterator have all-access permissions
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded("phar")) die("skip");
|
|
if (defined("PHP_WINDOWS_VERSION_MAJOR")) die("skip not for Windows")
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
umask(022);
|
|
var_dump(decoct(umask()));
|
|
chmod(__DIR__ . '/test79082/test79082-testfile', 0644);
|
|
chmod(__DIR__ . '/test79082/test79082-testfile2', 0400);
|
|
|
|
foreach([Phar::TAR => 'tar', Phar::ZIP => 'zip'] as $format => $ext) {
|
|
clearstatcache();
|
|
$phar = new PharData(__DIR__ . '/test79082.' . $ext, format: $format);
|
|
$phar->buildFromIterator(new \RecursiveDirectoryIterator(__DIR__ . '/test79082', \FilesystemIterator::SKIP_DOTS), __DIR__ . '/test79082');
|
|
$phar->extractTo(__DIR__);
|
|
var_dump(decoct(stat(__DIR__ . '/test79082-testfile')['mode']));
|
|
var_dump(decoct(stat(__DIR__ . '/test79082-testfile2')['mode']));
|
|
unlink(__DIR__ . '/test79082-testfile');
|
|
unlink(__DIR__ . '/test79082-testfile2');
|
|
}
|
|
foreach([Phar::TAR => 'tar', Phar::ZIP => 'zip'] as $format => $ext) {
|
|
clearstatcache();
|
|
$phar = new PharData(__DIR__ . '/test79082-d.' . $ext, format: $format);
|
|
$phar->buildFromDirectory(__DIR__ . '/test79082');
|
|
$phar->extractTo(__DIR__);
|
|
var_dump(decoct(stat(__DIR__ . '/test79082-testfile')['mode']));
|
|
var_dump(decoct(stat(__DIR__ . '/test79082-testfile2')['mode']));
|
|
unlink(__DIR__ . '/test79082-testfile');
|
|
unlink(__DIR__ . '/test79082-testfile2');
|
|
}
|
|
?>
|
|
--CLEAN--
|
|
<?php
|
|
unlink(__DIR__ . '/test79082.tar');
|
|
unlink(__DIR__ . '/test79082.zip');
|
|
unlink(__DIR__ . '/test79082-d.tar');
|
|
unlink(__DIR__ . '/test79082-d.zip');
|
|
?>
|
|
--EXPECT--
|
|
string(2) "22"
|
|
string(6) "100644"
|
|
string(6) "100400"
|
|
string(6) "100644"
|
|
string(6) "100400"
|
|
string(6) "100644"
|
|
string(6) "100400"
|
|
string(6) "100644"
|
|
string(6) "100400"
|