com php-src: Fix bug #67858: Leak when $php_errormsg alre ady set: Zend/tests/bug67858.phpt Zend/zend _execute_API.c
| From: | Nikita Popov | Date: | Mon, 18 Aug 2014 16:14:19 +0000 |
| Subject: | com php-src: Fix bug #67858: Leak when $php_errormsg alre ady set: Zend/tests/bug67858.phpt Zend/zend _execute_API.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-80581@lists.php.net to get a copy of this message | ||
Commit: 26a9dc3e04813a76bf59ffb5bf9df47f6034008b
Author: Nikita Popov <nikic@php.net> Mon, 18 Aug 2014 18:12:50 +0200
Parents: eda5d30be9bda5e2f2df1c5cb3e3bf6d4f50b459
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=26a9dc3e04813a76bf59ffb5bf9df47f6034008b
Log:
Fix bug #67858: Leak when $php_errormsg already set
Bugs:
https://bugs.php.net/67858
Changed paths:
A Zend/tests/bug67858.phpt
M Zend/zend_execute_API.c
Diff:
diff --git a/Zend/tests/bug67858.phpt b/Zend/tests/bug67858.phpt
new file mode 100644
index 0000000..f0cfc74
--- /dev/null
+++ b/Zend/tests/bug67858.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #67858: Leak when $php_errormsg already set
+--INI--
+track_errors=1
+error_reporting=E_ALL
+--FILE--
+<?php
+
+function f() {
+ $php_errormsg = [1, 2, 3];
+ echo $var;
+ var_dump($php_errormsg);
+}
+f();
+
+?>
+--EXPECTF--
+Notice: Undefined variable: var in %s on line %d
+string(23) "Undefined variable: var"
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 8af8772..b45a021 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -1724,6 +1724,7 @@ ZEND_API int zend_set_local_var_str(const char *name, int len, zval *value,
int
if (op_array->vars[i]->h == h &&
op_array->vars[i]->len == len &&
memcmp(op_array->vars[i]->val, name, len) == 0) {
+ zval_ptr_dtor(EX_VAR_NUM(i));
ZVAL_COPY_VALUE(EX_VAR_NUM(i), value);
return SUCCESS;
}