xref: /PHP-7.3/ext/filter/tests/bug51368.phpt (revision aed1e358)
1--TEST--
2FR #51368 (php_filter_float does not allow custom thousand separators)
3--SKIPIF--
4<?php
5if (!extension_loaded('filter')) die('skip filter extension not available');
6?>
7--FILE--
8<?php
9$options = ['flags' => FILTER_FLAG_ALLOW_THOUSAND, 'options' => ['thousand' => ' ']];
10var_dump(
11    filter_var('1 000', FILTER_VALIDATE_FLOAT, $options),
12    filter_var('1 234.567', FILTER_VALIDATE_FLOAT, $options)
13);
14$options = ['flags' => FILTER_FLAG_ALLOW_THOUSAND, 'options' => ['thousand' => '']];
15var_dump(filter_var('12345', FILTER_VALIDATE_FLOAT, $options));
16?>
17===DONE===
18--EXPECTF--
19float(1000)
20float(1234.567)
21
22Warning: filter_var(): thousand separator must be at least one char in %s on line %d
23bool(false)
24===DONE===
25