Commit Graph

1210 Commits

Author SHA1 Message Date
Máté Kocsis
314eedbc35
Convert resources to objects in ext/zlib
Closes GH-5680
2020-06-17 16:50:00 +02:00
Máté Kocsis
b516566b84
Convert CURL resources to objects
Closes GH-5402

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-06-17 16:11:57 +02:00
Máté Kocsis
2e18b30d44
Convert resource to object in Sysvshm extension
Closes GH-5499
2020-06-16 16:36:11 +02:00
Jakub Zelenka
367c55ff1d Update NEWS and UPGRADING for the OpenSSL ext CMS addition 2020-06-07 21:11:09 +01:00
Gabriel Caruso
7439941d55
Add $filter parameter for ReflectionClass::(getConstants|getReflectionConstants)
This solves [#79628](https://bugs.php.net/79628).

Similar to `ReflectionClass::getMethods()` and `ReflectionClass::getProperties()`,
this new `$filter` argument allows the filtering of constants defined in a class by
their visibility.

For that, we create three new constants for `ReflectionClassConstant`:

  * `IS_PUBLIC`
  * `IS_PROTECTED`
  * `IS_PRIVATE`

Closes GH-5649.
2020-06-07 15:57:48 +02:00
Nikita Popov
064b464448 Implement "Constructor Promotion" RFC
RFC: https://wiki.php.net/rfc/constructor_promotion

Closes GH-5291.
2020-06-05 15:15:51 +02:00
Benjamin Eberlei
1622d22c62 Add upgrading note for Attributes RFC
[ci-skip]
2020-06-04 18:21:18 +02:00
Nikita Popov
eeb7a7cd7a Add UPGRADING note for pty support
[ci skip]
2020-05-31 17:14:41 +02:00
Nikita Popov
393cd89ffb Add UPGRADING note for xmlrpc unbundling
And drop other UPGRADING references to xmlrpc. I don't think it
makes sense to have those for extensions that are no longer
shipped...

[ci skip]
2020-05-31 16:57:37 +02:00
Nikita Popov
d7f17ea44d Fix some line overruns in UPGRADING
[ci skip]
2020-05-31 16:55:46 +02:00
Nikita Popov
805e3e3af4 Move upgrading note for mixed
This should be in the "new features" section.

[ci skip]
2020-05-31 16:48:14 +02:00
George Peter Banyard
2302b14aab Use ZPP callable check for spl_autoload_register.
This makes it always throw a TypeError, moreover this makes the
error message consistent.

Added a warning mentioning that the second parameter is now ignored
when passed false.

Closes GH-5301
2020-05-30 13:59:06 +02:00
Máté Kocsis
444aa2636e
Add upgrading notes about the deprecated functionality in ext/enchant
[skip ci]
2020-05-29 15:15:27 +02:00
Máté Kocsis
cd3e04dff3
Convert enchant resources to opaque objects
Additionally, deprecate ENCHANT_MYSPELL and ENCHANT_ISPELL constants.
Closes GH-5577

Co-authored-by: Remi Collet <remi@php.net>
2020-05-29 14:51:41 +02:00
Tyson Andre
cc27781f40 [RFC] Always enable JSON support in php 8.0
Currently, it's possible to disable the json extension with
`./configure --disable-json` (for historical reasons that no longer apply).
However, JSON is widely used in many use cases - web sites, logging output,
and as a data format that can be used to share data with many applications
and programming languages,
so I'd personally find it useful if it was always enabled.

Examples of where this would be useful:

- For internal classes to be able to implement `JsonSerializable`
  which currently requires a hard dependency on the JSON extension.
- For PHP users to publish single-file scripts that use json_encode and
  json_decode and don't require polyfills or less readable var_export output.
  (polyfills are less efficient and may have issues with recursive data
  structures)
- So that php-src's own modules, tools and test cases can start using JSON
  if it's a good choice for encoding a value. (same for PECLs)

https://wiki.php.net/rfc/jsond mentions that in PHP 5,

> The current Json Parser in the json extension does not have a free license
> which is a problem for many Linux distros.
> This has been referenced at Bug #63520.
> That results in not packaging json extension in the many Linux distributions.

Starting in php 7.0 with the switch to jsond,
It looks like licensing is no longer an issue.

Changes:

- Remove all flags related to JSON such as `configure --disable-json`
- Require that JSON be compiled statically instead of as a shared library

Examples of uses of JSON in various distros
(backwards incompatible changes such as changing packaging are typically
reserved for major versions, and 8.0 is a major version)

- JSON is required by `php-cli` or `php` in ubuntu:
  https://packages.ubuntu.com/focal/php/
- The php-json package has to be installed separately
  from the PHP binary in Fedora repos.

Closes GH-5495
2020-05-27 09:08:43 -04:00
Nikita Popov
0221b8b2ab Add support for * width and precision in printf()
If * is used for width/precision in printf, then the width/precision
is provided by a printf argument instead of being part of the format
string. Semantics generally match those of printf in C.

This can be used to easily reproduce PHP's float printing behavior:

    // Locale-sensitive using precision ini setting.
    // Used prior to PHP 8.0.
    sprintf("%.*G", (int) ini_get('precision'), $float);

    // Locale-insensitive using precision ini setting.
    // Used since to PHP 8.0.
    sprintf("%.*H", (int) ini_get('precision'), $float);

    // Locale-insensitive using serialize_precision ini setting.
    // Used in serialize(), json_encode() etc.
    sprintf("%.*H", (int) ini_get('serialize_precision'), $float);

Closes GH-5432.
2020-05-27 10:42:25 +02:00
Nikita Popov
b6000b7e0e Add support for %h and %H in printf()
These are locale-independent variants of %g and %G.

Closes GH-5436.
2020-05-27 10:19:23 +02:00
Nikita Popov
a01b6e5787 Return empty array instead of null from enchant APIs
Closes GH-5566.
2020-05-27 10:12:21 +02:00
Max Semenik
23ee4d4b57 Support catching exceptions without capturing them to variables
RFC: https://wiki.php.net/rfc/non-capturing_catches

Closes GH-5345.
2020-05-26 15:12:18 +02:00
Máté Kocsis
cbf86efc21
Fix ZPP of v*printf() 2020-05-25 17:29:46 +02:00
Christoph M. Becker
ce668c0ec6 PGSQL and POD_SQL: don't include pg_config.h
Even if that header file is available, we better consider it private,
and don't include it.  The information about whether SSL support is
enabled is now missing (`USE_(OPEN)SSL`), and it seems there is no
alternative way to get it (`PQinitSSL()` is always defined), so we
remove it from the PHP info.  Furthermore, the `PG_VERSION` and
`PG_VERSION_STR` macros are no longer available, but as of libpq 9.1
there is `PQlibVersion()` which allows us to construct `PG_VERSION` in
a most likely backwards compatible manner.  The additional information
available through `PG_VERSION_STR` is lost, though, so we define
`PGSQL_LIBPQ_VERSION_STR` basically as alias of `PGSQL_LIBPQ_VERSION`,
and deprecate it right away.

Since we are now requiring at least libpq 9.1, we can remove some
further compatibility code and additional checks.

Regarding the raised requirements: official support for PostGreSQL 9.0
ended on 2015-10-08, and even CentOS 7 already has PostGreSQL 9.2, so
this is not supposed to be too much of an issue.
2020-05-25 10:48:35 +02:00
George Peter Banyard
bc3ee2eeea [skip-ci] Update UPGRADING
Add upgrading note for mixed type and removal of curly braces offset syntax
2020-05-22 17:02:30 +02:00
Christoph M. Becker
4bc1d8333a Raise ext/pgsql requirements to PostGreSQL 7.4
We can safely assume that users have at the very least libpq 7.4, for
which official support ended on 2010-10-01; even CentOS 6 has 8.4 now.
It is also noteworthy that PDO_PGSQL already requires libpq 7.4 or
later.
2020-05-22 15:56:24 +02:00
Nikita Popov
0a74da385d Add support for replaying warnings in opcache
If opcache.record_warnings is enabled, opcache will record
compilation warnings and replay them when the file is included
again. The primary use case I have in mind for this is automated
testing of the opcache file cache.

This resolves bug #76535.
2020-05-20 11:20:21 +02:00
Máté Kocsis
9198faa67f
Convert resource to object in Sysvmsg
Closes GH-5546
2020-05-14 12:56:06 +02:00
Remi Collet
30077100a4 Revert "doc for enchant Object move"
This reverts commit 2c63324a4e.
2020-05-13 15:56:18 +02:00
Remi Collet
2c63324a4e doc for enchant Object move 2020-05-13 15:23:07 +02:00
Máté Kocsis
256b7da356
Convert resource to object in XML-RPC extension
Closes GH-5457
2020-05-13 14:49:13 +02:00
Nikita Popov
28af364d2a Deprecate old ReflectionParameter type declaration APIs
This deprecates:

    ReflectionParameter::isArray()
    ReflectionParameter::isCallable()
    ReflectionParameter::getClass()

These APIs have been superseded by ReflectionParameter::getType()
since PHP 7.0. Types introduced since that time are not available
through the old APIs, and their behavior is getting increasingly
confusing. This is how they interact with PHP 8 union types:

 * isArray() will return true if the type is array or ?array,
   but not any other union type
 * Same for isCallable().
 * getClass() will return a class for T|int etc, as long as the
   union only contains a single type. T1|T2 will return null.

This behavior is not particularly reasonable or useful, and will
get more confusing as new type system extensions are added.

Closes GH-5209.
2020-05-11 17:01:40 +02:00
Nikita Popov
a0abc26ef7 Add get_resource_id() function
Behavior is same as for (int) $resource, just under a clearer
name. Also type-safe, in that the parameter actually needs to
be a resource.

Closes GH-5427.
2020-05-11 12:04:16 +02:00
Máté Kocsis
4a816584a4
Make float to string casts locale-independent
From now on, float to string casting will always behave locale-independently.
RFC: https://wiki.php.net/rfc/locale_independent_float_to_string
Closes GH-5224

Co-authored-by: George Peter Banyard <girgias@php.net>
2020-05-08 10:52:23 +02:00
Máté Kocsis
b67f699dcd
Rename the recently introduced Sysvsem class to SysvSemaphore 2020-05-07 10:21:58 +02:00
Máté Kocsis
eab54d2382
Convert resource to object in ext/sysvsem
Closes GH-5508
2020-05-06 15:42:41 +02:00
Nikita Popov
5bc1e224db Make numeric operations on resources, arrays and objects type errors
RFC: https://wiki.php.net/rfc/arithmetic_operator_type_checks

Closes GH-5331.
2020-05-05 16:11:13 +02:00
William Hudgins
31fb6a08b3 Add str_starts_with() and str_ends_with()
RFC: https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions

Closes GH-5300.
2020-05-05 16:03:47 +02:00
AllenJB
50752401a7 Change the default PDO error mode to exceptions
According to <https://www.php.net/manual/en/pdo.error-handling.php>.
2020-05-04 22:51:47 +02:00
Remi Collet
3427545752 Use libenchant-2 when available 2020-05-04 08:27:31 +02:00
Christoph M. Becker
69888c3ff1 Fix #79467: data:// wrappers are writable
Despite the docs claiming that data: wrappers would not be writable[1],
they are implemented as writing to a memory stream.  That does not seem
to be particularly sensible, so we disallow writing altogether.

[1] <https://www.php.net/manual/en/wrappers.data.php#refsect1-wrappers.data-options>
2020-05-03 12:19:37 +02:00
Tyson Andre
1dbf923866
[skip ci] Fix a typo in UPGRADING
Confirmed that php_zip.c checks for `"enc_password"`

Closes GH-5503
2020-05-01 12:22:24 +02:00
Nikita Popov
c4ad8beaa8 Do not inherit LC_CTYPE locale from environment
Treatment of locales in PHP is currently inconsistent: The LC_ALL
locale is set to "C", as is standard behavior on program startup.
The LC_CTYPE locale is set to "", which will inherit it from the
environment. However, the inherited LC_CTYPE locale will only be
used in some cases, while in other cases it is necessary to perform
an explicit setlocale() call in PHP first. This is the case for
the locale-sensitive handling in the PCRE extension.

Make things consistent by *never* inheriting any locales from the
environment. LC_ALL, including LC_CTYPE will be "C" on startup.
A locale can be set or inherited through an explicit setlocale()
call, at which point the behavior will be fully consistent and
predictable.

Closes GH-5488.
2020-04-30 10:22:51 +02:00
Nikita Popov
53eee290b6 Completely remove disabled functions from function table
Currently, disabling a function only replaces the internal
function handler with one that throws a warning, and a few
places in the engine special-case such functions, such as
function_exists. This leaves us with a Schrödinger's function,
which both does not exist (function_exists returns false) and
does exist (you cannot define a function with the same name).
In particular, this prevents the implementation of robust
polyfills, as reported in https://bugs.php.net/bug.php?id=79382:

    if (!function_exists('getallheaders')) {
        function getallheaders(...) { ... }
    }

If getallheaders() is a disabled function, this code will break.

This patch changes disable_functions to remove the functions from
the function table completely. For all intents and purposes, it
will look like the function does not exist.

This also renders two bits of PHP functionality obsolete and thus
deprecated:

 * ReflectionFunction::isDisabled(), as it will no longer be
   possible to construct the ReflectionFunction of a disabled
   function in the first place.
 * get_defined_functions() with $exclude_disabled=false, as
   get_defined_functions() now never returns disabled functions.

Fixed bug #79382.

Closes GH-5473.
2020-04-30 09:53:57 +02:00
Remi Collet
1b98151734 doc enchant changes 2020-04-30 09:40:46 +02:00
Nikita Popov
f545ee2c6c Allow optional trailing comma in parameter list
RFC: https://wiki.php.net/rfc/trailing_comma_in_parameter_list

Closes GH-5306.
2020-04-28 16:11:08 +02:00
Ilija Tovilo
0810fcd0d0 Make throw statement an expression
RFC: https://wiki.php.net/rfc/throw_expression

This has an open issue with temporaries that are live at the time
of the throw being leaked. Landing this now for easier testing and
will revert if we cannot resolve the issue.

Closes GH-5279.
2020-04-23 12:51:23 +02:00
Jacob Dreesen
64d30c1976 Fix typo in UPGRADING [ci skip] 2020-04-23 11:54:18 +02:00
Your Name
ef0e4478c5 Add get_debug_type() function
RFC: https://wiki.php.net/rfc/get_debug_type
2020-04-23 10:45:08 +02:00
Nikita Popov
8597ec00d4 Remove support for libmysqlclient 5.0
Closes GH-5391.
2020-04-23 10:38:20 +02:00
Nicolas Grekas
657f756ccd Skip non-existing properties returned by __sleep() 2020-04-22 16:41:04 +02:00
Tyson Andre
630897f996 Document change to ReflectionMethod->isConstructor/isDestructor
See https://externals.io/message/109377
This prevented PHPUnit's test doubles from being created for interfaces.

The reason this changed is
https://github.com/php/php-src/pull/3846/files#diff-3a8139128d4026ce0cb0c86beba4e6b9L5549-R5605
(ReflectionMethod::isConstruct checks if the method is the zend_class_entry's
constructor, etc.)
2020-04-22 15:24:35 +02:00
Nikita Popov
661c0ac7f3 Remove support for EBCDIC
Closes GH-5390.
2020-04-20 16:39:39 +02:00
Máté Kocsis
3709e74b5e
Store default parameter values of internal functions in arg info
Closes GH-5353. From now on, PHP will have reflection information
about default values of parameters of internal functions.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-04-08 18:37:51 +02:00
Remi Collet
319c21b1f6 news / UPGRADING for zip 1.19.0 2020-04-02 14:58:13 +02:00
Nikita Popov
5a09b9fb0f Add PhpToken class
RFC: https://wiki.php.net/rfc/token_as_object

Relative to the RFC, this also adds a __toString() method,
as discussed on list.

Closes GH-5176.
2020-03-26 11:09:18 +01:00
Nikita Popov
f74e30c07c Check abstract method signatures coming from traits
RFC: https://wiki.php.net/rfc/abstract_trait_method_validation

Closes GH-5068.
2020-03-26 10:07:22 +01:00
Máté Kocsis
782f7e2ad8
Fix #75958 Return void instead of true 2020-03-25 15:04:33 +01:00
Remi Collet
d12b4c3c24 bump zip version 2020-03-20 14:08:57 +01:00
Remi Collet
a4d12f46d1 ZipArchive::open(): Using empty file as ZipArchive is deprecated 2020-03-20 11:27:42 +01:00
Nikita Popov
df79277de3 Revert "Fetch for read in nested property assignments"
This reverts commit bb43a3822e.

After thinking about this a bit more, this is now going to be
a complete solution for the "readonly properties" case, for example:

    unset($foo->readOnly->bar);

should also be legal and

    $foo->readOnly['bar'] = 42;

should also be legal if $foo->readOnly is not an array but an
ArrayAccess object.

I think it may be better to distinguish better on the BP_VAR flag
level. Reverting for now.
2020-03-18 14:54:43 +01:00
Remi Collet
a5f136b855 bump zp to 1.18.1 + doc 2020-03-18 14:09:50 +01:00
Nikita Popov
bb43a3822e Fetch for read in nested property assignments
$a->b->c = 'd';

is now compiled the same way as

    $b = $a->b;
    $b->c = 'd';

That is, we perform a read fetch on $a->b, rather than a write
fetch.

This is possible, because PHP 8 removed auto-vivification support
for objects, so $a->b->c = 'd' may no longer modify $a->b proper
(i.e. not counting interior mutability of the object).

Closes GH-5250.
2020-03-18 12:08:06 +01:00
Christoph M. Becker
66d8d0c7d7 Drop support for iconv without proper errno setting
It is hard to impossible to work around iconv() implementations which
do not properly set errno according to POSIX.  We therefore do no
longer allow to build against such iconv() implementations.

Co-Authored-By: Nikita Popov <nikita.ppv@googlemail.com>
2020-03-17 14:02:29 +01:00
Philipp Tanlak
1668ad7cb1 Add str_contains() function
RFC: https://wiki.php.net/rfc/str_contains

Closes GH-5179.
2020-03-16 11:05:26 +01:00
Nikita Popov
0fdffc1807 Update Unicode tables to 13.0.0 2020-03-12 11:29:51 +01:00
Nikita Popov
fff5771ccc Require non-absolute trait method refs to be unambiguous
Currently, when writing something like

class X {
    use T1, T2 {
       func as otherFunc;
    }
    function func() {}
}

where both T1::func() and T2::func() exist, we will simply assume
that func refers to T1::func(). This is surprising, and it doesn't
really make sense that this particular method gets picked.

This commit validates that non-absolute method references are
unambiguous, i.e. refer to exactly one method. If there is
ambiguity, it is required to write T1::func as otherFunc or
similar.

Closes GH-5232.
2020-03-10 16:01:13 +01:00
Remi Collet
ed998f8a0d Fix #50678 files extracted by ZipArchive class lost their original modified time 2020-03-09 07:09:50 +01:00
Remi Collet
125724cf58 [ci skip] fix for #72374 is no more a BC break 2020-03-06 10:29:16 +01:00
Remi Collet
e786e9c83c upgrade information about changs in Zip 2020-03-05 14:03:20 +01:00
Nikita Popov
336eb48c36 Automatically implement Stringable interface 2020-03-02 15:25:33 +01:00
Benjamin Eberlei
531ea6d340 Add upgrading note regarding merge of RFC for new DOMParentNode/DOMChildNode APIs. 2020-02-28 17:35:54 +01:00
Nicolas Oelgart
aa79a22d32 Add preg_last_error_msg() function
Provides the last PCRE error as a human-readable message, similar
to functionality existing in other extensions, such as
json_last_error_msg().

Closes GH-5185.
2020-02-25 10:26:03 +01:00
Nikita Popov
a939805641 Use serialize_precision for var_dump()
var_dump() is debugging functionality, so it should print
floating-point numbers accurately. We do this by switching
to serialize_precision, which (by default) will print with
as much precision as necessary to preserve the exact value
of the float.

This also affects debug_zval_dump().

Closes GH-5172.
2020-02-25 09:51:32 +01:00
Máté Kocsis
f031735489
Update UPGRADING
[skip ci]
2020-02-20 11:13:24 +01:00
Nikita Popov
3b08f53c97 Deprecate required param after optional
As an exception, we allow "Type $foo = null" to occur before a
required parameter, because this pattern was used as a replacement
for nullable types in PHP versions older than 7.1.

Closes GH-5067.
2020-02-18 14:35:58 +01:00
Christoph M. Becker
9ca449e0a8 Make quoting of cmd execution functions consistent
While the `$command` passed to `proc_open()` had to be wrapped in
double-quotes manually, that was implicitly done for all other
program execution functions.  This could easily introduce bugs and
even security issues when switching from one to another program
execution function.

Furthermore we ensure that the additional quotes are always
unwrapped regardless of what is passed as `$command` by passing
the `/s` flag to cmd.exe.  As it was, `shell_exec('path with
spaces/program.exe')` did execute program.exe, but adding an
argument (`shell_exec('path with spaces/program.exe -h)`) failed
to execute program.exe, because cmd.exe stripped the additional
quotes.

While these changes obviously can cause BC breaks, we feel that in
the long run the benefits of having consistent behavior for all
program execution functions outweighs the drawbacks of potentially
breaking some code now.
2020-02-17 23:17:17 +01:00
Nikita Popov
72bd55902d Improve generated names for anonymous classes
In order of preference, the generated name will be:

    new class extends ParentClass {};
    // -> ParentClass@anonymous
    new class implements FirstInterface, SecondInterface {};
    // -> FirstInterface@anonymous
    new class {};
    // -> class@anonymous

This is intended to display a more useful class name in error messages
and stack traces, and thus make debugging easier.

Closes GH-5153.
2020-02-17 12:21:33 +01:00
Nikita Popov
43443857b7 Add static return type
RFC: https://wiki.php.net/rfc/static_return_type

The "static" type is represented as MAY_BE_STATIC, rather than
a class type like "self" and "parent", as it has special
resolution semantics, and cannot be cached in the runtime cache.

Closes GH-5062.
2020-02-17 11:51:09 +01:00
Tyson Andre
d9b80efb57 [skip ci] Fix typos in UPGRADING
Closes GH-5183
2020-02-16 10:28:39 -05:00
Nikita Popov
ae2e4b5953 Add UPGRADING notes
Not listing the details here, I think the RFC is a better reference
for the precise technical details.

[ci skip]
2020-02-11 12:44:43 +01:00
Nikita Popov
d933591674 Add support for $obj::class
This allows $obj::class, which gives the same result as get_class($obj).
Anything other than an object results in TypeError.

RFC: https://wiki.php.net/rfc/class_name_literal_on_object

Closes GH-5065.
2020-02-11 12:16:30 +01:00
Dmitry Stogov
64b40f69dc Make ASSIGN, ASSIGN_OP, INC and DEC opcodes to return IS_TMP_VAR instead of IS_VAR.
This helps to avoid unnecessary IS_REFERENCE checks.
This changes some notices "Only variables should be passed by reference" to exception "Cannot pass parameter %d by reference".

Also, for consistency, compile-time fatal error "Only variables can be passed by reference" was converted to exception "Cannot pass parameter %d by reference"
2020-02-07 13:36:52 +03:00
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
Nikita Popov
0904dd3dc2 Remove INPUT_SESSION and INPUT_REQUEST
These were never supported and always generated a warning. Remove
them entirely for PHP 8.
2019-07-08 10:50:34 +02:00
Tyson Andre
435384127c Fix a typo in UPGRADING 2019-06-16 11:24:44 +02:00
Bob Weinand
af12aa8124 Merge branch 'concatenation_precedence' 2019-05-16 18:39:48 +02:00
Nikita Popov
fd2db11929 Always generate fatal error for LSP failures
RFC: https://wiki.php.net/rfc/lsp_errors
2019-05-07 13:45:28 +02:00
Kalle Sommer Nielsen
4218466111 Okay, too quick to merge, these are only relevant to 7.4 2019-05-01 23:48:05 +03:00
Kalle Sommer Nielsen
c71e35ea91 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove some more interbase leftovers
  Fix typo
  NEWS for ext/interbase unbundling
2019-05-01 23:45:24 +03:00
Kalle Sommer Nielsen
c8a20dfdca NEWS for ext/interbase unbundling 2019-05-01 23:35:30 +03:00
Nikita Popov
55ecfe4ef3 Add UPGRADING entries 2019-04-29 14:17:44 +02:00
Christoph M. Becker
c68dc6b5e3 Extend CURLFile to support streams
Due to former restrictions of the libcurl API, curl multipart/formdata
file uploads supported only proper files.  However, as of curl 7.56.0
the new `curl_mime_*()` API is available (and already supported by
PHP[1]), which allows us to support arbitrary *seekable* streams, which
is generally desirable, and particularly resolves issues with the
transparent Unicode and long part support on Windows (see bug #77711).

Note that older curl versions are still supported, but CURLFile is
still restricted to proper files in this case.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=a83b68ba56714bfa06737a61af795460caa4a105>
2019-04-29 10:21:07 +02:00
Nikita Popov
3cfbbf2956 Make DateInterval objects uncomparable
Arbitrary DateInterval objects don't have well-defined comparison
semantics. Throw a warning and treat the objects as uncomparable.

Support for comparing DateInterval objects returned by
DateTime::diff() may be added in the future.
2019-04-23 13:12:06 +02:00
Peter Kokot
a353d4c218 Update changelogs 2019-04-20 16:16:18 +02:00
Hugh McMaster
9f0c9b7ad6 Rename --enable-libxml to --with-libxml to meet naming guidelines 2019-04-18 13:08:02 +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
Nikita Popov
e35a3cb28c ext/xml: Use object instead of resource
Use an XmlParser object instead of a resource. This is an internal
representation change, not a conversion to OO APIs. XmlParser objects
cannot be explicitly constructed, they are created through the usual
xml_parser_* APIs.

This change allows us to provide a proper get_gc() implementation,
thus resolving bugs #72793 and #76874.

xml_parser_free() is a no-op now and need not be called anymore.
2019-04-08 16:23:13 +02:00
Florian Berberich
07df6594b5 Added range options to the float validation filter
php_filter_int (called via the constant FILTER_VALIDATE_INT) has the options min_range
and max_range. they allow the user to not only test if a value is a double but also if
the value is inside a specific range. php_filter_float (called via the constant
FILTER_VALIDATE_FLOAT) didn't provide this yet, making validation of numeric but
not-only-int values more complicated for the user.
this commits implements the options min_range and max_range for the function
php_filter_float to fix this inconsistency.
2019-04-08 13:22:26 +02:00
Nikita Popov
d373c11e71 Implement new custom object serialization mechanism
RFC: https://wiki.php.net/rfc/custom_object_serialization
2019-03-22 10:43:06 +01:00
Nikita Popov
6311581ac6 Fix bug #73948
If PREG_UNMATCHED_AS_NULL is used, make sure that unmatched capturing
groups at the end are also set to null, rather than just those in the
middle.
2019-03-21 09:50:20 +01:00
Kalle Sommer Nielsen
26f98ecd19 Sync the changes to ext/filter with 7.4, now that it works.
- Removed --with-pcre-dir
- The filter extension can now be built as shared on Unix with ./configure
2019-03-20 20:09:45 +02:00
Christoph M. Becker
6bbb18a0b6 Unbundle ext/wddx
The extension is now available from <https://pecl.php.net/package/wddx>.

Cf. <https://wiki.php.net/rfc/deprecate-and-remove-ext-wddx>.
2019-03-20 14:15:50 +01:00
Nikita Popov
12bcdd68b4 Fix #77094: Add flags support for pcre_replace_callback(_array) 2019-03-19 10:38:21 +01:00
Nikita Popov
2b9acd37f0 Fixed bug #72685
We currently have a large performance problem when implementing lexers
working on UTF-8 strings in PHP. This kind of code tends to perform a
large number of matches at different offsets on a single string. This
is generally fast. However, if /u mode is used, the full string will
be UTF-8 validated on each match. This results in quadratic runtime.

This patch fixes the issue by adding a IS_STR_VALID_UTF8 flag, which
is set when we have determined that the string is valid UTF8 and
further validation is skipped.

A limitation of this approach is that we can't set the flag for interned
strings. I think this is not a problem for this use-case which will
generally work on dynamic data. If we want to use this flag for other
purposes as well (mbstring?) then it might be worthwhile to UTF-8 validate
strings during interning. But right now this doesn't seem useful.
2019-03-18 16:58:48 +01:00
Claude Pache
37443a6318 test reversed 2019-03-13 20:27:17 +01:00
Joe Watkins
b003e0a0f5
weakrefs upgrading note 2019-03-12 06:52:43 +01:00
Andrew Brampton
c79ce48ddb Fix #71890: Add support for crc32c Castagnoli's polynomial.
This variant of crc32 is heavily used by storage systems, such as iSCSI, SCTP,
Btrfs, ext4, and is increasingly being used in API (such as Google Cloud
Storage, and Apache Kafka).
2019-03-11 10:19:35 +01:00
Nikita Popov
deb44d405e Revert "Detect invalid uses of parent:: during compilation"
This reverts commit a9e6667817.

Breakage found in the wild: Mockery uses a parent:: call in the
implementation regardless of whether the class has a parent or not:
4324afeaf9/library/Mockery/Mock.php (L600)

This change is not worth the compat break in 7.4.
2019-03-04 12:24:02 +01:00
Kalle Sommer Nielsen
5e8ed0a0f5 NEWS 2019-03-01 01:41:19 +02:00
Nikita Popov
7be0e06b48 Remove mysqli embedded server support
This code is not compatible with PHP 7.0. The fact that nobody
complained that the mysqli embedded server functionality doesn't
build anymore seems like a strong signal that we can drop it...
2019-02-28 12:55:16 +01:00
Christoph M. Becker
f04cf7a587 Remove ability to import case-insensitive constants from typelibs
According to commit 23a5be3[1], we remove the ability to import case-
insensitive constants, but do not remove the now superfluous parameter
and ini setting.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=23a5be3696f4d92e1b18fd59f3ac63c6a15ea12a>
2019-02-19 16:54:52 +01:00
Tyson Andre
12ffee57d6 Fixed bug #77631
Do not include unbound anonymous classes in get_declared_classes().

Note that earlier PHP versions would include the anonymous class in
get_declared_classes(), and return false until the class was bound,
but would not crash.
2019-02-19 10:07:40 +01:00
Remi Collet
b537203d20 use pkg-config for libedit 2019-02-19 09:10:06 +01:00
Pedro Magalhães
40278879fd UPGRADING entry for pcntl_unshare [skip ci] 2019-02-18 19:58:56 +00:00
Christoph M. Becker
fae22461f9 Deprecate case-insensitive constants via typelib import
As of PHP 7.3.0, case-insensitive constants are deprecated.  We catch
up on this with regard to ext/com_dotnet, which allows to import
constants from typelibs, by triggering a deprecation notice whenever
`com_load_typelib()` is called with `$case_sensitive` being `false`,
and whenever `com.autoregister_casesensitive` is set to `false`,
regardless of whether there are actually constants in the typelib which
would be imported.
2019-02-15 13:07:56 +01:00
Gabriel Caruso
14357e5bcb Add UPGRADING entry for ad75511c8e 2019-02-14 05:15:27 -02:00
Nikita Popov
6347f0b937 Implement ReflectionReference
RFC: https://wiki.php.net/rfc/reference_reflection
2019-02-13 12:21:18 +01:00
Anatol Belski
34122ede21 Update NEWS and UPGRADING [ci skip] 2019-02-12 19:14:32 -08:00
legale
d77ad27415 Implement mb_str_split()
RFC: https://wiki.php.net/rfc/mb_str_split
2019-02-12 16:42:51 +01:00
kasper Franz
c4b77e03b1 Correct section number in UPGRADING
This make the top list follow the bottom numbering

[ci skip]
2019-02-12 15:09:09 +01:00
David Carlier
4e87e56e22 Adding bunch of FreeBSD socket options flags specifics.
SO_USER_COOKIE primarly to be traced via dtrace instrumentation.
If SO_USER_COOKIE is available, the rest is so the former is
two years old while the rest is from around 2008.
2019-02-12 10:27:33 +01:00
Christoph M. Becker
6ac8b0a783 Deprecate ext/wddx
Cf. <https://wiki.php.net/rfc/deprecate-and-remove-ext-wddx>.
2019-02-11 19:31:46 +01:00
Nikita Popov
61ef088f21 Add missing braces in UPGRADING example
[ci skip]
2019-02-11 17:10:36 +01:00
Nikita Popov
a302d11610 Don't silence fatal errors with @ 2019-02-11 16:17:55 +01:00
Nikita Popov
a6c535e658 Add UPGRADING notes for oniguruma unbundling 2019-02-11 15:00:33 +01:00
Nikita Popov
e93d6d97aa Disable PEAR by default
Installation of PEAR can be enabled using --with-pear, but will
through a deprecation warning during ./configure.
2019-02-11 11:10:13 +01:00
Nikita Popov
fdb85a828a Return empty str from quotemeta() on empty str 2019-02-11 09:58:10 +01:00
Nikita Popov
ab48b45f6c Improve UPGRADING note
[ci skip]
2019-02-11 09:54:08 +01:00
Peter Kokot
5ca12f6c5f [ci skip] Update changelog 2019-02-10 19:18:07 +01:00
Gabriel Caruso
35db1ccdd1
Fix variadic arginfos for Reflection functions
Fix arginfos of required arguments for some Reflection methods
2019-02-10 14:29:08 -02:00
Pedro Magalhães
6732028273 Implement the negative_array_index RFC 2019-02-08 16:08:32 +00:00
Levi Morrison
780bdcd80b Fix SplHeap::compare arginfo and tests 2019-02-08 10:14:38 +01:00
Peter Kokot
2b4495bf4d [ci skip] Move OPcache configure option changes 2019-02-08 00:31:25 +01: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
Côme Chilliet
f0ddc93f46 Removed ldap_sort and LDAP_DEPRECATED build flag
ldap_sort was deprecated in PHP7, it is now removed.
This allows removing the LDAP_DEPRECATED flag when building against
 openldap.
2019-02-04 13:10:05 +01:00
Côme Chilliet
d93ce17959 Mark ldap_control_paged_result and ldap_control_paged_result_response as deprecated
These functions have serious limitations and may confuse users.
Same operations can be done using the new ldap control system in search
 operations.
2019-02-04 12:20:51 +01:00
Nikita Popov
06ed6b8978 Make mb_ereg_replace() pattern argument a string 2019-02-01 15:19:46 +01:00
Nikita Popov
e366ceebad Deprecate mb_ereg_replace with non-string pattern
I'm counting this towards the non-string needle deprecation from
https://wiki.php.net/rfc/deprecations_php_7_3. I wasn't aware that
mb_ereg_replace() is also affected by this issue. It's even more
ridiculous than usual here, because the integer is interpreted as
an ASCII codepoint, even though these are supposed to be multibyte
functions :(
2019-02-01 15:02:31 +01:00
Nikita Popov
aad39879f2 Remove bareword fallback for constants
Access to undefined constants will now always result in an Error
exception being thrown.

This required quite a few test changes, because there were many
buggy tests that unintentionally used bareword fallback in combination
with error suppression.
2019-01-31 13:52:06 +01:00
Nikita Popov
340c6d3927 Revert "Don't silence fatal errors with @"
This reverts commit abd36289e2.

This wasn't ready for merging yet, there are still some test
failures.
2019-01-31 09:39:10 +01:00
Nikita Popov
abd36289e2
Don't silence fatal errors with @ 2019-01-31 07:11:05 +01:00
Nikita Popov
e18fde1a02 Remove -1 crop mode 2019-01-30 16:46:36 +01:00
Nikita Popov
f8038f827c Remove intl Normalizer::NONE 2019-01-30 16:35:32 +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
Nikita Popov
c88e2cce81 Removed read_exif_data() alias 2019-01-30 13:13:47 +01:00
Nikita Popov
5a2787a02d Require at least one arg for mktime/gmmktime 2019-01-30 13:13:47 +01:00
Nikita Popov
94ae35c9fb Remove ability to specify 'salt' in password_hash() 2019-01-30 13:13:47 +01:00
Nikita Popov
6c73b50cf6 Remove static calls to non-static methods 2019-01-30 09:19:02 +01:00
Nikita Popov
4eb5db2c68 Forbid unbinding $this from methods 2019-01-30 09:19:02 +01:00
Nikita Popov
23a5be3696 Remove ability to declare userland case-insensitive constants
This is part of https://wiki.php.net/rfc/case_insensitive_constant_deprecation.

This commit only removes the ability to declare such constants from
userland. Before the functionality can be removed entirely, it's
necessary to figure out the handling of true/false/null first.
2019-01-30 09:19:02 +01:00
Nikita Popov
52a9325328 Remove 'e' modifier for mb_ereg_replace()
This was deprecated in PHP 7.1 through
https://wiki.php.net/rfc/deprecate_mb_ereg_replace_eval_option.
2019-01-29 13:04:20 +01:00
Nikita Popov
682b54f687 Remove support for legacy constructors
This has been deprecated in PHP 7.0 by
https://wiki.php.net/rfc/remove_php4_constructors.
2019-01-29 13:04:20 +01:00
Nikita Popov
6b89dbcc5b Remove FILTER_FLAG_(SCHEME|HOST)_REQUIRED
Deprecated in PHP 7.3 as part of
https://wiki.php.net/rfc/deprecations_php_7_3.
2019-01-29 11:10:47 +01:00
Nikita Popov
d74d3922ce Remove (unset) cast
Deprecated in PHP 7.2 as part of
https://wiki.php.net/rfc/deprecations_php_7_2.
2019-01-29 11:10:47 +01:00
Nikita Popov
c97b9aa226 Always treat needles as strings
This is part of https://wiki.php.net/rfc/deprecations_php_7_3.
2019-01-29 11:10:47 +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
83bc092d40 Remove deprecated mbregex aliases
These have been 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
6db97f5e3e Remove each()
This has been deprecated in PHP 7.2 as part of
https://wiki.php.net/rfc/deprecations_php_7_2.
2019-01-29 09:42:59 +01:00
Nikita Popov
9bc2cacf7f Remove special treatment of strings in asserts
This was deprecated in PHP 7.2 as part of
https://wiki.php.net/rfc/deprecations_php_7_2.
2019-01-29 09:42:59 +01:00
Nikita Popov
97df99a6d7 Add UPGRADING entries for removed functionality 2019-01-28 16:05:02 +01:00
Christoph M. Becker
3d15a6f86b Remove deprecated INTL_IDNA_VARIANT_2003
Cf. <https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003>
2019-01-28 15:18:01 +01:00
Christoph M. Becker
e973663882 Remove deprecated png2wbmp() and jpeg2wbmp()
Cf. <https://wiki.php.net/rfc/deprecate-png-jpeg-2wbmp>
2019-01-28 14:50:52 +01:00
Christoph M. Becker
dfa6c2046a Remove deprecated image2wbmp()
Cf. <https://wiki.php.net/rfc/image2wbmp>.
2019-01-28 14:29:06 +01:00
Nikita Popov
e118151139 Clear NEWS, UPGRADING and UPGRADING.INTERNALS 2019-01-28 11:17:30 +01:00
Andreas Treichel
b1e9c73b27 Allow strip_tags with an array of allowed tagnames 2019-01-24 15:56:32 +01:00
Nikita Popov
89a4c172e2 Remove the "o" serialization format
We never generate the "o" format during serialization, so let's not
keep this unnecessary attack surface around.
2019-01-22 18:09:49 +01:00
Nikita Popov
a50198d0fe Implement ??= operator
RFC: https://wiki.php.net/rfc/null_coalesce_equal_operator

$a ??= $b is $a ?? ($a = $b), with the difference that $a is only
evaluated once, to the degree that this is possible. In particular
in $a[foo()] ?? $b function foo() is only ever called once.
However, the variable access themselves will be reevaluated.
2019-01-22 11:12:04 +01:00
Christoph M. Becker
36c825575e [ci skip] Note preloading and ext/ffi in UPGRADING 2019-01-21 15:58:02 +01:00
Christoph M. Becker
570d4311b6 Use pkg-config to detect and configure for system libgd
Formerly, a single option `--with-gd` was sufficient to enable the
extension, and to determine whether to use the system or the bundled
libgd depending on whether a directory was passed.  Since pkg-config
determines the path automatically, we now offer `--enable-gd` (whether
the extension should be build) and `--with-external-gd` (whether to use
the system libgd).
2019-01-21 14:01:34 +01:00
Tyson Andre
58a2ced052 [ci skip] Fix typos in UPGRADING 2019-01-19 17:46:03 +01:00
Nikita Popov
48ca2c0833 Document pkg-config related changes
Creating a separate section in UPGRADING for this, as there are a
lot of these, and there's going to be more of them.
2019-01-15 10:15:05 +01: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
Sammy Kaye Powers
74c0e580ef Improve openssl_random_pseudo_bytes()
CSPRNG implementations should always fail closed. Now
openssl_random_pseudo_bytes() will fail closed by throwing an
`\Exception` in fail conditions.

RFC: https://wiki.php.net/rfc/improve-openssl-random-pseudo-bytes
2019-01-11 11:16:05 +01:00
Andreas Treichel
3c9af3095c Preserve aspect ratio for width or height 2019-01-05 13:39:49 +01:00
Nikita Popov
a9e6667817 Detect invalid uses of parent:: during compilation
We already detect the case where we're entirely outside a class --
now also check whether there actually is a parent.

This is a minor BC break, in that code that was never executed
might have previously contained an invalid parent:: reference without
generating an error.
2019-01-04 11:55:41 +01:00
Nikita Popov
f1c0e671e9 Add performance improvement section to UPGRADING
[ci skip]
2018-12-26 22:26:49 +01:00
Eli Schwartz
285a077c12 ext/gd: use --with instead of --enable
By convention it probably makes sense to stick with this even when
dropping the *-dir=DIR part.

See:
https://github.com/php/php-src/pull/3632#discussion_r229474568
https://autotools.io/autoconf/arguments.html
2018-12-26 13:37:39 +01:00
BohwaZ
82af24f2b2 Implement SQLite3Stmt::getSQL method, returning the original statement SQL, eventually expanded 2018-12-15 17:27:33 +01: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
Christoph M. Becker
8c781c1c20 Resolve imagecropauto() default $mode quirk
The `$mode` parameter of `imagecropauto()` defaults to `-1`.  However,
`-1` is changed to `GD_CROP_DEFAULT` right away, so basically the
default is `GD_CROP_DEFAULT`, which is rather confusing and
unnecessary.

Therefore, we change the default to `IMG_CROP_DEFAULT`, but still allow
an explicit `-1` to be passed for BC reasons, in which case we trigger
a deprecation notice, so we can rid the `-1` support eventually.
2018-12-12 17:25:37 +01:00
Christoph M. Becker
f0f4ab4b02 [ci skip] Fix names of the constants
`GD_CROP_DEFAULT` and `GD_CROP_SIDES` are names of libgd constants, and
as such they are not relevant for userland developers.  Therefore, we
replace them by the constant names of our wrapper, i.e.
`IMG_CROP_DEFAULT` and `IMG_CROP_SIDES`, respectively.
2018-12-01 23:54:17 +01:00
Christoph M. Becker
dcad13e8c9 Fix #73291: imagecropauto() $threshold differs from external libgd
Since upstream does not appear to move in any way[1], we sync our
behavior.  Even though the BC break is ugly (which is the reason we
target master only), having to deal with different algorithms is even
worse for portable userland code.

[1] <https://github.com/libgd/libgd/issues/334>
2018-12-01 18:49:30 +01:00
Christoph M. Becker
947ca9f43d Sync behavior of gdImageAutoCrop() with upstream
Since cropping support has been added to our bundled libgd,
`gdImageAutoCrop` differs from upstream in that `GD_CROP_DEFAULT` falls
back on `GD_CROP_SIDES` if there is no transparent color in the image.
While this difference seem to be a useful improvement in our bundled
libgd, upstream has not yet signaled that there willing to back-port
it[1], so we revert it to stay in sync with upstream.

We also remove the additional NULL bailout at the end of the function,
which doesn't appear to be relevant any longer since bug 77198 has been
fixed.

[1] <https://github.com/libgd/libgd/issues/298>
2018-12-01 15:34:10 +01:00
Christoph M. Becker
a757ebb5b5 Require SQLite ≥ 3.7.4 for ext/sqlite3
`SQLite3::readOnly()` uses `sqlite3_stmt_readonly()` which is only
available as of libsqlite 3.7.4.  For older SQLite3 versions we return
always `false`, which can be confusing.  Instead of sticking with this
behavior, or even undefining the method for old SQLite3 versions, we
lift the requirements to SQLite 3.7.4 (released on 2010-12-08),
according to a respective discussion[1].

Since pdo_sqlite doesn't use `sqlite3_stmt_readonly()`, we stick with
the minimum requirement of SQLite 3.5.0.

[1] <https://github.com/php/php-src/pull/3614>
2018-11-29 15:10:39 +01:00
Christoph M. Becker
035de21d77 Deny (un)serialization of SQLite3, SQLite3Stmt and SQLite3Result
Serializing `SQLite3`, `SQLite3Stmt` and `SQLite3Result` instances is
possible but pointless, since unserializing results in uninitialized
instances, which will bail out of any method call.  Therefore, we deny
serialization and unserialization in the first place.
2018-11-29 01:08:03 +01:00
Nikita Popov
28edeb2ba3 User serialize_deny for PDOStatement as well 2018-11-26 13:30:57 +01:00
Nikita Popov
6e4b202694 Switch PDO to use serialize_deny
And remove dummy __sleep/__wakeup. This switches the thrown
exception type from PDOException to Exception.
2018-11-26 13:28:14 +01:00
Nikita Popov
a624c2bd13 Use serialize_deny for CURLFile
Instead of a throwing __wakeup() method.
2018-11-26 13:20:51 +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
Peter Kokot
35a9ec1b0d [ci skip] Update UPGRADING 2018-11-15 10:46:48 +01:00
Christoph M. Becker
86c6b3bdcd Support SQLite3 @name notation
Besides the common `:param` notation to designate named parameters in
prepared statements, SQLite3 also supports `@param` and `$param`.
While the latter is mostly to support the Tcl programming language, and
would be confusing for PHP's sqlite3 binding due to the similarity with
string interpolation, the former is common under .NET and raises no
such issue.  Therefore we add support for it.

This patch has been developed in cooperation with @BohwaZ.
2018-11-11 14:55:34 +01:00
Eli Schwartz
2d03197749 ext/gd: Use pkg-config to detect the availability of freetype2
The latest version of freetype2 does not install freetype-config by
default, but pkg-config support has been there for approximately 15
years. In order to reliably detect freetype2, pkg-config *must* be used.

See:
https://savannah.nongnu.org/bugs/?53093
https://bugs.php.net/bug.php?id=76324
2018-11-07 13:05:47 +01:00
Christoph M. Becker
0d6490598d Add TIDY_TAG_* constants supported by libtidy 5
Cf. <http://api.html-tidy.org/tidy/tidylib_api_5.0.0/tidyenum_8h.html#ae5b597c0999422ff383f08ab595ef5e8a16d20becf3c3cb022ddabccc83d8c314>.
2018-10-27 16:17:09 +02:00
Peter Kokot
37c329d715 Trim trailing whitespace in source code files 2018-10-13 14:17:28 +02:00
Christoph M. Becker
87392eff1a Require SQLite ≥ 3.5.0 for ext/sqlite3 and ext/pdo_sqlite
It is possible to pass flags when opening an SQLite database.  For
Sqlite < 3.5.0 these are ignored, since `sqlite3_open` doesn't support
flags.  Neither a warning or notice is raised in this case, nor is this
behavior documented in the PHP manual.  Instead of fixing it either
way, we lift the requirement to SQLite 3.5.0 (released on 2007-09-04)
instead of the former SQLite 3.3.9 (released on 2007-01-04).
2018-10-13 12:15:58 +02:00
Nikita Popov
0b6063f331 Restore array_key_exists() compatibility for ArrayObject
Doing this by special-casing array_key_exists() for ArrayObject.
2018-10-11 16:10:22 +02:00
Nikita Popov
5a679341b8 Add UPGRADING notes
[ci skip]
2018-10-10 12:00:57 +02:00
Christoph M. Becker
849a896a5e [ci skip] Update NEWS and UPGRADING wrt. unbundling libsqlite 2018-10-06 12:45:06 +02:00
Anatol Belski
969fdb717a Update UPGRADING [ci skip] 2018-10-03 19:11:31 +02:00
Kalle Sommer Nielsen
bf34442581 Implemented RFC "Always available hash extension" 2018-10-03 08:47:07 +02:00
Remi Collet
3d5fe90e7e NEWS and UPGRADING 2018-10-01 07:24:04 +02:00
Nikita Popov
fc18f44213 Deprecate unbinding of $this of non-static methods
Static calls to non-static methods have been fully deprecated in
PHP 7.0 as part of https://wiki.php.net/rfc/reclassify_e_strict.

A combination of ReflectionMethod::getClosure() ("fake closures")
and Closure::bindTo() etc can be used to achieve the same behavior.
This commit ensures that a deprecation notice will be thrown also
in this case.
2018-09-29 21:01:27 +02:00
Nikita Popov
96da1fe8a9 Fixed bug #76737
Explicitly prohibit serialization and unserialization of reflection
objects.
2018-09-29 14:47:57 +02:00