Skip to content

Commit f9950cc

Browse files
committed
ext/intl: Fix dateformat_format when the time is an array of references.
1 parent 27affd8 commit f9950cc

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

ext/intl/dateformat/dateformat_format.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static int32_t internal_get_arr_ele(IntlDateFormatter_object *dfo,
6464
return result;
6565
}
6666

67-
if ((ele_value = zend_hash_str_find(hash_arr, key_name, strlen(key_name))) != NULL) {
67+
if ((ele_value = zend_hash_str_find_deref(hash_arr, key_name, strlen(key_name))) != NULL) {
6868
if(Z_TYPE_P(ele_value) != IS_LONG) {
6969
spprintf(&message, 0, "datefmt_format: parameter array contains "
7070
"a non-integer element for key '%s'", key_name);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Fix dateformat_format() with array argument with values as references.
3+
--FILE--
4+
<?php
5+
$a = 24;
6+
$localtime_arr = array (
7+
'tm_sec' => &$a ,
8+
'tm_min' => 3,
9+
'tm_hour' => 19,
10+
'tm_mday' => 3,
11+
'tm_mon' => 3,
12+
'tm_year' => 105,
13+
);
14+
$fmt = datefmt_create('en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/New_York', IntlDateFormatter::GREGORIAN);
15+
$formatted = datefmt_format($fmt , $localtime_arr);
16+
var_dump($formatted);
17+
?>
18+
--EXPECTF--
19+
string(%d) "Sunday, April 3, 2005 at 7:03:24 PM Eastern Daylight Time"

0 commit comments

Comments
 (0)