mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
ext/intl: Fix dateformat_format when the time is an array of references.
This commit is contained in:
parent
1c182674b0
commit
f34859cb90
3 changed files with 26 additions and 1 deletions
2
NEWS
2
NEWS
|
@ -18,6 +18,8 @@ PHP NEWS
|
|||
- Intl:
|
||||
. Fix locale_compose and locale_lookup to work with their array argument
|
||||
with values as references. (David Carlier)
|
||||
. Fix dateformat_format when the time is an array of references.
|
||||
(David Carlier)
|
||||
|
||||
- Embed:
|
||||
. Fixed bug GH-8533 (Unable to link dynamic libphp on Mac). (Kévin Dunglas)
|
||||
|
|
|
@ -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);
|
||||
|
|
23
ext/intl/tests/dateformat_format_references.phpt
Normal file
23
ext/intl/tests/dateformat_format_references.phpt
Normal file
|
@ -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…
Add table
Add a link
Reference in a new issue