Commit Graph

145 Commits

Author SHA1 Message Date
Nikita Popov
c45f19590c Remove delref in free_object_storage
This gives us better object leak diagnostics.
2019-08-28 17:04:36 +02:00
Nikita Popov
51ed4a8d8f Merge branch 'PHP-7.3' into PHP-7.4 2019-03-18 10:04:59 +01:00
Nikita Popov
61eebb559e Merge branch 'PHP-7.2' into PHP-7.3 2019-03-18 10:04:29 +01:00
twosee
bd6eabd659 Don't disable object slot reuse while running shutdown functions
We only need to do this once we're running destructors. The current
approach interferes with some event loop code that runs everything
inside a shutdown function.
2019-03-18 10:02:31 +01:00
Nikita Popov
df93506f56 Merge branch 'PHP-7.3' into PHP-7.4 2019-03-01 14:35:26 +01:00
Nikita Popov
4dc0662eca Check for NULL GC type in objects_store_del
This might happen if OBJ_RELEASE is used on an object that was already
released by GC. Specific cases of this issue were previously fixed in
ffaee27478 and
72104d2b6e, however the issue still
affects 3rd-party extensions using OBJ_RELEASE.

The whole GC type NULL + OBJ_IS_VALID + IS_FREE_CALLED system seems
overly complicated and can probably be simplified in 7.4.
2019-03-01 14:32:11 +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
Dmitry Stogov
71d6899e53 micro-optimization 2018-11-15 18:47:23 +03:00
Dmitry Stogov
9ab3b42888 Split zend_objects_store_put() into hot/cold parts 2018-11-15 16:31:22 +03:00
Dmitry Stogov
c994d90db2 Reorder conditions and set expectation. 2018-11-06 22:37:04 +03: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
Nikita Popov
1cfbb21790 Classify object handlers are required/optional 2018-10-16 20:53:59 +02:00
Nikita Popov
25522baec4 Merge branch 'PHP-7.2' into PHP-7.3 2018-09-28 12:58:59 +02:00
Nikita Popov
1c35357b31 Merge branch 'PHP-7.1' into PHP-7.2 2018-09-28 12:57:55 +02:00
Nikita Popov
45cdcb2d0b Fixed bug #76846 2018-09-28 12:56:47 +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
Xinchen Hui
ffaee27478 Fixed bug #76427 (Segfault in zend_objects_store_put) 2018-06-11 21:00:38 +08:00
Dmitry Stogov
f2b4ec4bdc Export standard object handlers, to avoid indirect access 2018-05-31 11:57:22 +03:00
Dmitry Stogov
1af60a2a71 Keep initialized object_handlers structures in read-only memory. 2018-03-14 14:01: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
b3e22da745 Use OBJ_FLAGS() macro to access object flags (even if they are currently stored together with GC_FLAGS) 2018-01-22 15:57:00 +03:00
Dmitry Stogov
4861373182 Replace checks with asserts 2018-01-16 11:39:51 +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
175e461369 Use fastcall calling convention for objects and resources API 2017-12-14 13:50:39 +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
bc5811f361 further sync for vim mode lines 2017-07-04 18:12:45 +02:00
Dmitry Stogov
908ce66f73 Cleanup. Removed unused functions and unimplemented prototype. Avoid useless "dtor_obj" calls. 2017-06-27 12:03:06 +03:00
Dmitry Stogov
f25ecdacf8 shutdown_executor() refactoring (reuse opcache fast request shutdown code) 2017-06-22 01:45:28 +03:00
Nikita Popov
5af997ed81 Don't use zend_try around dtor_obj() and free_obj()
Without these zend_trys we may
a) leak the object (fine)
b) don't add it to the free list (also fine, we just lose an
   object store bucket)
c) don't remove it from the GC root buffer (also fine, because GC
   explicitly checks for both FREE_CALLED and invalid buckets)
2017-05-04 20:57:25 +02:00
Jim Zubov
1b1399c95d Added EG(flags) - executor global flags
EG_FLAGS_IN_SHUTDOWN - is set when PHP is in shutdown state
2017-02-09 12:40:33 -05:00
Jim Zubov
f9afc6aabc newly added zend_object_store.no_reuse is redefined as a global zend_object_store_no_reuse,
to avoid alignment issues
2017-02-07 21:13:39 -05:00
Jim Zubov
9a8a1c9da1 Bug Fix:
Corrupted class entries on shutdown when a destructor spawns another object
(C) 2017 CommerceByte Consulting

When zend_objects_store_call_destructors() is called from the shutdown sequence -
it's calling the dtor's for remaining objects one by one in sequence of object handles.
If the dtor spawns one or more objects, and the new objects happen to reuse the old handles -
their dtor's are not called in this cycle.
The dtor's are called later on, when zend_deactivete() kicks in, and the static property lists in the class entries are freed.
This causes "Undefined static property" errors, and/or SIGSEGV.

Solution:
zend_object_store.no_reuse field is added
Set to 0 on initialization, set to 1 on the shutdown sequence.
zend_objects_store_put(zend_object *) checks the no_reuse flag, and never reuses the old handle slots if set.
This way, the dtor's for newly spawned objects are guaranteed to be called in the zend_objects_store_call_destructors() loop.
2017-02-06 18:05:34 -05:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Dmitry Stogov
51f59739b6 Turn function into inline 2016-11-21 13:13:28 +03:00
Xinchen Hui
9564998e49 Fixed Bug #71859 (zend_objects_store_call_destructors operates on realloced memory, crashing) 2016-03-20 04:52:57 -07:00
Xinchen Hui
97a9470d97 bump year which is missed in rev 49493a2 2016-01-02 17:56:11 +08:00
Dmitry Stogov
37f0c6b5cb Add myself into list of authors of the most refactored files. 2015-08-31 11:38:16 +03:00
Nikita Popov
866bd89b1d Always report object leaks
Previously cycles were excluded from leak reports, however the
situation here has improved a lot in the meantime and we can
report all leaks.
2015-07-03 19:33:34 +02:00
Dmitry Stogov
388c2cbdbc Micro optimizations 2015-04-28 19:11:45 +03:00
Nikita Popov
aef96d5169 Partially enable leak reports for objects
Cycle leaks are currently not reported, because this needs further
work.

The last GC run has been moved to run earlier (before the object
store free), so that array cycles that hold references to objects
don't show up as leaks. Fingers crossed that this doesn't adversely
affect anything else.
2015-04-18 17:31:11 +02: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
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Nikita Popov
116c5ecda1 Remove proxy object implementation 2014-10-09 14:01:08 +02:00
Anatol Belski
6f9f0bf205 master renames phase 2 2014-08-25 19:28:33 +02:00