From: Dmitry Stogov Date: Fri, 19 Dec 2014 15:20:55 +0000 (+0300) Subject: Avoid NULL pointer dereferencing X-Git-Tag: PRE_PHP7_REMOVALS~36^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ffc49acabc3e331022c4e9423cf85f6bb900da20;p=php Avoid NULL pointer dereferencing --- diff --git a/ext/standard/string.c b/ext/standard/string.c index 419fef3d59..2668161c09 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -4274,7 +4274,11 @@ PHP_FUNCTION(setlocale) zend_string_release(loc); } - RETURN_STR(zend_string_copy(BG(locale_string))); + if (BG(locale_string)) { + RETURN_STR(zend_string_copy(BG(locale_string))); + } else { + RETURN_EMPTY_STRING(); + } } zend_string_release(loc);