Commit Graph

387 Commits

Author SHA1 Message Date
Christoph M. Becker
ceae81665c Fix #73527: Invalid memory access in php_filter_strip 2020-06-04 13:37:11 +02:00
Peter Kokot
b746e69887 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:32:30 +02:00
Peter Kokot
782352c54a Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
Peter Kokot
a5e80b22e1 Fix typos in code comments 2018-07-25 11:57:11 +02:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02: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
094c2aaf83 The session_array global is not used at all, so comment it out for now 2018-07-09 04:21: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
Dmitry Stogov
169d454593 Use zval_ptr_dtor() imstead of zval_dtor() 2018-07-05 17:55:54 +03:00
Dmitry Stogov
dd932f7e63 Changed php_add[c]slashes prototypes (removed should_free argument) 2018-06-29 00:19:16 +03:00
Nikita Popov
f2c4f06f84 Remove unnecessary uses of z/ parameters 2018-06-25 22:27:42 +02:00
Peter Kokot
40c1d5d4e2 Normalize filter phpinfo() output
This patch normalizes the filter extension version in the php info
output. Instead of the Git attributes ident blob object name from Git
repository only extension status is displayed.
2018-06-02 13:35:22 +02:00
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03: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
Christoph M. Becker
ef255c9f0f Revert "[ci skip] Add missing return types to protos"
This reverts commit a2c7c46d5e.

Since apparently there have been some mistakes in this commit, and it's
not clear yet how to solve them, we're reverting for now.
2018-02-27 17:40:03 +01:00
Gabriel Caruso
a2c7c46d5e [ci skip] Add missing return types to protos 2018-02-24 11:45:17 +01:00
Gabriel Caruso
1314f0fb3a Use int instead of long in protos 2018-02-23 11:06:20 +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
Anatol Belski
26f1ffbd91 Fix overflow, int var used in loop with size_t counter 2018-02-18 17:55:50 +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
Dmitry Stogov
20b13fda09 Eliminate useless separations 2018-01-17 11:59:01 +03:00
Dmitry Stogov
6e1fdd2371 Use SEPARATE_ARRAY 2018-01-17 03:01:56 +03:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Xinchen Hui
ccd4716ec7 year++ 2018-01-02 12:53:31 +08:00
Anatol Belski
20d930d8f3 Fix remaining signedness warnings 2017-11-14 17:07:09 +01:00
Anatol Belski
a5bc5aed71 Patch core for PCRE2 support
RFC https://wiki.php.net/rfc/pcre2-migration
2017-11-13 19:37:38 +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
Dmitry Stogov
cb9d81ef4f Refactored recursion pretection 2017-10-06 01:34:50 +03:00
Xinchen Hui
513b0093c2 Refactor php_url struct to save memory dup in common cases 2017-08-06 17:48:05 +08:00
Nikita Popov
3f8ceb6f05 Drop useless allocation in php_filter_callback 2017-07-04 21:11:22 +02:00
Dmitry Stogov
40ecad3402 Fixed wrong usage of old ZPP API. 2017-06-19 18:08:50 +03:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06: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