Commit Graph

184 Commits

Author SHA1 Message Date
Remi Collet
ef2fd0e5b5
fix [-Wstrict-prototypes] buid warnings 2021-11-24 14:55:11 +01:00
Nikita Popov
6d505d4445 Add RETURN/RETVAL_COPY_DEREF() macros
These were missing from the set...

I think quite a few of these usages don't actually need the DEREF,
but I've just kept things as is for now.
2021-07-22 09:44:19 +02:00
Nikita Popov
9d2a466c4b Remove explicit assignments of zend_objects_destroy_object
This is the default handler, no need to set it explicitly. This
makes it easier to see which objects really have a custom dtor_obj.
2021-06-09 11:29:50 +02: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
Nikita Popov
71cbef78ba Fixed bug #80111
Remove traverse_pointer before destroying the element contents.
2021-04-19 14:41:19 +02:00
Nikita Popov
044de83635 Prefer ZVAL_COPY
Instead of ZVAL_COPY_VALUE + Z_TRY_ADDREF. Also fix another leak
in SplDoublyLinkedList::add(), the push case was leaking as well.
2021-04-19 14:35:36 +02:00
Nikita Popov
497fadcacd Fix leak in SplDoublyLinkedList::add() 2021-04-19 13:08:35 +02:00
Nikita Popov
02db708cd4 Remove generic dtor+ctor from SPL dllist
This is only ever used with zvals. It was particularly confusing
because a lot of code mixed the generic code with zval specific
code.
2021-04-19 13:02:19 +02:00
Máté Kocsis
4f4c031f62
Generate ext/spl class entries from stubs
Closes GH-6709
2021-02-18 13:01:51 +01: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
Nikita Popov
d8b22c56cf Fix INDIRECT elements leaked by SPL __serialize implementations 2021-01-12 15:35:19 +01:00
George Peter Banyard
9affbef0e6 Use normal error in SPL for 'An iterator cannot be used with foreach by reference' 2020-09-15 12:49:59 +02:00
George Peter Banyard
61c299fe9c Error promotions in SPL
Warning to Error promotion and a Notice to Warning promotion to align
with the behaviour specified in the Reclassify Engine Warnings RFC.

Closes GH-6072
2020-09-03 19:27:02 +02:00
Máté Kocsis
f7fbc6333f
Add more precise type info for stubs
Closes GH-6005
2020-09-01 16:35:56 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov
312201dce4 Add get_gc handle for object iterators
Optional handler with the same semantics as the object handler.
2020-07-01 15:17:22 +02:00
Nikita Popov
15846ff115 Add ZVAL_OBJ_COPY macro
For the common ZVAL_OBJ + GC_ADDREF pattern.
This mirrors the existing ZVAL_STR_COPY API.
2020-06-17 16:36:56 +02:00
twosee
7d6a0ba808 Fix expression warnings and break warnings
Close GH-5675.
2020-06-07 10:41:11 +02:00
Alex Dowad
d4d0852c23 SplDoublyLinkedList uses iteration flags in iterator struct
The 'flags' field in spl_dllist_it was formerly unused. This means that if one started to
iterate over an SplDoublyLinkedList using 'foreach', and then *changed* the iteration mode
halfway, the 'foreach' loop would start iterating in the opposite direction. Probably this
was not what was intended.

Therefore, use the 'flags' field in spl_dllist_it for iteration via 'foreach'. For explicit
iteration using methods like '::next()' and '::current()', continue to use the flags in
the SplDoublyLinkedList object itself.
2020-05-12 17:22:31 +02:00
Alex Dowad
9999e7faa3 Remove useless prototype for spl_dllist_get_iterator 2020-05-12 17:21:21 +02:00
Nikita Popov
48a34bc120 Add helper APIs for get_gc implementations
get_gc() implementations that need to explore heterogeneous data
currently work by computing how many GC entries they need,
allocating a buffer for that and storing it on the object. This
is inefficient and wastes memory, because the buffer is retained
after the GC run.

This commit adds an API for a single global GC buffer, which can
be reused by get_gc implementations (as only one get_gc call is
ever active at the same time). The GC buffer will automatically
grow during the GC run and be discarded at the end.
2020-04-27 10:48:22 +02:00
Máté Kocsis
d7f7080bb5
Generate methods entries from stubs for ext/spl
Closes GH-5458
2020-04-25 23:54:56 +02:00
Christoph M. Becker
9809713844 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #69264: __debugInfo() ignored while extending SPL classes
2020-04-06 12:04:12 +02:00
Christoph M. Becker
22a077b642 Fix #69264: __debugInfo() ignored while extending SPL classes
We actually implement `::__debugInfo()` and drop the `get_debug_info()`
handlers of all relevant SPL classes.  This is cleaner and gives more
flexibility regarding overriding the functionality in descendant
classes.
2020-04-06 12:01:29 +02:00
Máté Kocsis
782f7e2ad8
Fix #75958 Return void instead of true 2020-03-25 15:04:33 +01:00
Máté Kocsis
2e8ccce5dc
Add stubs for SplDoublyLinkedList
Closes GH-5293
2020-03-25 15:01:24 +01:00
Christoph M. Becker
f3c24ec265 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #75673: SplStack::unserialize() behavior
2020-03-06 09:12:03 +01:00
Christoph M. Becker
b761997de3 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #75673: SplStack::unserialize() behavior
2020-03-06 09:11:10 +01:00
Christoph M. Becker
b84277297a Fix #75673: SplStack::unserialize() behavior
Even though `SplStack::unserialize()` is not supposed to be called on
an already constructed instance, it is probably better if the method
clears the stack before actually unserializing.
2020-03-06 09:09:49 +01:00
Nikita Popov
ac51a5f02a Make SPL doubly linked list smaller
Store rc in data u2. This drops element size from 40 to 32 bytes.
2020-02-21 09:54:18 +01:00
Nikita Popov
60f62359a0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79151
2020-01-23 14:21:21 +01:00
Nikita Popov
3f020aef85 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79151
2020-01-23 14:21:14 +01:00
Nikita Popov
db9776c53c Fixed bug #79151
Make sure we also NULL out next/prev of the removed element on
pop/shift. This only matter is that element is still being referenced
by an iterator.
2020-01-23 14:20:26 +01:00
Máté Kocsis
b7d2882fee
Use zend_parse_parameters_none() instead of zend_parse_parameters_none_throw() 2020-01-03 13:22:39 +01:00
Máté Kocsis
01a50778d1
Use RETURN_THROWS() after zend_throw_exception() in most of the extensions 2020-01-02 10:56:18 +01:00
Máté Kocsis
817605917b
Use RETURN_THROWS() during ZPP in the remaining extensions
In reflection, sodium, and SPL
2019-12-31 16:33:02 +01:00
Christoph M. Becker
4008704f62 zend_parse_parameters_throw() is obsolete
Since `zend_parse_parameters()` throws now, there is no reason to
explicitly call `zend_parse_parameters_throw()` anymore, and since both
have actually the same implementation, we redefine the latter as macro.
2019-11-01 16:47:15 +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
e28cb9d04e Merge branch 'PHP-7.4' 2019-08-26 11:10:07 +02:00
Nikita Popov
9483c50772 Fixed bug #78456 2019-08-26 11:08:42 +02:00
Dmitry Stogov
b2cdde0826 Merge branch 'PHP-7.4'
* PHP-7.4:
  Replace ZVAL_COPY() and ZVAL_COPY_VALUE() for IS_OBJECT by cheaper macros
2019-05-28 20:19:15 +03:00
Dmitry Stogov
83804519df Replace ZVAL_COPY() and ZVAL_COPY_VALUE() for IS_OBJECT by cheaper macros 2019-05-28 20:10:02 +03:00
Nikita Popov
f17931a8bb Merge branch 'PHP-7.4' 2019-05-22 09:06:23 +02:00
Jaroslav Hanslík
d6c0c5ef8e Fixed some arg infos to match documentation 2019-05-22 09:05:32 +02:00
Nikita Popov
03783bb55d Merge branch 'PHP-7.4' 2019-04-10 09:40:06 +02:00
Nikita Popov
e2ea0f105c Fix bug #77866: Port Serializable SPL classes to use __unserialize()
Payloads created using Serializable are still supported.
2019-04-10 09:36:39 +02:00
Dmitry Stogov
91ef4124e5 Refactor zend_object_handlers API to pass zend_object* and zend_string* insted of zval(s). 2019-02-04 13:20:25 +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
0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Dmitry Stogov
0f7f1498be Use ZEND_THIS macro to hide implementation details in extensions code. 2018-11-15 19:54:19 +03:00