const char *local;
php_stream_wrapper *wrapper;
- if (!filename_length) {
+ if (!filename_length || CHECK_NULL_PATH(filename, filename_length)) {
+ if (filename_length && !IS_EXISTS_CHECK(type)) {
+ php_error_docref(NULL, E_WARNING, "Filename contains null byte");
+ }
RETURN_FALSE;
}
size_t filename_len; \
\
ZEND_PARSE_PARAMETERS_START(1, 1) \
- Z_PARAM_PATH(filename, filename_len) \
+ Z_PARAM_STRING(filename, filename_len) \
ZEND_PARSE_PARAMETERS_END(); \
\
php_stat(filename, filename_len, funcnum, return_value); \
<?php
$filename = __FILE__ . chr(0). ".ridiculous";
-
-try {
- var_dump(file_exists($filename));
-} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
-}
+var_dump(file_exists($filename));
?>
--EXPECT--
-file_exists(): Argument #1 ($filename) must not contain any null bytes
+bool(false)
Warning: filegroup(): stat failed for %s/filegroup_variation3/filegroup*.tmp in %s on line %d
bool(false)
- Iteration 7 -
-filegroup(): Argument #1 ($filename) must not contain any null bytes
+
+Warning: filegroup(): Filename contains null byte in %s on line %d
+bool(false)
- Iteration 8 -
-filegroup(): Argument #1 ($filename) must not contain any null bytes
+
+Warning: filegroup(): Filename contains null byte in %s on line %d
+bool(false)
*** Done ***
Warning: fileinode(): stat failed for %s/fileinode_variation3/fileinode*.tmp in %s on line %d
bool(false)
- Iteration 7 -
-fileinode(): Argument #1 ($filename) must not contain any null bytes
+
+Warning: fileinode(): Filename contains null byte in %s on line %d
+bool(false)
- Iteration 8 -
-fileinode(): Argument #1 ($filename) must not contain any null bytes
+
+Warning: fileinode(): Filename contains null byte in %s on line %d
+bool(false)
*** Done ***
Warning: fileowner(): stat failed for %s/fileowner_variation3/fileowner*.tmp in %s on line %d
bool(false)
- Iteration 7 -
-fileowner(): Argument #1 ($filename) must not contain any null bytes
+
+Warning: fileowner(): Filename contains null byte in %s on line %d
+bool(false)
- Iteration 8 -
-fileowner(): Argument #1 ($filename) must not contain any null bytes
+
+Warning: fileowner(): Filename contains null byte in %s on line %d
+bool(false)
*** Done ***
Warning: fileperms(): stat failed for %s/fileperms_variation3/fileperms*.tmp in %s on line %d
bool(false)
- Iteration 7 -
-fileperms(): Argument #1 ($filename) must not contain any null bytes
+
+Warning: fileperms(): Filename contains null byte in %s on line %d
+bool(false)
- Iteration 8 -
-fileperms(): Argument #1 ($filename) must not contain any null bytes
+
+Warning: fileperms(): Filename contains null byte in %s on line %d
+bool(false)
*** Done ***
bool(false)
-- Iteration 9 --
-is_dir(): Argument #1 ($filename) must not contain any null bytes
+bool(false)
-- Iteration 10 --
-is_dir(): Argument #1 ($filename) must not contain any null bytes
+bool(false)
*** Done ***
-- Iteration 5 --
bool(false)
-- Iteration 6 --
-is_executable(): Argument #1 ($filename) must not contain any null bytes
+bool(false)
-- Iteration 7 --
-is_executable(): Argument #1 ($filename) must not contain any null bytes
+bool(false)
-- Iteration 8 --
bool(false)
-- Iteration 9 --
- Iteration 6 -
bool(false)
- Iteration 7 -
-is_file(): Argument #1 ($filename) must not contain any null bytes
+bool(false)
- Iteration 8 -
-is_file(): Argument #1 ($filename) must not contain any null bytes
+bool(false)
*** Done ***
-- Iteration 6 --
bool(false)
-- Iteration 7 --
-is_readable(): Argument #1 ($filename) must not contain any null bytes
+bool(false)
-- Iteration 8 --
-is_readable(): Argument #1 ($filename) must not contain any null bytes
+bool(false)
-- Iteration 9 --
-is_readable(): Argument #1 ($filename) must not contain any null bytes
+bool(false)
-- Iteration 10 --
bool(true)
-- Iteration 11 --
bool(false)
bool(false)
-- Iteration 7 --
-is_writable(): Argument #1 ($filename) must not contain any null bytes
-is_writeable(): Argument #1 ($filename) must not contain any null bytes
+bool(false)
+bool(false)
-- Iteration 8 --
-is_writable(): Argument #1 ($filename) must not contain any null bytes
-is_writeable(): Argument #1 ($filename) must not contain any null bytes
+bool(false)
+bool(false)
-- Iteration 9 --
-is_writable(): Argument #1 ($filename) must not contain any null bytes
-is_writeable(): Argument #1 ($filename) must not contain any null bytes
+bool(false)
+bool(false)
-- Iteration 10 --
bool(true)
bool(true)