Skip to content
Merged
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
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ PHP NEWS

- Posix:
. Added validity check to the flags argument for posix_access(). (arshidkv12)
. Added validity check to the permissions argument for posix_mkfifo(). (arshidkv12)

- Reflection:
. Fixed bug GH-20217 (ReflectionClass::isIterable() incorrectly returns true
Expand Down
6 changes: 6 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ PHP 8.6 UPGRADE NOTES
- Phar:
. Phar::mungServer() now supports reference values.

- Posix:
. posix_access() now throws a ValueError exception if the flags
argument is invalid.
. posix_mkfifo() now throws a ValueError exception if the permissions
argument is invalid.

- Sockets:
. socket_addrinfo_lookup() now has an additional optional argument $error
when not null, and on failure, gives the error code (one of the EAI_*
Expand Down
10 changes: 2 additions & 8 deletions ext/mysqli/mysqli_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1410,10 +1410,7 @@ PHP_FUNCTION(mysqli_stmt_send_long_data)
RETURN_THROWS();
}

if (mysql_stmt_send_long_data(stmt->stmt, param_nr, data, data_len)) {
RETURN_FALSE;
}
RETURN_TRUE;
RETURN_BOOL(!mysql_stmt_send_long_data(stmt->stmt, param_nr, data, data_len));
}
/* }}} */

Expand Down Expand Up @@ -1552,10 +1549,7 @@ PHP_FUNCTION(mysqli_stmt_reset)

MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);

if (mysql_stmt_reset(stmt->stmt)) {
RETURN_FALSE;
}
RETURN_TRUE;
RETURN_BOOL(!mysql_stmt_reset(stmt->stmt));
}
/* }}} */

Expand Down
5 changes: 5 additions & 0 deletions ext/posix/posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,11 @@ PHP_FUNCTION(posix_mkfifo)
RETURN_FALSE;
}

if (mode < 0 || (mode & ~07777)) {
zend_argument_value_error(2, "must be between 0 and 0o7777");
RETURN_THROWS();
}

result = mkfifo(ZSTR_VAL(path), mode);
if (result < 0) {
POSIX_G(last_error) = errno;
Expand Down
36 changes: 36 additions & 0 deletions ext/posix/tests/posix_mkfifo_invalid_mode.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--TEST--
posix_mkfifo(): invalid mode argument
--SKIPIF--
<?php
if (!function_exists("posix_mkfifo")) {
die("skip no posix_mkfifo()");
}
?>
--FILE--
<?php

// Negative mode
try {
posix_mkfifo(__DIR__ . "/testfifo1", -1);
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}

// Too large mode
try {
posix_mkfifo(__DIR__ . "/testfifo2", 010000); // > 07777
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}

// Garbage bits
try {
posix_mkfifo(__DIR__ . "/testfifo3", 020000); // S_IFCHR bit
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
posix_mkfifo(): Argument #2 ($permissions) must be between 0 and 0o7777
posix_mkfifo(): Argument #2 ($permissions) must be between 0 and 0o7777
posix_mkfifo(): Argument #2 ($permissions) must be between 0 and 0o7777
6 changes: 1 addition & 5 deletions ext/standard/dns_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,7 @@ PHP_FUNCTION(dns_check_record)

status = DnsQuery_A(hostname, type, DNS_QUERY_STANDARD, NULL, &pResult, NULL);

if (status) {
RETURN_FALSE;
}

RETURN_TRUE;
RETURN_BOOL(!status);
}
/* }}} */

Expand Down
11 changes: 3 additions & 8 deletions ext/standard/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1016,10 +1016,8 @@ PHPAPI PHP_FUNCTION(fflush)
ZEND_PARSE_PARAMETERS_END();

ret = php_stream_flush(stream);
if (ret) {
RETURN_FALSE;
}
RETURN_TRUE;

RETURN_BOOL(!ret);
}
/* }}} */

Expand All @@ -1032,10 +1030,7 @@ PHPAPI PHP_FUNCTION(rewind)
PHP_Z_PARAM_STREAM(stream)
ZEND_PARSE_PARAMETERS_END();

if (-1 == php_stream_rewind(stream)) {
RETURN_FALSE;
}
RETURN_TRUE;
RETURN_BOOL(-1 != php_stream_rewind(stream));
}
/* }}} */

Expand Down
5 changes: 1 addition & 4 deletions win32/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,7 @@ PHP_FUNCTION(sapi_windows_set_ctrl_handler)
if (!ZEND_FCI_INITIALIZED(fci)) {
zval_ptr_dtor(&ctrl_handler);
ZVAL_UNDEF(&ctrl_handler);
if (!SetConsoleCtrlHandler(NULL, add)) {
RETURN_FALSE;
}
RETURN_TRUE;
RETURN_BOOL(SetConsoleCtrlHandler(NULL, add));
}

if (!SetConsoleCtrlHandler(NULL, FALSE) || !SetConsoleCtrlHandler(php_win32_signal_system_ctrl_handler, add)) {
Expand Down