1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 16:38:25 +02:00
Commit Graph

2177 Commits

Author SHA1 Message Date
Christoph M. Becker ae1fad5bb7 Fix #77431 SplFileInfo::__construct() accepts NUL bytes
`SplFileInfo::__construct()` has to expect a path instead of a string,
analogous to `SplFileObject::__construct()`.
2019-03-03 23:34:00 -08:00
Nikita Popov 57561bd129 Merge branch 'PHP-7.4' 2019-03-01 15:35:18 +01:00
Nikita Popov 51dacafc64 Use separate files for SplFileObject::setCsvControl() tests 2019-03-01 15:32:02 +01:00
Nikita Popov c8e2b333cb Merge branch 'PHP-7.4' 2019-02-20 11:22:31 +01:00
Nikita Popov f5872614d8 Make ext/spl/tests/bug42364.phpt more robust
If tests are run in parallel, files may be created and deleted in
the directory. Create a separate directory just for this test to
avoid this dependence.
2019-02-20 11:19:55 +01:00
Dmitry Stogov 832d683334 Merge branch 'PHP-7.4'
* PHP-7.4:
  Use ZEND_ACC_REUSE_GET_ITERATOR flag instead of run-time class modification
2019-02-20 02:33:11 +03:00
Dmitry Stogov f2e515e9eb Use ZEND_ACC_REUSE_GET_ITERATOR flag instead of run-time class modification 2019-02-20 02:32:29 +03:00
Nikita Popov e517cffd92 Merge branch 'PHP-7.4' 2019-02-18 13:58:40 +01:00
Dmitry Stogov c9ffae1bec Fixed bug #77633
Add a new class flag to inherit get_iterator() when implementing
the Iterator/IteratorAggregate interfaces and use it for
ArrayIterator.
2019-02-18 13:47:44 +01:00
Peter Kokot 9dc8cd5cc2 Merge branch 'PHP-7.4'
* PHP-7.4:
  SplDoublyLinkedList Iterating a DLL by reference shouldn't be permitted
2019-02-17 19:36:13 +01:00
MarkBaker a84227650a SplDoublyLinkedList Iterating a DLL by reference shouldn't be permitted 2019-02-17 19:35:13 +01:00
Fabien Villepinte ce7552af38 Fixed bug #77619
Fix MultipleIterator::__construct() arginfo
2019-02-14 17:03:52 +01:00
Nikita Popov a302d11610 Don't silence fatal errors with @ 2019-02-11 16:17:55 +01:00
Nikita Popov b65435c986 Merge branch 'PHP-7.4' 2019-02-11 15:51:06 +01:00
Nikita Popov 2ca123e8f0 Merge branch 'PHP-7.3' into PHP-7.4 2019-02-11 15:50:53 +01:00
Nikita Popov 4da67537c1 Merge branch 'PHP-7.2' into PHP-7.3 2019-02-11 15:50:47 +01:00
Ahmed Abdou ec28d4c247 Fix bug #51068 (glob:// do not support current path relative)
Fix DirectoryIterator glob://* current path relative queries
2019-02-11 15:50:27 +01:00
Levi Morrison 780bdcd80b Fix SplHeap::compare arginfo and tests 2019-02-08 10:14:38 +01:00
Dmitry Stogov f45e0ce928 Remove ZEND_OVERLOADED_FUNCTION and corresponding call_method object handler 2019-02-07 21:05:46 +03:00
Nikita Popov 2f1f34952e Remove $errcontext argument to error handlers
I'm removing the argument entirely here, but we might want to change
this to passing null or and empty array instead, if the impact of
dropping it entirely turns out to be too large.

This was deprecated as part of https://wiki.php.net/rfc/deprecations_php_7_2
as a doc-only deprecation.
2019-02-05 14:12:10 +01:00
Nikita Popov d750f0a192 Merge branch 'PHP-7.4' 2019-02-05 09:41:08 +01:00
Nikita Popov 8bc663f43b Remove zpp variation tests 2019-02-05 09:38:55 +01: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 623911f993 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove local variables
2019-02-03 21:23:18 +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
Nikita Popov 0dfd918ee7 Remove support for __autoload()
There are probably some improvements we can do to the SPL
implementation now that __autoload() is gone. In particular having
EG(autoload_func) as a property zend function, rather than a simple
callback probably doesn't make sense.
2019-01-30 14:00:16 +01:00
Zeev Suraski 0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Zeev Suraski 38c337f22e Remove year range from copyright notice 2019-01-30 11:00:23 +02:00
Nikita Popov 6c73b50cf6 Remove static calls to non-static methods 2019-01-30 09:19:02 +01:00
Nikita Popov c7d7af8069 Remove fgetss and friends
These were deprecated in PHP 7.3 as part of
https://wiki.php.net/rfc/deprecations_php_7_3.
2019-01-29 09:43:00 +01:00
Nikita Popov 909d0a3d78 Fixed bug #77518 2019-01-25 11:12:34 +01:00
Dmitry Stogov 7f053c2c49 Merge branch 'PHP-7.3'
* PHP-7.3:
  Fixed bug #77263 (Segfault when using 2 RecursiveFilterIterator)
2019-01-14 13:21:03 +03:00
Dmitry Stogov 920450534e Fixed bug #77263 (Segfault when using 2 RecursiveFilterIterator) 2019-01-14 13:18:28 +03:00
Nikita Popov e219ec144e Implement typed properties
RFC: https://wiki.php.net/rfc/typed_properties_v2

This is a squash of PR #3734, which is a squash of PR #3313.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Joe Watkins <krakjoe@php.net>
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2019-01-11 15:49:06 +01:00
Nikita Popov cd7601ebfc Merge branch 'PHP-7.3' 2018-12-27 15:34:22 +01:00
Lauri Kenttä 16c62a8179 Fix #77360: class_uses causes segfault 2018-12-27 15:34:02 +01:00
Nikita Popov 6a06190850 Merge branch 'PHP-7.3' 2018-12-27 15:29:51 +01:00
Lauri Kenttä 89bf3df67d Fix #77359: spl_autoload causes segfault
Use the correct function to free the string.
2018-12-27 15:28:25 +01:00
Dmitry Stogov 22c9d19144 Removed useless zval_ptr_dtor(return_value) 2018-12-26 12:58:11 +03:00
Christoph M. Becker 9a095416b7 Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix #77298: segfault occurs when add property to unserialized empty ArrayObject
2018-12-21 17:47:02 +01:00
CHU Zhaowei b15189f4d8 Fix #77298: segfault occurs when add property to unserialized empty ArrayObject 2018-12-21 17:45:52 +01:00
Dmitry Stogov cec091176c Replace zend_hash_apply... with ZEND_HASH_FOREACH... 2018-12-19 02:49:56 +03:00
Christoph M. Becker 3b0f051193 Allow empty $escape to eschew escaping CSV
Albeit CSV is still a widespread data exchange format, it has never been
officially standardized.  There exists, however, the “informational” RFC
4180[1] which has no notion of escape characters, but rather defines
`escaped` as strings enclosed in double-quotes where contained
double-quotes have to be doubled.  While this concept is supported by
PHP's implementation (`$enclosure`), the `$escape` sometimes interferes,
so that `fgetcsv()` is unable to correctly parse externally generated
CSV, and `fputcsv()` is sometimes generating non-compliant CSV.  Since
PHP's `$escape` concept is availble for many years, we cannot drop it
for BC reasons (even though many consider it as bug).  Instead we allow
to pass an empty string as `$escape` parameter to the respective
functions, which results in ignoring/omitting any escaping, and as such
is more inline with RFC 4180.  It is noteworthy that this is almost no
userland BC break, since formerly most functions did not accept an empty
string, and failed in this case.  The only exception was `str_getcsv()`
which did accept an empty string, and used a backslash as escape
character then (which appears to be unintended behavior, anyway).

The changed functions are `fputcsv()`, `fgetcsv()` and `str_getcsv()`,
and also the `::setCsvControl()`, `::getCsvControl()`, `::fputcsv()`,
and `::fgetcsv()` methods of `SplFileObject`.

The implementation also changes the type of the escape parameter of the
PHP_APIs `php_fgetcsv()` and `php_fputcsv()` from `char` to `int`, where
`PHP_CSV_NO_ESCAPE` means to ignore/omit escaping.  The parameter
accepts the same values as `isalpha()` and friends, i.e. “the value of
which shall be representable as an `unsigned char` or shall equal the
value of the macro `EOF`.  If the argument has any other value, the
behavior is undefined.”  This is a subtle BC break, since the character
`chr(128)` has the value `-1` if `char` is signed, and so likely would
be confused with `EOF` when converted to `int`.  We consider this BC
break to be acceptable, since it's rather unlikely that anybody uses
`chr(128)` as escape character, and it easily can be fixed by casting
all `escape` arguments to `unsigned char`.

This patch implements the feature requests 38301[2] and 51496[3].

[1] <https://tools.ietf.org/html/rfc4180>
[2] <https://bugs.php.net/bug.php?id=38301>
[3] <https://bugs.php.net/bug.php?id=51496>
2018-12-15 14:38:15 +01:00
Nikita Popov 3b70dc078f Fix unused variable warnings 2018-12-04 19:01:36 +01:00
Gabriel Caruso cdd8368d6f Clean up unnecessary ternary expressions and simplify some returns
- Simplify conditions
- Use ZEND_HASH_APPLY_* instead of hard-coded booleans
- Use ZEND_NORMALIZE_BOOL
- Drop sign in favor of ZEND_NORMALIZE_BOOL
2018-12-03 01:22:14 +01:00
Nikita Popov 2766a8e66b Fix leaks
For some reason I'm no longer getting memory leak errors for my
local build :/
2018-11-15 21:34:46 +01:00
Nikita Popov 022eea8be1 Check for zero SplPriorityQueue extract flags earlier
Generate an exception during the SplPriorityQueue::setExtracFlags()
call instead of generating E_RECOVERABLE_FATAL all over the place
later.
2018-11-15 21:05:05 +01:00
Nikita Popov e965fee904 Optimize SplPriorityQueue implementation
Do not create an array with two keys for every element. That's a
huge waste of memory. Instead we allocate a two-element structure.
This reduces memory usage and avoids having to perform hashtable
lookups to get at the data and priority.

The only thing this might impact negatively is the non-default
EXTR_BOTH mode, in which case the array has to be created anyway.
2018-11-15 20:52:01 +01:00
Dmitry Stogov 0f7f1498be Use ZEND_THIS macro to hide implementation details in extensions code. 2018-11-15 19:54:19 +03:00
Dmitry Stogov c6ad0b92b7 Replace getThis() by EX(This), when additional check is not necessary. 2018-11-14 02:44:25 +03:00