Skip to content

Fix reference handling of IntlTimeZone::getCanonicalID/intltz_get_canonical_id #18469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
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
19 changes: 19 additions & 0 deletions ext/intl/tests/intltz_get_canonical_id_refs.phpt
Original file line number Diff line number Diff line change
@@ -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"
}
4 changes: 1 addition & 3 deletions ext/intl/timezone/timezone_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_canonical_id)
RETVAL_NEW_STR(u8str);

if (is_systemid) { /* by-ref argument passed */
ZVAL_DEREF(is_systemid);
zval_ptr_dtor(is_systemid);
ZVAL_BOOL(is_systemid, isSystemID);
ZEND_TRY_ASSIGN_REF_BOOL(is_systemid, isSystemID);
}
}

Expand Down
Loading