Skip to content

Commit 93bed98

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
2 parents bf84ea0 + 84dcf57 commit 93bed98

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ PHP NEWS
4343
. Fixed bug GH-9164 (Segfault in zend_accel_class_hash_copy).
4444
(Arnaud, Sergei Turchanov)
4545

46+
- OpenSSL:
47+
. Fixed bug GH-9339 (OpenSSL oid_file path check warning contains
48+
uninitialized path). (Jakub Zelenka)
49+
4650
- PDO_SQLite:
4751
. Fixed bug GH-9032 (SQLite3 authorizer crashes on NULL values). (cmb)
4852

ext/openssl/openssl.c

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

524524
if (error_msg != NULL) {
525525
if (arg_num == 0) {
526526
const char *option_title = option_name ? option_name : "unknown";
527527
const char *option_label = is_from_array ? "array item" : "option";
528-
php_error_docref(NULL, E_WARNING, "Path '%s' for %s %s %s",
529-
real_path, option_title, option_label, error_msg);
528+
php_error_docref(NULL, E_WARNING, "Path for %s %s %s",
529+
option_title, option_label, error_msg);
530530
} else if (is_from_array && option_name != NULL) {
531531
php_openssl_check_path_error(
532532
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)