Commit Graph

97 Commits

Author SHA1 Message Date
George Peter Banyard
be9adc4fbc
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix build with Valgrind without I_REPLACE_SONAME_FNNAME_ZU symbol
2022-05-07 16:48:23 +01:00
Martin Vobruba
b388e951b8
Fix build with Valgrind without I_REPLACE_SONAME_FNNAME_ZU symbol
Fixes #8453

Signed-off-by: George Peter Banyard <girgias@php.net>
2022-05-07 16:45:03 +01:00
George Peter Banyard
c2547ab7dc
Add some const qualifiers in zend_string/hash (#8304)
Co-authored-by: Levi Morrison <morrison.levi@gmail.com>
2022-04-20 15:56:51 +01:00
Max Kellermann
b9e895bca0
Replace memcmp() with zend_string functions (#8216)
* ext/oci8: use zend_string_equals()

Eliminate duplicate code.

* main/php_variables: use zend_string_equals_literal()

Eliminate duplicate code.

* Zend/zend_string: add zend_string_equals_cstr()

Allows eliminating duplicate code.

* Zend, ext/{opcache,standard}, main/output: use zend_string_equals_cstr()

Eliminate duplicate code.

* Zend/zend_string: add zend_string_starts_with()

* ext/{opcache,phar,spl,standard}: use zend_string_starts_with()

This adds missing length checks to several callers, e.g. in
cache_script_in_shared_memory().  This is important when the
zend_string is shorter than the string parameter, when memcmp()
happens to check backwards; this can result in an out-of-bounds memory
access.
2022-03-31 16:27:58 +02:00
Nikita Popov
4a4ae45a0b Fix bug #81142 by adding zend_string_init_existing_interned()
Add a new interned string handler that fetches an interned string
if it exists, but does not create one if it does not (and instead
returns a non-interned string).

This fixes bug #81142, by preventing the creating of new interned
strings for unserialized array keys.

Closes GH-7360.
2021-08-12 11:57:50 +02:00
Nikita Popov
a0c44fbaf1 Always define valgrind replacement symbol for zend_string_equal_val
The required symbol name seems to be very stable, so we can hardcode
a fallback. This avoids many false positives when PHP is not built
against valgrind.
2021-05-21 21:00:34 +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
4fb705a03d Add zend_string_concat2 API 2020-04-14 17:18:05 +02:00
Nikita Popov
d030ddb2cd Export the zend_string_concat3() API 2020-04-09 15:06:53 +02:00
Dmitry Stogov
5ffa5217fc Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Check assert only when RC_DEBUG is enabled
2019-04-18 14:27:05 +03:00
Dmitry Stogov
3a04adce82 Check assert only when RC_DEBUG is enabled 2019-04-18 14:26:15 +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
Dmitry Stogov
f80b1b0c56 Delay hash table allocation 2019-01-24 16:01:04 +03:00
jvoisin
fbdaabba62 Fix some sign-related issues in comparisons 2019-01-09 10:01:12 +01:00
Nikita Popov
12cbe930cd Merge branch 'PHP-7.3' 2018-11-13 12:31:44 +01:00
Jan Rękorajski
f76be1a0d6 Fix compilation on x32
Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
2018-11-13 12:31:00 +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
Dmitry Stogov
33e777acbf Improved shared interned strings handling. The previous implementation worked incorrectly in ZTS build. It changed strings only in function/class tables of one thread. Now all threads gets the same shared interned strings. Also, on shutdown, we don't try to replace SHM interned strings back to process strings, but delay dettachment of SHM instead. 2018-10-25 20:30:51 +03:00
Peter Kokot
be49d61b19 Remove old SVN keywords substitutions
When the PHP source code was versioned in Subversion, there was
possible to substitute certain keywords such as $Id$ with revision
number, last change time and author name. Such approach is not used
in Git so this patch removes these outdated artifacts from source
code files.
2018-06-16 13:04:30 +02:00
Dmitry Stogov
858d545ce6 micro optimization 2018-05-08 00:22:04 +03:00
Dmitry Stogov
cb464a53c8 Use "fastcall" calling convention 2018-04-04 01:12:59 +03:00
Dmitry Stogov
a795bd8265 Optimize zend_hash_real_init() 2018-03-23 00:13:45 +03:00
Dmitry Stogov
6f483dc94c Use macros to update specific parts of GC_TYPE_INFO() (direct assignments to GC_TYPE(), GC_FLAGS() and GC_INFO() are prohibited) 2018-02-28 00:52:12 +03:00
Dmitry Stogov
e43ac26356 Fixed string comparison (it may fail in case of not null-terminated strings) 2018-01-31 12:38:02 +03:00
Dmitry Stogov
53eb20f0cb Merge branch 'PHP-7.2'
* PHP-7.2:
  Restore initial values on graceful server restart.
2018-01-26 15:25:03 +03:00
Dmitry Stogov
aad12cb49c Restore initial values on graceful server restart. 2018-01-26 15:22:36 +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
Dmitry Stogov
4691cbe5d1 Fixed possible local assembler labels conflicts. 2017-12-20 21:44:24 +03:00
Nikita Popov
4e6b80ca54 Fix movzb operand size 2017-12-06 23:15:35 +01:00
Dmitry Stogov
1646042342 Use local labels 2017-12-06 17:47:30 +03:00
Dmitry Stogov
3beaf10289 Fixed gcc assembler constaints.
Added less efecient replacement functions for valgrind, to prevent warnings about uninitialized tail.
2017-12-06 15:32:31 +03:00
Dmitry Stogov
c019c131e8 Use unsigned comparison instructions 2017-12-05 02:41:12 +03:00
Dmitry Stogov
8305a73483 Implemented x86 and x86_64 assembler functions for zend_string equality check.
They take into account zend_string layout (value alignment and trailing padding) and perform comparison by double or quad words.
2017-12-04 23:40:54 +03:00
Dmitry Stogov
74c84cd7f0 Use zend_string_equal*() API for zend_string equality check instead of direct memcmp() usage. 2017-12-04 17:17:02 +03:00
Dmitry Stogov
26b2b27a25 Don't intern strings in-place if their refcoung greater than 1 2017-11-03 21:00:07 +03:00
Dmitry Stogov
f2b91b31e4 Switch back from "request" interned strings storage to "permanent" in MSHUTDOWN 2017-11-02 23:29:21 +03:00
Dmitry Stogov
49ea143bbd Encapsulate reference-counting primitives.
Prohibit direct update of GC_REFCOUNT(), GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF() shoukf be instead.
Added mactros to validate reference-counting (disabled for now).
These macros are going to be used to eliminate race-condintions during reference-counting on data shared between threads.
2017-10-27 01:28:58 +03:00
Anatol Belski
efcce55360 Fix datatype 2017-10-19 10:26:39 +02:00
Dmitry Stogov
272f5a1716 Extend zend_string API to avoid reallocation in zend_string_init_interned() 2017-10-19 00:02:56 +03:00
Anatol Belski
bc5811f361 further sync for vim mode lines 2017-07-04 18:12:45 +02:00
Anatol Belski
fdba33922a move to hash API for interned strings ht management 2017-03-07 19:01:00 +01:00
Anatol Belski
c698299550 Interned strings unification for TS/NTS
Hereby, interned strings are supported in thread safe PHP. The patch
implements two types of interned strings

- interning per process, strings are not freed till process end
- interning per request, strings are freed at request end

There is no runtime interning.

With Opcache, all the permanent iterned strings are copied into SHM on
startup, additional copying into SHM might happen on demand.
2017-03-04 10:39:13 +01: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
Anatol Belski
afbb3b858a Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  use already exported symbol
  Revert "export symbol missing by phpdbg"
2016-10-13 10:08:10 +02:00
Anatol Belski
3104882cf8 Revert "export symbol missing by phpdbg"
This reverts commit 611ab7fe5b.

Overseen strpprintf is there
2016-10-13 09:50:32 +02:00