Commit Graph

98 Commits

Author SHA1 Message Date
Remi Collet
6c5814dade
revert base64_encode change 2024-03-27 08:08:43 +01:00
Remi Collet
b5446e42b2
add $padding option to base64_encode 2024-03-26 13:45:32 +01:00
Frank Du
a9437ceb6f
base64: add avx512 and vbmi version. (#6361)
1. Implementation based on https://github.com/WojciechMula/base64simd
2. Only runtime path is added to reduce the complexity of SIMD variants.
3. Expand test case to cover SIMD implementation.

Signed-off-by: Frank Du <frank.du@intel.com>
2023-02-13 03:30:47 +00:00
Andy Postnikov
2108d6983f
Revert "Fix parse_url(): can not recognize port without scheme"
This reverts commit 72d83709d9.

Closes GH-9569
2022-09-23 19:44:29 +02:00
pandaLIU
72d83709d9
Fix parse_url(): can not recognize port without scheme
Closes GH-7844.
2022-05-16 12:03:35 +02:00
Nikita Popov
892421c9a8 Make some zend_test dependencies explicit
Rather than checking that specific functions exist.
2021-06-14 15:40:34 +02:00
Stanislav Malyshev
7eff4057de Merge branch 'PHP-8.0'
* PHP-8.0:
  Alternative fix for bug 77423
2021-01-26 23:01:40 -08:00
Stanislav Malyshev
effa287b35 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Alternative fix for bug 77423
2021-01-26 22:55:16 -08:00
Stanislav Malyshev
fbf8c758fe Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Alternative fix for bug 77423
2021-01-26 22:55:10 -08:00
Christoph M. Becker
4a89e726bd Alternative fix for bug 77423
That bug report originally was about `parse_url()` misbehaving, but the
security aspect was actually only regarding `FILTER_VALIDATE_URL`.
Since the changes to `parse_url_ex()` apparently affect userland code
which is relying on the sloppy URL parsing[1], this alternative
restores the old parsing behavior, but ensures that the userinfo is
checked for correctness for `FILTER_VALIDATE_URL`.

[1] <5174de7cd3 (commitcomment-45967652)>
2021-01-26 22:54:58 -08:00
Tyson Andre
81d20d003c Skip bug77423 if filter extension is unavailable. 2021-01-17 10:44:45 -05:00
Christoph M. Becker
5174de7cd3 Fix #77423: parse_url() will deliver a wrong host to user
To avoid that `parse_url()` returns an erroneous host, which would be
valid for `FILTER_VALIDATE_URL`, we make sure that only userinfo which
is valid according to RFC 3986 is treated as such.

For consistency with the existing url parsing code, we use ctype
functions, although that is not necessarily correct.
2021-01-04 01:20:21 -08:00
Christoph M. Becker
b132da7f9d Fix #77423: parse_url() will deliver a wrong host to user
To avoid that `parse_url()` returns an erroneous host, which would be
valid for `FILTER_VALIDATE_URL`, we make sure that only userinfo which
is valid according to RFC 3986 is treated as such.

For consistency with the existing url parsing code, we use ctype
functions, although that is not necessarily correct.
2021-01-04 01:19:18 -08:00
Stanislav Malyshev
434c2b1bdb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #77423: parse_url() will deliver a wrong host to user
2021-01-01 21:29:08 -08:00
Stanislav Malyshev
128fca4037 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77423: parse_url() will deliver a wrong host to user
2021-01-01 21:06:07 -08:00
Christoph M. Becker
2d3d72412a Fix #77423: parse_url() will deliver a wrong host to user
To avoid that `parse_url()` returns an erroneous host, which would be
valid for `FILTER_VALIDATE_URL`, we make sure that only userinfo which
is valid according to RFC 3986 is treated as such.

For consistency with the existing url parsing code, we use ctype
functions, although that is not necessarily correct.
2021-01-01 20:08:01 -08:00
Christoph M. Becker
bceab5b7c0 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80266: parse_url silently drops port number 0
2020-11-04 14:58:47 +01:00
Christoph M. Becker
b8f2531ff0 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80266: parse_url silently drops port number 0
2020-11-04 14:57:17 +01:00
Christoph M. Becker
00e41a10b8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80266: parse_url silently drops port number 0
2020-11-04 14:54:32 +01:00
Christoph M. Becker
2cab085bb3 Fix #80266: parse_url silently drops port number 0
As of commit 81b2f3e[1], `parse_url()` accepts URLs with a zero port,
but does not report that port, what is wrong in hindsight.

Since the port number is stored as `unsigned short` there is no way to
distinguish between port zero and no port.  For BC reasons, we thus
introduce `parse_url_ex2()` which accepts an output parameter that
allows that distinction, and use the new function to fix the behavior.

The introduction of `parse_url_ex2()` has been suggested by Nikita.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=81b2f3e5d9fcdffd87a4fcd12bd8c708a97091e1>

Closes GH-6399.
2020-11-04 14:53:19 +01:00
Nikita Popov
6ab4e330ac Use ephemeral port in more server tests
Port the main php_cli_server.inc to use ephemeral ports, thus
allowing CLI server tests to be parallelized.

A complication here is that we also need to give each test a
separate doc root, to avoid index.php files writing over each
other.

Closes GH-6375.
2020-10-23 14:26:34 +02:00
Christoph M. Becker
c0f8cc1904 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #80114: parse_url does not accept URLs with port 0
2020-09-20 15:38:18 +02:00
Christoph M. Becker
105132bd6b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80114: parse_url does not accept URLs with port 0
2020-09-20 15:37:11 +02:00
Christoph M. Becker
81b2f3e5d9 Fix #80114: parse_url does not accept URLs with port 0
URIs with a 0 port are generally valid, so `parse_url()` should
recognize such URIs, but still report the port as missing.

Co-authored-by: twosee <twose@qq.com>

Closes GH-6152.
2020-09-20 15:34:45 +02:00
Nikita Popov
0bc2657b2f Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix binary-safety of parse_url
2020-09-02 16:46:49 +02:00
Nikita Popov
81811dbbfb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix binary-safety of parse_url
2020-09-02 16:45:57 +02:00
Nikita Popov
54dbd3eccc Fix binary-safety of parse_url
php_parse_url() is intended to support strings that are not zero
terminated. We can't use strcspn in the implementation.

As we have two uses of strcspn, add a helper.
2020-09-02 16:45:25 +02:00
Máté Kocsis
7aacc705d0
Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Máté Kocsis
b5c7a83dca
Remove unnecessary PHPDoc-alike blocks from tests
Closes GH-5759
2020-06-24 13:13:44 +02:00
Tyson Andre
32a1ebbd43 Clean up calls to extension_loaded('json') in tests
These are no longer needed after https://wiki.php.net/rfc/always_enable_json

Closes GH-5637
2020-05-28 15:07:47 -04:00
Máté Kocsis
bb6f374048
Improve argument error messages in ext/standard
Closes GH-5198
2020-03-18 19:56:10 +01:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Máté Kocsis
afdaa91170
Fix #78880: Final spelling fixes 2020-01-16 19:14:31 +01:00
Islam Israfilov
f553e676ec Fixed #78385: Distinguish absent/empty query/fragment
http://example.com/foo   => query = null, fragment = null
http://example.com/foo?  => query = "",   fragment = null
http://example.com/foo#  => query = null, fragment = ""
http://example.com/foo?# => query = "",   fragment = ""

Closes GH-5078.
2020-01-13 10:18:23 +01:00
Máté Kocsis
f0b5d55c6f
Promote warning to exception in parse_url() 2019-12-11 18:47:48 +01:00
Fabien Villepinte
a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00
Fabien Villepinte
26dfce7f36 Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
Nikita Popov
2580a7ba09 More zpp error/variation test removals 2019-03-07 17:09:43 +01:00
Nikita Popov
c0e15a3b7f Implement fine-grained conflict handling
Tests can specify conflict keys, either in --CONFLICTS-- or
a per-directory CONFLICTS file. Non-conflicting tests may be run
in parallel.
2019-02-20 11:20:40 +01:00
Nikita Popov
8bc663f43b Remove zpp variation tests 2019-02-05 09:38:55 +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
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
f1d7e3ca0b 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:31:31 +02:00
Peter Kokot
d7a3edd45d Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
Peter Kokot
782352c54a Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
Peter Kokot
17ccbeec32 Trim trailing whitespace in *.phpt 2018-10-14 19:44:14 +02:00
Gabriel Caruso
9c144e0d82
Trim trailing whitespace in tests 2018-10-14 12:07:20 -03: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
fef879a2d6 Use bool instead of boolean while throwing a type error
PHP requires boolean typehints to be written "bool" and disallows
"boolean" as an alias. This changes the error messages to match
the actual type name and avoids confusing messages like "must be
of type boolean, boolean given".

This a followup to ce1d69a1f6, which
implements the same change for integer->int.
2018-02-04 23:09:40 +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