Skip to content

Commit 4137190

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix GH-14590: Memory leak in FPM test gh13563-conf-bool-env.phpt
2 parents f97e277 + 056bec7 commit 4137190

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ PHP NEWS
66
. Fixed bug GH-13922 (Fixed support for systems with
77
sysconf(_SC_GETPW_R_SIZE_MAX) == -1). (Arnaud)
88
. Fixed bug GH-14626 (Fix is_zend_ptr() for huge blocks). (Arnaud)
9+
. Fixed bug GH-14590 (Memory leak in FPM test gh13563-conf-bool-env.phpt.
10+
(nielsdos)
911

1012
- Phar:
1113
. Fixed bug GH-14603 (null string from zip entry).

Zend/zend_ini_parser.y

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,10 @@ static void zend_ini_get_var(zval *result, zval *name, zval *fallback)
179179
if ((curval = zend_get_configuration_directive(Z_STR_P(name))) != NULL) {
180180
ZVAL_NEW_STR(result, zend_string_init(Z_STRVAL_P(curval), Z_STRLEN_P(curval), ZEND_SYSTEM_INI));
181181
/* ..or if not found, try ENV */
182-
} else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name))) != NULL ||
183-
(envvar = getenv(Z_STRVAL_P(name))) != NULL) {
182+
} else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name))) != NULL) {
183+
ZVAL_NEW_STR(result, zend_string_init(envvar, strlen(envvar), ZEND_SYSTEM_INI));
184+
efree(envvar);
185+
} else if ((envvar = getenv(Z_STRVAL_P(name))) != NULL) {
184186
ZVAL_NEW_STR(result, zend_string_init(envvar, strlen(envvar), ZEND_SYSTEM_INI));
185187
/* ..or if not defined, try fallback value */
186188
} else if (fallback) {

0 commit comments

Comments
 (0)