]> granicus.if.org Git - php/log
php
4 years agoMake is_file() and friends return false when path contains 0-byte
Christian Schneider [Wed, 2 Dec 2020 09:21:08 +0000 (10:21 +0100)]
Make is_file() and friends return false when path contains 0-byte

These functions now return false silently:
is_writable, is_readable, is_executable, is_file, is_dir, is_link,
file_exists

These functions now throw a warning an return false (rather than
throwing a ValueError):
fileperms, fileinode, filesize, fileowner, filegroup, filetype,
fileatime, filemtime, filectime, lstat, stat

See also https://externals.io/message/112333.

Closes GH-6478.

4 years agoFix failing VirtualProtect() calls
Christoph M. Becker [Wed, 2 Dec 2020 14:06:30 +0000 (15:06 +0100)]
Fix failing VirtualProtect() calls

Whenever JIT is disabled due to incompatibilities, we also need to set
`JIT_G(on)` to zero.

Closes GH-6470.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Wed, 2 Dec 2020 10:29:41 +0000 (11:29 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed bug #80457

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Nikita Popov [Wed, 2 Dec 2020 10:29:06 +0000 (11:29 +0100)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fixed bug #80457

4 years agoFixed bug #80457
Nikita Popov [Wed, 2 Dec 2020 10:26:10 +0000 (11:26 +0100)]
Fixed bug #80457

On x32 sizeof(size_t) != sizeof(zend_long), so we need to be
careful with sign extension here.

Patch by bruno dot premont at restena dot lu.

4 years agoDon't throw from imagecreatefromstring() with too short string
Nikita Popov [Wed, 2 Dec 2020 09:51:55 +0000 (10:51 +0100)]
Don't throw from imagecreatefromstring() with too short string

If the string is too short, we should treat this the same way as
an unrecognized image type. This function should be usable to
determine whether something is a valid image without doing any
checks beforehand.

4 years agoFixed bug #80462
Nikita Popov [Wed, 2 Dec 2020 09:19:32 +0000 (10:19 +0100)]
Fixed bug #80462

4 years agoBackport IMAP test modernization to PHP-8.0 branch
George Peter Banyard [Tue, 1 Dec 2020 15:18:54 +0000 (15:18 +0000)]
Backport IMAP test modernization to PHP-8.0 branch

Closes GH-6476

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Tue, 1 Dec 2020 15:59:47 +0000 (16:59 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix #73809: Phar Zip parse crash - mmap fail

4 years agoFix #73809: Phar Zip parse crash - mmap fail
Christoph M. Becker [Tue, 1 Dec 2020 13:20:39 +0000 (14:20 +0100)]
Fix #73809: Phar Zip parse crash - mmap fail

Phar signatures practically are of limited size; for the MD5 and SHA
hashes the size is fixed (at most 64 bytes for SHA512); for OpenSSL
public keys there is no size limit in theory, but "64 KiB ought to be
good enough for anybody".  So we check for that limit, to avoid fatal
errors due to out of memory conditions.

Since it is neither possible to have the signature compressed in the
ZIP archive, nor is it possible to manually add a signature via Phar,
we use ZipArchive to create a suitable archive for the test on the fly.

Closes GH-6474.

4 years agoFixed bug #80447 (Strange out of memory error when running with JIT)
Dmitry Stogov [Tue, 1 Dec 2020 13:46:41 +0000 (16:46 +0300)]
Fixed bug #80447 (Strange out of memory error when running with JIT)

4 years agoBug #80447 (Strange out of memory error when running with JIT)
Dmitry Stogov [Tue, 1 Dec 2020 13:43:05 +0000 (16:43 +0300)]
Bug #80447 (Strange out of memory error when running with JIT)

4 years agoDisable stack reuse optimization for x86 PIC code. It may clobber local variable...
Dmitry Stogov [Tue, 1 Dec 2020 12:20:06 +0000 (15:20 +0300)]
Disable stack reuse optimization for x86 PIC code. It may clobber local variable used for Global Offset Table.

4 years agoDon't use scope when validating Attribute
Nikita Popov [Tue, 1 Dec 2020 10:49:27 +0000 (11:49 +0100)]
Don't use scope when validating Attribute

This is not safe to do at this point. Even if we made it safe,
we'd see inconsistencies due to a partially compiled class.

Fixes oss-fuzz #28129.

4 years agoFix use after free with file cache and arena allocated strings
Nikita Popov [Tue, 1 Dec 2020 10:31:23 +0000 (11:31 +0100)]
Fix use after free with file cache and arena allocated strings

4 years agoDon't mark cpu_supports functions as always inline
Nikita Popov [Tue, 1 Dec 2020 09:22:36 +0000 (10:22 +0100)]
Don't mark cpu_supports functions as always inline

The use of no-sanitize may result in an inlining failure, which
will be promoted into a compile error by always-inline. Use a
normal inlining hint without enforcing it.

4 years agoFixed incorrect "skipif.inc" include
Dmitry Stogov [Tue, 1 Dec 2020 08:34:09 +0000 (11:34 +0300)]
Fixed incorrect "skipif.inc" include

4 years agoSkip test if JIT is not available
Dmitry Stogov [Tue, 1 Dec 2020 06:58:33 +0000 (09:58 +0300)]
Skip test if JIT is not available

4 years agoFix #62004: SplFileObject: fgets after seek returns wrong line
Christoph M. Becker [Wed, 18 Nov 2020 12:41:21 +0000 (13:41 +0100)]
Fix #62004: SplFileObject: fgets after seek returns wrong line

As it is, `::seek(0)` sets the file pointer to the beginning of the
file, but `::seek($n)` where `$n > 0` sets the file pointer to the
beginning of the following line, having line `$n` already read into the
line buffer.  This is pretty inconsistent; we fix it by always seeking
to the beginning of the line.

We also add a test case for the duplicate bug #46569.

Closes GH-6434.

4 years agoPreallocate stack space for JIT in execute_ex() to eliminate JIT prologue/epilogue.
Dmitry Stogov [Mon, 30 Nov 2020 14:56:08 +0000 (17:56 +0300)]
Preallocate stack space for JIT in execute_ex() to eliminate JIT prologue/epilogue.

4 years agoFixed "may be used uninitialized" compilation warnings
Dmitry Stogov [Mon, 30 Nov 2020 14:46:43 +0000 (17:46 +0300)]
Fixed "may be used uninitialized" compilation warnings

4 years agoDrop all JIT related XFAILS from phpdbg test suite
Christoph M. Becker [Mon, 30 Nov 2020 14:19:28 +0000 (15:19 +0100)]
Drop all JIT related XFAILS from phpdbg test suite

phpdbg now disables JIT, so these cause XFAIL warnings.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Mon, 30 Nov 2020 14:17:27 +0000 (15:17 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Next attempt to fix bug #80368

4 years agoNext attempt to fix bug #80368
Nikita Popov [Mon, 30 Nov 2020 14:15:59 +0000 (15:15 +0100)]
Next attempt to fix bug #80368

Apparently treating LibreSSL as OpenSSL 1.1 is not just something
we did in our code, it's something that upstream LibreSSL claims,
despite not actually being compatible. Duh.

Check for EVP_CIPH_OCB_MODE instead, which should reliably
determine support...

4 years agoFix Bug #80438: imap_msgno() incorrectly warns and return false on valid UIDs in...
George Peter Banyard [Mon, 30 Nov 2020 04:48:17 +0000 (04:48 +0000)]
Fix Bug #80438: imap_msgno() incorrectly warns and return false on valid UIDs in PHP 8.0.0

Checking for a valid Unique ID (UID) cannot use the convenience macro as they might
be larger than the message number which has for maximum value the total number of
current messages available in the mailbox.

4 years agoRename XmlParser to XMLParser for consistency with XMLWriter/XMLReader
George Peter Banyard [Tue, 24 Nov 2020 13:51:51 +0000 (13:51 +0000)]
Rename XmlParser to XMLParser for consistency with XMLWriter/XMLReader

4 years agoSuppress stream errors in mysqlnd
Nikita Popov [Thu, 26 Nov 2020 11:30:17 +0000 (12:30 +0100)]
Suppress stream errors in mysqlnd

mysqlnd currently sets error_reporting=0 to suppress errors while
writing to streams. Unfortunately these errors are still visible
to userland error handlers, which is a source of confusion.
See for example https://bugs.php.net/bug.php?id=80412.

Instead add a stream flag that suppresses the emission of
read/write errors in the first place, and set it in mysqlnd.

I think it might be useful to have this option for userland as
well in the future, but for now this is just an internal
mechanism.

Closes GH-6458.

4 years agoHide phpdbg/JIT incompatibility macro (JIT is disabled for phpdbg)
Dmitry Stogov [Mon, 30 Nov 2020 13:42:17 +0000 (16:42 +0300)]
Hide phpdbg/JIT incompatibility macro (JIT is disabled for phpdbg)

4 years agoAdd additional entries to unserialize corpus
Nikita Popov [Mon, 30 Nov 2020 13:32:07 +0000 (14:32 +0100)]
Add additional entries to unserialize corpus

These are useful to seed typed property fuzzing.

4 years agoFix another ref source management bug in unserialize
Nikita Popov [Mon, 30 Nov 2020 13:23:17 +0000 (14:23 +0100)]
Fix another ref source management bug in unserialize

When we overwrite an existing property during unserialization,
we also have to drop the ref source from it.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Mon, 30 Nov 2020 11:32:45 +0000 (12:32 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix #76813: Access violation near NULL on source operand

4 years agoFix #76813: Access violation near NULL on source operand
Christoph M. Becker [Sat, 28 Nov 2020 12:47:37 +0000 (13:47 +0100)]
Fix #76813: Access violation near NULL on source operand

We avoid `YYCURSOR` becoming `NULL` by initializing `YYMARKER`, and add
a default rule for `<NORMAL>` where we catch unexpected input.

We also fix the only superficially related issue regarding empty input
followed by `T_SEPARATOR` and command, which caused another segfault.

Closes GH-6464.

4 years agoDisable JIT with incompatible third-party extensions
Dmitry Stogov [Mon, 30 Nov 2020 10:58:34 +0000 (13:58 +0300)]
Disable JIT with incompatible third-party extensions

4 years agoFixed bug #80437
Nikita Popov [Mon, 30 Nov 2020 10:40:46 +0000 (11:40 +0100)]
Fixed bug #80437

Only chmod if the file has been created.

4 years agoOnly replace IN_ARRAY result type for JMPZ/JMPNZ
Nikita Popov [Mon, 30 Nov 2020 10:09:28 +0000 (11:09 +0100)]
Only replace IN_ARRAY result type for JMPZ/JMPNZ

Replacing the result type in the general case is dangerous,
because not all opcodes support both VAR and TMP. One common case
is the in_array() result being passed to SEND_VAR, which would
have to be changed to SEND_VAL.

Rather than complicating this logic, reduce the scope to only
doing the type replacement for JMPZ and JMPNZ. The only reason
we're doing this in the first place is to enable the smart branch
optimization, so we can limit it to the relevant opcodes. Replacing
the result type may be marginally useful in other cases as well
(as it may avoid reference checks), but not worth the bother.

4 years agoUse ephemeral ports in mcast_ipv*_recv.phpt
Nikita Popov [Mon, 30 Nov 2020 08:47:03 +0000 (09:47 +0100)]
Use ephemeral ports in mcast_ipv*_recv.phpt

4 years agotidy::repairFile() and ::repairString() return string|false
Christoph M. Becker [Sun, 29 Nov 2020 23:24:15 +0000 (00:24 +0100)]
tidy::repairFile() and ::repairString() return string|false

4 years agoRespect strict_types during sccp function call evaluation
Nikita Popov [Fri, 27 Nov 2020 19:20:48 +0000 (20:20 +0100)]
Respect strict_types during sccp function call evaluation

Similar to what we do with attributes, add a dummy call frame
on which we can set the strict_types flag.

4 years agoDon't check for throwing calls in sccp function evaluation
Nikita Popov [Fri, 27 Nov 2020 16:40:34 +0000 (17:40 +0100)]
Don't check for throwing calls in sccp function evaluation

We only need to reject functions that could warn (or have runtime
dependent behavior). If a function can throw in some cases, just
let it and discard the result.

4 years agoFix handling of sccp exceptions
Nikita Popov [Fri, 27 Nov 2020 16:43:24 +0000 (17:43 +0100)]
Fix handling of sccp exceptions

We should clear the exception *before* we destroy the execute_data.
Add a variation of the test that indirects through another file,
and would crash otherwise.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Jakub Zelenka [Fri, 27 Nov 2020 16:35:16 +0000 (16:35 +0000)]
Merge branch 'PHP-7.4' into PHP-8.0

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Jakub Zelenka [Fri, 27 Nov 2020 16:33:47 +0000 (16:33 +0000)]
Merge branch 'PHP-7.3' into PHP-7.4

4 years agoFix test for bug62890 to not depend on system cert store
Jakub Zelenka [Fri, 27 Nov 2020 16:32:43 +0000 (16:32 +0000)]
Fix test for bug62890 to not depend on system cert store

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Fri, 27 Nov 2020 16:04:50 +0000 (17:04 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix build for non-x86

4 years agoFix build for non-x86
Nikita Popov [Fri, 27 Nov 2020 16:04:17 +0000 (17:04 +0100)]
Fix build for non-x86

4 years agoHandle exceptions during SCCP function evaluation
Nikita Popov [Fri, 27 Nov 2020 16:00:12 +0000 (17:00 +0100)]
Handle exceptions during SCCP function evaluation

Easier to handle them than to ensure they can't happen in the
first place.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Fri, 27 Nov 2020 13:49:45 +0000 (14:49 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix AVX detection

4 years agoFix AVX detection
Nikita Popov [Fri, 27 Nov 2020 10:54:39 +0000 (11:54 +0100)]
Fix AVX detection

Our CPU detection code currently only checks whether hardware
support for AVX exists. However, we also need to check for operating
system support for XSAVE, as well as whether XCR0 has the SSE and
AVX bits set.

If this is not the case, unset the AVX and AVX2 bits in the cpuinfo
structure.

Hopefully this resolves our issues with CPU support detection.

Closes GH-6460.

4 years agoOnly use travis for cron jobs
Nikita Popov [Fri, 27 Nov 2020 13:15:34 +0000 (14:15 +0100)]
Only use travis for cron jobs

Our primary CI has been Azure Pipelines for a while now already.
Travis was primarily retained as a) a fast feedback builder and
b) to test architectures not available elsewhere.

Due to Travis CI open source policy changes, Travis is no longer
useful as a fast feedback builder. As such, only use it for cron
job builds.

4 years agoMake sure zend_cpu_supports_pclmul() is always defined
Nikita Popov [Fri, 27 Nov 2020 11:22:03 +0000 (12:22 +0100)]
Make sure zend_cpu_supports_pclmul() is always defined

If __builtin_cpu_supports() is available, but doesn't have support
for pclmul, the function would end up not being defined at all.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Fri, 27 Nov 2020 10:51:30 +0000 (11:51 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix mysqli_get_client_stats test

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Christoph M. Becker [Fri, 27 Nov 2020 10:50:59 +0000 (11:50 +0100)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix mysqli_get_client_stats test

4 years agoFix mysqli_get_client_stats test
Daniel Black [Fri, 27 Nov 2020 05:43:20 +0000 (16:43 +1100)]
Fix mysqli_get_client_stats test

MySQL removed RENAME DATABASE in 18300001c1dbbfddf9a0adcbaeea68956102bdd0
(Sept 2007, 5.1.23). As this briefest existance is very insignificant lets remove it.

It also breaks when testing against MariaDB.

As the alternate path in this test covers all supported MySQL and MariaDB
versions and a signifant portion of unsupported versions lets keep it simple.

Closes GH-6459.

4 years agoAvoid direct calls to zend_cpu_supports()
Nikita Popov [Fri, 27 Nov 2020 10:18:10 +0000 (11:18 +0100)]
Avoid direct calls to zend_cpu_supports()

While the use of zend_cpu_supports_*() is only strictly necessary
inside ifunc resolvers, where the cpu state has not been initialized
yet, we should prefer the compiler builtins in all cases.

4 years agoAssert that cpuinfo is initialized before use
Nikita Popov [Fri, 27 Nov 2020 10:14:07 +0000 (11:14 +0100)]
Assert that cpuinfo is initialized before use

And fix some incorrect indentation.

4 years agoMove avx check into a macro
Nikita Popov [Fri, 27 Nov 2020 10:06:05 +0000 (11:06 +0100)]
Move avx check into a macro

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Fri, 27 Nov 2020 09:58:04 +0000 (10:58 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed bug #80368

4 years agoFixed bug #80368
Nikita Popov [Fri, 27 Nov 2020 09:57:19 +0000 (10:57 +0100)]
Fixed bug #80368

We assume that usually LibreSSL supports everything OpenSSL 1.1 does.
In this instance, this is not the case.

4 years agoFixed bug #80433
Nikita Popov [Fri, 27 Nov 2020 09:51:57 +0000 (10:51 +0100)]
Fixed bug #80433

Use ZEND_STRTOL to allow leading zeros in opcache.jit option.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Fri, 27 Nov 2020 09:03:02 +0000 (10:03 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed bug #80425

4 years agoFixed bug #80425
Nikita Popov [Fri, 27 Nov 2020 09:02:00 +0000 (10:02 +0100)]
Fixed bug #80425

Rename the methods in MessageFormatAdapter to make sure they don't
clash with anything defined by icu itself, which may be a problem
if icu is linked statically.

4 years agoUpdate PECL package release date
Christopher Jones [Thu, 26 Nov 2020 23:17:37 +0000 (10:17 +1100)]
Update PECL package release date

4 years agoFix bug number
Christoph M. Becker [Thu, 26 Nov 2020 22:34:35 +0000 (23:34 +0100)]
Fix bug number

4 years agoEliminate deafd stores
Dmitry Stogov [Thu, 26 Nov 2020 18:05:07 +0000 (21:05 +0300)]
Eliminate deafd stores

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Thu, 26 Nov 2020 10:56:00 +0000 (11:56 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix bug #80402: Don't strip -lpthread

4 years agoFix bug #80402: Don't strip -lpthread
Nikita Popov [Tue, 24 Nov 2020 11:23:03 +0000 (12:23 +0100)]
Fix bug #80402: Don't strip -lpthread

The current behavior has been introduced 20 years ago in
f9e375f493a1aeacbbcc8f2f00880d05b4ba7aaf as part of a larger change.
It's not clear to me why special treatement of -lpthread is necessary
here.

4 years agoRemove -dev from ZEND_VERSION
Sara Golemon [Thu, 26 Nov 2020 02:19:12 +0000 (02:19 +0000)]
Remove -dev from ZEND_VERSION

4 years agoAdd UPGRADING note for PDO::inTransaction()
Nikita Popov [Wed, 25 Nov 2020 16:28:23 +0000 (17:28 +0100)]
Add UPGRADING note for PDO::inTransaction()

[ci skip]

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Wed, 25 Nov 2020 16:24:49 +0000 (17:24 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed bug #80411

4 years agoFixed bug #80411
Nikita Popov [Wed, 25 Nov 2020 16:23:42 +0000 (17:23 +0100)]
Fixed bug #80411

References to null-serializations are stored as null, and as such
are part of the reference count.

Reminds me that we really need to deprecate the mess that is
Serializable.

4 years agoFix unserialization ref source management, again
Nikita Popov [Wed, 25 Nov 2020 16:04:07 +0000 (17:04 +0100)]
Fix unserialization ref source management, again

Handle one case the previous patch did not account for: If
unserialization of data fails, we should still register a ref
source.

Also add an extra test for a reference between two typed properties,
as this used to be handled incorrectly earlier.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Wed, 25 Nov 2020 15:29:00 +0000 (16:29 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed error reporting in mysqli_stmt::__construct

4 years agoFixed error reporting in mysqli_stmt::__construct
Dharman [Tue, 24 Nov 2020 23:02:04 +0000 (23:02 +0000)]
Fixed error reporting in mysqli_stmt::__construct

For the sake of simplicity, I've synchronized the implementation
with PHP 8, which means null values are also accepted.

Closes GH-6454.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Wed, 25 Nov 2020 15:08:28 +0000 (16:08 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Reindent more mysqli tests

4 years agoFix phpt reindentation in tidy script
Nikita Popov [Wed, 25 Nov 2020 15:07:56 +0000 (16:07 +0100)]
Fix phpt reindentation in tidy script

This was missing adjacent SKIPIF/FILE/CLEAN sections.

4 years agoReindent more mysqli tests
Nikita Popov [Wed, 25 Nov 2020 15:07:16 +0000 (16:07 +0100)]
Reindent more mysqli tests

Due to a bug in the tidy script, most tests did not actually get
reindented...

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Wed, 25 Nov 2020 14:58:21 +0000 (15:58 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Reindent ext/mysqli tests

4 years agoReindent ext/mysqli tests
Nikita Popov [Wed, 25 Nov 2020 14:57:11 +0000 (15:57 +0100)]
Reindent ext/mysqli tests

Reindent ext/mysqli tests on PHP-7.4, so they match with the
indentation on PHP-8.0. Otherwise merging test changes across
branches is very unpleasant.

4 years agoAllow running tidy.php on specific directory
Nikita Popov [Wed, 25 Nov 2020 14:54:26 +0000 (15:54 +0100)]
Allow running tidy.php on specific directory

4 years agoFix ref source management during unserialization
Nikita Popov [Wed, 25 Nov 2020 11:25:07 +0000 (12:25 +0100)]
Fix ref source management during unserialization

Only register the slot for adding ref sources later if we didn't
immediately register one. Also avoids leaking a ref source if
it is added early and the assignment fails.

Fixes oss-fuzz #27628.

4 years agosockets: Fix variable/macro name collision on AIX
Calvin Buckley [Tue, 24 Nov 2020 19:45:34 +0000 (15:45 -0400)]
sockets: Fix variable/macro name collision on AIX

The name "rem_size" is used by a macro in a system header on AIX,
specifically `sys/xmem.h`. Without changing the name, you get the
name mangled like so:

```
In file included from /usr/include/sys/uio.h:92:0,
                 from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/sys/socket.h:83,
                 from /usr/include/sys/syslog.h:151,
                 from /usr/include/syslog.h:29,
                 from /home/calvin/rpmbuild/BUILD/php-8.0.0RC5/main/php_syslog.h:27,
                 from /home/calvin/rpmbuild/BUILD/php-8.0.0RC5/main/php.h:318,
                 from /home/calvin/rpmbuild/BUILD/php-8.0.0RC5/ext/sockets/sendrecvmsg.c:17:
/home/calvin/rpmbuild/BUILD/php-8.0.0RC5/ext/sockets/sendrecvmsg.c: In function 'zif_socket_cmsg_space':
/home/calvin/rpmbuild/BUILD/php-8.0.0RC5/ext/sockets/sendrecvmsg.c:298:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
   size_t rem_size = ZEND_LONG_MAX - entry->size;
          ^
/home/calvin/rpmbuild/BUILD/php-8.0.0RC5/ext/sockets/sendrecvmsg.c:298:10: error: expected expression before '.' token
/home/calvin/rpmbuild/BUILD/php-8.0.0RC5/ext/sockets/sendrecvmsg.c:299:18: error: 'u2' undeclared (first use in this function)
   size_t n_max = rem_size / entry->var_el_size;
                  ^
/home/calvin/rpmbuild/BUILD/php-8.0.0RC5/ext/sockets/sendrecvmsg.c:299:18: note: each undeclared identifier is reported only once for each function it appears in
```

...because of the declaration in `sys/xmem.h`:

```
```

This just renames the variable so that it won't trip on this
definition. Tested to fix the build on IBM i PASE.

Closes GH-6453.

4 years agoFixed bug #80377
Nikita Popov [Tue, 24 Nov 2020 14:52:41 +0000 (15:52 +0100)]
Fixed bug #80377

Make sure the $PHP_THREAD_SAFETY variable is always available
when configuring extensions. It was previously available for
phpized extensions, but for in-tree builds it was being set
too late.

Then, use $PHP_THREAD_SAFETY instead of $enable_zts to check for
ZTS in bundled extensions, which makes sure these checks also
work for phpize builds.

4 years agoFix test diff
Christopher Jones [Wed, 25 Nov 2020 05:42:12 +0000 (16:42 +1100)]
Fix test diff

4 years agoUse diferent temporary register (%r0 may keep a method address)
Dmitry Stogov [Wed, 25 Nov 2020 00:49:42 +0000 (03:49 +0300)]
Use diferent temporary register (%r0 may keep a method address)

4 years agoRevert "Fixed bug #80377"
Dmitry Stogov [Tue, 24 Nov 2020 22:10:26 +0000 (01:10 +0300)]
Revert "Fixed bug #80377"

This reverts commit fc26ad9b1220fdfd7db15ecaff5e7c38283c55b6.

4 years ago[ci skip] Fix misspelled method names
Florian Engelhardt [Tue, 24 Nov 2020 15:48:17 +0000 (16:48 +0100)]
[ci skip] Fix misspelled method names

Closes GH-6452.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Tue, 24 Nov 2020 15:42:52 +0000 (16:42 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix usage of casted string in ReflectionParameter ctor

4 years agoFix usage of casted string in ReflectionParameter ctor
Nikita Popov [Tue, 24 Nov 2020 15:41:18 +0000 (16:41 +0100)]
Fix usage of casted string in ReflectionParameter ctor

Fixes oss-fuzz #27755.

4 years agoFixed bug #80377
Nikita Popov [Tue, 24 Nov 2020 14:52:41 +0000 (15:52 +0100)]
Fixed bug #80377

Use $PHP_THREAD_SAFETY instead of $enable_zts to check for ZTS.
This variable is also available for phpize builds, while enable_zts
is only present for in-tree builds.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Tue, 24 Nov 2020 14:27:35 +0000 (15:27 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed bug #80393

4 years agoFixed bug #80393
Nikita Popov [Tue, 24 Nov 2020 14:26:40 +0000 (15:26 +0100)]
Fixed bug #80393

Handle macos versions that don't start with 10.* in libtool.

Patch by kir dot morozov at gmail dot com.

4 years agoAllow PHP_CURL_APIs to be imported by DLLs
Christoph M. Becker [Thu, 19 Nov 2020 14:42:01 +0000 (15:42 +0100)]
Allow PHP_CURL_APIs to be imported by DLLs

Closes GH-6438.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Tue, 24 Nov 2020 13:06:19 +0000 (14:06 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix #77961: finfo_open crafted magic parsing SIGABRT

4 years agoFix #77961: finfo_open crafted magic parsing SIGABRT
Christoph M. Becker [Mon, 23 Nov 2020 16:12:46 +0000 (17:12 +0100)]
Fix #77961: finfo_open crafted magic parsing SIGABRT

libmagic may abort the running process, which is not desirable for PHP;
we raise a fatal error instead.

Closes GH-6437.

4 years ago[ci skip] Update generate_patch.sh
Christoph M. Becker [Tue, 24 Nov 2020 12:35:15 +0000 (13:35 +0100)]
[ci skip] Update generate_patch.sh

This has apparently been forgotten when updating to libmagic 5.39.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Tue, 24 Nov 2020 12:10:18 +0000 (13:10 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix #80366: Return Value of zend_fstat() not Checked

4 years agoFix #80366: Return Value of zend_fstat() not Checked
Christoph M. Becker [Tue, 17 Nov 2020 13:42:22 +0000 (14:42 +0100)]
Fix #80366: Return Value of zend_fstat() not Checked

In the somewhat unlikely case that `zend_fstat()` fails, we must not
proceed executing the function, but return `false` instead.

Patch based on the patch contributed by sagpant at microsoft dot com.

Closes GH-6432.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Tue, 24 Nov 2020 12:02:08 +0000 (13:02 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed bug #80362: Running dtrace scripts can cause php to crash

4 years agoFixed bug #80362: Running dtrace scripts can cause php to crash
Nikita Popov [Tue, 24 Nov 2020 12:00:53 +0000 (13:00 +0100)]
Fixed bug #80362: Running dtrace scripts can cause php to crash

Patch by al at coralnet dot name.

4 years agoFixed bug #80404
Nikita Popov [Tue, 24 Nov 2020 10:31:53 +0000 (11:31 +0100)]
Fixed bug #80404

For a division like [1..1]/[2..2] produce [0..1] as a result, which
would be the integer envelope of the floating-point result.

The implementation is pretty ugly (we're now taking min/max across
eight values...) but I couldn't come up with a more elegant way
to handle this that doesn't make things a lot more complex (the
division sign handling is the annoying issue here).