Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/intl/dateformat/dateformat_format.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static int32_t internal_get_arr_ele(IntlDateFormatter_object *dfo,
return result;
}

if ((ele_value = zend_hash_str_find(hash_arr, key_name, strlen(key_name))) != NULL) {
if ((ele_value = zend_hash_str_find_deref(hash_arr, key_name, strlen(key_name))) != NULL) {
if(Z_TYPE_P(ele_value) != IS_LONG) {
spprintf(&message, 0, "datefmt_format: parameter array contains "
"a non-integer element for key '%s'", key_name);
Expand Down
23 changes: 23 additions & 0 deletions ext/intl/tests/dateformat_format_references.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
Fix dateformat_format() with array argument with values as references.
--SKIPIF--
<?php
if (PHP_OS_FAMILY === "Windows") die("skip currently unsupported on Windows");
?>
--FILE--
<?php
$a = 24;
$localtime_arr = array (
'tm_sec' => &$a ,
'tm_min' => 3,
'tm_hour' => 19,
'tm_mday' => 3,
'tm_mon' => 3,
'tm_year' => 105,
);
$fmt = datefmt_create('en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/New_York', IntlDateFormatter::GREGORIAN);
$formatted = datefmt_format($fmt , $localtime_arr);
var_dump($formatted);
?>
--EXPECTF--
string(%d) "Sunday, April 3, 2005 at 7:03:24%aPM Eastern Daylight Time"
Loading