summaryrefslogtreecommitdiff
path: root/ext/standard/basic_functions.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2016-07-19 00:53:08 -0700
committerStanislav Malyshev <stas@php.net>2016-07-19 00:53:08 -0700
commit4d0565b5bad444b0652379668c5116b74ee13747 (patch)
tree922cc7fbcf1c456bc89b2467c3e1f97d0708de3b /ext/standard/basic_functions.c
parent1a886926920acd6168cdff9f097bc20fc839a7f7 (diff)
parentf0a17b3a862399a77e54460b7f1b800bed4d6a69 (diff)
downloadphp-git-4d0565b5bad444b0652379668c5116b74ee13747.tar.gz
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: fix #72519, possible OOB using imagegif fix #72512, invalid read or write for palette image when invalid transparent index is used Apparently some envs miss SIZE_MAX Fix tests Fix bug #72618: NULL Pointer Dereference in exif_process_user_comment Partial fix for bug #72613 - do not treat negative returns from bz2 as size_t Fix bug #72606: heap-buffer-overflow (write) simplestring_addn simplestring.c Fix for bug #72558, Integer overflow error within _gdContributionsAlloc() Fix bug #72603: Out of bound read in exif_process_IFD_in_MAKERNOTE Fix bug #72562 - destroy var_hash properly Fix bug #72533 (locale_accept_from_http out-of-bounds access) Fix fir bug #72520 Fix for bug #72513 CS fix and comments with bug ID Fix for HTTP_PROXY issue. add tests for bug #72512 Fixed bug #72512 gdImageTrueColorToPaletteBody allows arbitrary write/read access Fixed bug #72479 - same as #72434 Conflicts: ext/bz2/bz2.c main/SAPI.c main/php_variables.c
Diffstat (limited to 'ext/standard/basic_functions.c')
-rw-r--r--ext/standard/basic_functions.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 57de98b15d..f7776d6e5b 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -3986,21 +3986,24 @@ PHP_FUNCTION(long2ip)
* System Functions *
********************/
-/* {{{ proto string getenv(string varname)
+/* {{{ proto string getenv(string varname[, bool local_only])
Get the value of an environment variable */
PHP_FUNCTION(getenv)
{
char *ptr, *str;
int str_len;
+ zend_bool local_only = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &str, &str_len, &local_only) == FAILURE) {
RETURN_FALSE;
}
- /* SAPI method returns an emalloc()'d string */
- ptr = sapi_getenv(str, str_len TSRMLS_CC);
- if (ptr) {
- RETURN_STRING(ptr, 0);
+ if (!local_only) {
+ /* SAPI method returns an emalloc()'d string */
+ ptr = sapi_getenv(str, str_len TSRMLS_CC);
+ if (ptr) {
+ RETURN_STRING(ptr, 0);
+ }
}
#ifdef PHP_WIN32
{