From 1612ffad059b11dfa55c9f6692b637b9849be677 Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Wed, 2 Apr 2003 21:33:02 +0000 Subject: [PATCH] MFB: Fix the setlocale() segfault --- ext/standard/string.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/standard/string.c b/ext/standard/string.c index 371a72eb7d..9aac0a2674 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -3377,6 +3377,7 @@ PHP_FUNCTION(setlocale) } while (1) { if (Z_TYPE_PP(args[1]) == IS_ARRAY) { + if(!zend_hash_num_elements(Z_ARRVAL_PP(args[1]))) break; zend_hash_get_current_data(Z_ARRVAL_PP(args[1]),(void **)&plocale); } else { plocale = args[i]; -- 2.50.1