Commit Graph

930 Commits

Author SHA1 Message Date
Markus Staab
9f4d1b9936 Fix typo [ci skip] 2020-01-26 16:08:46 +01:00
George Peter Banyard
300d4df654 Add mention about empty needles for strrch() functions in UPGRADING [ci skip] 2020-01-25 12:34:42 +01:00
wbender
98bfad738a Fix bug #64865: Use CONTEXT_DOCUMENT_ROOT for scanning dir tree
If CONTEXT_DOCUMENT_ROOT is set use that rather than DOCUMENT_ROOT to
scan up the dir tree looking for .user.ini files.

Closes GH-5051.
2020-01-24 15:33:55 +01:00
Nikita Popov
e72bf63691 Allow variadic arguments to replace non-variadic ones
Any number of arguments can be replaced by a variadic one, so
long as the variadic argument is compatible (in the sense of
contravariance) with the subsumed arguments.

In particular this means that function(...$args) becomes a
near-universal signature: It is compatible with any function
signature that does not accept parameters by-reference.

This also fixes bug #70839, which describes a special case.

Closes GH-5059.
2020-01-23 15:23:31 +01:00
Máté Kocsis
4281c2a989
Add UPGRADING notes [skip ci] 2020-01-22 23:24:50 +01:00
Christoph M. Becker
7426e3b6a1 Bump required libcurl version to 7.29.0
libcurl 7.29.0 has been released almost eight years ago, so this
version is supposed to be available practically everywhere.  This bump
also allows us to get rid of quite some conditional code and tests
catering to very old libcurl versions.
2020-01-19 14:10:46 +01:00
Christoph M. Becker
f6fbe13717 Rename run-test.php to run-tests.php in the test packs
In the php-src repository, the test runner is named run-tests.php, but
when it is copied to the tests packs, it is renamed to run-test.php.
This renaming does not make sense, and is actually somewhat confusing.
Although changing the name back to run-tests.php constitutes a BC
break, we think the benefit of having a single name outweights the
disadvantages in the long run.
2020-01-14 18:31:25 +01:00
Christoph M. Becker
03bd4333f6 Add imagegetinterpolation()
While `imagesetinterpolation()` is available as of PHP 5.5.0,
there is no according getter function, so users would have to track the
current interpolation method manually.

To remedy this, we introduce `imagegetinterpolation()` as thin wrapper
for `gdImageGetInterpolationMethod()` (which has been introduced with
libgd 2.1.1), and use `im->interpolation_id` as fallback for older
libgd.  Since our bundled libgd does not yet have this function, we add
it.

We also simplify the recently introduced bug79068.phpt, where it is
sufficient to check that the interpolation method has not been changed.
2020-01-14 18:25:27 +01:00
Islam Israfilov
f553e676ec Fixed #78385: Distinguish absent/empty query/fragment
http://example.com/foo   => query = null, fragment = null
http://example.com/foo?  => query = "",   fragment = null
http://example.com/foo#  => query = null, fragment = ""
http://example.com/foo?# => query = "",   fragment = ""

Closes GH-5078.
2020-01-13 10:18:23 +01:00
George Peter Banyard
66659d6cf6 [ci skip] Update UPGRADING 2020-01-09 00:38:47 +01:00
mike
1658b5babc Adding DateTime(Immutable)::createFromInterface()
These are like

    DateTime::createFromImmutable()
    DateTimeImmutable::createFromMutable()

but accept any DateTimeInterface instead.

Closes GH-5016.
2020-01-03 16:55:12 +01:00
Nikita Popov
d8c9902567 Implement WeakMap
RFC: https://wiki.php.net/rfc/weak_maps
2020-01-03 10:43:24 +01:00
Wouter Wijsman
f13d0a72d5 Add FILTER_VALIDATE_BOOL as alias for FILTER_VALIDATE_BOOLEAN
Both filters are equivalent, but FILTER_VALIDATE_BOOL uses our
canonical name for the type (the only one permitted in type
declarations for example), so the new name is preferred long
term.

The old name may be deprecated in the future, but no specific
timeline is planned.
2019-12-30 14:18:03 +01:00
BohwaZ
3958592487 Add setAuthorizer method to SQLite3
This adds the possibility to define a userland callback that will be
used to authorize or not an action on the database.
2019-12-20 11:33:23 +01:00
Máté Kocsis
bc231f017b
Add upgrading note about implode() [ci skip] 2019-12-19 22:58:26 +01:00
George Peter Banyard
fdf45debdf Remove deprecated behaviour of passing encoding as third parameter in mb_strrpos()
Merged GH-5011
2019-12-13 22:03:27 +01:00
Máté Kocsis
73730eebca
Add upgrading notes about removed functionality that were deprecated in PHP 7.4 2019-12-05 13:15:55 +01:00
Christoph M. Becker
2de79f0855 Make the $num_points parameter of php_imagepolygon optional
That parameter is mostly useless in practise, and likely has been
directly ported from the underlying `gdImagePolygon()` and friends,
which require that parameter since the number of elements of the point
array would otherwise be unknown.  Typical usages of `imagepolygon()`,
`imageopenpolygon()` and `imagefilledpolygon()` pass `count($points)/2`
or hard-code this value as literal.  Since explicitly specifying this
parameter is annoying and error-prone, we offer the possibility to omit
it, in which case the `$points` array must have an even number of
elements, and the number of points is calculated as `count($points)/2`.
2019-11-15 09:41:10 +01:00
Nikita Popov
999e32b65a Implement union types
According to RFC: https://wiki.php.net/rfc/union_types_v2

The type representation now makes use of both the pointer payload
and the type mask at the same time. Additionall, zend_type_list is
introduced as a new kind of pointer payload, which is used to store
multiple class types. Each of the class types is a tagged pointer,
which may be either a class name or class entry. The latter is only
used for typed properties, while arguments/returns will instead use
cache slots. A type list can contain a mix of both names and CEs at
the same time, as not all classes may be resolvable.

One thing this is missing is support for union types in arginfo
and stubs, which I want to handle separately.

I've also dropped the special object code from the JIT implementation
for now -- I plan to add this back in a different form at a later time.
For now I did not want to include non-trivial JIT changes together
with large functional changes.

Another possible piece of follow-up work is to implement "iterable"
as an internal alias for "array|Traversable". I believe this will
eliminate quite a few special-cases that had to be implemented.

Closes GH-4838.
2019-11-08 15:15:48 +01:00
Nikita Popov
c46b2ed677 Remove support for array_key_exists() with objects 2019-11-04 13:10:03 +01:00
Tyson Andre
96f361dca0 Update documentation/comment for GH-4860
Fix folding for the new helper method.

Clarify comment in UPGRADING:
The performance on associative arrays would also improve,
as long as no offsets were unset (no gaps).
Packed arrays can have gaps.

Closes GH-4873.
[ci skip]
2019-10-30 10:26:56 +01:00
Nikita Popov
87fefd165a Remove ability to unbind $this of closures if used
This was deprecated in PHP 7.4, removing it for PHP 8.0.
2019-10-28 13:24:07 +01:00
Tyson Andre
9d48bf5152 Fix miscellaneous typos in docs and error messages
Closes GH-4863.
2019-10-28 11:44:08 +01:00
Tyson Andre
e7ff590d0d Optimize array_slice for packed arrays with large offsets
If the offset is 100000, and there are no gaps in the packed/unpacked array,
then advance the pointer once by 100000,
instead of looping and skipping 100000 times.

Add a new test of array_slice handling unset offsets.

Closes GH-4860.
2019-10-28 11:30:59 +01:00
Colin O'Dell
e7335eb420 Allow array_splice() length to be null 2019-10-23 11:22:12 +02:00
Colin O'Dell
80103bdb78 Document the changes to substr functions 2019-10-23 11:22:12 +02:00
Nikita Popov
530a8a3854 Fix and undeprecate ReflectionType::__toString()
Add deprecated _ZendTestClass::__toString() method to preserve
an existing test.

ReflectionType::__toString() will now return a complete
representation of the type, as it should have originally. Users
that relied on nullability being absent should have been pushed
to ReflectionNamedType::getName() by the deprecation of
ReflectionType::__toString() in PHP 7.1 / PHP 7.4.
2019-10-22 11:26:02 +02:00
Nikita Popov
5c24f8042d Promote "Cannot use parent" to fatal error 2019-10-15 11:46:48 +02:00
Nikita Popov
e35bdb4912 Add fdiv() function
The fdiv() function is part of the fmod() / intdiv() family. It
implements a floating-point division with IEEE-754 semantics.
That is, division by zero is considered well-defined and does not
trigger any kind of diagnostic. Instead one of INF, -INF or NAN
will be returned, depending on the case.

This is in preparation for throwing DivisionByZeroError from the
standard division operator.
2019-10-11 16:36:11 +02:00
Nikita Popov
db233501ff Use clean shutdown on uncaught exception 2019-10-11 12:41:15 +02:00
Nikita Popov
d44cf9b539 Replace "unexpected character" warning with ParseError
Closes GH-4767.
2019-10-04 11:28:58 +02:00
tyage
4d6f88e215 Fix #72374: remove_path strips first char of filename 2019-10-02 15:33:28 +02:00
Nikita Popov
2f92957fd3 Convert some notices to warnings
Part of https://wiki.php.net/rfc/engine_warnings.
2019-10-02 10:34:08 +02:00
Mark
8aad466c42 Convert GD Resources to objects 2019-09-30 15:14:02 +02:00
Nikita Popov
38b19d47e0 Convert "Only arrays and Traversables can be unpacked" into Error 2019-09-27 15:50:34 +02:00
Nikita Popov
e8b0163e0b Promote write "use scalar as array" warning to Error 2019-09-27 15:49:18 +02:00
Nikita Popov
0ebf2bdba0 Convert "Illegal offset type" warnings to exceptions 2019-09-27 13:00:07 +02:00
Nikita Popov
f2b09969db Convert "cannot add element" warning to exception 2019-09-27 13:00:07 +02:00
Nikita Popov
a66c60cce3 Throw Error when writing property of non-object
This removes object auto-vivification support.

This also means that we can remove the corresponding special
handling for typed properites: We no longer need to check that a
property is convertible to stdClass if such a conversion might
take place indirectly due to a nested property write.

Additionally OBJ_W style operations now no longer modify the
object operand, and as such we no longer need to treat op1 as a
def in SSA form.

The next step would be to actually compile the whole LHS of OBJ_W
operations in R rather than W mode, but that causes issues with
SimpleXML, whose object handlers depend on the current compilation
structure.

Part of https://wiki.php.net/rfc/engine_warnings.
2019-09-27 10:11:47 +02:00
Christoph M. Becker
5356bad8c6 Remove unused parameter
The `$use_include_path` parameter doesn't make sense for
`tidy_repair_string()`, and actually unused, so we remove it.
2019-09-22 16:28:42 +02:00
Christoph M. Becker
48892e6d24 Remove unused parameter
Cf. <https://bugs.php.net/78579>.
2019-09-21 16:30:17 +02:00
Nikita Popov
cdd4e591a4 Don't make argument nullable based on AST null initializer
Closes GH-4720.
2019-09-19 11:27:00 +02:00
Christoph M. Becker
d61bc63c4d Change XMLWriter resources to objects
While we generally prefer objects over resources for quite a while, the
procedural XMLWriter API still uses resources, although there is
already an object-oriented API which uses objects.  This dichotomy
makes no sense, slightly complicates the implementation, and doesn't
allow a stepwise migration to the object-oriented API, which might be
desired.  Thus we completely drop the XMLWriter resources in favor of
XMLWriter objects.

We consider the minor BC break acceptable for a major version, since
only explicit type checks (`is_resource()`, `gettype()` etc.) need to
be adapted.
2019-09-18 08:52:14 +02:00
Benjamin Eberlei
873b54840f Upgrading notes for removed ext/dom classes. 2019-09-17 23:52:08 +02:00
Peter Cowburn
4253811c42 upgrading notes for ValueError/zend_value_error() 2019-09-10 13:19:24 +01:00
Nikita Popov
790ed7d540 Enable display_startup_errors by default 2019-09-06 14:33:03 +02:00
Nikita Popov
ea5854ca8c Make error_reporting=E_ALL the default 2019-09-02 10:03:26 +02:00
George Peter Banyard
6d578482a9 Improve strpos and strstr function family implementation 2019-08-26 17:11:37 +02:00
viest
48040cf345 Remove deprecated getaddrinfo flags
The AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES have
been deprecated by glibcs, and PHP 7.4 follows this deprecation.

This removes the offending flags for PHP 8.0.
2019-08-26 11:45:31 +02:00
Sjon Hortensius
05752d3acf Ref #77388: Don't pass BAD_ESCAPE_IS_LITERAL
This option is considered dangerous and unwanted. To allow for more
graceful migration don't error on now ignored X modifier.

Closes GH-4430.
2019-07-18 10:52:27 +02:00