Fix reference handling of IntlTimeZone::getCanonicalID/intltz_get_canonical_id

Closes GH-18469.
This commit is contained in:
Niels Dossche 2025-04-30 23:42:53 +02:00
parent e3105f5f1e
commit a090e59b37
No known key found for this signature in database
GPG key ID: B8A8AD166DF0E2E5
2 changed files with 20 additions and 3 deletions

View file

@ -0,0 +1,19 @@
--TEST--
IntlTimeZone::getCanonicalID: refs test
--EXTENSIONS--
intl
--FILE--
<?php
class Test {
public string $prop = "a";
}
$test = new Test;
$ref =& $test->prop;
print_R(intltz_get_canonical_id('Portugal', $ref));
var_dump($test);
?>
--EXPECT--
Europe/Lisbonobject(Test)#1 (1) {
["prop"]=>
&string(1) "1"
}

View file

@ -291,9 +291,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_canonical_id)
RETVAL_NEW_STR(u8str); RETVAL_NEW_STR(u8str);
if (is_systemid) { /* by-ref argument passed */ if (is_systemid) { /* by-ref argument passed */
ZVAL_DEREF(is_systemid); ZEND_TRY_ASSIGN_REF_BOOL(is_systemid, isSystemID);
zval_ptr_dtor(is_systemid);
ZVAL_BOOL(is_systemid, isSystemID);
} }
} }