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
5 changes: 2 additions & 3 deletions ext/intl/formatter/formatter_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ PHP_FUNCTION( numfmt_parse_currency )
FORMATTER_METHOD_INIT_VARS;

/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Osz/|z!",
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Osz|z!",
&object, NumberFormatter_ce_ptr, &str, &str_len, &zcurrency, &zposition ) == FAILURE )
{
RETURN_THROWS();
Expand Down Expand Up @@ -165,8 +165,7 @@ PHP_FUNCTION( numfmt_parse_currency )
/* Convert parsed currency to UTF-8 and pass it back to caller. */
u8str = intl_convert_utf16_to_utf8(currency, u_strlen(currency), &INTL_DATA_ERROR_CODE(nfo));
INTL_METHOD_CHECK_STATUS( nfo, "Currency conversion to UTF-8 failed" );
zval_ptr_dtor( zcurrency );
ZVAL_NEW_STR(zcurrency, u8str);
ZEND_TRY_ASSIGN_REF_NEW_STR(zcurrency, u8str);

RETVAL_DOUBLE( number );
}
Expand Down
20 changes: 20 additions & 0 deletions ext/intl/tests/numfmt_parse_currency_references.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
numfmt_parse_currency() reference handling
--EXTENSIONS--
intl
--FILE--
<?php
class Test {
public int $prop = 1;
}
$test = new Test;
$fmt = numfmt_create( 'de_DE', NumberFormatter::CURRENCY );
$num = "1\xc2\xa0$";
try {
numfmt_parse_currency($fmt, $num, $test->prop);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Cannot assign string to reference held by property Test::$prop of type int
Loading