summaryrefslogtreecommitdiff
path: root/ext/spl/spl_fixedarray.c
Commit message (Collapse)AuthorAgeFilesLines
* Clean up spl_fixedarray.cLevi Morrison2020-09-271-138/+129
| | | | | | | | | | | | | | | | | | | | | Remove inline. Remove old folding blocks. Convert an int usage to bool. Convert some uses of int and size_t into zend_long. This is incomplete because get_gc requires `int *n`, which should probably become zend_long or size_t eventually. Adds spl_fixedarray_empty to help enforce invariants. Adds spl_fixedarray_default_ctor. Documents some functions. Reworks spl_fixedarray_copy into two functions: - spl_fixedarray_copy_ctor - spl_fixedarray_copy_range I'm hoping to eventually export SplFixedArray for extensions to use directly, which is the motivation here.
* SplFixedArray is Aggregate, not IterableAlex Dowad2020-09-231-172/+39
| | | | | | | | | | | | | | | | | | | | | | | | One strange feature of SplFixedArray was that it could not be used in nested foreach loops. If one did so, the inner loop would overwrite the iteration state of the outer loop. To illustrate: $spl = SplFixedArray::fromArray([0, 1]); foreach ($spl as $a) { foreach ($spl as $b) { echo "$a $b"; } } Would only print two lines: 0 0 0 1 Use the new InternalIterator feature which was introduced in ff19ec2df3 to convert SplFixedArray to an Aggregate rather than Iterable. As a bonus, we get to trim down some ugly code! Yay!
* Use ValueError instead of exceptions in SPL extensionGeorge Peter Banyard2020-09-151-2/+2
|
* Use normal error in SPL for 'An iterator cannot be used with foreach by ↵George Peter Banyard2020-09-151-1/+1
| | | | reference'
* Error promotions in SPLGeorge Peter Banyard2020-09-031-3/+1
| | | | | | | 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
* Remove proto comments from C filesMax Semenik2020-07-061-32/+16
| | | | Closes GH-5758
* Add get_gc handle for object iteratorsNikita Popov2020-07-011-1/+2
| | | | Optional handler with the same semantics as the object handler.
* Add ZVAL_OBJ_COPY macroNikita Popov2020-06-171-2/+1
| | | | | For the common ZVAL_OBJ + GC_ADDREF pattern. This mirrors the existing ZVAL_STR_COPY API.
* Generate methods entries from stubs for ext/splMáté Kocsis2020-04-251-38/+17
| | | | Closes GH-5458
* Remove unused 'ce_get_iterator' field from spl_fixedarray_objectAlex Dowad2020-04-231-2/+0
|
* Merge branch 'PHP-7.4'Christoph M. Becker2020-03-231-13/+4
|\ | | | | | | | | * PHP-7.4: Fix #79393: Null coalescing operator failing with SplFixedArray
| * Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2020-03-231-13/+4
| |\ | | | | | | | | | | | | * PHP-7.3: Fix #79393: Null coalescing operator failing with SplFixedArray
| | * Fix #79393: Null coalescing operator failing with SplFixedArrayChristoph M. Becker2020-03-231-13/+4
| | | | | | | | | | | | | | | | | | | | | We favor the KISS principle over optimization[1] – SPL is already special enough. [1] <https://github.com/php/php-src/pull/2489/commits/352f3d4476a79bb86136b431719df7394e5a8d4e#r112498098>ff
* | | Add some stubs for SPLMáté Kocsis2020-03-101-41/+17
| | | | | | | | | | | | Closes GH-5245
* | | Initialize SplFixedArray elements to NULL instead of UNDEFNikita Popov2020-01-301-31/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | The SplFixedArray API treats all elements as NULL, even if they have not been explicitly initialized. Rather than initializing to UNDEF an treating that specially in various circumstances, directly initialize elements to NULL. This also fixes an assertion failure in the attached test case.
* | | Use RETURN_THROWS() after zend_throw_exception() in most of the extensionsMáté Kocsis2020-01-021-4/+4
| | |
* | | Use RETURN_THROWS() during ZPP in the remaining extensionsMáté Kocsis2019-12-311-16/+16
| | | | | | | | | | | | In reflection, sodium, and SPL
* | | zend_parse_parameters_throw() is obsoleteChristoph M. Becker2019-11-011-1/+1
| | | | | | | | | | | | | | | | | | 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.
* | | Remove mention of PHP major version in Copyright headersGabriel Caruso2019-09-251-2/+0
| | | | | | | | | | | | Closes GH-4732.
* | | Merge branch 'PHP-7.4'Dmitry Stogov2019-05-281-1/+2
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Replace ZVAL_COPY() and ZVAL_COPY_VALUE() for IS_OBJECT by cheaper macros
| * | Replace ZVAL_COPY() and ZVAL_COPY_VALUE() for IS_OBJECT by cheaper macrosDmitry Stogov2019-05-281-1/+2
| | |
* | | Merge branch 'PHP-7.4'Nikita Popov2019-05-221-2/+2
|\ \ \ | |/ /
| * | Fixed some arg infos to match documentationJaroslav Hanslík2019-05-221-2/+2
| | |
* | | Merge branch 'PHP-7.4'Nikita Popov2019-05-141-1/+1
|\ \ \ | |/ /
| * | Add RETURN_EMPTY_ARRAY() / RETVAL_EMPTY_ARRAY()Nikita Popov2019-05-141-1/+1
| | | | | | | | | | | | The usual wrappers around ZVAL_EMPTY_ARRAY()...
* | | Merge branch 'PHP-7.4'Dmitry Stogov2019-02-201-1/+1
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Use ZEND_ACC_REUSE_GET_ITERATOR flag instead of run-time class modification
| * | Use ZEND_ACC_REUSE_GET_ITERATOR flag instead of run-time class modificationDmitry Stogov2019-02-201-1/+1
| | |
* | | Refactor zend_object_handlers API to pass zend_object* and zend_string* ↵Dmitry Stogov2019-02-041-23/+19
|/ / | | | | | | insted of zval(s).
* | Remove local variablesPeter Kokot2019-02-031-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Remove yearly range from copyright noticeZeev Suraski2019-01-301-1/+1
| |
* | Use ZEND_THIS macro to hide implementation details in extensions code.Dmitry Stogov2018-11-151-16/+16
| |
* | Replace getThis() by EX(This), when additional check is not necessary.Dmitry Stogov2018-11-141-16/+16
| |
* | Micro optimizationsDmitry Stogov2018-10-171-11/+13
|/
* Removed useless IS_UNDEF checksDmitry Stogov2018-07-311-6/+5
|
* Remove unused Git attributes identPeter Kokot2018-07-251-2/+0
| | | | | | | | | | | | | | | 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.
* Improved user iterator implementation to reduce zend_class_entry memory ↵Dmitry Stogov2018-07-121-11/+11
| | | | consumption and avoid race condition during resolving/caching of user iterator functions of internal classes in ZTS build.
* Uze ZVAL_COPY_DEREF() instead of ZVAL_DEREF() and ZVAL_COPY()Dmitry Stogov2018-07-091-10/+5
|
* Export standard object handlers, to avoid indirect accessDmitry Stogov2018-05-311-1/+1
|
* Removed useless zval_ptr_dtor()Dmitry Stogov2018-05-291-3/+0
|
* Remove return types from some magic method in protosGabriel Caruso2018-03-091-2/+2
| | | | __construct, __destruct, __wakeup does not have return types defined.
* Trailing whitespacesGabriel Caruso2018-01-031-1/+1
| | | | Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
* year++Xinchen Hui2018-01-021-1/+1
|
* Move constants into read-only data segmentDmitry Stogov2017-12-141-1/+1
|
* Move zend_object_iterator_funcs structures into read-only data segmentDmitry Stogov2017-12-141-1/+1
|
* Add zend_object_alloc() APINikita Popov2017-11-251-1/+1
| | | | | | | | | | | Using ecalloc() to create objects is expensive, because the dynamic-size memset() is unreasonably slow. Make sure we only zero the main object structure with known size, as the properties are intialized separately anyway. Technically we do not need to zero the embedded zend_object structure either, but as long as the memset argument is constant, a couple more bytes don't really matter.
* RC manipulation cleanup 2Xinchen Hui2017-11-021-10/+3
|
* Avoid HashTable allocations for empty arrays (using zend_empty_array).Dmitry Stogov2017-10-241-1/+4
|
* Merge branch 'PHP-7.0' into PHP-7.1Nikita Popov2017-05-241-0/+15
|\
| * Fixed bug #74478jhdxr2017-05-241-0/+15
| |
* | Merge branch 'PHP-7.0' into PHP-7.1Nikita Popov2017-05-011-1/+1
|\ \ | |/