Skip to content

Commit cb5d5d8

Browse files
committed
Merge branch 'PHP-8.1'
2 parents 25de2c6 + 93bed98 commit cb5d5d8

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

ext/openssl/openssl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,15 +519,15 @@ static bool php_openssl_check_path_ex(
519519
error_msg = "must not contain any null bytes";
520520
error_type = E_ERROR;
521521
} else if (expand_filepath(fs_file_path, real_path) == NULL) {
522-
error_msg = "The argument must be a valid file path";
522+
error_msg = "must be a valid file path";
523523
}
524524

525525
if (error_msg != NULL) {
526526
if (arg_num == 0) {
527527
const char *option_title = option_name ? option_name : "unknown";
528528
const char *option_label = is_from_array ? "array item" : "option";
529-
php_error_docref(NULL, E_WARNING, "Path '%s' for %s %s %s",
530-
real_path, option_title, option_label, error_msg);
529+
php_error_docref(NULL, E_WARNING, "Path for %s %s %s",
530+
option_title, option_label, error_msg);
531531
} else if (is_from_array && option_name != NULL) {
532532
php_openssl_check_path_error(
533533
arg_num, error_type, "option %s array item %s", option_name, error_msg);

ext/openssl/tests/gh9339.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
GH-9339: oid_file path check warning contains uninitialized path
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded("openssl")) die("skip openssl not loaded");
6+
?>
7+
--FILE--
8+
<?php
9+
$configCode = <<<CONFIG
10+
oid_file = %s
11+
[ req ]
12+
default_bits = 1024
13+
CONFIG;
14+
15+
$configFile = __DIR__ . '/gh9339.cnf';
16+
file_put_contents($configFile, sprintf($configCode, __DIR__ . '/' . str_repeat('a', 9000)));
17+
openssl_pkey_new([ 'config' => $configFile ]);
18+
?>
19+
--CLEAN--
20+
<?php
21+
@unlink(__DIR__ . '/gh9339.cnf');
22+
?>
23+
--EXPECTF--
24+
25+
Warning: openssl_pkey_new(): Path for oid_file option must be a valid file path in %s on line %d

0 commit comments

Comments
 (0)