mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix reference support for intltz_get_offset()
It should use the helper macros such that types are properly respected. Closes GH-18364.
This commit is contained in:
parent
c905d59106
commit
bf4b470098
3 changed files with 32 additions and 5 deletions
3
NEWS
3
NEWS
|
@ -15,6 +15,9 @@ PHP NEWS
|
|||
. Fixed GH-18243 imagettftext() overflow/underflow on font size value.
|
||||
(David Carlier)
|
||||
|
||||
- Intl:
|
||||
. Fix reference support for intltz_get_offset(). (nielsdos)
|
||||
|
||||
- LDAP:
|
||||
. Fixed bug GH-17776 (LDAP_OPT_X_TLS_* options can't be overridden). (Remi)
|
||||
. Fix NULL deref on high modification key. (nielsdos)
|
||||
|
|
26
ext/intl/tests/intltz_get_offset_references.phpt
Normal file
26
ext/intl/tests/intltz_get_offset_references.phpt
Normal file
|
@ -0,0 +1,26 @@
|
|||
--TEST--
|
||||
intltz_get_offset references
|
||||
--EXTENSIONS--
|
||||
intl
|
||||
--FILE--
|
||||
<?php
|
||||
$tz = IntlTimeZone::createTimeZone('Europe/Brussels');
|
||||
|
||||
class Test {
|
||||
public string $a, $b;
|
||||
}
|
||||
$test = new Test;
|
||||
$test->a = $test->b = "hello";
|
||||
|
||||
$rawOffset =& $test->a;
|
||||
$dstOffset =& $test->b;
|
||||
intltz_get_offset($tz, 0.0, true, $rawOffset, $dstOffset);
|
||||
var_dump($test);
|
||||
?>
|
||||
--EXPECT--
|
||||
object(Test)#2 (2) {
|
||||
["a"]=>
|
||||
&string(7) "3600000"
|
||||
["b"]=>
|
||||
&string(1) "0"
|
||||
}
|
|
@ -419,7 +419,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_offset)
|
|||
TIMEZONE_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
|
||||
"Odbz/z/", &object, TimeZone_ce_ptr, &date, &local, &rawOffsetArg,
|
||||
"Odbzz", &object, TimeZone_ce_ptr, &date, &local, &rawOffsetArg,
|
||||
&dstOffsetArg) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
@ -431,10 +431,8 @@ U_CFUNC PHP_FUNCTION(intltz_get_offset)
|
|||
|
||||
INTL_METHOD_CHECK_STATUS(to, "intltz_get_offset: error obtaining offset");
|
||||
|
||||
zval_ptr_dtor(rawOffsetArg);
|
||||
ZVAL_LONG(rawOffsetArg, rawOffset);
|
||||
zval_ptr_dtor(dstOffsetArg);
|
||||
ZVAL_LONG(dstOffsetArg, dstOffset);
|
||||
ZEND_TRY_ASSIGN_REF_LONG(rawOffsetArg, rawOffset);
|
||||
ZEND_TRY_ASSIGN_REF_LONG(dstOffsetArg, dstOffset);
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue