Commit Graph

101 Commits

Author SHA1 Message Date
Ilija Tovilo
6335264c07
Fix header errors when parsed standalone (#14272)
This is annoying for multiple reasons:

1. LSPs can show many errors for these files.
2. LSP can stop parsing these files completely if there are too many errors,
   resulting in spotty LSP features.
2024-05-20 22:30:38 +02:00
Ilija Tovilo
6f63d4b274
Fix -Wenum-int-mismatch warnings on gcc 13
Closes GH-11103
2023-04-20 16:04:59 +02:00
Dmitry Stogov
706a9b2a39 Revert "Zend/zend_types.h: move zend_result to separate header (#10609)"
This reverts commit 3bce116069.
2023-04-04 22:48:26 +03:00
Max Kellermann
3bce116069
Zend/zend_types.h: move zend_result to separate header (#10609)
Many sources need just `zend_result`, and with this new header, they
only need to include `zend_result.h` instead of `zend_types.h`; the
latter is large and has fat dependencies, which slows down the build.
2023-02-20 13:07:51 +00:00
Christoph M. Becker
c8955c078a
Revert GH-10220
Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491.
This reverts commit 588a07f737.
This reverts commit f377e15751.
This reverts commit b4ba16fe18.
This reverts commit 694ec1deea.
This reverts commit 6b34de8eba.
This reverts commit aa1cd02a43.
This reverts commit 308fd311ea.
This reverts commit 16203b53e1.
This reverts commit 738fb5ca54.
This reverts commit 9fdbefacd3.
This reverts commit cd4a7c1d90.
This reverts commit 928685eba2.
This reverts commit 01e5ffc85c.
2023-01-16 12:27:33 +01:00
George Peter Banyard
098a43dbd0
Introduce new INI API to get zend_string* value for an INI setting 2023-01-15 16:00:18 +00:00
Max Kellermann
cd4a7c1d90 Zend/zend_ini: include cleanup 2023-01-10 14:19:03 +00:00
Max Kellermann
2d662f325d Zend/zend_ini_scanner: parse const strings 2023-01-04 12:49:48 +00:00
George Peter Banyard
3e362f51ac Add zend_string INI validators
Currently we only have validators for char* which is rather annoying as INI settings are saved as zend_string* in the first place

Closes GH-9328
2022-09-06 10:41:47 +01:00
Ayesh Karunaratne
9f8e5182a1
INI parser: Fix typo /multipler/multiplier
Closes GH-8987.
2022-07-13 12:16:26 +02:00
Arnaud Le Blanc
827754ac22
Fix type (#8814) 2022-06-17 15:23:21 +02:00
Arnaud Le Blanc
efc8f0ebf8
Deprecate zend_atol() / add zend_ini_parse_quantity() (#7951)
Add zend_ini_parse_quantity() and deprecate zend_atol(), zend_atoi()

zend_atol() and zend_atoi() don't just do number parsing.
They also check for a 'K', 'M', or 'G' at the end of the string,
and multiply the parsed value out accordingly.

Unfortunately, they ignore any other non-numerics between the
numeric component and the last character in the string.
This means that numbers such as the following are both valid
and non-intuitive in their final output.

* "123KMG" is interpreted as "123G" -> 132070244352
* "123G " is interpreted as "123 " -> 123
* "123GB" is interpreted as "123B" -> 123
* "123 I like tacos." is also interpreted as "123." -> 123

Currently, in php-src these functions are used only for parsing ini values.

In this change we deprecate zend_atol(), zend_atoi(), and introduce a new
function with the same behavior, but with the ability to report invalid inputs
to the caller. The function's name also makes the behavior less unexpected:
zend_ini_parse_quantity().

Co-authored-by: Sara Golemon <pollita@php.net>
2022-06-17 14:12:53 +02:00
Arnaud Le Blanc
812068f664
Use zend_register_ini_entries_ex / zend_unregister_ini_entries_ex (#8505) 2022-05-06 16:36:31 +02:00
Arnaud Le Blanc
f07a08df5c
Fix unregistering ini entries of dynamically loaded extension (#8435)
Fixes GH-8185
2022-05-06 15:25:44 +02: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
George Peter Banyard
fa8d9b1183 Improve type declarations for Zend APIs
Voidification of Zend API which always succeeded
Use bool argument types instead of int for boolean arguments
Use bool return type for functions which return true/false (1/0)
Use zend_result return type for functions which return SUCCESS/FAILURE as they don't follow normal boolean semantics

Closes GH-6002
2020-08-28 15:41:27 +02:00
Nikita Popov
41c7d28c11 Add macro to get ini target address 2020-04-27 10:30:00 +02:00
Michael Voříšek
d2ba848572 Use strlen for INI_* macros
strlen() is resolved at compile time by optimizing compilers.

Prevent mistakes and allow to use INI_* macros with char * variables
which can have sizeof() == 1.

Closes GH-5174.
2020-02-17 11:11:14 +01:00
Michael Voříšek
f15b5ff353 Add const modifier for name strings
Closes GH-5173.
2020-02-13 14:44:06 +01:00
Dmitry Stogov
e14d77335c Mark "cold" functions 2019-05-29 11:48:41 +03: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
a81202ac49 Adios, yearly copyright ranges 2019-01-30 11:48:28 +01:00
Zeev Suraski
54dc07f3dc Update email addresses. We're still @Zend, but future proofing it... 2018-11-01 17:20:07 +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
Dmitry Stogov
6c035f53f1 Separate duplicated code into a zend_ini_parse_bool() function. 2018-03-05 11:51:58 +03:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Dmitry Stogov
dc47171523 Avoid temporary string creation and destruction. 2017-12-11 18:18:30 +03:00
Dmitry Stogov
9731a22eba Use Zend MM heap for non-persistent ini entry values. 2017-11-08 12:01:59 +03:00
Anatol Belski
793ca716fb Fix datatypes and compiler warnings
Switch to size_t

Not critical as an unsigned is already used, but fixes a couple of
warnings in other areas.

Normalize signature

It's a function with the usual compare semantics, returning a platform
specific at least produces unnecessary warnings elsewhere and is otherwise
inappropriate.

Fix return value

Drop unused var

Fix compiler warnings

Fix compiler warning

Fix var name in arginfo

Fix cast
2017-10-23 08:56:57 +02:00
Anatol Belski
853e73fb8e Reduce struct size, on 64-bit by 8 bytes each
Note, the max modifiable flag value is currently 1<<5, there is still
some space. ATM it looks unlikely, but should more flags need to be
added, the types will need to be reconsidered.
2017-07-28 20:02:26 +02:00
Anatol Belski
bc5811f361 further sync for vim mode lines 2017-07-04 18:12:45 +02:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Anatol Belski
b204b3abd1 further normalizations, uint vs uint32_t
fix merge mistake

yet one more replacement run
2016-11-26 17:29:01 +01:00
Xinchen Hui
97a9470d97 bump year which is missed in rev 49493a2 2016-01-02 17:56:11 +08:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Anatol Belski
9e4310eeeb reworked ini dtor 2014-12-16 10:15:02 +01:00
Anatol Belski
eb629b70da free the right globals
That's the same as in the previous commit. In the TS mode the tsrm
cache pointer might be unavailable or point to a wrong thread, so
the exact globals passed should be freed.
2014-12-16 09:12:09 +01:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Dmitry Stogov
88d7ca44f6 Refactored INI subsystem to use zend_string* instead of char* 2014-09-01 20:57:33 +04:00
Anatol Belski
c3e3c98ec6 master renames phase 1 2014-08-25 19:24:55 +02:00
Anatol Belski
8ee2a4a9b5 first shot on merging the core fro the int64 branch 2014-08-16 11:16:11 +02:00
Nikita Popov
08ae88157b Allocate zend_strings with correct size
For me (32bit) sizeof(zend_string) is 20, which means that the
char[1] array at the end is padded with three bytes. Thus allocating
based on sizeof(zend_string)-1 overallocates by those 3 padding bytes.

This commit fixes the allocation size, by using XtOffsetOf.
2014-04-23 19:34:51 +02:00
Dmitry Stogov
050d7e38ad Cleanup (1-st round) 2014-04-15 15:40:40 +04:00
Dmitry Stogov
a0fe8e5a91 Use better data structures (incomplete) 2014-02-18 01:41:23 +04:00
Dmitry Stogov
f4cfaf36e2 Use better data structures (incomplete) 2014-02-10 10:04:30 +04:00
Xinchen Hui
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
Ard Biesheuvel
050aae2860 Fixed bug #64197 (_Offsetof() macro used but not defined on ARM/Clang)
Updated the code to test for __ARMCC_VERSION instead of __arm, as
that is a more reliable indicator of whether the ARMCC compiler is
being used.
2013-02-13 12:22:50 +01:00
Xinchen Hui
0a7395e009 Happy New Year 2013-01-01 16:28:54 +08:00
Felipe Pena
4e19825281 - Year++ 2012-01-01 13:15:04 +00:00