Skip to content

Commit a090e59

Browse files
committed
Fix reference handling of IntlTimeZone::getCanonicalID/intltz_get_canonical_id
Closes GH-18469.
1 parent e3105f5 commit a090e59

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
IntlTimeZone::getCanonicalID: refs test
3+
--EXTENSIONS--
4+
intl
5+
--FILE--
6+
<?php
7+
class Test {
8+
public string $prop = "a";
9+
}
10+
$test = new Test;
11+
$ref =& $test->prop;
12+
print_R(intltz_get_canonical_id('Portugal', $ref));
13+
var_dump($test);
14+
?>
15+
--EXPECT--
16+
Europe/Lisbonobject(Test)#1 (1) {
17+
["prop"]=>
18+
&string(1) "1"
19+
}

ext/intl/timezone/timezone_methods.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_canonical_id)
291291
RETVAL_NEW_STR(u8str);
292292

293293
if (is_systemid) { /* by-ref argument passed */
294-
ZVAL_DEREF(is_systemid);
295-
zval_ptr_dtor(is_systemid);
296-
ZVAL_BOOL(is_systemid, isSystemID);
294+
ZEND_TRY_ASSIGN_REF_BOOL(is_systemid, isSystemID);
297295
}
298296
}
299297

0 commit comments

Comments
 (0)