Commit graph

158 commits

Author SHA1 Message Date
Niels Dossche
841f0b1515
Remove dead error checks for php_stream_filter_alloc() (#19194)
php_stream_filter_alloc() can't fail, so simplify the code.
2025-08-12 22:18:39 +02:00
Jakub Zelenka
7c96af42b7
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-20 11:14:04 +01:00
Jakub Zelenka
ffff27f734
Merge branch 'PHP-8.2' into PHP-8.3 2024-11-20 11:12:19 +01:00
Niels Dossche
f3ade203d7
Fix GHSA-r977-prxv-hc43
Move the bound check upwards. Since this doesn't generate output we can
check the bound first.
2024-11-20 11:07:04 +01:00
Gina Peter Bnayard
91aca96a8e ext/standard/filters.c: Use bool type where possible for persistent field/param 2024-08-13 14:10:06 +02:00
Gina Peter Bnayard
9cfe9e10ba ext/standard/filters.c: Use zend_result return type instead of int 2024-08-13 14:10:06 +02:00
Gina Peter Bnayard
2baadf3807 ext/standard/filters.c: Voidify php_conv_base64_decode_ctor()
It always returned SUCCESS
2024-08-13 14:10:06 +02:00
Gina Peter Bnayard
54cc76fdb4 ext/standard/filters.c: Remove some register keywords 2024-08-13 14:10:06 +02:00
Gina Peter Banyard
25a5146180
Clean-up unused headers (#14365)
* ext/mbstring.c: clean-up headers and include intrinsics
2024-06-01 17:12:42 +01:00
Levi Morrison
c461b60060
refactor: change zend_is_true to return bool (#14301)
Previously this returned `int`. Many functions actually take advantage
of the fact this returns exactly 0 or 1. For instance,
`main/streams/xp_socket.c` does:

    sockopts |= STREAM_SOCKOP_IPV6_V6ONLY_ENABLED * zend_is_true(tmpzval);

And `Zend/zend_compile.c` does:

    child = &ast->child[2 - zend_is_true(zend_ast_get_zval(ast->child[0]))];

I changed a few places trivially from `int` to `bool`, but there are
still many places such as the object handlers which return `int` that
should eventually be `bool`.
2024-05-24 15:16:36 -06:00
Cristian Rodríguez
927adfb1a6
Use a single version of mempcpy(3) (#12257)
While __php_mempcpy is only used by ext/standard/crypt_sha*, the
mempcpy "pattern" is used everywhere.

This commit removes __php_mempcpy, adds zend_mempcpy and transforms
open-coded parts into function calls.
2023-12-20 15:16:32 +00:00
Niels Dossche
ddedd15eae Remove always-true condition in php_conv_open() 2023-12-12 16:43:43 +00:00
Javier Eguiluz
732d92c0e5
[skip ci] Fix various typos and grammar issues (#11143) 2023-04-28 11:05:32 +02:00
Niels Dossche
375e7402af
Change implicit enum return value checks to explicit checks (#10703) 2023-02-26 08:56:20 +00:00
Niels Dossche
9006f06a84
Remove dead cleanup code (#10333)
This code path was only triggered if inst->cd == NULL. But the freeing
only happens if inst->cd != NULL. There is nothing to free here, so
remove this code. In fact, let's get rid of the goto too to make the
code more clear to read.
2023-01-16 12:54:35 +00: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
George Peter Banyard
5caaf40b43
Introduce pseudo-keyword ZEND_FALLTHROUGH
And use it instead of comments
2021-04-07 00:46:29 +01:00
Dmitry Stogov
4a2ae84188 Add "const". Move constant strings to read-only memory. 2020-09-07 21:35:48 +03:00
Christoph M. Becker
383a9f46ad Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #74267: segfault with streams and invalid data
2020-06-08 23:28:36 +02:00
Christoph M. Becker
ee4683cf28 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #74267: segfault with streams and invalid data
2020-06-08 23:22:49 +02:00
Christoph M. Becker
12c59f6660 Fix #74267: segfault with streams and invalid data
If the current character is a line break character, it cannot be a tab
or space character, so we would always fail with an invalid sequence
error.  Obviously, these `scan_stat == 4` conditions are meant to be
exclusive.

Furthermore, if `in_pp == NULL || in_left_p == NULL` is true, we hit a
segfault if we are not returning right away.  Obviously, the additional
constraints don't make sense, so we remove them.
2020-06-08 23:19:43 +02:00
Máté Kocsis
d1764ca330
Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +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
Nikita Popov
a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Peter Kokot
623911f993 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove local variables
2019-02-03 21:23:18 +01:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Zeev Suraski
0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Zeev Suraski
38c337f22e Remove year range from copyright notice 2019-01-30 11:00:23 +02:00
Nikita Popov
c7d7af8069 Remove fgetss and friends
These were deprecated in PHP 7.3 as part of
https://wiki.php.net/rfc/deprecations_php_7_3.
2019-01-29 09:43:00 +01:00
Stanislav Malyshev
36534afd10 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix null pointer deref in qprint-encode filter (bug #77231)
2018-12-03 10:20:07 -08:00
Stanislav Malyshev
a9ef7ecc60 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix null pointer deref in qprint-encode filter (bug #77231)
2018-12-03 10:20:02 -08:00
Stanislav Malyshev
d5dc3c69f9 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix null pointer deref in qprint-encode filter (bug #77231)
2018-12-03 10:19:57 -08:00
Stanislav Malyshev
036bc5c1fb Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fix null pointer deref in qprint-encode filter (bug #77231)
2018-12-03 10:19:49 -08:00
Stanislav Malyshev
78bffa72c1 Fix null pointer deref in qprint-encode filter (bug #77231) 2018-12-03 10:19:08 -08:00
Gabriel Caruso
9e4d590b19
Remove extra semicolons 2018-07-25 21:47:04 -03: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
Nikita Popov
4a5b2101e5 Deprecate string.strip_tags filter
Part of https://wiki.php.net/rfc/deprecations_php_7_3.
2018-07-21 22:38:39 +02:00
Nikita Popov
f3dc67b255 Merge branch 'PHP-7.1' into PHP-7.2 2018-07-05 19:11:25 +02:00
Nikita Popov
0c4ab798de Merge branch 'PHP-7.2' 2018-07-05 19:10:24 +02:00
Nikita Popov
0504594a28 Merge branch 'PHP-7.1' into PHP-7.2 2018-07-05 19:09:40 +02:00
Nikita Popov
791f07e4f0 Fix string.strip_tags filter
Was segfaulting if no allowed tags are specified and performing an
out of bounds read if they were.
2018-07-05 19:08:00 +02: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
Dmitry Stogov
fa06cbf50c typo 2017-12-14 23:56:55 +03:00
Dmitry Stogov
83e495e0fd Move constants into read-only data segment 2017-12-14 22:14:36 +03:00
Anatol Belski
80b926d24d Fix unsigned comparison 2017-11-17 18:53:37 +01:00
Dmitry Stogov
ccc12b82da Avoid unnecessary reference-counting on strings. 2017-11-16 17:09:32 +03:00
Thomas Punt
9f08aff3fd Remove superfluous allocation checks around ZMM-based functions 2017-04-02 00:58:19 +02:00
Nikita Popov
edcabf6d07 Drop unnecessary allocator return value checks 2017-03-13 22:07:15 +01:00