xref: /PHP-7.2/ext/intl/tests/bug72533.phpt (revision f1d7e3ca)
1--TEST--
2Bug #72533 (locale_accept_from_http out-of-bounds access)
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5--FILE--
6<?php
7
8function ut_main()
9{
10    $ret = var_export(ut_loc_accept_http(str_repeat('x', 256)), true);
11    $ret .= "\n";
12	if(intl_is_failure(intl_get_error_code())) {
13		$ret .= var_export(intl_get_error_message(), true);
14	}
15    $ret .= "\n";
16    $ret .= var_export(ut_loc_accept_http(str_repeat('en,', 256)), true);
17    $ret .= "\n";
18	if(intl_is_failure(intl_get_error_code())) {
19		$ret .= var_export(intl_get_error_message(), true);
20	}
21    return $ret;
22}
23
24include_once( 'ut_common.inc' );
25ut_run();
26?>
27--EXPECTF--
28false
29'locale_accept_from_http: locale string too long: U_ILLEGAL_ARGUMENT_ERROR'
30'en'
31