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
26 changes: 26 additions & 0 deletions ext/intl/tests/intltz_get_offset_references.phpt
Original file line number Diff line number Diff line change
@@ -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"
}
8 changes: 3 additions & 5 deletions ext/intl/timezone/timezone_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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;
}
Expand Down
Loading