Commit Graph

281 Commits

Author SHA1 Message Date
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
Kamil Tekiela
cd0cd3d31e
Fix typos (#7327) 2021-08-01 18:03:30 +01:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
George Peter Banyard
aca6aefd85
Remove 'register' type qualifier (#6980)
The compiler should be smart enough to optimize this on its own
2021-05-14 13:38:01 +01:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Stanislav Malyshev
23961ef382 Merge branch 'PHP-8.0'
* PHP-8.0:
  Rm unneeded function
2021-01-27 00:19:21 -08:00
Stanislav Malyshev
e9b8b085a7 Rm unneeded function 2021-01-27 00:18:49 -08: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
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Stanislav Malyshev
ced4c0bfe6 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  [ci skip] Update NEWS
  [ci skip] Fix order
  [ci skip] Unpdate NEWS
  Fix #77423: parse_url() will deliver a wrong host to user
2021-01-04 01:47:09 -08: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
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
Máté Kocsis
76e4bf3068
Parameter type and name fixes in ext/standard
Closes GH-6382
2020-10-27 11:27:25 +01: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
Dmitry Stogov
4a2ae84188 Add "const". Move constant strings to read-only memory. 2020-09-07 21:35:48 +03: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
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Alex Dowad
c4f716a20d Fix {{{ comment to match function name for php_replace_controlchars_ex 2020-06-24 22:26:00 +02:00
Xinchen Hui
e97a67963c drop use of extract_epi16 2020-05-09 12:28:49 +08:00
Xinchen Hui
af112f6572 Use SSE2 instructions do url_encode 2020-05-08 16:32:43 +08:00
Nikita Popov
661c0ac7f3 Remove support for EBCDIC
Closes GH-5390.
2020-04-20 16:39:39 +02:00
Stanislav Malyshev
d3fbdf0048 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #79465 - use unsigneds as indexes.
  Fix bug #79330 - make all execution modes consistent in rejecting \0
2020-04-13 21:09:23 -07:00
Stanislav Malyshev
864d69bef7 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #79465 - use unsigneds as indexes.
  Fix bug #79330 - make all execution modes consistent in rejecting \0
2020-04-13 21:09:15 -07:00
Stanislav Malyshev
d539e61c30 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #79465 - use unsigneds as indexes.
  Fix bug #79330 - make all execution modes consistent in rejecting \0
2020-04-13 21:09:08 -07:00
Stanislav Malyshev
9d6bf8221b Fix bug #79465 - use unsigneds as indexes. 2020-04-13 21:08:37 -07:00
Nikita Popov
2d1bf6970d Add Z_PARAM_RESOURCE_OR_NULL()
As a more explicit alternative to Z_PARAM_RESOURCE_EX(, 1, 0).
2020-04-09 15:39:11 +02:00
Máté Kocsis
bb6f374048
Improve argument error messages in ext/standard
Closes GH-5198
2020-03-18 19:56:10 +01:00
Stanislav Malyshev
2bc92a0cf7 Fix bug #79329 - get_headers should not accept \0 2020-03-16 22:42:15 -07:00
Stanislav Malyshev
335547a04d Fix bug #79329 - get_headers should not accept \0 2020-03-16 22:40:48 -07:00
Stanislav Malyshev
69fdc14152 Fix bug #79329 - get_headers should not accept \0 2020-03-16 22:40:00 -07:00
Stanislav Malyshev
0d139c5b94 Fix bug #79329 - get_headers should not accept \0 2020-03-15 17:30:44 -07: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
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Peter Kokot
e676aef56a Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove APACHE symbol
2019-07-08 15:06:54 +02:00
Peter Kokot
4b864c2ebb Remove APACHE symbol
The APACHE symbol was used in very early PHP versions to indicate the
Apache module usage. Since PHP 4 this is no longer used in the code.
2019-07-08 15:05:54 +02:00