]> granicus.if.org Git - php/log
php
3 years agoserialize() optimization
Dmitry Stogov [Fri, 26 Feb 2021 10:30:19 +0000 (13:30 +0300)]
serialize() optimization

3 years agoOptimize out zend_strpprintf() usage for simple concationaton
Dmitry Stogov [Fri, 26 Feb 2021 07:34:30 +0000 (10:34 +0300)]
Optimize out zend_strpprintf() usage for simple concationaton

3 years agoImprove SPL directory and stat() cache using zend_srting* instead of char*
Dmitry Stogov [Thu, 25 Feb 2021 23:28:46 +0000 (02:28 +0300)]
Improve SPL directory and stat() cache using zend_srting* instead of char*

3 years agoMerge branch 'PHP-8.0'
Felipe Pena [Thu, 25 Feb 2021 20:57:30 +0000 (20:57 +0000)]
Merge branch 'PHP-8.0'

3 years agoMerge branch 'PHP-7.4' into PHP-8.0
Felipe Pena [Thu, 25 Feb 2021 20:54:24 +0000 (20:54 +0000)]
Merge branch 'PHP-7.4' into PHP-8.0

3 years agoFix memleak on ReflectionFunction and ReflectionGenerator classes when calling __cons...
Felipe Pena [Thu, 25 Feb 2021 20:53:14 +0000 (20:53 +0000)]
Fix memleak on ReflectionFunction and ReflectionGenerator classes when calling __construct after instantiation

3 years agoRemove quicktester
George Peter Banyard [Sat, 20 Feb 2021 10:55:02 +0000 (10:55 +0000)]
Remove quicktester

This is barely used and more of a hinderence than anything else

Closes GH-6712

3 years agoMerge branch 'PHP-8.0'
Remi Collet [Thu, 25 Feb 2021 12:54:34 +0000 (13:54 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  skip test with openssl < 1.1.0

3 years agoMerge branch 'PHP-7.4' into PHP-8.0
Remi Collet [Thu, 25 Feb 2021 12:54:19 +0000 (13:54 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  skip test with openssl < 1.1.0

3 years agoskip test with openssl < 1.1.0
Remi Collet [Thu, 25 Feb 2021 12:52:35 +0000 (13:52 +0100)]
skip test with openssl < 1.1.0

The test fails, but without any crash
(this test is designed to catch a crash)

3 years agoMerge branch 'PHP-8.0'
Christoph M. Becker [Thu, 25 Feb 2021 11:05:27 +0000 (12:05 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Capture Microsoft-defined HRESULT exit codes exit codes

3 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Thu, 25 Feb 2021 11:03:43 +0000 (12:03 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Capture Microsoft-defined HRESULT exit codes exit codes

3 years agoCapture Microsoft-defined HRESULT exit codes exit codes
Dylan K. Taylor [Tue, 23 Feb 2021 21:34:51 +0000 (22:34 +0100)]
Capture Microsoft-defined HRESULT exit codes exit codes

The lack of such a check leads to false-passes of tests on Windows
which expect no output, but produce a segfault or similar issue. I
discovered this a while ago due to bad tests in an extension I maintain.

Closes GH-6722.

3 years agoMerge branch 'PHP-8.0'
Nikita Popov [Thu, 25 Feb 2021 09:19:06 +0000 (10:19 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  crc32 module, clang spurious warning removal.

3 years agocrc32 module, clang spurious warning removal.
David CARLIER [Wed, 24 Feb 2021 20:34:33 +0000 (20:34 +0000)]
crc32 module, clang spurious warning removal.

Closes GH-6725.

3 years agoSpeed up __sleep() and __wakeup() calls
Dmitry Stogov [Thu, 25 Feb 2021 09:16:22 +0000 (12:16 +0300)]
Speed up __sleep() and __wakeup() calls

3 years agoMerge branch 'PHP-8.0'
Nikita Popov [Thu, 25 Feb 2021 08:52:18 +0000 (09:52 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  mysqlnd pam fix test error message

3 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Thu, 25 Feb 2021 08:52:07 +0000 (09:52 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  mysqlnd pam fix test error message

3 years agomysqlnd pam fix test error message
Daniel Black [Thu, 25 Feb 2021 02:09:08 +0000 (13:09 +1100)]
mysqlnd pam fix test error message

Closes GH-6727.

3 years agoMerge branch 'PHP-8.0'
Nikita Popov [Wed, 24 Feb 2021 20:31:03 +0000 (21:31 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Fix potential file collision in dom tests
  Fix bug #80757 (Exit code is 0 when could not open file)
  Update NEWS

3 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Wed, 24 Feb 2021 20:30:44 +0000 (21:30 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix potential file collision in dom tests

3 years agoFix potential file collision in dom tests
Nikita Popov [Wed, 24 Feb 2021 20:30:20 +0000 (21:30 +0100)]
Fix potential file collision in dom tests

3 years agoMerge branch 'PHP-7.4' into PHP-8.0
Felipe Pena [Wed, 24 Feb 2021 19:07:22 +0000 (19:07 +0000)]
Merge branch 'PHP-7.4' into PHP-8.0

3 years agoFix bug #80757 (Exit code is 0 when could not open file)
Felipe Pena [Wed, 24 Feb 2021 18:17:27 +0000 (18:17 +0000)]
Fix bug #80757 (Exit code is 0 when could not open file)

3 years agoUpdate NEWS
Felipe Pena [Wed, 24 Feb 2021 18:40:32 +0000 (18:40 +0000)]
Update NEWS

3 years agoSwitch few functions useful in Symphony apps to new ZPP API.
Dmitry Stogov [Wed, 24 Feb 2021 16:13:11 +0000 (19:13 +0300)]
Switch few functions useful in Symphony apps to new ZPP API.

3 years agoFixed error message
Dmitry Stogov [Wed, 24 Feb 2021 16:12:32 +0000 (19:12 +0300)]
Fixed error message

3 years agoAllow pointer to end of memory in IS_UNSERIALIZED()
Nikita Popov [Wed, 24 Feb 2021 10:45:25 +0000 (11:45 +0100)]
Allow pointer to end of memory in IS_UNSERIALIZED()

We already use <= for IS_SERIALIZED(), but the same general
problem can also occur for IS_UNSERIALIZED(). We don't seem to
hit this in practice prior to GH-5595 though.

3 years agoMerge branch 'PHP-8.0'
Dmitry Stogov [Wed, 24 Feb 2021 09:20:49 +0000 (12:20 +0300)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Fixed bug #80782 (DASM_S_RANGE_VREG on PHP_INT_MIN-1)

3 years agoFixed bug #80782 (DASM_S_RANGE_VREG on PHP_INT_MIN-1)
Dmitry Stogov [Wed, 24 Feb 2021 09:20:20 +0000 (12:20 +0300)]
Fixed bug #80782 (DASM_S_RANGE_VREG on PHP_INT_MIN-1)

3 years agozend_compile.c: fix typo
Dylan T [Tue, 23 Feb 2021 17:19:21 +0000 (17:19 +0000)]
zend_compile.c: fix typo

Don't mind me, I just happened to be browsing this code. ðŸ™ƒ

Closes GH-6721.

[ci skip]

3 years agorun-tests: add skip cache
Max Semenik [Thu, 11 Feb 2021 17:33:03 +0000 (20:33 +0300)]
run-tests: add skip cache

Currently every --SKIPIF-- section in every test file results in 1
extra execution of PHP, every --EXTENSIONS-- section - in 2 executions.
This is quite wasteful, as skip checking code is extremely repetitive
and extensions are fixed for every binary/ini/command parameters
combination.

This patch adds caching to all such checks.

On my machine, the gains are quite noticeable: 36s instead of 43s
with -j16, 292s instead of 337s without concurrency. Cache stats are
3780 hits, 1247 misses in the latter case. In the future, tests could
be adjusted to have more uniform skip checks to improve performance even
more.

Closes GH-6681.

3 years agoMerge branch 'PHP-8.0'
Christoph M. Becker [Tue, 23 Feb 2021 12:23:22 +0000 (13:23 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  run-tests: fixed exit code not being set on BORKED tests

3 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Tue, 23 Feb 2021 12:22:25 +0000 (13:22 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  run-tests: fixed exit code not being set on BORKED tests

3 years agoMerge branch 'PHP-7.3' into PHP-7.4
Christoph M. Becker [Tue, 23 Feb 2021 12:14:42 +0000 (13:14 +0100)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  run-tests: fixed exit code not being set on BORKED tests

3 years agorun-tests: fixed exit code not being set on BORKED tests PHP-7.3
Dylan K. Taylor [Mon, 22 Feb 2021 23:56:11 +0000 (23:56 +0000)]
run-tests: fixed exit code not being set on BORKED tests

When no test paths are specified this shows up when 'make test' is used on a PECL extension without specifying tests to run (or in php-src too, I guess...)

Closes GH-6717.

3 years agoFix Windows build
Nikita Popov [Tue, 23 Feb 2021 11:22:34 +0000 (12:22 +0100)]
Fix Windows build

Don't add to a void pointer.

3 years agoMerge branch 'PHP-8.0'
Christoph M. Becker [Tue, 23 Feb 2021 11:18:03 +0000 (12:18 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Update php_version.h to proper version number

3 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Tue, 23 Feb 2021 11:16:15 +0000 (12:16 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Update php_version.h to proper version number

3 years agoUpdate php_version.h to proper version number
Christoph M. Becker [Tue, 23 Feb 2021 11:09:06 +0000 (12:09 +0100)]
Update php_version.h to proper version number

3 years agoRemove free_chunk API
Nikita Popov [Tue, 23 Feb 2021 10:46:34 +0000 (11:46 +0100)]
Remove free_chunk API

This API only works in very limited circumstances -- relying on
it will invariably lead to leaks. The correct way to "free" something
from the pool is to use the checkpoint API.

3 years agoRemove resize_chunk API
Nikita Popov [Tue, 23 Feb 2021 10:18:48 +0000 (11:18 +0100)]
Remove resize_chunk API

The last user has been dropped in the previous commit. This has
never worked meaningfully in the first place.

3 years agoFixed bug #80761
Nikita Popov [Tue, 23 Feb 2021 10:14:51 +0000 (11:14 +0100)]
Fixed bug #80761

When row data split across multiple packets, allocate a temporary
buffer that can be reallocated, and only copy into the row buffer
pool arena once we know the final size. This avoids quadratic
memory usage for very large results.

3 years agoMerge branch 'PHP-8.0'
Nikita Popov [Tue, 23 Feb 2021 09:22:20 +0000 (10:22 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Fixed bug #80786

3 years agoFixed bug #80786
Nikita Popov [Tue, 23 Feb 2021 09:17:30 +0000 (10:17 +0100)]
Fixed bug #80786

Don't use r0 as temporary register in math_double_long if it is
already used for a memory result.

This was already done in one branch, but not the other.

3 years agoFixed bug #80724
Cameron Porter [Mon, 15 Feb 2021 04:55:25 +0000 (22:55 -0600)]
Fixed bug #80724

FilesystemIterator::FOLLOW_SYMLINKS is currently treated as a directory
key mode flag, even though it does not change the way that the key
during iteration is set. To address this, FOLLOW_SYMLINKS has been
converted into an OTHER flag.

Closes GH-6695.

3 years agoFix #80329: Add option to specify LOAD DATA LOCAL white list folder
Darek Slusarczyk [Mon, 22 Feb 2021 10:03:24 +0000 (11:03 +0100)]
Fix #80329: Add option to specify LOAD DATA LOCAL white list folder

 * allow the user to specify a folder where files that can be sent
   via LOAD DATA LOCAL can exist
 * add mysqli.local_infile_directory for mysqli
   (ignored if mysqli.allow_local_infile is enabled)
 * add PDO::MYSQL_ATTR_LOCAL_INFILE_DIRECTORY for pdo_mysql
   (ignored if PDO::MYSQL_ATTR_LOCAL_INFILE is enabled)
 * add related tests
 * fixes for building with libmysql 8.x
 * small improvement in existing tests
 * update php.ini-[development|production] files

Closes GH-6448.

Co-authored-by: Nikita Popov <nikic@php.net>
3 years agoMerge branch 'PHP-8.0'
Christoph M. Becker [Mon, 22 Feb 2021 14:33:57 +0000 (15:33 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Fix #75776: Flushing streams with compression filter is broken

3 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Mon, 22 Feb 2021 14:31:49 +0000 (15:31 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix #75776: Flushing streams with compression filter is broken

3 years agoFix #75776: Flushing streams with compression filter is broken
Christoph M. Becker [Tue, 16 Feb 2021 18:36:37 +0000 (19:36 +0100)]
Fix #75776: Flushing streams with compression filter is broken

First, the `bzip2.compress` filter has the same issue as `zlib.deflate`
so we port the respective fix[1] to ext/bz2.

Second, there is still an issue, if a stream with an attached
compression filter is flushed before it is closed, without any writes
in between.  In that case, the compression is never finalized.  We fix
this by enforcing a `_php_stream_flush()` with the `closing` flag set
in `_php_stream_free()`, whenever a write filter is attached.  This
call is superfluous for most write filters, but does not hurt, even
when it is unnecessary.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=20e75329f2adb11dd231852c061926d0e4080929>

Closes GH-6703.

3 years agoGenerate class entries from stubs for com, standard, xmlreader, xmlwriter, xsl, zip...
Máté Kocsis [Wed, 17 Feb 2021 12:42:42 +0000 (13:42 +0100)]
Generate class entries from stubs for com, standard, xmlreader, xmlwriter, xsl, zip, Zend

Closes GH-6706

3 years agoMerge branch 'PHP-8.0'
Christoph M. Becker [Mon, 22 Feb 2021 13:34:45 +0000 (14:34 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI

3 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Mon, 22 Feb 2021 13:33:49 +0000 (14:33 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI

3 years agoFix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI
Christoph M. Becker [Mon, 22 Feb 2021 11:24:15 +0000 (12:24 +0100)]
Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI

There is no good reason not to show the credits in text based SAPIs,
except for brevity.  Thus, we suppress the credits from `php -i`.

Closes GH-6710.

3 years agoMerge branch 'PHP-8.0'
Christoph M. Becker [Mon, 22 Feb 2021 11:36:43 +0000 (12:36 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Fix #80774: session_name() problem with backslash

3 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Mon, 22 Feb 2021 11:34:54 +0000 (12:34 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix #80774: session_name() problem with backslash

3 years agoFix #80774: session_name() problem with backslash
Christoph M. Becker [Fri, 19 Feb 2021 12:14:26 +0000 (13:14 +0100)]
Fix #80774: session_name() problem with backslash

Since we do no longer URL decode cookie names[1], we must not URL
encode the session name.  We need to prevent broken Set-Cookie headers,
by rejecting names which contain invalid characters.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=6559fe912661ca5ce5f0eeeb591d928451428ed0>

Closes GH-6711.

3 years agoMerge branch 'PHP-8.0'
Nikita Popov [Mon, 22 Feb 2021 09:33:16 +0000 (10:33 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Fix trampoline leak on dynamic static call of non-static method

3 years agoFix trampoline leak on dynamic static call of non-static method
Nikita Popov [Mon, 22 Feb 2021 09:32:28 +0000 (10:32 +0100)]
Fix trampoline leak on dynamic static call of non-static method

Fixes oss-fuzz #30317.

3 years agoDon't resolve special class names
Nikita Popov [Mon, 22 Feb 2021 09:09:28 +0000 (10:09 +0100)]
Don't resolve special class names

Adjust zend_resolve_class_name() to not resolve special class names.
This avoids the need to only call this function after a preliminary
check for non-default fetch types. Doing so is somewhat fragile
when dynamic class names are involved.

Fixes oss-fuzz #31139.

3 years agoMerge branch 'PHP-8.0'
Nikita Popov [Mon, 22 Feb 2021 08:38:44 +0000 (09:38 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Fixed bug #80781

3 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Mon, 22 Feb 2021 08:37:51 +0000 (09:37 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed bug #80781

3 years agoFixed bug #80781
Nikita Popov [Mon, 22 Feb 2021 08:33:23 +0000 (09:33 +0100)]
Fixed bug #80781

zend_find_array_dim_slow() may throw, make sure to handle this.
This backports the code we already use for this on PHP-8.0,
and also backports an exception check that makes this easier to
catch.

3 years agoFix typo [ci skip]
Markus Staab [Sat, 20 Feb 2021 14:22:05 +0000 (15:22 +0100)]
Fix typo [ci skip]

Closes GH-6713.

3 years agoNEWS: Associate FR to xxHash additions
Anatol Belski [Sun, 21 Feb 2021 12:37:16 +0000 (13:37 +0100)]
NEWS: Associate FR to xxHash additions

[ci skip]

Signed-off-by: Anatol Belski <ab@php.net>
3 years agoUPGRADING: Add note about xxHash secret and fix a typo
Anatol Belski [Sun, 21 Feb 2021 12:33:21 +0000 (13:33 +0100)]
UPGRADING: Add note about xxHash secret and fix a typo

[ci skip]

Signed-off-by: Anatol Belski <ab@php.net>
3 years agohash: Implement secret support for xxh3 and xxh128
Anatol Belski [Sat, 20 Feb 2021 22:26:59 +0000 (23:26 +0100)]
hash: Implement secret support for xxh3 and xxh128

A secret can be passed through the options array. The length is
currently in the range of 136 to 256 bytes. The concerned algos are
already marked as non serializable.

Signed-off-by: Anatol Belski <ab@php.net>
3 years agoRevert "Remove class validation. zend_lookup_class_ex() performs it anyway."
Dmitry Stogov [Sat, 20 Feb 2021 15:51:03 +0000 (18:51 +0300)]
Revert "Remove class validation. zend_lookup_class_ex() performs it anyway."

This reverts commit 61cf1355fd53b6556f0502510ba3e1efbd04d242.

Class name validation is only performed if key is not passed. Here, lc_name is passed as key.

3 years agoRemove class validation. zend_lookup_class_ex() performs it anyway.
Dmitry Stogov [Sat, 20 Feb 2021 14:01:16 +0000 (17:01 +0300)]
Remove class validation. zend_lookup_class_ex() performs it anyway.

3 years agoReduce ZPP API overhead
Dmitry Stogov [Sat, 20 Feb 2021 10:59:29 +0000 (13:59 +0300)]
Reduce ZPP API overhead

3 years agoFix closure GC handler for fake closures
Nikita Popov [Sat, 20 Feb 2021 10:16:37 +0000 (11:16 +0100)]
Fix closure GC handler for fake closures

Fixes oss-fuzz #31135.

3 years agoFixed NULL pointer dereference
Dmitry Stogov [Sat, 20 Feb 2021 08:20:29 +0000 (11:20 +0300)]
Fixed NULL pointer dereference

3 years agoAttempt to fix ext\standard\tests\file\basename_bug66395_variation2-win32.phpt and...
Dmitry Stogov [Fri, 19 Feb 2021 18:48:19 +0000 (21:48 +0300)]
Attempt to fix ext\standard\tests\file\basename_bug66395_variation2-win32.phpt and ext\standard\tests\file\pathinfo_basic1-win32.phpt

3 years agoImprove basename(). Avoid calling mblen() for ASCII compatible locales.
Dmitry Stogov [Fri, 19 Feb 2021 12:42:21 +0000 (15:42 +0300)]
Improve basename(). Avoid calling mblen() for ASCII compatible locales.

3 years agoFix typo
Anton Vasiliev [Wed, 17 Feb 2021 22:50:00 +0000 (22:50 +0000)]
Fix typo

Closes GH-6708

Signed-off-by: George Peter Banyard <girgias@php.net>
3 years agoFix crash during default value evaluation
Nikita Popov [Thu, 18 Feb 2021 15:44:10 +0000 (16:44 +0100)]
Fix crash during default value evaluation

3 years agoProperly relove self::CONSTANT at compile time
Dmitry Stogov [Thu, 18 Feb 2021 14:18:57 +0000 (17:18 +0300)]
Properly relove self::CONSTANT at compile time

3 years agoFixed bug #53826
Nikita Popov [Thu, 18 Feb 2021 13:16:48 +0000 (14:16 +0100)]
Fixed bug #53826

We should handle the case where the method doesn't exist, and
where it is not visible the same way.

3 years agoWe don't need map_ptr slots for op_array.run_time_cache during preloading.
Dmitry Stogov [Thu, 18 Feb 2021 12:46:48 +0000 (15:46 +0300)]
We don't need map_ptr slots for op_array.run_time_cache during preloading.

3 years agoGenerate ext/spl class entries from stubs
Máté Kocsis [Thu, 18 Feb 2021 10:14:36 +0000 (11:14 +0100)]
Generate ext/spl class entries from stubs

Closes GH-6709

3 years agoFixed bug #75474
Nikita Popov [Wed, 17 Feb 2021 13:45:35 +0000 (14:45 +0100)]
Fixed bug #75474

For fake closures, we need to share static variables with the
original function, not work on a separate copy. Calling a function
through Closure::fromCallable() should have the same behavior as
calling it directly.

3 years agoFix static variable behavior with inheritance
Nikita Popov [Wed, 17 Feb 2021 09:47:30 +0000 (10:47 +0100)]
Fix static variable behavior with inheritance

When a method is inherited, the static variables will now always
use the initial values, rather than the values at the time of
inheritance. As such, behavior no longer depends on whether
inheritance happens before or after a method has been called.

This is implemented by always keeping static_variables as the
original values, and static_variables_ptr as the modified copy.

Closes GH-6705.

3 years agoInitialize property to UNDEF on unserialize overwrite
Nikita Popov [Thu, 18 Feb 2021 10:10:20 +0000 (11:10 +0100)]
Initialize property to UNDEF on unserialize overwrite

The UNDEF marker here is important to prevent the creation of
a reference to the property currently being overwritten, which
would then leak.

This fixes oss-fuzz 6029559193534464, which was incorrectly
merged into oss-fuzz #30584 (which is reported at
https://github.com/google/oss-fuzz/issues/5211).

3 years agoMerge branch 'PHP-8.0'
Nikita Popov [Thu, 18 Feb 2021 09:35:17 +0000 (10:35 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Avoid signed integer overflow in substr()

3 years agoAvoid signed integer overflow in substr()
Nikita Popov [Thu, 18 Feb 2021 09:29:19 +0000 (10:29 +0100)]
Avoid signed integer overflow in substr()

Perform negation after the (size_t) cast rather than before,
so as to avoid a signed integer overflow for PHP_INT_MIN.

Fixes oss-fuzz #31069.

3 years agoDon't use unmangled name if property not found
Nikita Popov [Thu, 18 Feb 2021 09:16:40 +0000 (10:16 +0100)]
Don't use unmangled name if property not found

This restores the previous behavior for this case. We'll continue
to use the mangled name, even if it does not correspond to a
declared property.

This also fixes an assertion failure for the case of property
overwrite, as the add_new was not guaranteed to be "new" previously.

Fixes oss-fuzz #31045.

3 years agoMerge branch 'PHP-8.0'
Christoph M. Becker [Wed, 17 Feb 2021 16:31:47 +0000 (17:31 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Fix #80763: msgfmt_format() does not accept DateTime references

3 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Wed, 17 Feb 2021 16:28:22 +0000 (17:28 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix #80763: msgfmt_format() does not accept DateTime references

3 years agoFix #80763: msgfmt_format() does not accept DateTime references
Christoph M. Becker [Wed, 17 Feb 2021 13:05:28 +0000 (14:05 +0100)]
Fix #80763: msgfmt_format() does not accept DateTime references

`intl_zval_to_millis()` needs to cater to references.

Closes GH-6707.

3 years agoAvoid writing zend_vm_opcodes.h if it did not change
Nikita Popov [Wed, 17 Feb 2021 16:16:22 +0000 (17:16 +0100)]
Avoid writing zend_vm_opcodes.h if it did not change

Now that we track header changes, a change to zend_vm_opcodes.h
requires rebuilding essentially the whole tree. In most cases,
changes to zend_vm_def.h don't actually result in any header
changes though.

Avoid touching the file by first checking whether the to be written
contents are actually the same.

3 years agoCoding style tweaks for zend_vm_gen.php
Alex Erohin [Wed, 17 Feb 2021 07:45:39 +0000 (10:45 +0300)]
Coding style tweaks for zend_vm_gen.php

- fixed array style for $vm_kind_name and $op_types
- deleted unnecessary else statement for is_hot_helper function
- fixed concatenation style
- fixed style of using whitespace between "(" and switch/foreach - replaced !is_null with "!=="

Closes GH-6704.

3 years agoMerge branch 'PHP-8.0'
Nikita Popov [Wed, 17 Feb 2021 15:40:33 +0000 (16:40 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Color LEAK&FAIL like a failure

3 years agoColor LEAK&FAIL like a failure
Nikita Popov [Wed, 17 Feb 2021 11:39:27 +0000 (12:39 +0100)]
Color LEAK&FAIL like a failure

3 years agoMerge branch 'PHP-8.0'
Sara Golemon [Wed, 17 Feb 2021 15:25:37 +0000 (15:25 +0000)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Prep for 8.0.4

3 years agoPrep for 8.0.4
Sara Golemon [Wed, 17 Feb 2021 15:24:36 +0000 (15:24 +0000)]
Prep for 8.0.4

3 years agounserialize() optimization. Omit class name validation before hash lookup, and perfor...
Dmitry Stogov [Wed, 17 Feb 2021 10:30:52 +0000 (13:30 +0300)]
unserialize() optimization. Omit class name validation before hash lookup, and perform it only before autoloading.

3 years agoMerge branch 'PHP-8.0'
Dmitry Stogov [Wed, 17 Feb 2021 08:51:50 +0000 (11:51 +0300)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Fixed bug #80745 (JIT produces Assert failure and UNKNOWN:0 var_dumps in code involving bitshifts)

3 years agoFixed bug #80745 (JIT produces Assert failure and UNKNOWN:0 var_dumps in code involvi...
Dmitry Stogov [Wed, 17 Feb 2021 08:51:13 +0000 (11:51 +0300)]
Fixed bug #80745 (JIT produces Assert failure and UNKNOWN:0 var_dumps in code involving bitshifts)

3 years agoMerge branch 'PHP-8.0'
Nikita Popov [Wed, 17 Feb 2021 08:45:31 +0000 (09:45 +0100)]
Merge branch 'PHP-8.0'

* PHP-8.0:
  Remove generated zend_jit_x86.c on `make clean`

3 years agoRemove generated zend_jit_x86.c on `make clean`
Dylan T [Tue, 16 Feb 2021 18:40:26 +0000 (18:40 +0000)]
Remove generated zend_jit_x86.c on `make clean`

Not removing this causes build failure when reconfiguring and rebuilding after a `make clean`, e.g. enabling/disabling ZTS.

This makes https://bugs.php.net/bug.php?id=80561 more bearable. Ideally it would be rebuilt automatically on configuration change if necessary, but I have no idea how to implement this.

Closes GH-6702.