Commit Graph

12642 Commits

Author SHA1 Message Date
Christopher Jones
3804858c47 Retrofit description of recent PR changes 2020-07-15 13:44:32 +10:00
Nikita Popov
70501b81a7 Fixed bug #79852 2020-07-14 12:31:06 +02:00
Nikita Popov
213852de78 Fixed bug #79828 2020-07-13 09:55:13 +02:00
Nikita Popov
86e2b7bb70 Fixed bug #79841 2020-07-13 09:41:05 +02:00
Nikita Popov
a72c53a070 Fixed bug #79817
Use *_IND macros in a few places in string.c.
2020-07-10 14:06:41 +02:00
Derick Rethans
972383fda4 Revert "Partial fixed bug #79649 (Altering disable_functions from module init corrupts memory)"
This reverts commit a297c09da5.
2020-07-09 09:50:25 +01:00
Nikita Popov
77a8a709da Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #79787
2020-07-08 11:22:18 +02:00
XXiang
3d5de7d746 Fix bug #79787
Closes GH-5807.
2020-07-08 11:20:58 +02:00
Nikita Popov
77acc8a069 Fixed bug #79793
Make sure the string key is not released while throwing the
undefined index warning.
2020-07-07 16:29:48 +02:00
Nikita Popov
beb002a867 Fixed bug #79791
First throw the undefined variable warning, and then set the
variable to null. Otherwise we're not guaranteed that it's
actually null afterwards.
2020-07-07 16:00:50 +02:00
Nikita Popov
62bec0e083 Fixed bug #79784
The fix here is essentially the same as for bug #78598, just for
the undefined variable notice, rather than the undefined index one.
2020-07-07 14:22:58 +02:00
Nikita Popov
220880ad2d Fixed bug #78598
When performing an RW modification of an array offset, the undefined
offset warning may call an error handler / OB callback, which may
destroy the array we're supposed to change. Detect this by temporarily
incrementing the reference count. If we find that the array has been
modified/destroyed in the meantime, we do nothing -- the execution
model here would be that the modification has happened on the destroyed
version of the array.
2020-07-07 12:13:58 +02:00
Nikita Popov
48a247178e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79792
2020-07-07 11:59:40 +02:00
Nikita Popov
64931fd3c4 Fixed bug #79792
We need to remove the iterators even if the array is empty (we
will not create one if the first place, but the array may become
empty after the fact).
2020-07-07 11:58:25 +02:00
Nikita Popov
eaf6303a74 Fixed bug #79790
I haven't tracked down in detail where the interaction with
increment_function comes from, but the root problem here is failure
to handle the illegal offset type exception.
2020-07-07 10:56:55 +02:00
Nikita Popov
6a9d934b2c Fixed bug #79779
ASSIGN_OBJ_REF was not handling in zend_wrong_string_offset.
2020-07-07 10:27:22 +02:00
Nikita Popov
d9b4974cbc Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79778
2020-07-07 10:20:11 +02:00
Nikita Popov
b765f96f5f Fixed bug #79778
In the interest of avoiding side-effects during dumping, I'm
replacing the value with a <constant ast> string instead of
performing an update constant operation.
2020-07-07 10:19:39 +02:00
Nikita Popov
971e5c5186 Fixed bug #79783
Make sure we don't drop the by-reference check when passing the
result of a VM builtin function.
2020-07-07 09:56:14 +02:00
Gabriel Caruso
829a1e653a Update NEWS for 8.0.0alpha3 2020-07-07 02:32:35 +00:00
Gabriel Caruso
73f4441d0f Update NEWS for PHP 8.0.0alpha2 2020-07-07 02:23:24 +00:00
Christoph M. Becker
8c67c16699 Update to PCRE2 10.35
We also port a fix for the build system regarding the `-fcf-protection`
gcc flag; cf. <https://bugs.exim.org/show_bug.cgi?id=2578>.
2020-07-02 12:15:04 +02:00
Christoph M. Becker
993b19ae69 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #70362: Can't copy() large 'data://' with open_basedir
2020-06-30 10:48:07 +02:00
Christoph M. Becker
7f3bc64287 Fix #70362: Can't copy() large 'data://' with open_basedir
open_basedir is only relevant for plain files, so there is no need to
check it for other URL wrappers.
2020-06-30 10:46:53 +02:00
Xinchen Hui
c3af355755 Move to alpha2 section 2020-06-30 14:21:33 +08:00
Christoph M. Becker
4af69b8477 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #63208: BSTR to PHP string conversion not binary safe
2020-06-29 19:06:00 +02:00
Christoph M. Becker
a385cfa7ad Fix #63208: BSTR to PHP string conversion not binary safe
A `BSTR` is similar to a `zend_string`; it stores the length of the
string just before the actual string, and thus the string may contain
NUL bytes.  However, `php_com_olestring_to_string()` is supposed to
deal with arbitrary `OLECHAR*`s which may not be `BSTR`s, so we
introduce `php_com_bstr_to_string()` and use it for the only case where
we actually have to deal with `BSTR`s which may contain NUL bytes.

Contrary to `php_com_olestring_to_string()` we return a `zend_string`,
so we can save the re-allocation when converting to a `zval`.

We also cater to `php_com_string_to_olestring()` not being binary safe,
with basically the same fix we did for `php_com_olestring_to_string()`.
2020-06-29 19:05:02 +02:00
Christoph M. Becker
dfac28f8d8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79756: finfo_file crash (FILEINFO_MIME)
2020-06-29 17:46:46 +02:00
Christoph M. Becker
816b4c1235 Fix #79756: finfo_file crash (FILEINFO_MIME)
If `ctime` or `asctime` return `NULL`, we must not attempt to copy the
buffer, but rather return `NULL` as well.
2020-06-29 17:45:28 +02:00
Christoph M. Becker
aca621cf92 Fix #79749: Converting FFI instances to bool fails
Casting objects to bool is supposed to yield `true`.  Since the
`cast_object` handler is required now, we have to implement the
`_IS_BOOL` conversion there.
2020-06-29 16:02:58 +02:00
Xinchen Hui
d005a8e92b Fixed bug #79743 (Fatal error when assigning to array property with JIT enabled)
simple typo
2020-06-29 17:47:21 +08:00
Nikita Popov
43cd3f6814 Fixed bug #79741 2020-06-26 12:28:39 +02:00
Nikita Popov
c5caa05171 Fixed bug #79740 2020-06-26 10:31:55 +02:00
Nikita Popov
5435a4a9d4 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79030 Use usec from apache request time
2020-06-24 14:43:02 +02:00
Herbert256
4a26628b29 Fixed bug #79030 Use usec from apache request time
Don't unnecessarily truncate to milliseconds.

Closes GH-5760.
2020-06-24 14:41:50 +02:00
Christoph M. Becker
18f58080dc Convert shmop resources to opaque objects
We make `shmop_close()` a NOP, and deprecate the function right away;
detaching from SHM now happens when the wrapper object is freed.
2020-06-24 13:59:29 +02:00
Christoph M. Becker
26aefb750a Fix #69804: ::getStaticPropertyValue() throws on protected props
`ReflectionClass` allows reading of the values of private and protected
constants, and also to get private and protected static methods.
Therefore getting the values of private and protected static properties
is also permissible, especially since `::getStaticProperties()` already
allows to do so.

We also allow ::setStaticPropertyValue() to modify private and
protected properties, because otherwise this method is useless, as
modifying public properties can be done directly.
2020-06-24 11:17:36 +02:00
Christoph M. Becker
ef2130db88 Fix #79487: ::getStaticProperties() ignores property modifications
When retrieving the static class properties via reflection, we have to
cater to possible modifications.
2020-06-24 10:05:51 +02:00
Christoph M. Becker
f3cccfde9e Revert "Fix #79487: ::getStaticProperties() ignores property modifications"
This reverts commit a895bb6885.
2020-06-23 19:28:51 +02:00
Christoph M. Becker
a895bb6885 Fix #79487: ::getStaticProperties() ignores property modifications
When retrieving the static class properties via reflection, we have to
cater to possible modifications.
2020-06-23 18:48:54 +02:00
Christoph M. Becker
e7bbac9d11 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #55857: ftp_size on large files
2020-06-23 16:00:11 +02:00
Christoph M. Becker
e94126aac7 Fix #55857: ftp_size on large files
`atol()` returns a `long` which is not the same as `zend_long` on
LLP64; we use `ZEND_ATOL()` instead.

There is no need for a new test case, since filesize_large.phpt already
tests for that behavior; unfortunately, the FTP test suite relies on
`pcntl_fork()` and therefore cannot be run on Windows.
2020-06-23 15:57:24 +02:00
Christoph M. Becker
91982bad63 7.3 is now 7.3.21-dev 2020-06-23 10:29:42 +02:00
Nikita Popov
525d8a8bfa Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79570
2020-06-19 17:32:21 +02:00
Böszörményi Zoltán
6aff9a50ca Fixed bug #79570
Use the same logic for getgrgid_r, getpwnam_r and getpwuid_r
as for getgrnam_r in #75696

Closes GH-5740.
2020-06-19 17:31:28 +02:00
Nikita Popov
2f56b0018e Merge branch 'PHP-7.3' into PHP-7.4 2020-06-19 10:47:01 +02:00
Nikita Popov
32f377b0b9 Fixed bug #79710
Make sure we don't use zresource after the stream has been destroyed.
2020-06-19 10:46:26 +02:00
Christoph M. Becker
acdd6e597d Add missing NEWS entry
I forgot to update NEWS after merging back then.
2020-06-18 15:28:19 +02:00
Christoph M. Becker
3a0bdb720a Fix #63575: Root elements are not properly cloned
Cloning of root elements has to preserve that property, so they require
some special treatment.
2020-06-17 16:48:50 +02:00
Christoph M. Becker
aa754ba85e FR #79344: xmlwriter_write_attribute_ns: $prefix should be nullable
The `$prefix` parameter of `xmlwriter_write_element_ns()` and
`xmlwriter_start_element_ns()` is nullable, what allows these functions
to be used instead of their non NS variants.  Consequently, we make the
`$prefix` parameter of `xmlwriter_write_attribute_ns()` and
`xmlwriter_start_attribute_ns()` nullable as well.
2020-06-16 15:50:01 +02:00
Christoph M. Becker
59e343c779 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79687: Sony picture - PHP Warning - Make, Model, MakerNotes
2020-06-13 18:32:15 +02:00
Christoph M. Becker
5621c5faf8 Fix #79687: Sony picture - PHP Warning - Make, Model, MakerNotes
Even if the length of a maker note does not match our expectations
(either because the maker note is corrupted, or because our
expectations do not quite match reality), there is no need to let
parsing fail; we can still go on parsing the other meta information.
2020-06-13 18:30:57 +02:00
Christoph M. Becker
ff7fd3dc85 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79676: imagescale adds black border with IMG_BICUBIC
2020-06-12 14:07:43 +02:00
Christoph M. Becker
86e1f0ea11 Fix #79676: imagescale adds black border with IMG_BICUBIC
We have to loop over all image pixels to avoid the black border.  This
is also done in external libgd in `_gdScaleOneAxis` and `_gdScalePass`.
2020-06-12 14:05:54 +02:00
Christoph M. Becker
08858e7cca Fix #73529: session_decode() silently fails on wrong input
The `php_serialize` decode function has to return `FAILURE`, if the
unserialization failed on anything but an empty string.

The `php` decode function has also to return `FAILURE`, if there is
trailing garbage in the string.
2020-06-10 16:48:49 +02:00
Christoph M. Becker
2a6f2d82e1 Update NEWS wrt. bug 79681 2020-06-10 16:44:17 +02:00
Nikita Popov
94df2f697f Fix bug #65006
The "callable name" may be the same for multiple distinct callables.
The code already worked around this for the case of instance methods,
but there are other cases in which callable names clash, such as
the use of self:: reported in the referenced bug.

Rather than trying to generate a unique name for callables, compare
the content of the alfi structures. This is less efficient if there
are many autoload functions, but autoload *registration* does not
need to be particularly efficient.

As a side-effect, this no longer permits unregistering non-callables.
2020-06-10 11:30:32 +02:00
Nikita Popov
5b59d4915c Cleanup SPL autoload implementation
Replace EG(autoload_func) with a C level zend_autoload hook.
This avoids having to do one indirection through PHP function
calls. The need for EG(autoload_func) was a leftover from the
__autoload() implementation.

Additionally, drop special-casing of spl_autoload(), and instead
register it just like any other autoloading function. This fixes
bug #71236 as a side-effect.

Finally, change spl_autoload_functions() to always return an array.
The distinction between false and an empty array no longer makes
sense here.

Closes GH-5696.
2020-06-10 09:38:47 +02:00
Xinchen Hui
a297c09da5 Partial fixed bug #79649 (Altering disable_functions from module init corrupts memory)
In module startup stage, we should not initiliaze
EG(modified_ini_directives) as it use zend MM, the zend MM will be
restart at the end of modules startup stage,

by say "partial", because this issue still exists if altering ZEND_USER
inis, we should add a zend_ini_deactive at the end of modules startup
stage, but it brings some new cost, and I think no one would do things
like that
2020-06-10 11:16:42 +08:00
Christoph M. Becker
3c12c41927 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix possibly unsupported timercmp() usage
2020-06-09 16:54:43 +02:00
Christoph M. Becker
7ac0fb5ae4 Fix possibly unsupported timercmp() usage
The `timercmp()` manpage[1] points out that some systems have a broken
implementation which does not support `>=`.  This is definitely the
case for the Windows SDK, which only supports `<` and `>`.

[1] <https://linux.die.net/man/3/timercmp>
2020-06-09 16:52:19 +02:00
Christoph M. Becker
85657b486f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #62890: default_socket_timeout=-1 causes connection to timeout
2020-06-09 16:47:00 +02:00
Christoph M. Becker
eadd980706 Fix #62890: default_socket_timeout=-1 causes connection to timeout
While unencrypted connections ignore negative timeouts, SSL/TLS
connections did not special case that, and so always failed due to
timeout.
2020-06-09 16:45:34 +02:00
Christoph M. Becker
eac700b1e6 [ci skip] Update NEWS 2020-06-09 16:37:17 +02:00
Nikita Popov
2447fd9f84 Fixed bug #79683
Reset fake_scope during __toString() call.

I'll check if we can solve this more globally in master, by
resetting fake_scope in zend_call_function.
2020-06-09 15:51:05 +02:00
Christoph M. Becker
ee4683cf28 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #74267: segfault with streams and invalid data
2020-06-08 23:22:49 +02:00
Christoph M. Becker
12c59f6660 Fix #74267: segfault with streams and invalid data
If the current character is a line break character, it cannot be a tab
or space character, so we would always fail with an invalid sequence
error.  Obviously, these `scan_stat == 4` conditions are meant to be
exclusive.

Furthermore, if `in_pp == NULL || in_left_p == NULL` is true, we hit a
segfault if we are not returning right away.  Obviously, the additional
constraints don't make sense, so we remove them.
2020-06-08 23:19:43 +02:00
Nikita Popov
b03cafd19c Fix bug #77966: Cannot alias a method named "namespace"
This is a bit tricky: In this cases we have "namespace as", which
means that we will only recognize "namespace" as an identifier when
the lookahead token is already at the "as". This means that
zend_lex_tstring picks up the wrong identifier.

We solve this by actually assigning the identifier as the semantic
value on the parser stack -- as in almost all cases we will not
actually need the identifier, this is just an (offset, size)
reference, not a copy of the string.

Additionally, we need to teach the lexer feedback mechanism used
by tokenizer TOKEN_PARSE mode to apply feedback to something
other than the very last token. To that purpose we pass through
the token text and check the tokens in reverse order to find the
right one.

Closes GH-5668.
2020-06-08 12:55:14 +02:00
Nikita Popov
df2db7fcea Fixed bug #79657
Throwing an exception should count as an initialization for this
purpose.
2020-06-08 11:31:28 +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
e949f306be Fixed bug #72089: Throw Error on require failure
It should be noted that we still throw the usual fopen warnings,
but the final fatal error becomes an Error exception. Combine
with @ to suppress FS warnings.

Closes GH-5641.
2020-06-05 09:46:39 +02:00
Christoph M. Becker
d65c85366d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #73527: Invalid memory access in php_filter_strip
2020-06-04 13:38:45 +02:00
Christoph M. Becker
ceae81665c Fix #73527: Invalid memory access in php_filter_strip 2020-06-04 13:37:11 +02:00
Christoph M. Becker
864fb0ec23 Implement #47074: phpinfo() reports "On" as 1 for the some extensions
What is modified as boolean, should also be displayed as boolean.
2020-06-04 11:25:45 +02:00
Christoph M. Becker
5e38a1b352 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79668: get_defined_functions(true) may miss functions
2020-06-04 09:00:01 +02:00
Christoph M. Becker
b8e7b30b47 Fix #79668: get_defined_functions(true) may miss functions
Instead of some brittle and unefficient string matching, we can just
check for the function handler.
2020-06-04 08:45:27 +02:00
Christoph M. Becker
d23cd354c0 Fix #79665: ini_get() and opcache_get_configuration() inconsistency
Overriding the given INI values in modifier callbacks is not possible,
so instead of enforcing "normalized" internal values, we just reject
the attempted changes.
2020-06-03 11:07:25 +02:00
Christoph M. Becker
af4a9bf1bf Fix #73927: phpdbg fails with windows error prompt at "watch array"
We expect zvals, so we should request zvals.

We also suppress spurious watchpoint removal notices.
2020-06-02 15:17:40 +02:00
Christoph M. Becker
461135009c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79664: PDOStatement::getColumnMeta fails on empty result set
2020-06-02 10:47:10 +02:00
Christoph M. Becker
63bd8f38f4 Fix #79664: PDOStatement::getColumnMeta fails on empty result set
As its name suggests, `sqlite3_data_count` returns the number of
columns in the current row of the result set; we are interested in the
number of columns regardless of the current row, so we have to use
`sqlite3_column_count` instead.
2020-06-02 10:45:47 +02:00
Christoph M. Becker
b26ad33001 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79650: php-win.exe 100% cpu lockup
2020-06-01 13:24:32 +02:00
Christoph M. Becker
923c45bdca Fix #79650: php-win.exe 100% cpu lockup
As of PHP 7.3.0, `sapi_cli_single_write()` is supposed to return `< 0`
on failure, but `fwrite()` returns a `size_t`, and signals error by
setting the stream's error indicator.  We have to cater to that.
2020-06-01 13:22:44 +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
Christoph M. Becker
8483a21f29 Fix several mostly Windows related phpdbg bugs
* Properly initialize PHPDBG_G(watch_tmp)

  Otherwise that may cause segfaults in ZTS builds.

* Deactivate potentially remaining watchpoints after REPL

  Otherwise the memory could still be protected, resulting in segfaults
  during shutdown.

* NULL zend_handlers_table after freeing

  As of commit 4130fe4[1], the `zend_handlers_table` is explicitly
  freed in the `zend_vm_dtor()`.  Since phpdbg (and maybe some other
  SAPIs) may restart the engine afterwards, we have to make sure that
  the table is also NULLed.

* Only set context option if there is a context

  In other words, we must not follow the null pointer.

* Cater to file handles without attached console

  File handles do not necessarily have an attached console (for
  instance, pipes do not), in which case `GetConsoleScreenBufferInfo()`
  fails.  In this case we set a default value (`40`) for lines like on
  other systems.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=4130fe437a5db7ead1444d3748bd0fbad9829cb2>
2020-05-26 17:45:25 +02:00
Christoph M. Becker
e483761a1e Fix #73926: phpdbg will not accept input on restart execution
We are more liberal, and accept Windows line endings (CRLF) as well.
2020-05-26 17:44:39 +02:00
Christoph M. Becker
879004dae3 Fix #79595: zend_init_fpu() alters FPU precision
On startup, PHP deliberately changes the floating point control word to
enforce binary64 format for the calculations for best consistency
across platforms.  However, this is unnessary for x86_64 architectures,
because in this case SSE instructions are used by default, and there is
no good reason to pass `-mfpmath=i387` or such.

Therefore, we can skip the modification, which has the benefit that
system libraries are free to work in the mode of their liking.
2020-05-26 17:19:54 +02:00
Derick Rethans
c6fc400e8b Add (expected) release date, and new header for 7.4.8 2020-05-26 14:20:06 +01:00
Derick Rethans
46d88a49cc This bug fix was cherry picked into 7.4.6 2020-05-26 14:19:13 +01:00
Derick Rethans
fb370ecbe5 Fixed historical dates in NEWS 2020-05-26 11:47:26 +01:00
Christoph M. Becker
c249f593ef 7.3.20 will be next 2020-05-26 10:53:22 +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
Nikita Popov
10eb842a64 Revert "Fix #79595: zend_init_fpu() alters FPU precision"
This reverts commit 88dfc475c5.
2020-05-22 16:57:14 +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
Christoph M. Becker
88dfc475c5 Fix #79595: zend_init_fpu() alters FPU precision
On startup, PHP deliberately changes the floating point control word to
enforce binary64 format for the calculations for best consistency
across platforms.  However, this is unnessary when compiling under
`__SSE__`, because in this case the x87 instructions are not used.
Therefore, we can skip the modification, which has the benefit that
system libraries are free to work in the mode of their liking.
2020-05-22 15:46:13 +02:00
Christoph M. Becker
da801ba5e3 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79615: Wrong GIF header written in GD GIFEncode
2020-05-22 09:19:05 +02:00
Christoph M. Becker
d4bd6fb491 Fix #79615: Wrong GIF header written in GD GIFEncode
The color resolution is expected in bits 4-6 of the packed fields byte
of the logical screen descriptor (byte 10 of the GIF data stream),
according to the specification[1], section 18.

[1] <https://www.w3.org/Graphics/GIF/spec-gif89a.txt>
2020-05-22 09:15:41 +02:00
Nikita Popov
4f47ba99f0 Fix bug #79603, by retrying on RTD key collision
This is a non-intrusive fix for 7.4, still trying to find a good
solution for master.

Closes GH-5597.
2020-05-20 11:22:50 +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
Nikita Popov
d87b0685b5 Fixed bug #79600
Missed unsetting of DO_INIT in one case.
2020-05-15 11:04:40 +02:00
Xinchen Hui
3a3241ced7 fixed typo of bug id (#79599) 2020-05-15 15:43:38 +08:00
Xinchen Hui
ccd41e0833 Fixed bug #97599 (coredump in set_error_handler) 2020-05-15 15:36:00 +08:00
Christoph M. Becker
d1cd489a53 Fix #79596: MySQL FLOAT truncates to int some locales
We must not do locale aware float to string conversion here; instead
we using our `snprintf()` implementation with the `F` specifier.
2020-05-15 09:09:41 +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
Xinchen Hui
91b5571fcc Fixed #79582 (Crash seen when opcache.jit=1235 and opcache.jit_debug=2) 2020-05-13 18:00:16 +08:00
Christoph M. Becker
129fd647a1 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79588: Boolean opcache settings ignore on/off values
2020-05-12 19:48:12 +02:00
Christoph M. Becker
5bdb4ab786 Fix #79588: Boolean opcache settings ignore on/off values
We should display boolean INI settings as boolean.
2020-05-12 19:44:39 +02:00
Christoph M. Becker
4b0d5e0faf Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79489: .user.ini does not inherit
2020-05-12 11:48:36 +02:00
Christoph M. Becker
bdba0cd3d2 Fix #79489: .user.ini does not inherit
On Windows, PATH_TRANSLATED may contain backslashes as well as slashes,
so we must not only check for `DEFAULT_SLASH`.
2020-05-12 11:47:47 +02:00
Christoph M. Becker
85e241c35c [ci skip] Update NEWS 2020-05-12 11:16:55 +02:00
Christoph M. Becker
d5300873c5 Fix #79571: FFI: var_dumping unions may segfault
We must not attempt to access arbitrary union members when retrieving
debug info, because that may not be valid.  Therefore we do no longer
dereference pointer types inside of unions, but report their address as
string in `%p` format instead.
2020-05-11 16:24:46 +02:00
Christoph M. Becker
80b5006196 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79566: Private SHM is not private on Windows
2020-05-05 11:41:04 +02:00
Christoph M. Becker
f33cf52faf Fix #79566: Private SHM is not private on Windows
We map the POSIX semantics of `IPC_PRIVATE` by creating unnamed file
mapping objects on Windows.  While that is not particularly useful for
ext/shmop, which is the only bundled extension which uses `shmget()`,
it may be useful for external extensions.
2020-05-05 11:38:29 +02:00
Christoph M. Becker
ed6bf0bc69 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79561: dns_get_record() fails with DNS_ALL
2020-05-04 23:00:56 +02:00
Christoph M. Becker
c40a494406 Fix #79561: dns_get_record() fails with DNS_ALL
Since Windows has its own definitions of the `PHP_DNS_*` macros, we
have to use these when registering the PHP constants.
2020-05-04 22:59:38 +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
Nikita Popov
7c1316ec6a Fixed bug #79535
We did not allocate a cache slot for FETCH_CLASS. This is already
fixed on newer PHP versions.
2020-05-04 14:51:18 +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
Christoph M. Becker
9b9252c667 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79528: Different object of the same xml between 7.4.5 and 7.4.4
2020-05-01 12:40:37 +02:00
Christoph M. Becker
54148fd686 Fix #79528: Different object of the same xml between 7.4.5 and 7.4.4
Revert "Fix #61597: SXE properties may lack attributes and content"

This reverts commit 7c081db885.
2020-05-01 12:37:39 +02:00
Remi Collet
1b98151734 doc enchant changes 2020-04-30 09:40:46 +02:00
Xinchen Hui
8555c2bff0 Fixed bug #79536 (zend_clear_exception prevent exception's destructor to be called). 2020-04-29 18:58:28 +08:00
Gabriel Caruso
34c460f329
Check __set_state structure
Fix Bug #79521.

Closes GH-5462.
2020-04-28 17:02:03 +02:00
Christoph M. Becker
6998cc5029 Bump version 2020-04-28 09:10:50 +02:00
Xinchen Hui
5f900b3285 update NEWS 2020-04-28 11:13:33 +08:00
Christoph M. Becker
29968d8f99 Fix #79470: PHP incompatible with 3rd party file system on demand
We add support for Activision HSM (`IO_REPARSE_TAG_ACTIVISION_HSM`) and
VFS for Git (`IO_REPARSE_TAG_PROJFS`).  The latter fixes bug #78784.
2020-04-27 09:30:57 +02:00
Christoph M. Becker
3151676f52 Fix #79514: Memory leaks while including unexistent file
We have to destroy (un-opened) ZEND_HANDLE_FILENAMEs.
2020-04-24 18:14:53 +02:00
Christoph M. Becker
767a77ac19 Fix #36365: scandir duplicates file name at every 65535th file
Since DIR_W32.offset is declared as `uint16_t`, we have an overflow for
directories with many entries.  This patch changes the field to
`uint32_t`.
2020-04-24 09:47:56 +02:00
Nicolas Grekas
73d02c3b3e Fix bug #79447
Partially reverts 846b647953: instead of
throwing, this skips uninitialized typed properties when serializing objects.

This makes serialize with __sleep() behave the same as serialize()
without __sleep().

As in the non-__sleep() case, unserialize(serialize($x)) identity
may not be preserved due to replacement of uninitialized/unset
properties with default values. Fixing this will require changes to
the serialization format.

Closes GH-5396.
2020-04-23 10:30:33 +02:00
Christoph M. Becker
c705079b12 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79503: Memory leak on duplicate metadata
2020-04-22 15:08:50 +02:00
Christoph M. Becker
ccca2c448d Fix #79503: Memory leak on duplicate metadata
Duplicate metadata can only happen if someone tampers with the phar, so
we can and should treat that as error.
2020-04-22 15:07:46 +02:00
Christoph M. Becker
225117af71 Upgrade to PCRE2 10.34
We backport the slightly modified variant from master.
2020-04-22 14:23:26 +02:00
Christoph M. Becker
3d1b730c11 Fix #71417: fread() does not report zlib.inflate errors
If the zlib.inflate filter fails to decompress the stream, we raise a
notice instead of failing silently.
2020-04-20 16:49:08 +02:00
Christoph M. Becker
d757be640f Fix #71263: fread() does not report bzip2.decompress errors
If the bzip2.decompress filter fails to decompress the stream, we raise
a notice instead of failing silently.
2020-04-20 14:21:50 +02:00
Alex Dowad
0d11d37357 Fix bug #67369 ArrayObject serializatino drops the iterator class
When ArrayObject is round-tripped through serialize() and unserialize(),
it forgets any iterator class name which was set using ::setIteratorClass().
Fix that.
2020-04-20 11:55:18 +02:00
Christoph M. Becker
18ad38a7b2 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79491: Search for .user.ini extends up to root dir
2020-04-20 10:58:33 +02:00
Christoph M. Becker
fa10abd6d7 Fix #79491: Search for .user.ini extends up to root dir
The `start` parameter of `php_cgi_ini_activate_user_config` is supposed
to hold the byte offset of the doc root in the given `path`.  However,
the current expression which fixes a potential type incompatibility
will ever only evaluate to zero or one, because it uses the *logical*
and operator (`&&`).  Furthermore we notice that subtracting one from
`doc_root_len` is not necessary, so there is even no need for the
`start` parameter at all.
2020-04-20 10:56:36 +02:00
Nikita Popov
a230b5a6c9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79497: Fix php_openssl_subtract_timeval()
2020-04-20 10:26:22 +02:00
Joe Cai
94e09bfe55 Fix #79497: Fix php_openssl_subtract_timeval()
I stumbled upon this while debugging a strange issue with
stream_socket_client() where it randomly throws out errors when
the connection timeout is set to below 1s. The logic to calculate
time difference in php_openssl_subtract_timeval() is wrong when
a.tv_usec < b.tv_usec, causing connection errors before the timeout
is reached.
2020-04-20 10:25:54 +02:00
Nikita Popov
0b709e3409 Fix bug #79336
Make reading of floats and doubles host-endian independent.
2020-04-16 12:18:41 +02:00
Nikita Popov
58e6a0a602 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79477
2020-04-15 11:21:42 +02:00
Nikita Popov
79a36ff7f3 Fixed bug #79477
Make sure to deindirect properties when creating array.
2020-04-15 11:21:05 +02:00
Christoph M. Becker
537680a9c4 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add missing CVE
2020-04-14 18:19:34 +02:00
Christoph M. Becker
c4cdf1ae12 Add missing CVE 2020-04-14 18:18:18 +02:00
Nikita Popov
ef56b2c977 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79468
2020-04-14 12:01:51 +02:00
dinosaur
95eaccd0bb Fixed bug #79468
Close the stream filter resources when removing them from the stream.
2020-04-14 11:59:51 +02:00
Alex Dowad
80598f1250 Syntax errors caused by unclosed {, [, ( mention specific location
Aside from a few very specific syntax errors for which detailed exceptions are
thrown, generally PHP just emits the default error messages generated by bison on syntax
error. These messages are very uninformative; they just say "Unexpected ... at line ...".

This is most problematic with constructs which can span an arbitrary number of lines, such
as blocks of code delimited by { }, 'if' conditions delimited by ( ), and so on. If a closing
delimiter is missed, the block will run for the entire remainder of the source file (which
could be thousands of lines), and then at the end, a parse error will be thrown with the
dreaded words: "Unexpected end of file".

Therefore, track the positions of opening and closing delimiters and ensure that they match
up correctly. If any mismatch or missing delimiter is detected, immediately throw a parse
error which points the user to the offending line. This is best done in the *lexer* and not
in the parser.

Thanks to Nikita Popov and George Peter Banyard for suggesting improvements.

Fixes bug #79368.
Closes GH-5364.
2020-04-14 11:22:23 +02:00
Christoph M. Becker
a76b3358e4 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add NEWS entries [ci skip]
2020-04-14 08:56:09 +02:00