Commit Graph

167 Commits

Author SHA1 Message Date
Niels Dossche
2fc27b7d2a
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14590: Memory leak in FPM test gh13563-conf-bool-env.phpt
2024-06-28 22:10:23 +02:00
Niels Dossche
41371900a8
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-14590: Memory leak in FPM test gh13563-conf-bool-env.phpt
2024-06-28 22:08:18 +02:00
Niels Dossche
056bec72f4
Fix GH-14590: Memory leak in FPM test gh13563-conf-bool-env.phpt
Values retrieved from zend_getenv should be freed.
Note: The only possible value for `zend_getenv` is `sapi_getenv` which uses
zend alloc to duplicate the string that it reads from the SAPI module.

Closes GH-14708.
2024-06-28 22:05:15 +02:00
Cristian Rodríguez
8e62e2b829
Mark multple functions as static (#13864)
* Mark many functions as static

Multiple functions are missing the static qualifier.

* remove unused struct sigactions

struct sigaction act, old_term, old_quit, old_int;
all unused.

* optimizer: minXOR and maxXOR are unused
2024-05-22 13:11:46 +02:00
Ilija Tovilo
a48b977d3f Use :- as ini interpolation fallback separator 2023-07-18 08:31:02 +01:00
Gabriel Fontes
bc8b9aedf6 Add fallback value syntax for ini variables 2023-07-18 08:31:02 +01:00
Ilija Tovilo
b340e10d6e
Fix uninitialized memory in parse_ini_string()
Introduced by GH-11014

Fixes oss-fuzz #58080
Closes GH-11092
2023-04-17 15:23:06 +02:00
Ilija Tovilo
86ffde3c38
Improve ini number handling with INI_SCANNER_TYPED
Fixes GH-11010
Closes GH-11014
2023-04-11 18:54:11 +02:00
Max Kellermann
2d662f325d Zend/zend_ini_scanner: parse const strings 2023-01-04 12:49:48 +00:00
Max Kellermann
5e9b335e24 Zend/zend_ini_scanner: zend_ini_scanner_get_filename() returns const string 2023-01-04 12:49:48 +00:00
Ilija Tovilo
09aa27cc09
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix ZEND_RC_MOD_CHECK() for thread local ini parser strings
2022-09-12 23:33:03 +02:00
Ilija Tovilo
9af98cd465
Fix ZEND_RC_MOD_CHECK() for thread local ini parser strings 2022-09-12 23:31:26 +02:00
Nikita Popov
107ad28350 Suppress unused-but-set-variable warning in parsers
This is very ugly: Bison provides a yynerrs variable, which is
usually not actually used, but also not annotated with
YY_MAYBE_UNUSED. Suppress this warning by adding a (void)yynerrs
into the top-level reduction action. The alternative would be to
disable the warning for these generated files.
2022-07-28 22:29:42 +02:00
Dmitry Stogov
c732ab400a Change Zend Stream API to use zend_string* instead of char*.
This allows to eliminate re-calculation of string lenght and hash value.
See the detailed list of changes in UPGRADING.INTERNALS.
2021-03-16 20:31:36 +03: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
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov
e696732850 Merge branch 'PHP-7.4'
* PHP-7.4:
  Canonicalize bison error during ini parsing
2020-05-14 14:16:22 +02:00
Nikita Popov
3978d3a957 Canonicalize bison error during ini parsing
Bison 3.6 seems to use "end of file" rather than "$end" for this.
Force the same on older bison versions to be consistent.
2020-05-14 14:15:56 +02:00
Akim Demaille
4cbffd89d9
Clean up the generation of the parsers
Prefer '%define api.value.type' to '#define YYSTYPE', so that Bison
know the type.

Use '%code requires' to declare what is needed to define the api.value.type
(that code is output in the generated header before the generated
definition of YYSTYPE).

Prefer '%define api.prefix' inside the grammar file to '-p' outside,
as anyway the functions defined in the file actually use this prefix.

Prefer `%param` to both `%parse-param` and `%lex-param`.

Closes GH-5138
2020-02-01 14:21:53 +01:00
Akim Demaille
2127a37b83
Bison: enable all the warnings and fix them
First, fix 5547d36120: the definition of
YFLAGS was not passed into the Makefile: AC_SUBST does not suffice, we
need PHP_SUBST_OLD.  While at it, allow to pass variable and value at
the same time.

Then pass -Wall to bison, rather than only -Wempty-rules.

Use %precedence where associativity is useless.

Remove useless %precedence.
GH-5138
2020-02-01 14:21:21 +01:00
Akim Demaille
37d0f7d3b3
Use "%empty" in the parsers, instead of comments
The annotation %empty is properly enforced: warnings when it's
missing, and errors when it's inappropriate.  Support for %empty was
introduced in Bison 3.0.

Pass -Wempty-rule to Bison.

Closes GH-5134
2020-01-31 09:52:40 +01:00
Akim Demaille
5265fabc25 Use "%define parse.error verbose"
The YYERROR_VERBOSE macro will no longer be supported in Bison 3.6.
It was superseded by the "%error-verbose" directive in Bison 1.875
(2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that support
for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
(2013-07-25), "%error-verbose" is deprecated in favor of "%define
parse.error verbose".

Closes GH-5125.
2020-01-29 11:16:30 +01:00
Nikita Popov
e4b12fc62a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add destructor annotations in ini parser
2019-12-19 10:43:14 +01:00
Nikita Popov
0f078f6e78 Add destructor annotations in ini parser
It would be better to switch this to use %union and %type annotations,
but not going to do that change for 7.3.
2019-12-19 10:43:05 +01:00
Nikita Popov
852ab5d83f Use %define api.pure instead of %pure-parser
%pure-parser is deprecated. In our case there is no difference between
true & full, as we don't use locations.
2019-06-12 09:26:34 +02:00
Nikita Popov
9e2937d0f2 Merge branch 'PHP-7.3' into PHP-7.4 2019-04-08 11:13:10 +02:00
Nikita Popov
0a25b41f6d Merge branch 'PHP-7.2' into PHP-7.3 2019-04-08 11:12:52 +02:00
Nikita Popov
eea61cda7d Fixed bug #77844
We should probably return an integer result from the operation in
typed mode, right now the result is always a string.
2019-04-08 11:11:58 +02:00
Peter Kokot
b33fa18eab Remove unused PHP_AC_BROKEN_SPRINTF and AC_ZEND_BROKEN_SPRINTF
The sprintf function has been normalized to php_sprintf via
61364b5bb1.

This patch removes the checks to make a custom sprintf function

The ZEND_BROKEN_SPRINTF has been removed and the
hardcoded #define zend_sprintf sprintf is used.

The php_sprintf and zend_sprintf are now symbols to sprintf.

This patch now removes the custom PHP definitions of the php_sprintf and
zend_sprintf functions in favor of the C99 sprintf which is also
standardized in C89 already. Once, on some systems sprintf didn't behave
in same way.
2019-02-23 22:26:47 +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
a81202ac49 Adios, yearly copyright ranges 2019-01-30 11:48:28 +01:00
Zeev Suraski
9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02: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
37c329d715 Trim trailing whitespace in source code files 2018-10-13 14:17:28 +02:00
Peter Kokot
3362620b5f Trim trailing whitespace in source code files 2018-10-13 14:16:33 +02:00
Peter Kokot
902d39a3a7 Trim trailing whitespace in source code files 2018-10-13 14:14:50 +02:00
Christoph M. Becker
6da3a1e3ce Revert "Implement #67331: Have parse_ini_file add empty entries"
This reverts commit 3f3e914df3.

The commit broke some tests on Windows, and generally needs more
though.
2018-09-15 17:08:58 +02:00
Christoph M. Becker
3f3e914df3 Implement #67331: Have parse_ini_file add empty entries
Some INI processors allow to specify empty values by just giving the
key without the equals sign, for instance MySQL and Python.  It appears
to be sensible to add this possibility to our INI parser, so that it
can be used for such INI files as well.  We choose NULL as the value of
empty values.

This syntactical enhancement is a (minor) BC break, though, as can be
seen by the necessary change to bug49692.ini.  The “comment” formerly
has been simply ignored, but now it would be parsed as key with an
empty value.

This PR is based on Adam's former patch.
2018-09-15 15:37:01 +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
Nikita Popov
adb09c98d2 Fix return type of zend_ini_dtor 2018-06-02 13:41:09 +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
Anatol Belski
363e0450aa Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed bug #76068 parse_ini_string fails to parse "[foo]\nbar=1|>baz" with segfault
2018-03-10 11:21:01 +01:00
Anatol Belski
cf0012dad0 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #76068 parse_ini_string fails to parse "[foo]\nbar=1|>baz" with segfault
2018-03-10 11:20:11 +01:00
Anatol Belski
8417a23973 Fixed bug #76068 parse_ini_string fails to parse "[foo]\nbar=1|>baz" with segfault 2018-03-10 11:18:21 +01:00
Dmitry Stogov
de79001bef ZVAL_COPY_OR_DUP() instead of ZVAL_DUP() 2018-01-17 17:58:42 +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
Dmitry Stogov
ccc12b82da Avoid unnecessary reference-counting on strings. 2017-11-16 17:09:32 +03:00