Commit graph

191 commits

Author SHA1 Message Date
Gabriel Caruso
cdd8368d6f Clean up unnecessary ternary expressions and simplify some returns
- Simplify conditions
- Use ZEND_HASH_APPLY_* instead of hard-coded booleans
- Use ZEND_NORMALIZE_BOOL
- Drop sign in favor of ZEND_NORMALIZE_BOOL
2018-12-03 01:22:14 +01:00
Peter Kokot
d679f02295 Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:33:09 +02:00
Peter Kokot
d7a3edd45d Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
Gabriel Caruso
9c144e0d82
Trim trailing whitespace in tests 2018-10-14 12:07:20 -03:00
Christoph M. Becker
61330b0faf Fix PHPT ENV sections
run-tests.php assumes the contents of an ENV section are a simple list
of key-value-pairs, instead of evaluating the section contents as PHP
script which server-tests.php did.  Since server-tests.php is gone, we
remove the superfluous and confusing scripting.
2018-10-06 12:29:04 +02:00
Gabriel Caruso
0e0019f694
Remove superfluous checks of always available functions 2018-08-03 00:13:01 -03:00
Christoph M. Becker
c0407d95f7 Deprecate explicit use of FILTER_FLAG_SCHEME|HOST_REQUIRED
As of PHP 5.2.1 FILTER_VALIDATE_URL implies FILTER_FLAG_SCHEME_REQUIRED
| FILTER_FLAG_HOST_REQUIRED, which makes these constants useless at
best, if not even misleading.  Therefore we deprecate the explicit use
of these constants for FILTER_VALIDATE_URL, to pave the way for their
eventual removal.

See <https://wiki.php.net/rfc/deprecations_php_7_3#filter_flag_scheme_required_and_filter_flag_host_required>.
2018-07-17 10:45:46 +02:00
Kalle Sommer Nielsen
529baa9a3d Added test to accompany the FILTER_SANITIZE_ADD_SLASHES filter 2018-07-09 03:59:35 +02:00
Kalle Sommer Nielsen
a8dce31957 Added the 'add_slashes' sanitization filter (FILTER_SANITIZE_ADD_SLASHES) as an alias to 'magic_quotes' (FILTER_SANITIZE_MAGIC_QUOTES) so we can move past our "magical" legacy. 2018-07-09 03:58:20 +02:00
Nikita Popov
9aeeecc47c Merge branch 'PHP-7.2' 2018-07-07 12:08:27 +02:00
Nikita Popov
5d0d812a53 Merge branch 'PHP-7.1' into PHP-7.2 2018-07-07 12:08:02 +02:00
cdoco
47fb17b108 Fixed bug #76366 (references in sub-array for filtering breaks the filter) 2018-07-07 12:07:43 +02:00
Christoph M. Becker
aed1e358dc Implement #51368: php_filter_float does not allow custom thousand separators
A set of hard-coded thousand separator characters (presently, `',.`) is
somewhat limited (users may prefer other separators, such as spaces or
underscores), as well as somewhat too liberal (arbitrary combinations
of different thousand separators are presently possible).  Therefore we
introduce a `thousand` option analogous to `decimal`, which allows to
define the desired thousand separators as non-empty string, defaulting
to `',.`.  While we easily could support empty strings here as well,
that would not make much sense, since this behavior can more easily be
accomplished by not setting the `FILTER_FLAG_ALLOW_THOUSAND` flag in
the first place.
2018-03-24 15:04:32 +01:00
Gabriel Caruso
57896cf515 Make some skipped tests run, and fix some skip messages 2018-03-11 16:38:00 +01:00
Gabriel Caruso
ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00
Gabriel Caruso
ce1d69a1f6 Use int instead of integer in type errors
PHP requires integer typehints to be written "int" and does not
allow "integer" as an alias. This changes type error messages to
match the actual type name and avoids confusing messages like
"must be of the type integer, integer given".
2018-02-04 19:08:23 +01:00
Gabriel Caruso
b0d3c1bf83 Add and fix SKIPIF sections 2018-02-04 17:26:37 +01:00
Gabriel Caruso
c6c9e71a5b Add missing SKIPIF sections 2018-02-03 13:54:34 +01:00
Christoph M. Becker
c4c4056041 Remove implicit constants from test case
`FILTER_FLAG_SCHEME_REQUIRED` and `FILTER_FLAG_HOST_REQUIRED` are
implicitly used for `FILTER_VALIDATE_URL` so there is no need to
specify them explicitly.

Cf. https://bugs.php.net/75442.
2017-10-28 18:00:10 +02:00
Peter Kokot
2bc23f8028
Update filter docs and tests
Filter extension is better presented in the PHP manual. Some ext/filter/tests
included outdated functions or were duplicated.
2017-10-19 12:09:06 +01:00
Nikita Popov
5af586bec5 Remove more PHP 6 leftovers from tests 2016-11-24 22:39:39 +01:00
Nikita Popov
45f7b2bcc8 Fix CRLF line-endings in tests
Also fix a single instance of CRLF in ibase_query.c.
2016-11-20 22:31:24 +01:00
Christoph M. Becker
1ccada35c0 Fix tests: don't count non-countables 2016-11-13 18:16:17 +01:00
Christoph M. Becker
e8e41aa8cd Merge branch 'PHP-7.0' into PHP-7.1 2016-09-09 14:43:16 +02:00
Christoph M. Becker
1a30a7a422 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-09 14:34:11 +02:00
Christoph M. Becker
23e721fc93 Fix #73054: default option ignored when object passed to int filter
If an object that can't be converted to string is validated, we must not
bail out early, but rather check for a requested default value.
2016-09-09 14:30:24 +02:00
Levi Morrison
cb91a51b00 Partially fix bug #67167 - Wrong return value...
...from FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE

The remainer of the fix would require the filter functions to only
convert to string when it makes sense for that particular filter.

(cherry picked from commit 432dc527ad)
2016-09-09 12:45:46 +02:00
Julien Pauli
376dcaa39a Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix #72972, Bad filter for the flags FILTER_FLAG_NO_RES_RANGE and FILTER_FLAG_NO_PRIV_RANGE
2016-09-05 10:13:19 +02:00
Julien Pauli
e5047ac2d2 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fix #72972, Bad filter for the flags FILTER_FLAG_NO_RES_RANGE and FILTER_FLAG_NO_PRIV_RANGE
2016-09-05 10:12:49 +02:00
Julien Pauli
9834978a8b Fix #72972, Bad filter for the flags FILTER_FLAG_NO_RES_RANGE and FILTER_FLAG_NO_PRIV_RANGE 2016-09-05 10:08:42 +02:00
Sjon Hortensius
66626cc223 Fix typos, previous version used reserver/reserverd/reserved 2016-07-23 23:14:14 +02:00
Anatol Belski
7f3375d5f2 make constant name more descriptive 2016-07-18 23:33:22 +02:00
Leo Feyer
8f4050709c Support Unicode characters in the local part of an e-mail address.
See RFC 6531 (https://tools.ietf.org/html/rfc6531).

Encode IDNA domains.

Add the missing "Done" to the expected output.

Add the FILTER_FLAG_EMAIL_RFC6531 flag.

Fix the filter_var() call.
2016-07-18 21:52:35 +02:00
Julien Pauli
13a5c54068 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Updated NEWS
  update filter_var filters for ipv4 addresses to reflect rfc6890
2016-07-08 16:31:53 +02:00
Jos Elstgeest
6fc7817558 update filter_var filters for ipv4 addresses to reflect rfc6890 2016-07-08 16:30:06 +02:00
Xinchen Hui
a9026070b6 Fixed test 2015-12-12 22:37:50 -08:00
Xinchen Hui
c47b49c9b5 Fixed test if PATH is not set 2015-12-08 08:26:04 -08:00
Reeze Xia
3427c122bf Fixed bug #71063 (filter_input(INPUT_ENV, ..) does not work) 2015-12-09 00:04:12 +08:00
Levi Morrison
432dc527ad Partially fix bug #67167 - Wrong return value...
...from FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE

The remainer of the fix would require the filter functions to only
convert to string when it makes sense for that particular filter.
2015-09-02 18:23:26 -06:00
Levi Morrison
730496b899 Skip if ext/filter isn't loaded 2015-09-02 10:12:08 -06:00
Nikita Popov
547d387973 Merge branch 'PHP-5.6' 2015-03-14 09:18:50 +01:00
Jeff Welch
1e51c5411e Fix #69203: FILTER_FLAG_STRIP_HIGH doesn't strip ASCII 127 2015-03-14 09:17:36 +01:00
Jeff Welch
fdbdb11514 Fix #69202: FILTER_FLAG_STRIP_BACKTICK ignored unless other flags are used. 2015-03-09 17:14:47 +08:00
Jeff Welch
66a2c528fe Fix #69202: FILTER_FLAG_STRIP_BACKTICK ignored unless other flags are used. 2015-03-09 17:08:35 +08:00
Jeff Welch
1dc5bd47d8 Adjust logic in sanity checks.
The code should return false when the provided options argument is neither an
array nor a valid filter.
2015-03-08 15:27:41 -04:00
Andrea Faulds
e5eb9530ab Use "float" and "integer" in typehint and zpp errors 2014-12-21 13:23:02 +00:00
Kévin Dunglas
54f06d2381 New label length test 2014-11-17 08:10:29 +01:00
Kévin Dunglas
a8742d30ea Fix ext/filter/tests/033.phpt 2014-11-14 11:40:39 +01:00
Kévin Dunglas
5ad3f87557 Fix filter_list test 2014-11-14 10:56:39 +01:00
Kévin Dunglas
728945d0a5 FILTER_VALIDATE_DOMAIN and RFC conformance for FILTER_VALIDATE_URL 2014-11-14 10:01:53 +01:00