Compare commits

..
Author SHA1 Message Date
Derick Rethans aeb198af40 Update versions for PHP 7.4.0beta2 2019-08-06 06:54:01 +00:00
Derick Rethans 6da7f015e1 Update NEWS for PHP 7.4.0beta2 2019-08-06 06:54:01 +00:00
Dmitry Stogov 3fc0e2bb80 Fixed bug #78376 (Incorrect preloading of constant static properties) 2019-08-05 22:55:06 +03:00
Christoph M. Becker 790b0b109a Fix handling of succeeding XFAIL tests
Due to a typo in commit e1151c9[1], succeeding XFAIL test without an
EXPECTF or EXPECTREGEX section have been reported reported as passed
instead of warned.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=e1151c9549cf5a7235c1609019f79bbb1bbcdbea>
2019-08-05 11:38:47 +02:00
Christoph M. Becker 1ed9ebdea5 Support calling convention specific function name mangling
On Windows certain calling conventions cause C function names to be
mangled, so to import them we have to use the properly mangled names.
2019-08-04 12:14:11 +02:00
Christoph M. Becker f12dc90e5e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78346: strip_tags no longer handling nested php tags
2019-08-02 17:04:36 +02:00
Christoph M. Becker a87ef5e3dd Fix #78346: strip_tags no longer handling nested php tags
When the strip tags state machine has been flattened, an if statement
has mistakenly been treated as else if.  We fix this, and also simplify
a bit right away.
2019-08-02 17:03:20 +02:00
Christoph M. Becker e60c507362 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78179: MariaDB server version incorrectly detected
2019-08-02 16:45:29 +02:00
Christoph M. Becker 81efd489db Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78179: MariaDB server version incorrectly detected
2019-08-02 16:44:15 +02:00
Christoph M. Becker f9f4a68368 Fix #78179: MariaDB server version incorrectly detected
As of MariaDB 10.0.2, the server reports a fake version number as work-
around for replication issues[1].  We apply the same "fix" as in the
MariaDB client to cater to this.

[1] <https://github.com/MariaDB/server/commit/c50ee6c23dbeb090963580754bec2f0a96ac0557#diff-5b45fa673c88c06a9651c7906364f592>
2019-08-02 16:42:49 +02:00
Nikita Popov a4a535d8de Merge branch 'PHP-7.3' into PHP-7.4 2019-08-02 10:38:26 +02:00
Nikita Popov d89157cd67 Add test for bug #78363 2019-08-02 10:37:44 +02:00
Nikita Popov e1934f8515 Merge branch 'PHP-7.2' into PHP-7.3 2019-08-02 10:35:48 +02:00
Nikita Popov 85e8ccd55e Fixed bug #78363 2019-08-02 10:35:24 +02:00
Nikita Popov bf53d30fae Fix forwarding of extra args in opcache server tests 2019-08-01 17:00:11 +02:00
Christoph M. Becker 61e1147146 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Remove upgrade-pcre.php script
2019-08-01 10:50:08 +02:00
Christoph M. Becker b419b24ead Remove upgrade-pcre.php script
This script has not been updated for PCRE2, and it's mostly useless
anyway.  Therefore we remove it altogether.
2019-08-01 10:49:05 +02:00
Nikita Popov bab8b3a8be Add test for bug #78356 2019-08-01 10:10:28 +02:00
Nikita Popov afd96392a3 Revert "Use RW fetch for argument unpacking"
This reverts commit 6913ec3282.
This reverts commit a9e332e027.

Causes https://bugs.php.net/bug.php?id=78356, which I don't have
a good solution for.
2019-08-01 10:06:53 +02:00
Christoph M. Becker 1f9a77baef Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix 78213: Empty row pocket
2019-07-31 18:08:05 +02:00
Christoph M. Becker 8af14024c2 Fix 78213: Empty row pocket
We have to ensure that we don't create an arena which is smaller than
its header, regardless of the configured alignment.
2019-07-31 18:05:40 +02:00
Peter Kokot 3e8774e57a Update NEWS 2019-07-30 22:09:00 +02:00
Peter Kokot 09b108246a Fix #78348: Remove -lrt from pdo_sqlite.so
The fdatasync check has been removed since PHP 5.3.

The Solaris fix was introduced via
8d63360fc4
and is today no longer relevant since the sqlite library is neither
bundled in php-src anymore neither the check needs to be done via the
PHP build system.

Closes GH-4485
2019-07-30 22:06:23 +02:00
Christoph M. Becker 053df4ac3b Fix tests
Apparently, nobody is testing with MySQL < 5.6 for quite a while.  We
should consider dropping support for these very old versions.
2019-07-30 16:32:49 +02:00
Nikita Popov a9e332e027 Handle RW UNPACK in inference 2019-07-30 10:31:51 +02:00
Nikita Popov 0ed6c37140 Fix FPM timer event re-registration
Make sure that fpm_event_add calls inside a timer callback work by
unregistering the event from the queue before invoking its callback.

The read timeout in tester.inc is increased because the added test
needs two seconds (one for SIGTERM, one for SIGKILL) until the
reload succeeds, so we should wait longer than that for a response.
2019-07-30 10:16:57 +02:00
Nikita Popov 6913ec3282 Use RW fetch for argument unpacking
Argument unpacking may need to create references inside the array
that is being unpacked. However, it currently can only do this
if a plain variable is unpacked, not for any nested accesses,
because the value is fetched for read. Resolve this by fetching
the operands for RW.
2019-07-30 10:07:08 +02:00
Christoph M. Becker 8413df5e55 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add security related NEWS entries [ci skip]
2019-07-30 09:51:37 +02:00
Christoph M. Becker ef439abd46 Add security related NEWS entries [ci skip] 2019-07-30 09:49:39 +02:00
Remi Collet 88cc70eb94 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  add security NEW entries + reorder [ci skip]
2019-07-30 09:27:20 +02:00
Remi Collet 6ea13baaf1 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  add security NEW entries + reorder [ci skip]
2019-07-30 09:27:06 +02:00
Remi Collet b29ecec4ef add security NEW entries + reorder [ci skip] 2019-07-30 09:26:50 +02:00
Stanislav Malyshev fd6874c64d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78338: Array cross-border reading in PCRE
2019-07-29 14:51:21 -07:00
Christoph M. Becker 8947fd9e9f Fix #78338: Array cross-border reading in PCRE
We backport r1092 from pcre2.
2019-07-29 14:49:33 -07:00
Stanislav Malyshev 4adf3dc109 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #77919: Potential UAF in Phar RSHUTDOWN
  Update NEWS
  Fix bug #78256 (heap-buffer-overflow on exif_process_user_comment)
  Fix bug #78222 (heap-buffer-overflow on exif_scan_thumbnail)
2019-07-29 13:20:52 -07:00
Stanislav Malyshev d69894734d Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77919: Potential UAF in Phar RSHUTDOWN
  Update NEWS
  Fix bug #78256 (heap-buffer-overflow on exif_process_user_comment)
  Fix bug #78222 (heap-buffer-overflow on exif_scan_thumbnail)
2019-07-29 13:20:44 -07:00
Stanislav Malyshev 284fb08fdc Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #77919: Potential UAF in Phar RSHUTDOWN
  Update NEWS
  Fix bug #78256 (heap-buffer-overflow on exif_process_user_comment)
  Fix bug #78222 (heap-buffer-overflow on exif_scan_thumbnail)
2019-07-29 13:19:16 -07:00
Christoph M. Becker cd1101e8c8 Fix #77919: Potential UAF in Phar RSHUTDOWN
We have to properly clean up in case phar_flush() is failing.

We also make the expectation of the respective test case less liberal
to avoid missing such bugs in the future.
2019-07-29 13:18:27 -07:00
Stanislav Malyshev 42e8b85d94 Update NEWS 2019-07-29 13:16:53 -07:00
Nikita Popov 76c2bef9b0 Don't explicitly install homebrew
It is already installed on azure, and this installation step is
very unreliable lately.
2019-07-29 21:08:29 +02:00
Christoph M. Becker 3429370d69 Fix build for --disable-signals 2019-07-29 18:49:44 +02:00
Nikita Popov 536c91c535 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-29 17:34:37 +02:00
Nikita Popov 44fe025c28 Merge branch 'PHP-7.2' into PHP-7.3 2019-07-29 17:34:16 +02:00
Albert Casademont dc7aa22b18 Fix bug #78326
Similar to what fread() does, truncate the stream_get_contents()
result if the original buffer was way too large.
2019-07-29 17:33:57 +02:00
Nikita Popov 6df1665bb3 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-29 17:14:40 +02:00
Nikita Popov bbed5564eb Merge branch 'PHP-7.2' into PHP-7.3 2019-07-29 16:57:57 +02:00
Nikita Popov 38f1288b64 Fix Zend signals unblocking
There are a few parts here:
 * opcache should not be blocking signals while invoking compile_file,
   otherwise signals may remain blocked on a compile error. While at
   it, also protect SHM memory during compile_file.
 * We should deactivate Zend signals at the end of the request, to make
   sure that we gracefully recover from a missing unblock and signals
   don't remain blocked forever.
 * We don't use a critical section in deactivation, because it should
   not be necessary. Additionally we want to clean up the signal queue,
   if it is non-empty.
 * Enable SIGG(check) in debug builds so we notice issues in the future.
2019-07-29 15:17:32 +02:00
Christoph M. Becker 94924841ac Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS [ci skip]
2019-07-29 14:48:57 +02:00
Christoph M. Becker 76683ea999 Update NEWS [ci skip]
The fix has been cherry-picked into PHP-7.3.8, so the bug will be fixed
already there.
2019-07-29 14:48:23 +02:00
Christoph M. Becker 07286d2fb4 Document how to generate ffi_parser.c 2019-07-29 13:38:53 +02:00
Nikita Popov a22a06c351 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-29 13:03:53 +02:00
Nikita Popov 8e63bb5e46 Fixed bug #78341
The smart branch logic assumed b->start refers to the old offsets,
while b->start was already adjusted to the new offsets at this
point. Delay the change until later.
2019-07-29 13:02:01 +02:00
Nikita Popov 92273bef66 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-29 11:27:39 +02:00
Nikita Popov 552ce9c763 Merge branch 'PHP-7.2' into PHP-7.3 2019-07-29 11:27:34 +02:00
Nikita Popov 68fd435ba8 Fixed bug #78333
Don't dereference float/double values at unknown address, instead
memcpy it into an aligned stack slot and dereference that.
2019-07-29 11:27:21 +02:00
Nikita Popov 2eb159d589 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-29 11:26:31 +02:00
Nikita Popov 727929765b Merge branch 'PHP-7.2' into PHP-7.3 2019-07-29 11:26:09 +02:00
Nikita Popov d142dfc93d Fixed bug #78333
Don't dereference float/double values at unknown address, instead
memcpy it into an aligned stack slot and dereference that.
2019-07-29 11:25:27 +02:00
Nikita Popov 4ae807e84e Fixed bug #78344
When performing a constant visibility check during compilation we
might be dealing with unlinked classes and as such should account
for the possibility of unresolved parents.
2019-07-29 11:12:00 +02:00
Nikita Popov 9bfda013d3 Fixed bug #78340
Even if we know the file size, we still need to read in a loop in
case the read call returns an incomplete result.

This was less of an issue previously because we did not use the
"one large read" approach for non-plain stream wrappers.
2019-07-29 10:07:12 +02:00
Stanislav Malyshev aeb6d13185 Fix bug #78256 (heap-buffer-overflow on exif_process_user_comment) 2019-07-29 00:53:37 -07:00
Stanislav Malyshev dea2989ab8 Fix bug #78222 (heap-buffer-overflow on exif_scan_thumbnail) 2019-07-29 00:53:28 -07:00
Christoph M. Becker fec71e3f25 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78342: Bus error in configure test for iconv //IGNORE
2019-07-29 08:51:33 +02:00
Christoph M. Becker 585131f901 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78342: Bus error in configure test for iconv //IGNORE
2019-07-29 08:50:39 +02:00
Christoph M. Becker 30eb4b3563 Fix #78342: Bus error in configure test for iconv //IGNORE
We have to check the return value of iconv_open() for error, to avoid
that and potentially other undesired behavior of iconv().
2019-07-29 08:48:13 +02:00
Tyson Andre 99fe0471ed nit: Fix a typo in UPGRADING
Closes GH-4481
2019-07-27 23:14:07 +02:00
Sebastian Jennen a2b2aaa67a file encoding cleanup: remove bom in win32 files
These two files have been: "UTF-8 Unicode (with BOM) text".
By applying `dos2unix` on these files the BOM has been removed.

I checked the whole source code with dos2unix:
These were the only two text files affected.
2019-07-27 10:12:54 +02:00
Peter Kokot f1c4b48c84 Mention also API versions bumps
Closes GH-4470
2019-07-26 01:48:01 +02:00
Theodore Brown 0e6e2297fc Fix typos in UPGRADING and improve wording in a few places
Closes GH-4478
2019-07-26 01:16:49 +02:00
Christoph M. Becker e1c80d8ea7 Remove duplication 2019-07-25 19:09:21 +02:00
Levi Morrison d758691b9b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Remove .post files only for passing tests
2019-07-25 09:50:47 -06:00
Levi Morrison c624a7fe43 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Remove .post files only for passing tests
2019-07-25 09:49:18 -06:00
Levi Morrison 5649267b25 Remove .post files only for passing tests
This allows the sh script for failing tests with --POST-- to work
2019-07-25 09:48:39 -06:00
Matteo Beccati 5d3d2b9827 Addded missing NEWS/UPGRADING entries for PDO "??" escape 2019-07-25 16:30:28 +02:00
Remi Collet 946a1e4314 Fix build warnings
- switch from strncpy to memcpy for -Wstringop-truncation
2019-07-25 11:50:44 +02:00
Nikita Popov 1cbcf0f4f1 Throw notice for plain wrapper fread/fwrite errors
Similar to what is done for socket read/write errors.
2019-07-25 10:42:10 +02:00
Peter Kokot dee243d475 Bump PHP_JSON_VERSION to PHP_VERSION
Closes GH-4459
2019-07-24 22:19:33 +02:00
Peter Kokot a3169964c0 Remove AC_FPM_POLL
AC_FPM_POLL defines HAVE_POLL symbol which is already checked by
configure.ac and function poll in AC_CHECK_FUNCTIONS.

Closes GH-4449
2019-07-24 22:03:47 +02:00
Peter Kokot 793dfa91bb Remove outdated Libtool hack for macs
This was once relevant for older versions of macs and autoconf 2.13.

Closes GH-4435
2019-07-24 21:40:21 +02:00
Nikita Popov 99d4b2bddc Mark _get_zval_ptr_deref as unused 2019-07-24 20:51:19 +02:00
Dmitry Stogov 853b426ecf Avoid over-specialization 2019-07-24 19:51:56 +03:00
Dmitry Stogov d7e8abb4aa Reordering 2019-07-24 18:49:46 +03:00
Dmitry Stogov 22e7ee3bb3 Delay dereference 2019-07-24 18:36:50 +03:00
Nikita Popov 626bc0e7cc Remove php_openssl_cipher_get_version()
This was added in 7.1 when add_assoc_string mistakenly accepted
a char* rather than const char* parameter and is no longer needed.
We can use SSL_CIPHER_get_version() directly.
2019-07-24 16:41:20 +02:00
Dmitry Stogov 6191df7553 Avoid reloading 2019-07-24 17:30:38 +03:00
David Carlier b05f364333 Fix bindpath mem leak in cgi
Closes GH-4451.
2019-07-24 12:06:40 +02:00
Derick Rethans 126dd8e1eb Update NEWS for 7.4.0beta2 2019-07-24 09:39:54 +00:00
Derick Rethans 5dae0eae62 Update NEWS for PHP 7.4.0beta1 2019-07-24 09:38:35 +00:00
Nikita Popov a49d53baa2 Don't skip uninitialized typed props in get_class_vars()
For bug #78319.
2019-07-24 10:52:01 +02:00
Nikita Popov d9680272c7 Revert "Drop free_filename field from zend_file_handle"
This reverts commit e0eca26285.

free_filename is used by the wincache extension, restore this
field for PHP 7.4.
2019-07-24 10:43:37 +02:00
Nikita Popov 1eb706179f Avoid references in TMP var
Make sure we deref the OBJ_IS result, because we store it in a TMP
var, which is not allowed to contain references and will cause
assertion failures in the unspecialized VM.

This also partially reverts fd463a9a60,
which merged the TMP and VAR specializations of COALESCE to work
around this bug.

An alternative would be to change the result type of OBJ_IS back
to VAR.
2019-07-24 10:07:26 +02:00
Nikita Popov 9e4603f772 Try to fix macos build
By avoiding unused variable opline warnings. Also clean up the
replacement of ZEND_VM_SPEC -- we were sometimes treating it as
an always-defined constant with a value (what it actually is) and
sometimes as a conditionally defined constant (which it isn't, but
which still worked thanks to the specializer). Switch to only
treating it as a constant with a value.
2019-07-24 09:44:55 +02:00
Dmitry Stogov 8d51af9bc2 Fixed CALL VM 2019-07-24 01:52:05 +03:00
Dmitry Stogov eaa9048973 Fixed unspecialized executor 2019-07-24 01:43:01 +03:00
George Peter Banyard 6d6d954d0d Cleanup of remaining E_STRICT in tests 2019-07-23 11:27:23 +02:00
Derick Rethans a07e85f93f Update NEWS for 7.4.0beta2 2019-07-23 08:06:23 +00:00
Derick Rethans 2b540b2f52 Update NEWS for PHP 7.4.0beta1 2019-07-23 08:05:05 +00:00
Peter Kokot 1fa238a7b3 Update NEWS 2019-07-23 02:32:38 +02:00
Peter Kokot e3236d8847 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS
  Update NEWS
2019-07-23 02:13:54 +02:00
Peter Kokot b42a13b08a Update NEWS 2019-07-23 02:13:36 +02:00
Peter Kokot 9e2ac14702 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS
2019-07-23 02:13:12 +02:00
Peter Kokot 8f384bea93 Update NEWS 2019-07-23 02:13:00 +02:00
Matteo Beccati b19fdc18a9 Fix FR #71885 (Allow escaping question mark placeholders) 2019-07-22 19:35:03 +02:00
Peter Kokot 5d827c89cf Remove HAVE_OCILOBISTEMPORARY and HAVE_OCICOLLASSIGN
Symbols are not used in the current code.

Also remove not needed ocijdbc8 library addition and checks whcih were
removed also via b8e1d4d4e5 so Oracle 8
is no longer supported.

Closes GH-4454
2019-07-22 19:13:24 +02:00
Nikita Popov 845d07b343 Add upgrading entries
[ci skip]
2019-07-22 17:56:16 +02:00
Nikita Popov 5664035ffe Also report errors from Zend stream reader operation 2019-07-22 17:49:08 +02:00
Nikita Popov d59aac58b3 Report errors from stream read and write operations
The php_stream_read() and php_stream_write() functions now return
an ssize_t value, with negative results indicating failure. Functions
like fread() and fwrite() will return false in that case.

As a special case, EWOULDBLOCK and EAGAIN on non-blocking streams
should not be regarded as error conditions, and be reported as
successful zero-length reads/writes instead. The handling of EINTR
remains unclear and is internally inconsistent (e.g. some code-paths
will automatically retry on EINTR, while some won't).

I'm landing this now to make sure the stream wrapper ops API changes
make it into 7.4 -- however, if the user-facing changes turn out to
be problematic we have the option of clamping negative returns to
zero in php_stream_read() and php_stream_write() to restore the
old behavior in a relatively non-intrusive manner.
2019-07-22 17:17:28 +02:00
Nikita Popov c817b8020c Special-case rc=1 self-referential arrays in ReflectionReference
New fix for bug #78263. This is special-cased elsewhere in the engine,
so we need to mirror it here.
2019-07-22 16:59:23 +02:00
Nikita Popov 19588a8f3b Revert "Add ReflectionReference::getRefcount()"
This reverts commit 428cfdd181.
2019-07-22 16:49:08 +02:00
Remi Collet 31d85b8417 cleanup gd build with system libgd - drop need to use libpng with system libgd - drop need to use libjpeg with system libgd - drop need to use libXpm with system libgd - drop need to use libfreetype with system libgd - improve configure comments 2019-07-22 16:14:19 +02:00
Peter Kokot a2b758dab5 Remove HAVE_PQPUTCOPYEND
Symbol is not used anywhere in the code and also Postgresql 7.x is
EOL anyway.

Closes GH-4453
2019-07-22 16:05:26 +02:00
Peter Kokot 9b8bf13b3a Fix internals upgrading log 2019-07-22 16:04:07 +02:00
Peter Kokot 4b03e102c5 Remove HAVE_DSA_DEFAULT_METHOD
Last usage removed via 6a81363405.

Closes GH-4455
2019-07-22 16:02:55 +02:00
Christoph M. Becker f8202b5513 Remove superfluous HAVE_GD_BUNDLED checks
If we're compiling the bundled libgd, `HAVE_GD_BUNDLED` is set, so
there is no need to check for this macro again.
2019-07-22 15:59:44 +02:00
Nikita Popov 72b9105d30 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-22 12:41:15 +02:00
Nikita Popov b59a9381b9 Remove test for bug #77185
Seems to be very unreliable in CI.
2019-07-22 12:40:26 +02:00
Nikita Popov 6572c00b81 Merge branch 'PHP-7.4' of git.php.net:/php-src into PHP-7.4 2019-07-22 12:29:00 +02:00
Christoph M. Becker d3d3404db7 Drop superfluous ENABLE_GD_TTF
If we `HAVE_LIBFREETYPE`, we define `ENABLE_GD_TTF` if it is not
defined.  Therefore we can check for `HAVE_LIBFREETYPE` in the first
place.
2019-07-22 12:01:24 +02:00
Nikita Popov 23bb9f4e2f Add deprecations to UPGRADING 2019-07-22 11:53:50 +02:00
Nikita Popov 28cf080701 Deprecate unbinding $this from non-static closure 2019-07-22 11:39:52 +02:00
Nikita Popov b3f74b0b7d Deprecate allow_url_include 2019-07-22 11:39:52 +02:00
Nikita Popov 964de035a7 Deprecate restore_include_path() 2019-07-22 11:39:52 +02:00
Nikita Popov b3668aabf7 Deprecate convert_cyr_string() 2019-07-22 11:39:52 +02:00
Nikita Popov e41b7f6db4 Deprecate (real) cast 2019-07-22 11:39:52 +02:00
Nikita Popov 46b982409a Deprecate implode() with swapped parameter order 2019-07-22 11:39:52 +02:00
Nikita Popov cd2f2cd7d0 Deprecate FILTER_SANITIZE_MAGIC_QUOTES 2019-07-22 11:39:52 +02:00
Nikita Popov 4e190691e2 Deprecate is_real() function 2019-07-22 11:39:52 +02:00
Nikita Popov b1cdf06673 Deprecate money_format() 2019-07-22 11:39:52 +02:00
Nikita Popov 4e4d8a4a6c Deprecate hebrevc() 2019-07-22 11:39:52 +02:00
Nikita Popov e9e2fa4ad4 Deprecate ezmlm_hash() 2019-07-22 11:39:52 +02:00
Nikita Popov 39e756e7fe Deprecate encoding as 3rd param to mb_strrpos() 2019-07-22 11:39:52 +02:00
Nikita Popov 3121b7174f Deprecate Reflection export() methods
And remove the Reflector::export() interface method.
2019-07-22 11:39:52 +02:00
Nikita Popov 0ba7c3eadf Deprecate array_key_exists() on objects 2019-07-22 11:39:52 +02:00
Nikita Popov b2ea507bea Deprecate get_magic_quotes_gpc() and get_magic_quotes_runtime() 2019-07-22 11:39:52 +02:00
Nikita Popov b2915fc332 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-22 11:19:24 +02:00
Nikita Popov 5e4dbce586 Reduce number of workers in test
4 seems to be enough to reliably reproduce the issue. Let's see
if this works better in CI.
2019-07-22 11:18:38 +02:00
Dmitry Stogov 60dca2295d Initialize static_members_table 2019-07-22 12:02:16 +03:00
Dmitry Stogov 2f51764e5d Evaluate constant in class scope 2019-07-22 11:59:24 +03:00
Nikita Popov 97b80bd83b Merge branch 'PHP-7.3' into PHP-7.4 2019-07-22 10:34:32 +02:00
Maksim Nikulin bdf24f8d6d Prevent use after free in fpm_event_epoll_wait
epoll event backend does not guarantee that child input/output events
are reported before SIGCHILD due to finished worker. While a bunch of
events received by epoll is being processed, child-related structures
may be removed before dispatching of an I/O event for the same child.
The result may be attempt to access to memory region allocated for
another purpose, segfault of the master process, and unavailable web
sites.

Postpone processing of SIGCHILD events till other events in the same
bunch are processed.

Fix Bug #62418 php-fpm master process crashes
Fix Bug #65398 Race condition between SIGCHLD and child stdout/stderr event leads to segfault
Fix Bug #75112 php-fpm crashing, hard to reproduce
Fix Bug #77114 php-fpm master segfaults in fpm_event_epoll_wait/fpm_event_fire
Fix Bug #77185 Use-after-free in FPM master event handling
2019-07-22 10:32:58 +02:00
Remi Collet fff6b18657 improve temporary fix for system libgd
- PHP_GD_PNG needed to set include path for png.h
- PHP_GD_JPEG needed to set include path for jpeglib.h
2019-07-22 09:11:32 +02:00
Peter Kokot ef165b4422 Remove build.mk usage
First step when creating the `configure` script is currently using
make. This is helpful when developing buildsystem to only rebuild
`configure` and `main/php_config.h.in` files when one of the *.m4
or configure.ac file changes and saves the developer time a little.

Realistically however, it is not needed that much considering the
times of several seconds to fully rebuild the configure script and
configuration header. The next step when running the `configure`
script is much more time consuming so performance on buildconf
level is a bit questionable and won't be noticed on today's
systems.

Additionally:
- buildconf now removes cache and all targets and uses -f option on
  the first step i.e. autoconf. The autoheader does not need the -f
  option in this case.

Closes GH-4437
2019-07-21 11:40:23 +02:00
Peter Kokot 1b969a74d0 Remove some unused HAVE_* symbols
- HAVE_NET_SNMP removed via cab643f615
- HAVE_CRYPTO_AEAD_AES256GCM ad120c5ae9
- Remove HAVE_FREETDS and HAVE_LIBDNET_STUB (not used in current
  extension; copy paste from other removed extensions)

Closes GH-4448
2019-07-21 11:34:18 +02:00
Peter Kokot 15782b27b8 Remove HAVE_LIBZIP
The libzip library is now always used from the system.

Closes GH-4450
2019-07-21 11:32:13 +02:00
George Wang 30de357fa1 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-21 00:01:39 -04:00
George Wang 82f35ab089 Merge branch 'PHP-7.2' into PHP-7.3 2019-07-21 00:01:06 -04:00
George Wang eb7e45f662 Checked in LiteSpeed SAPI 7.5, addressed two main problems in "clean shutdown" introduced in 7.4.3,
1. falls in an infinite loop because PHP engine's inconsistent state, now override the ITIMER_PROF to 0.1 second, clean shutdown must finish before that.
2. generate too much error log, we completely disable "error_reporting" before calling php_request_shutdown().
2019-07-20 23:59:43 -04:00
George Peter Banyard 1a031a242c Renamed MySQLi test to remove duplicate 'mysqli_'
Closes GH-4441
2019-07-21 01:10:31 +02:00
Markus Staab 577ed5bfa4 Fix typos
Closes GH-4447
2019-07-21 01:01:36 +02:00
Peter Kokot b1643e166d Fix failed tests for phar
- when $status is boolean, E_NOTICE appears and tests fail
- opcache is never enabled on these tests anyway.
- Add opcache.revalidate_freq=0 to testing script

  Instead of checking this in the tests files it can be used directly in
  the main testing script. Also this fixes failed tests.

- Use opcache_invalidate() instead of sleep() delay in some tests. Some
  delays are still used since the opcache_invalidate seems to be buggy
  and not working as expected.

Closes GH-4392
2019-07-21 00:49:35 +02:00
Peter Kokot f5227c5863 Move HAVE_SQLITE3_CLOSE_V2 to pdo_sqlite
Closes GH-4444
2019-07-21 00:40:59 +02:00
Remi Collet a85e4d5336 Fixed bug #78314 (missing freetype support/functions with external gd) 2019-07-20 07:57:13 +02:00
Peter Kokot 6de97402b5 Remove unused sqlite symbols
- HAVE_SQLITE3_KEY is no longer used in php-src
- SQLITE_ENABLE_COLUMN_METADATA is no longer used in php-src

Closes GH-4443
2019-07-20 00:27:10 +02:00
Peter Kokot 81fd1c5206 Fix typos in FFI
Closes GH-4438
2019-07-19 23:07:04 +02:00
Christoph M. Becker 737c1b492c Put oniguruma include path to proper CFLAGS 2019-07-19 20:04:47 +02:00
Christoph M. Becker 504cd03fc3 Move Oniguruma related config stuff to where it belongs
Oniguruma is exclusively used by ext/mbstring, and only if mbregex is
enabled.  Therefore it is unnecessary and confusing to have Oniguruma
related config stuff scattered elsewhere.

While we're at it, we also remove the referral to the bundled libonig
which is removed as of PHP 7.4.0, and the duplicated call to
`PHP_INSTALL_HEADERS()`.
2019-07-19 19:30:41 +02:00
Nikita Popov aa2e2c3f93 Merge Linux & Windows fwrite test
The test files are the same, just with a different OS check...
2019-07-19 10:59:02 +02:00
Dmitry Stogov 445d51347d Use run-time cache to avoid repeatable hash lookups in ZEND_DECLARE_CLASS_DELAYED 2019-07-19 11:46:03 +03:00
rjhdby d574df63dc Deprecate alternative array access syntax
RFC: https://wiki.php.net/rfc/deprecate_curly_braces_array_access
2019-07-19 10:06:10 +02:00
Dmitry Stogov d5943f5a11 Use run-time cache to avoid repeatable hash lookups when creating anonymous functions and classes 2019-07-19 10:43:49 +03:00
Dmitry Stogov b065fbde19 ZEND_DECLARE_ANON_CLASS doesn't need to skip anything now. It's immediatelly followed by ZEND_NEW. 2019-07-19 10:09:26 +03:00
Peter Kokot 7cbc6b6546 Remove safe_mode directive when installing ext/phar
Closes GH-4436
2019-07-19 00:02:12 +02:00
Dmitry Stogov 7cf651c39e Merge common code 2019-07-18 16:46:25 +03:00
Nikita Popov be7f405f6b Merge branch 'PHP-7.3' into PHP-7.4 2019-07-18 14:42:20 +02:00
Nikita Popov 4a9f78f9d7 Merge branch 'PHP-7.2' into PHP-7.3 2019-07-18 14:41:35 +02:00
Abyr Valg c8c183eb62 Fixed bug #77946
Save multi_info_read() result into easy handle.
2019-07-18 14:40:47 +02:00
Christoph M. Becker 55d34f7023 Remove remaining lightnings from run-tests.php
The classic Windows console only supports the Unicode BMP, so it can't
handle the LIGHTNING MOOD character (U+1F5F2).  It also seems that
common fonts do not support the LIGHTNING (U+2607) character, so a
general removal is appropriate.

However, Windows is already "ready for the future"[1], but PHP for
Windows is not (yet).

[1] <https://devblogs.microsoft.com/commandline/windows-command-line-unicode-and-utf-8-output-text-buffer/>
2019-07-18 12:15:25 +02:00
Peter Kokot bbdbc2658c Remove duplicate socklen_t check
- Use Autoconf's default AC_CHECK_TYPES

Closes GH-4418
2019-07-18 12:11:19 +02:00
Nikita Popov 562591f5eb Remove lightning
Windows is not quite ready for the future.
2019-07-18 11:16:24 +02:00
George Peter Banyard 3a5664fdfe Convert E_STRICT into E_NOTICE for htmlentities() function 2019-07-18 11:13:18 +02:00
Christoph M. Becker 3f23380361 Update NEWS and UPGRADING wrt. opcache.cache_id [ci skip] 2019-07-18 09:16:56 +02:00
Christoph M. Becker f34db7fc2a Use regedit to register event source
ext/win32std is unmaintained for years, so it is highly unlikely that
it is available.  We therefore use regedit instead to register the
event source.  We also remove the bundled syslog.reg, since it is of no
use, unless generated for the respective installation.
2019-07-18 09:10:48 +02:00
Peter Kokot b35b9eb1d6 Update changelogs 2019-07-18 02:27:14 +02:00
Peter Kokot 8db732155f Fix typo 2019-07-18 02:23:39 +02:00
Peter Kokot 359a78b16c Remove unused defines
Used in php-src the past and today removed and not used anymore:
- HAVE_CURL_EASY_STRERROR
- HAVE_CURL_MULTI_STRERROR
- HAVE_NEW_MIME2TEXT
- HAVE_MBSTR_CN
- HAVE_MBSTR_JA
- HAVE_MBSTR_KR
- HAVE_MBSTR_RU
- HAVE_MBSTR_TW

Part of oniguruma which doesn't use these anymore
- NOT_RUBY
- HAVE_STDARG_PROTOTYPES

Unused:
- HAVE_MPIR

Closes GH-4427
2019-07-18 02:21:39 +02:00
Peter Kokot 7dc6c3960b Update changelog 2019-07-18 02:18:14 +02:00
Peter Kokot 53299d610a Remove unused MISSING_MSGHDR_MSGFLAGS
Closes GH-4426
2019-07-18 02:17:14 +02:00
Peter Kokot daa243d1a0 Remove duplicate AC_PROG_CPP call
AC_PROG_CPP is already called in configure.ac.

Closes GH-4425
2019-07-18 02:14:31 +02:00
Peter Kokot fa7fbfd518 Update changelog 2019-07-18 02:13:13 +02:00
Peter Kokot 6afc3cede8 Remove unused HAVE_SHM_MMAP_ZERO and HAVE_SHM_MMAP_FILE
Closes GH-4424
2019-07-18 02:11:19 +02:00
Christoph M. Becker e2ed7e6716 Allow multiple cache instances per user/host on Windows
Formerly, there was at most a single OPcache instance per user and the
so called system ID (which is determined from the PHP version).
Sometimes multiple OPcaches might be desired, though, particularly for
unrelated CLI scripts, which may even be necessary (e.g. for our test
suite in parallel mode).

We therefore introduce a new INI directive `opcache.cache_id` which
allows to configure independent OPcache instances for the same user.

We also use `GetUserNameW()` instead of `php_win32_get_username()`,
because the latter retrieves the user name encoded in the
`default_charset`, which can obviously yield different results for
different charsets, leading to OPcache "incompatibilities".  Slightly
worse, some characters may not even be encodeable in the
`default_charset` and would be replaced by question marks, which could
result in different users sharing the same OPcache.

We also refactor, and re-use existing APIs to avoid duplicated code.
2019-07-17 19:51:07 +02:00
Christoph M. Becker 6f617b7759 Revert "Remove Windows syslog script and syslog.reg"
This reverts commit cc44bad1f6, since its
assumptions were not correct.  Actually, the classic event logging is
still used by PHP, because Windows 7 is still to be supported for a
while.  Without the respective registry entries, the event log entries
show an error message regarding missing ID descriptions.

Thanks to ab@php.net for hinting at this!

Obviously, the part depending on ext/win32std has still to be
overhauled, and further improvements are conceivable; we will address
this in due course.
2019-07-17 19:36:56 +02:00
Nikita Popov 56a2ea7aa2 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-17 15:59:22 +02:00
Nikita Popov 79efd55fc3 Merge branch 'PHP-7.2' into PHP-7.3 2019-07-17 15:59:14 +02:00
Nikita Popov b864abfe23 Fixed bug #69100 2019-07-17 15:58:29 +02:00
Nikita Popov 07a4d134ab Avoid duplicate fstat() for includes
By adding a flag to avoid forced fstat for includes. The two fstats
will happen back to back and we don't care about a possible
invalidation.

I was hoping to move this higher up in the stack and make the
ISREG check somewhere in fsizer of fixup, but this doesn't really
seem to be possible. E.g. an FP stdin handle will not be a regular
file but of course needs to be allowed. Additionally custom stream
wrappers may not implement this functionality.
2019-07-17 14:48:51 +02:00
Dmitry Stogov b30e4a5aa6 Avoid extra specialization for cold opcodes 2019-07-17 14:03:48 +03:00
Nikita Popov c2c5c9a973 Use reported fstat filesize for PHP streams 2019-07-17 11:56:00 +02:00
Nikita Popov 856c5d2837 Revert "Avoid unused fstat() call"
This reverts commit 5a90dc77b8.

Let's try to go with the reverse direction here and actually trust
the reported size...
2019-07-17 11:49:10 +02:00
Nikita Popov 5a90dc77b8 Avoid unused fstat() call
If we're including a file via PHP streams, we're not going to trust
the reported file size anyway and populate in a loop -- so don't
bother determining the file size in the first place. Only do this
for non-tty HANDLE_FP now, which is the only case where this
information was used.
2019-07-17 11:22:31 +02:00
Dmitry Stogov 6fbab09ef0 Remove old hack 2019-07-17 12:05:23 +03:00
Nikita Popov a986e70991 Avoid double buffering in Zend streams
Disable buffering in PHP streams, to avoid storing and copying the
file contents twice.

This will call stream_set_option() on custom stream wrapper as
well, so the method needs to be implemented to avoid a warning.
2019-07-17 10:40:04 +02:00
Dmitry Stogov 918f09f72a Added specialization for comparison instructions and QM_ASSIGN 2019-07-17 09:12:01 +03:00
Peter Kokot e7fcc45c43 Fix typo 2019-07-17 03:54:54 +02:00
Peter Kokot 476339646c Simplify functions checks in m4
- AC_CHECK_FUNCS already automatically defines belonging HAVE_function
  symbols and executes given shell code.
2019-07-17 03:50:47 +02:00
Dmitry Stogov ee5828205e Separate "cold" and common unspecialized code 2019-07-17 00:52:26 +03:00
Peter Kokot a520974740 Update changelog 2019-07-16 22:46:46 +02:00
Peter Kokot 63d6a2b697 Remove unused build checks
- yp_get_default_domain was part of ext/yp
- functions checks produce HAVE_function_name symbols. These checks are
  currently not used in php-src neither in the extensions out there.
- Removed symbols because they are not used in the code:
  - HAVE_GCVT
  - HAVE_PUTENV
  - HAVE_PUTENV
  - HAVE_SETVBUF
  - HAVE_TEMPNAM
  - HAVE_SIN (sin is also defined in C89 standard)
  - HAVE_SETSOCKOPT
  - HAVE_LOCKF
  - HAVE_ISASCII
  - HAVE_YP_GET_DEFAULT_DOMAIN (and other yp extension related unused checks)
  - HAVE_LINK
- HAVE_USLEEP is already defined in Windows configuration header
- HAVE_LIBBIND has not been used in php-src for a while anymore
- HAVE_GETHOSTNAME is duplicated in Windows configuration header

Closes GH-4417
2019-07-16 22:39:09 +02:00
Dmitry Stogov a6812c0c84 Provide type info 2019-07-16 22:56:20 +03:00
Nikita Popov b317f0eb59 Remove ZEND_HANDLE_MAPPED
The buf/len members are now simply used in addition to the main
stream, without changing the handle kind.
2019-07-16 17:44:32 +02:00
Nikita Popov e0eca26285 Drop free_filename field from zend_file_handle
free_filename was always zero.
2019-07-16 17:07:26 +02:00
Nikita Popov 49bac9b77b Introduce zend_stream_init_filename()
Avoid more ad-hoc initialization of zend_file_handle structures.
2019-07-16 16:44:37 +02:00
Nikita Popov 46faf8f018 Introduce zend_stream_init_fp() API
Reduce the amount of code that mucks around with zend_file_handle
initialization.
2019-07-16 16:44:37 +02:00
Dmitry Stogov 349a388b90 Slit INC/DEC opcodes into hot/cold parts and remove specialized versioins for LONG_OR_DOUBLE. 2019-07-16 17:39:25 +03:00
Nikita Popov a0f450a023 Remove unused _get_zval_ptr_cv_BP_VAR_UNSET function
To fix the macos -Werror build.
2019-07-16 15:53:55 +02:00
Nikita Popov e08cc4d921 Remove ZEND_HANDLE_FD
This handle type was unused.
2019-07-16 15:47:10 +02:00
Nikita Popov 5161cebe28 Fix bug #52752 by not using mmap() to lex files
Using mmap() is unsafe under concurrent modification. If the file
is truncated, access past the end of the file may occur, which will
generate a SIGBUS error. Even if the length does not change, the
contents may, which is a situation that the lexer certainly is not
prepared to deal with either.

Reproduce with test.php:

    <?php
    file_put_contents(__DIR__ . '/test.tpl',
        'AAA<?php $string = "' .
        str_repeat('A', mt_rand(1, 256 * 1024)) .
        '"; ?>BBB' . "\r\n");
    require_once __DIR__ . '/test.tpl';

And:

    for ((n=0;n<100;n++)); do sapi/cli/php test.php & done
2019-07-16 15:47:10 +02:00
Christoph M. Becker 292354f73a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Convert short tag to standard tag in Zend test file
2019-07-16 15:29:10 +02:00
George Peter Banyard e7e66d5275 Convert short tag to standard tag in Zend test file
Closes GH-4389.

(cherry picked from commit e6c2b28865)
2019-07-16 15:27:50 +02:00
Christoph M. Becker 20320598e5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS [ci skip]
2019-07-16 13:45:23 +02:00
Christoph M. Becker 956ecc2ce5 Update NEWS [ci skip] 2019-07-16 13:44:13 +02:00
Remi Collet b8ed9ac140 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  move NEWS entry [ci skip]
2019-07-16 13:00:44 +02:00
Remi Collet 344d01bee3 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  move NEWS entry [ci skip]
2019-07-16 13:00:30 +02:00
Remi Collet bd0514913b move NEWS entry [ci skip] 2019-07-16 13:00:13 +02:00
Dmitry Stogov c1b9088903 Replace deprecated conditions by ZEND_ASSERT. 2019-07-16 13:50:25 +03:00
Nikita Popov 290e520c03 Use ZEND_HASH_FOREACH APIs in a few more places 2019-07-16 12:20:16 +02:00
Nikita Popov c9acc90186 Support <?php followed by EOF
This is an annoying edge-case for canonicalization.
2019-07-16 11:53:48 +02:00
Nikita Popov ebfa05677b Merge branch 'PHP-7.3' into PHP-7.4 2019-07-16 11:11:00 +02:00
Nikita Popov eea9d61763 Merge branch 'PHP-7.2' into PHP-7.3 2019-07-16 11:10:51 +02:00
Nikita Popov 8a19fe29de Fixed bug #78297 2019-07-16 11:09:17 +02:00
Remi Collet a91fb18da4 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  next is 7.2.22
2019-07-16 10:39:24 +02:00
Remi Collet bf1ace7dd3 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  next is 7.2.22
2019-07-16 10:39:03 +02:00
Remi Collet c9037421ac next is 7.2.22 2019-07-16 10:38:20 +02:00
Nikita Popov 26977fdfdd Fix name collisions in fputcsv tests 2019-07-16 10:25:06 +02:00
Nikita Popov e2e3ddac7d Canonicalize file-names in zip tests
There were a number of name collisions in there.
2019-07-16 10:25:06 +02:00
Dmitry Stogov 1d4c38421a Delay IS_UNDEF checks 2019-07-16 11:16:45 +03:00
Dmitry Stogov 2e26b063b6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed incorrect specialization (missed IS_INDIRECT handling)
2019-07-16 01:54:22 +03:00
Dmitry Stogov c570980175 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed incorrect specialization (missed IS_INDIRECT handling)
2019-07-16 01:52:11 +03:00
Dmitry Stogov 9ccf3fb996 Fixed incorrect specialization (missed IS_INDIRECT handling) 2019-07-16 01:50:10 +03:00
George Peter Banyard 548d1ec27c Small typo and proto name fix
Closes GH-4415
2019-07-15 18:15:17 +02:00
Peter Kokot 24f4dff075 Remove win32/php_stdbool.h
File usage was removed via 33fc7d77d7.

Closes GH-4411
2019-07-15 18:00:04 +02:00
Peter Kokot 59ba991b9c Remove unused files
These were introduced in 504b9beae6
and their usages were removed via
4b3e198023.

Closes GH-4410
2019-07-15 17:58:46 +02:00
Peter Kokot cc44bad1f6 Remove Windows syslog script and syslog.reg
These were used on old Windows systems before Vista and also were
used together with unmaintained win32std extension.

https://docs.microsoft.com/en-us/windows/win32/eventlog/event-logging

Closes GH-4409
2019-07-15 17:57:11 +02:00
Peter Kokot 07daf6cd62 Remove some *.dsp/*.dsw leftovers
Usage of this was removed via 4b3e198023

Closes GH-4408
2019-07-15 17:55:37 +02:00
Nikita Popov fcdb12ed4d Combine SKIP_TOKEN+RETURN_TOKEN into one macro 2019-07-15 17:29:27 +02:00
Nikita Popov c5f1b384b5 Move shebang handling into the lexer
Instead of handling shebang lines by adjusting the file pointer in
individual SAPIs, move the handling into the lexer, where this is
both a lot simpler and more robust. Whether the shebang should be
skipped is controlled by CG(skip_shebang) -- we might want to do
that in more cases.

This fixed bugs #60677 and #78066.
2019-07-15 16:25:49 +02:00
Nikita Popov 17d4e86dda Merge branch 'PHP-7.3' into PHP-7.4 2019-07-15 15:20:36 +02:00
Nikita Popov 2d737a1e4b Merge branch 'PHP-7.2' into PHP-7.3 2019-07-15 15:20:15 +02:00
Nikita Popov 88ffe05797 Fix bug #77124
This is a backport of 6fcae63f61
to PHP 7.2.
2019-07-15 15:19:31 +02:00
Christoph M. Becker 37043e07df Sync mysqlnd version with PHP version
Since mysqlnd is solely developed in the php-src repository, it makes
not much sense to have its own version number, particularly since
nobody cares to update it.  Therefore we use PHP's version number, but
stick with the "mysqlnd" prefix which can be important to distinguish
the mysqli driver (libmysqlclient vs. mysqlnd).
2019-07-15 14:20:58 +02:00
Remi Collet da1816c3d3 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  typo [ci skip]
2019-07-15 14:17:23 +02:00
Remi Collet ad48464ec2 typo [ci skip] 2019-07-15 14:17:13 +02:00
Remi Collet c77f0506d0 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78269 password_hash uses weak options for argon2
  Fix #78269 password_hash uses weak options for argon2
2019-07-15 14:11:57 +02:00
Remi Collet 590d8f8263 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78269 password_hash uses weak options for argon2
2019-07-15 14:11:38 +02:00
Remi Collet a7ff3a6483 Fix #78269 password_hash uses weak options for argon2 2019-07-15 14:11:30 +02:00
Remi Collet eab0079c90 Fix #78269 password_hash uses weak options for argon2 2019-07-15 14:10:38 +02:00
Nikita Popov d60d16bda6 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-15 13:49:29 +02:00
Nikita Popov 9ad094e371 Emit T_BAD_CHARACTER for unexpected characters
Avoid having holes in the token stream which are annoying and
inefficient to reconstruct on the consumer side.
2019-07-15 12:51:01 +02:00
Nikita Popov 193f28c7d5 Fixed bug #78010
Prevent the gc_info from becoming all zero for a registered root
by setting the top bit to one for compressed root addresses.
2019-07-15 12:00:30 +02:00
Sebastian Pop af7639683f vectorize string-escape with NEON
On this benchmark:
function simple_string_escape() {
    $a = "test'asd'asd'' asd\'\"asdfasdf";
    for($i=0; $i<512; $i++) {
        $a .= chr($i%256);
    }
    for ($i = 0; $i < 100000; $i++) {
        if ($a === stripslashes(addslashes($a)))
            $a .= chr($i%256);
        else {
            echo "error at i=".$i."\n";
            return;
        }
    }
}
the execution time goes from 21.619s to 8.139s (165% speedup) on an A1 Graviton instance.

When removing the characters that need escaping, i.e., this benchmark:
function simple_string() {
  $a = "testasdasd asdasdfasdf";
  for ($i = 0; $i < 10000; $i++) {
      if ($a === stripslashes(addslashes($a)))
          $a .= "test dedeasdf";
      else {
          echo "error at i=".$i."\n";
          return;
      }
  }
}
the execution time goes from 2.932s down to 0.516s (468% speedup) on an A1 Graviton instance.
2019-07-15 11:35:08 +03:00
Nikita Popov a520c24269 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-15 10:29:37 +02:00
Nikita Popov 3eb057c4a7 Merge branch 'PHP-7.2' into PHP-7.3 2019-07-15 10:23:51 +02:00
Andrew Collington 768ad70f70 Fix bug #78291 Missing opcache directives
New opcache directives have been added recently which are returned
if using `ini_get_all('zend opcache')` but are not listed in the
directives if using `opcache_get_configuration()`.  This fix adds
those missing directives as well as if `opcache.mmap_base` is used
instead of `opcache.lockfile_path`.  Also adds a test to ensure the
directives match with both methods of fetching.
2019-07-15 10:22:47 +02:00
Peter Kokot 93b3d2f6ee Remove usage of PHP_AIX_LDFLAGS
These are currently not defined since their usage has been removed via
51ca2dba53
and
53349d69dd
2019-07-14 23:44:01 +02:00
Peter Kokot 94421e5724 Remove conditional calls of always available macros
These checks were once relevant for these extensions in PECL and PHP
versions without availability of the checked macros.

Closes GH-4405
2019-07-14 22:24:21 +02:00
Peter Kokot e39296d10b Remove unsed zts check for sqlite3
This check was relevant with bundled sqlite library. Removed via
6083a387a8

Closes GH-4403
2019-07-14 21:06:15 +02:00
Peter Kokot 66c02cc0a1 Remove duplicate PTHREADS template define
The undef PTHREADS converts to define if thread safety is configured.
This step is already done by pthreads m4 macros from TSRM so this now
removes duplicated PTHREADS defines from php_config.h.
2019-07-14 14:45:27 +02:00
Peter Kokot c72d6da461 Remove timelib outdated defines
- TIMELIB_OMIT_STDINT is not used anymore since
  https://github.com/derickr/timelib/commit/a171f99cf02baf39549ab7209e37565b8b8f6529
- HAVE_GETTIMEOFDAY was defined multiple times in Windows headers
- ext/date/lib/timelib_config.h.win32 does not seem to be used

Closes GH-4400
2019-07-14 13:50:05 +02:00
Peter Kokot 7a6d737de7 Remove PHP_MYSQL variable
PHP_MYSQL variable was once defined by the ext/mysql (--with-mysql).

Closes GH-4399
2019-07-14 13:48:44 +02:00
Peter Kokot f573ba1948 Update changelogs
- PHP-7.4 alpha, beta, RC versions already include bugs logged in the
  NEWS
- some links to RFCs
- php_error_docref0
2019-07-13 15:37:36 +02:00
Peter Kokot 4e0af6d862 Remove php_multiple_shlib_versions_ok
Variable usage was removed via
913cec6551
2019-07-13 15:06:35 +02:00
Peter Kokot f3cf8966be Remove unused recode extension artefacts
Closes GH-4395
2019-07-13 14:52:36 +02:00
Peter Kokot f5e4771824 Remove checks for always enabled spl and pcre
Closes GH-4397
2019-07-13 14:47:37 +02:00
Peter Kokot 499f2ac132 Remove WARNING_LEVEL fix for QNX
Fix is no longer relevant since the environment variable WARNING_LEVEL
is no longer used to define the value of the -w option for cc.

Closes GH-4398
2019-07-13 14:39:29 +02:00
Christoph M. Becker 8c76d898a9 Fix #78283: no output for explicit environment
This test does not work on Windows, if the child process has OPcache
enabled via php.ini, since TEMP is not set in the environment, so
OPcache can't find the base address file, and terminates the childs.

To avoid this (and potentially some other issues regarding missing
environment variables, such as PATH), we force the child process to
ignore any ini files.
2019-07-13 12:03:03 +02:00
Christoph M. Becker bf242d58e7 Fix #78282: atime and mtime mismatch
The fix for bug #78241 assumed that `time_t` would always be 64bit, but
actually is 32bit for x86.  We therefore enforce 64bit arithmetic to
avoid wrapping.
2019-07-13 09:44:46 +02:00
George Peter Banyard 1c1de0c41a Convert all php_error_docref0 to php_error_docref
Closes GH-4394
2019-07-13 02:05:17 +02:00
Peter Kokot 33994ebd95 Remove tsrm_config_common.h
- Checks and defines are not relevant for files that include it anymore
- Some code is not used anymore
- Defines are a bit duplicated in zend_portability.h and TSRM.h file
- MAXPATHLEN defs moved to zend_virtual_cwd.h
2019-07-13 01:58:01 +02:00
Christoph M. Becker a6fa097ceb No more need to cater to pre-PHP-5.3 or PHP-6 versions 2019-07-12 18:55:34 +02:00
Nikita Popov 0d568b9fd5 Don't split T_INLINE_HTML at partial PHP tag
If <?php occurs without required trailing whitespace, we should keep
it as part of a single T_INLINE_HTML region.
2019-07-12 17:22:11 +02:00
Nikita Popov 79b5b1a97f Merge branch 'PHP-7.3' into PHP-7.4 2019-07-12 16:51:52 +02:00
Nikita Popov 3f73916f10 Merge branch 'PHP-7.2' into PHP-7.3 2019-07-12 16:51:47 +02:00
Nikita Popov a7de2af46c Use TRY_ADDREF/TRY_DELREF in soap
The DELREF part is a possible fix for bug #78278, the ADDREF part
is a drive-by fix.
2019-07-12 16:50:43 +02:00
Nikita Popov 608f2112e9 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-12 16:30:47 +02:00
Nikita Popov 9d141f9889 Merge branch 'PHP-7.2' into PHP-7.3 2019-07-12 16:30:33 +02:00
Nikita Popov 4a91f66b8f Fixed bug #78279
Even if we don't initialize the callback on every request, we
should still reset our globals to default values...
2019-07-12 16:29:18 +02:00
Christoph M. Becker 76783a9bcc Update NEWS and UPGRADING wrt. ext/recode unbundling 2019-07-12 14:35:44 +02:00
Christoph M. Becker 58b607c9ea Removed ext/recode
Cf. <https://wiki.php.net/rfc/unbundle_recode>.
2019-07-12 13:58:17 +02:00
Christoph M. Becker 8aa7865997 Swap implode() argument order in the test helper 2019-07-12 13:26:54 +02:00
Nikita Popov e2c3bc80e3 Remove duplicate XtOffsetOf() definitions in php.h
These are already defined in zend_portability.h.
2019-07-12 13:18:18 +02:00
Nikita Popov 709897c2a5 Remove unused tsrm_strtok_r() function
There is also a php_strtok_r() function, which is actually used,
but nothing uses the tsrm_strtok_r() variant...
2019-07-12 13:14:24 +02:00
Nikita Popov 94d37a5dd7 Remove unnecessary uses of allow_url_include in tests 2019-07-12 12:54:34 +02:00
Nikita Popov 9345c191db Remove unnecessary uses of restore_include_path() in tests 2019-07-12 12:54:26 +02:00
Nikita Popov 2e56e14e39 Swap implode() argument order in some tests 2019-07-12 12:54:10 +02:00
Nikita Popov 9a274de4f4 Improve bless_tests
If a string var_dump contains a wildcard, also make the length a
wildcard.
2019-07-12 12:54:01 +02:00
Dmitry Stogov 0793af0673 Use common code for double math 2019-07-12 11:40:56 +03:00
Christoph M. Becker d0d02ecc4e Revert "Temporarily skip test"
This reverts commit 4e5a717866.

As of commit 17f7fb7605 the test should
no longer hang.
2019-07-11 23:33:34 +02:00
Dmitry Stogov 350f2212ff Allow GOTO style helpers in HYBRID VM 2019-07-12 00:00:55 +03:00
Dmitry Stogov ef1a1a0698 Separate "cold" parts of comparison instructions 2019-07-11 20:44:39 +03:00
Dmitry Stogov be94c0c3c6 Separate "cold" parts of binary op instructions 2019-07-11 18:23:08 +03:00
Nikita Popov 59852c0321 Remove redundant 64-bit ezmlm_hash() test
This test is the same as the as ezmlm_hash_basic.phpt. This function
does not behave differently on 32-bit and 64-bit.
2019-07-11 17:09:18 +02:00
Nikita Popov cbda1b1c6a Add ZEND_DEP_ME macro 2019-07-11 17:09:03 +02:00
George Peter Banyard e6c2b28865 Convert short tag to standard tag in Zend test file
Closes GH-4389.
2019-07-11 16:20:05 +02:00
Nikita Popov 17f7fb7605 Switch to using shell-less proc_open() in various server tests 2019-07-11 15:48:10 +02:00
Nikita Popov 6285bb52fa Support redirect+null descriptors in proc_open
This adds support for doing something like:

    [1 => ['pipe', 'w'], 2 => ['redirect', 1]]

This will make descriptor 2 on the child end a dup'd descriptor 1.
This is mainly useful in conjunction with shell-less mode, because
we don't have an easy way to do "2>&1" there.

Additionally we support:

    [1 => ['pipe', 'w'], 2 => ['null']]

Which would be the same as a >/dev/null or >nul redirect, depending
on platform.
2019-07-11 15:48:10 +02:00
Nikita Popov 42cac9d7d7 Don't call Reflection::export() internally
export() methods were implemented in a roundabout way, where they
would call Reflection::export(), which would then call __toString().
Cut out the middleman by directly calling __toString().
2019-07-11 14:14:55 +02:00
Christoph M. Becker 17997a908d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78212: Segfault in built-in webserver
2019-07-11 13:11:08 +02:00
Christoph M. Becker fa65f5ecf5 Fix #78212: Segfault in built-in webserver
Since syslog's ident and facility parameters have been added to
config[1], vsyslog() segfaults on Windows, if openlog() has not been
called before.  We bring back the removed lines to fix this.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=2475337bd8a0fad0dac03db3f5e7e9d331d53653>
2019-07-11 13:09:54 +02:00
Nikita Popov c02dfddda3 Include test name in JUnit testcase name
Azure does not show the classname attribute in any convenient way,
and the file name is the part we usually care about.
2019-07-11 12:46:56 +02:00
Nikita Popov d20fc5a192 Make proc_open_bug64438.phpt more robust
The test currently assumes that we'll first read the data of
stdout and stderr and then see eof on stdout and stderr. However
we could also read stdout, see eof on stdout, read stderr and see
eof on stderr, depending on timing.

Avoid output ordering issues by collecting events into a per-pipe
array, so interleaving is not visible.
2019-07-11 12:46:56 +02:00
Sebastian Pop 3b73c9fb86 neon vectorization for base64
A similar algorithm is used to vectorize on x86_64, with a good description in
https://arxiv.org/abs/1704.00605 . On AArch64 the implementation differs in that
instead of using multiplies to shift bits around, it uses the vld3+vst4 and
vld4+vst3 combinations to load and store interleaved data.  This patch is based
on the NEON implementation of Wojciech Mula:
https://github.com/WojciechMula/base64simd/blob/master/encode/encode.neon.cpp
https://github.com/WojciechMula/base64simd/blob/master/encode/lookup.neon.cpp
and
https://github.com/WojciechMula/base64simd/blob/master/encode/encode.neon.cpp
https://github.com/WojciechMula/base64simd/blob/master/encode/encode.neon.cpp
adapted to php/ext/standard/base64.c and vectorized with factor 16 instead of 8.

On a Graviton A1 instance and on the synthetic benchmarks in
https://github.com/lemire/fastbase64 I see 175% speedup on base64 encoding and
60% speedup on base64 decode compared to the scalar implementation.

The patch passes `make test` regression testing on aarch64-linux.
2019-07-11 12:04:29 +03:00
Sebastian Pop 2a535a9707 [AArch64] Use crc32 instructions when available
The time goes from 0.838s down to 0.029s (a 28x speedup) on a Graviton A1
instance and the following benchmark:

function simple_crc32() {
  $a = "foo";
  for ($i = 0; $i < 10000; $i++) {
      crc32($a);
      $a .= "o".$i;
  }
}
2019-07-11 10:29:45 +02:00
Nikita Popov ba8c4894d8 Add server conflict to soap custom content type test 2019-07-11 10:26:53 +02:00
Peter Kokot a6daded1a4 Refactor undefining PACKAGE_* symbols
Instead of patching configuration headers template generated by
the given tools - autoheader, this moves patching these symbols to
the configure step before creating and invoking the config.status
and before the configuration header file is generated from the
patched template.

Closes GH-4374
2019-07-11 02:00:51 +02:00
Peter Kokot d63fdced2e Remove TSRM/tsrm_config.w32.h
The tsrm_config.w32.h file is a simple wrapper for already defined
symbols and includes elsewhere.

Closes GH-4383
2019-07-10 21:19:44 +02:00
Dmitry Stogov 0e3d4911fa Set expectation to reduce hot code fragmentation 2019-07-10 18:29:35 +03:00
Nikita Popov a54ee8a947 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-10 17:28:37 +02:00
Nikita Popov e7a83ec8df Fix bug #78271
When cleaning nops in the dfa pass, we were always keeping the
smart branch inhibiting nop that occurs directly before the jump
instruction. However, as we skip unreachable blocks entirely, it
may happen that we need to keep a nop that occurs further back,
prior to the unreachable blocks. Account for that case now.

We should really do something about the smart branch situation,
this is very fragile...
2019-07-10 17:25:40 +02:00
Cyril Pascal 6791107319 Align segments on huge page boundary only for x86
Closes GH-4387.
2019-07-10 15:19:24 +02:00
Nikita Popov ee18687f97 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-10 13:10:07 +02:00
Nikita Popov 3fa9f9cfae Add CONFLICTS to recognized sections
It does nothing on 7.3, but this makes it easier to write tests in
3rd party extensions.
2019-07-10 13:09:06 +02:00
Nikita Popov 07bbc54658 Fix file collisions in phar tests 2019-07-10 12:55:40 +02:00
Nikita Popov 852e35317d Additional fix for mysqli_fork test 2019-07-10 12:42:17 +02:00
Nikita Popov c42b7dd6d3 Throw notice on array access on illegal type
No notice is thrown for list() accesses, because we did not come
to an agreement regarding patterns like

    while ([$key, $value] = yield $it->next()) { ... }

where silent null access may be desirable.

No effort is made to suppress multiple notices in access chains
likes $x[0][0][0], because the technical complexity this causes
does not seem worthwhile.

RFC: https://wiki.php.net/rfc/notice-for-non-valid-array-container
2019-07-10 12:02:14 +02:00
Nikita Popov a63422029e Fix invalid array access in mysqli_fork test 2019-07-10 11:59:27 +02:00
Dmitry Stogov d57d74b271 Reduce cost for references to strings and resources 2019-07-10 12:27:59 +03:00
Nikita Popov 2bca35eacc Rename support_strings to !is_list
In preparation for more behavior that depends on whether it it is
a list() access. Using support_strings for that would be
confusing.
2019-07-10 11:10:17 +02:00
Nikita Popov 0c450967e1 Simplify two unserialize() tests
unserialize() returns false for these now, so it doesn't make sense
to try and do something with the result.
2019-07-10 11:09:54 +02:00
Nikita Popov a207b3574b Fix iteration limits in SXE test
Test doesn't look like it's specifically testing out of bounds
access, just two different iteration patterns, so make sure the
limits are correct.
2019-07-10 11:09:47 +02:00
Nikita Popov 9d82a01d01 Clean up DateTimeZone::getLocation() test
And avoid invalid array access.
2019-07-10 11:09:41 +02:00
Nikita Popov dfe5fd2a37 Avoid invalid array access in fcgi.inc 2019-07-10 11:09:34 +02:00
Remi Collet db0eaa8cf1 improve libargon2/libsodium compatibility 2019-07-10 09:00:41 +02:00
Peter Kokot 48abed7fd8 Use e.g. instead of less common f.e. [ci skip] 2019-07-09 17:53:46 +02:00
Sara Golemon f65956e4fb Relax argon2 mem_cost down to 64k, bump time_cost to 4 2019-07-09 11:36:48 -04:00
David Carlier aa0e29a668 CGI: Fix memory leak on error paths 2019-07-09 16:19:41 +02:00
Dmitry Stogov 8f0c87e1b6 Avoid unintended inlining 2019-07-09 14:01:48 +03:00
Nikita Popov ba05b2c6b0 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-09 11:05:54 +02:00
Nikita Popov 825f47564a Merge branch 'PHP-7.2' into PHP-7.3 2019-07-09 11:05:18 +02:00
Nikita Popov 22ed362810 Revert "Fixed bug #76980"
This reverts commit 35353dc49a.

This changes causes issues for Symfony, see
https://github.com/symfony/symfony/issues/32395. I'm reverting it
from PHP 7.2 and PHP 7.3 and only leaving it in PHP 7.4.
2019-07-09 11:04:16 +02:00
Derick Rethans 432ad35b55 Merge remote-tracking branch 'origin/PHP-7.4' into PHP-7.4 2019-07-09 09:14:01 +01:00
Christoph M. Becker 726c07e9af Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Upgrade to SQLite 3.28.0
2019-07-09 10:08:09 +02:00
Christoph M. Becker 7404d756e9 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Upgrade to SQLite 3.28.0
2019-07-09 10:04:41 +02:00
Christoph M. Becker 40f7533cc1 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Upgrade to SQLite 3.28.0
2019-07-09 10:02:47 +02:00
Christoph M. Becker e944ae6b2a Upgrade to SQLite 3.28.0
Over the years, multiple security vulnerabilities[1] have been found
and fixed in SQLite3, so it makes sense to update our bundled libsqlite
to the latest available version.

[1] <https://www.cvedetails.com/vulnerability-list/vendor_id-9237/Sqlite.html>
2019-07-09 09:59:46 +02:00
Dmitry Stogov e1f418dd18 Remove duplicated code for (PRE|POST)_DEC_(OBJ|STATIC_PROP) opcodes 2019-07-09 10:46:04 +03:00
Derick Rethans 086b476c27 Update NEWS for 7.4.0beta1 2019-07-09 07:41:09 +00:00
559 changed files with 14132 additions and 13862 deletions

No files matched your search

+1 -1
View File
@@ -33,7 +33,7 @@ environment:
PARALLEL: -j2
- THREAD_SAFE: 1
OPCACHE: 1
PARALLEL:
PARALLEL: -j2
INTRINSICS: AVX
services:
+1 -1
View File
@@ -9,7 +9,7 @@ end_of_line = lf
charset = utf-8
tab_width = 4
[{*.{awk,bat,c,cpp,d,h,l,mk,re,skl,w32,y},Makefile*}]
[{*.{awk,bat,c,cpp,d,h,l,re,skl,w32,y},Makefile*}]
indent_size = 4
indent_style = tab
-1
View File
@@ -1,5 +1,4 @@
# Replace $Id$ strings with 40-character hexadecimal blob object name.
/ext/mysqlnd/mysqlnd.h ident
/ext/ext_skel.php ident
/ext/phar/phar/pharcommand.inc ident
/ext/dba/libinifile/inifile.c ident
+1 -1
View File
@@ -208,7 +208,7 @@ php
/win32/*.positions
/win32/*.suo
/win32/ext
/win32/phpts.def
/win32/syslog.reg
/win32/wsyslog.h
# Standard object files generated by Visual Studio
-1
View File
@@ -16,7 +16,6 @@ addons:
- libenchant-dev
- libaspell-dev
- libpspell-dev
- librecode-dev
- libsasl2-dev
- libxpm-dev
- libzip-dev
-5
View File
@@ -429,11 +429,6 @@ PRIMARY MAINTAINER: Unkown
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: recode
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de> (2000 - 2000)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: reflection
PRIMARY MAINTAINER: Marcus Börger <helly@php.net> (2003 - 2009)
Johannes Schlüter <johannes@php.net> (2006 - 2014)
+86
View File
@@ -1,5 +1,91 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
08 Aug 2019, PHP 7.4.0beta2
- Core:
. Fixed bug #78340 (Include of stream wrapper not reading whole file).
(Nikita)
. Fixed bug #78344 (Segmentation fault on zend_check_protected). (Nikita)
. Fixed bug #78356 (Array returned from ArrayAccess is incorrectly unpacked
as argument). (Nikita)
- Exif:
. Fixed bug #78333 (Exif crash (bus error) due to wrong alignment and
invalid cast). (Nikita)
. Fixed bug #78256 (heap-buffer-overflow on exif_process_user_comment).
(CVE-2019-11042) (Stas)
. Fixed bug #78222 (heap-buffer-overflow on exif_scan_thumbnail).
(CVE-2019-11041) (Stas)
- Iconv:
. Fixed bug #78342 (Bus error in configure test for iconv //IGNORE). (Rainer
Jung)
- MySQLnd:
. Fixed bug #78179 (MariaDB server version incorrectly detected). (cmb)
. Fixed bug #78213 (Empty row pocket). (cmb)
- Opcache:
. Fixed bug #78341 (Failure to detect smart branch in DFA pass). (Nikita)
. Fixed bug #78376 (Incorrect preloading of constant static properties).
(Dmitry)
- PCRE:
. Fixed bug #78338 (Array cross-border reading in PCRE). (cmb)
- PDO_Sqlite:
. Fixed bug #78348 (Remove -lrt from pdo_sqlite.so). (Peter Kokot)
- Phar:
. Fixed bug #77919 (Potential UAF in Phar RSHUTDOWN). (cmb)
- Standard:
. Fixed bug #78326 (improper memory deallocation on stream_get_contents()
with fixed length buffer). (Albert Casademont)
. Fixed bug #78346 (strip_tags no longer handling nested php tags). (cmb)
25 Jul 2019, PHP 7.4.0beta1
- Core:
. Fixed bug #78212 (Segfault in built-in webserver). (cmb)
. Fixed bug #60677 (CGI doesn't properly validate shebang line contains #!).
(Nikita)
. Fixed bug #78066 (PHP eats the first byte of a program that comes from
process substitution). (Nikita)
. Fixed bug #52752 (Crash when lexing). (Nikita)
. Implemented RFC: Deprecate curly brace syntax for accessing array elements
and string offsets.
https://wiki.php.net/rfc/deprecate_curly_braces_array_access (Andrey Gromov)
. Implemented RFC: Deprecations for PHP 7.4.
https://wiki.php.net/rfc/deprecations_php_7_4 (Kalle, Nikita)
- GD:
. Fixed bug #78314 (missing freetype support/functions with external gd).
(Remi)
- Libxml:
. Fixed bug #78279 (libxml_disable_entity_loader settings is shared between
requests (cgi-fcgi)). (Nikita)
- LiteSpeed:
. Updated to LiteSpeed SAPI V7.5 (Fixed clean shutdown). (George Wang)
- Opcache:
. Fixed bug #78271 (Invalid result of if-else). (Nikita)
. Added new INI directive opcache.cache_id (Windows only). (cmb)
- PDO:
. Implemented FR #71885 (Allow escaping question mark placeholders).
https://wiki.php.net/rfc/pdo_escape_placeholders (Matteo)
- Recode:
. Unbundled the recode extension. (cmb)
- Standard:
. Fixed bug #78282 (atime and mtime mismatch). (cmb)
. Fixed bug #73535 (php_sockop_write() returns 0 on error, can be used to
trigger Denial of Service). (Nikita)
11 Jul 2019, PHP 7.4.0alpha3
- Core:
+1 -1
View File
@@ -15,7 +15,7 @@
#if !defined(__CYGWIN__) && defined(WIN32)
# define TSRM_WIN32
# include "tsrm_config.w32.h"
# include "Zend/zend_config.w32.h"
#else
# include "main/php_config.h"
#endif
+1 -1
View File
@@ -1,4 +1,4 @@
// vim:ft=javascript
ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_win32.c");
ADD_SOURCES("TSRM", "TSRM.c tsrm_win32.c");
ADD_FLAG("CFLAGS_BD_TSRM", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
-14
View File
@@ -1,14 +0,0 @@
#ifndef TSRM_CONFIG_W32_H
#define TSRM_CONFIG_W32_H
#include <../main/config.w32.h>
#include "Zend/zend_config.w32.h"
#define HAVE_UTIME 1
#define HAVE_ALLOCA 1
#include <malloc.h>
#include <stdlib.h>
#include <crtdbg.h>
#endif
-69
View File
@@ -1,69 +0,0 @@
#ifndef TSRM_CONFIG_COMMON_H
#define TSRM_CONFIG_COMMON_H
#ifndef __CYGWIN__
# ifdef _WIN32
# define TSRM_WIN32
# endif
#endif
#ifdef TSRM_WIN32
# include "tsrm_config.w32.h"
#else
# include "main/php_config.h"
# include <sys/param.h>
#endif
#if HAVE_ALLOCA_H && !defined(_ALLOCA_H)
# include <alloca.h>
#endif
/* AIX requires this to be the first thing in the file. */
#ifndef __GNUC__
# ifndef HAVE_ALLOCA_H
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
# endif
# endif
# endif
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <limits.h>
#ifndef MAXPATHLEN
# if _WIN32
# include "win32/ioutil.h"
# define MAXPATHLEN PHP_WIN32_IOUTIL_MAXPATHLEN
# elif PATH_MAX
# define MAXPATHLEN PATH_MAX
# elif defined(MAX_PATH)
# define MAXPATHLEN MAX_PATH
# else
# define MAXPATHLEN 256
# endif
#endif
#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2))
# define TSRM_ALLOCA_MAX_SIZE 4096
# define TSRM_ALLOCA_FLAG(name) \
int name;
# define tsrm_do_alloca_ex(size, limit, use_heap) \
((use_heap = ((size) > (limit))) ? malloc(size) : alloca(size))
# define tsrm_do_alloca(size, use_heap) \
tsrm_do_alloca_ex(size, TSRM_ALLOCA_MAX_SIZE, use_heap)
# define tsrm_free_alloca(p, use_heap) \
do { if (use_heap) free(p); } while (0)
#else
# define TSRM_ALLOCA_FLAG(name)
# define tsrm_do_alloca(p, use_heap) malloc(p)
# define tsrm_free_alloca(p, use_heap) free(p)
#endif
#endif /* TSRM_CONFIG_COMMON_H */
-63
View File
@@ -1,63 +0,0 @@
#include <stdio.h>
#include "tsrm_config_common.h"
#include "tsrm_strtok_r.h"
static inline int in_character_class(char ch, const char *delim)
{/*{{{*/
while (*delim) {
if (*delim == ch) {
return 1;
}
delim++;
}
return 0;
}/*}}}*/
TSRM_API char *tsrm_strtok_r(char *s, const char *delim, char **last)
{/*{{{*/
char *token;
if (s == NULL) {
s = *last;
}
while (*s && in_character_class(*s, delim)) {
s++;
}
if (!*s) {
return NULL;
}
token = s;
while (*s && !in_character_class(*s, delim)) {
s++;
}
if (!*s) {
*last = s;
} else {
*s = '\0';
*last = s + 1;
}
return token;
}/*}}}*/
#if 0
main()
{
char foo[] = "/foo/bar//\\barbara";
char *last;
char *token;
token = tsrm_strtok_r(foo, "/\\", &last);
while (token) {
printf ("Token = '%s'\n", token);
token = tsrm_strtok_r(NULL, "/\\", &last);
}
return 0;
}
#endif
-8
View File
@@ -1,8 +0,0 @@
#ifndef TSRM_STRTOK_R
#define TSRM_STRTOK_R
#include "TSRM.h"
TSRM_API char *tsrm_strtok_r(char *s, const char *delim, char **last);
#endif
+1 -1
View File
@@ -769,7 +769,7 @@ static zend_always_inline void UnixTimeToFileTime(time_t t, LPFILETIME pft) /* {
// Note that LONGLONG is a 64-bit value
LONGLONG ll;
ll = t * 10000000 + 116444736000000000;
ll = t * 10000000LL + 116444736000000000LL;
pft->dwLowDateTime = (DWORD)ll;
pft->dwHighDateTime = ll >> 32;
}
+111 -37
View File
@@ -22,6 +22,10 @@ PHP 7.4 UPGRADE NOTES
========================================
- Core:
. Trying to use values of type null, bool, int, float or resource as an
array (such as $null["key"]) will now generate a notice. This does not
affect array accesses performed by list().
RFC: https://wiki.php.net/rfc/notice-for-non-valid-array-container
. get_declared_classes() no longer returns anonymous classes that haven't
been instantiated yet.
. "fn" is now a reserved keyword. In particular it can no longer be used as a
@@ -30,7 +34,10 @@ PHP 7.4 UPGRADE NOTES
. Passing the result of a (non-reference) list() assignment by reference is
consistently disallowed now. Previously this worked if the right hand side
was a simple (CV) variable and did not occur as part of the list().
. Added --ini-path and --ini-dir options to php-config.
. `<?php` at the end of the file (without trailing newline) will now be
interpreted as an opening PHP tag. Previously it was interpreted either as
`<? php` and resulted in a syntax error (with short_open_tag=1) or was
interpreted as a literal `<?php` string (with short_open_tag=0).
- BCMath:
. BCMath functions will now warn if a non well-formed number is passed, such
@@ -65,8 +72,8 @@ PHP 7.4 UPGRADE NOTES
- Openssl:
. The openssl_random_pseudo_bytes() function will now throw an exception in
error situations, similar to random_bytes(). In particular, an Error is
thrown if the number of requested bytes is smaller *or equal* than zero,
and an Exception is thrown is sufficient randomness cannot be gathered.
thrown if the number of requested bytes is less than *or equal to* zero,
and an Exception is thrown if sufficient randomness cannot be gathered.
The $crypto_strong output argument is guaranteed to always be true if the
function does not throw, so explicitly checking it is not necessary.
RFC: http://php.net/manual/de/function.openssl-random-pseudo-bytes.php
@@ -128,6 +135,19 @@ PHP 7.4 UPGRADE NOTES
Applications correctly using the constants PASSWORD_DEFAULT,
PASSWORD_BCRYPT, PASSWORD_ARGON2I, and PASSWORD_ARGON2ID will continue to
function correctly.
. htmlentities() will now throw a notice (instead of a strict standards
warning) if it is used with an encoding for which only basic entity
substitution is supported, in which case it is equivalent to
htmlspecialchars().
. fread() and fwrite() will now return false if the operation failed.
Previously an empty string or 0 was returned. EAGAIN/EWOULDBLOCK are not
considered failures.
. fread() and fwrite() on plain files will now throw a notice on failure,
such as when trying to write to a read-only file resource.
- Tokenizer:
. token_get_all() will now emit a T_BAD_CHARACTER token for unexpected
characters instead of leaving behind holes in the token stream.
========================================
2. New Features
@@ -141,7 +161,7 @@ PHP 7.4 UPGRADE NOTES
public string $name;
}
This will enforce that $user->id can only be assigned integer and
This will enforce that $user->id can only be assigned integers and
$user->name can only be assigned strings. For more information see the
RFC: https://wiki.php.net/rfc/typed_properties_v2
@@ -226,7 +246,7 @@ PHP 7.4 UPGRADE NOTES
imagefilter($im, IMG_FILTER_SCATTER, int $sub, int $plus, array $colors = []);
The $colors array can be populated with a set of indexed colors where to
The $colors array can be populated with a set of indexed colors to
apply the scatter pixel shifting on.
Note, the result of this filter is always random.
@@ -236,7 +256,7 @@ PHP 7.4 UPGRADE NOTES
used by storage systems, such as iSCSI, SCTP, Btrfs and ext4.
- Mbstring:
. Added mb_str_split() function, which provide the same functionality as
. Added mb_str_split() function, which provides the same functionality as
str_split(), but operating on code points rather than bytes.
RFC: https://wiki.php.net/rfc/mb_str_split
@@ -262,8 +282,8 @@ PHP 7.4 UPGRADE NOTES
. PDOStatement::getColumnMeta() is now available
- PDO_SQLite:
. PDOStatement::getAttribute(PDO::SQLITE_ATTR_READONLY_STATEMENT) allows to
check whether this statement is read-only, i.e. whether it doesn't modify
. PDOStatement::getAttribute(PDO::SQLITE_ATTR_READONLY_STATEMENT) allows
checking whether the statement is read-only, i.e. if it doesn't modify
the database.
. PDO::setAttribute(PDO::SQLITE_ATTR_EXTENDED_RESULT_CODES, true) enables the
use of SQLite3 extended result codes in errorInfo().
@@ -302,6 +322,13 @@ PHP 7.4 UPGRADE NOTES
proc_open(['php', '-r', 'echo "Hello World\n";'], $descriptors, $pipes);
. proc_open() now supports "redirect" and "null" descriptors. For example:
// Like 2>&1 on the shell
proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['redirect', 1]], $pipes);
// Like 2>/dev/null or 2>nul on the shell
proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['null']], $pipes);
. password_hash() has argon2i(d) implementations from ext/sodium when PHP is
built without libargon.
@@ -326,22 +353,35 @@ PHP 7.4 UPGRADE NOTES
$a ? $b : ($c ? $d : $e)
RFC: https://wiki.php.net/rfc/ternary_associativity
. The array and string offset access syntax using curly braces is deprecated.
Use $str[$idx] instead of $str{$idx}.
RFC: https://wiki.php.net/rfc/deprecate_curly_braces_array_access
. The (real) cast is deprecated, use (float) instead.
. Unbinding $this of a non-static method through a combination of
ReflectionMethod::getClosure() and closure rebinding is deprecated. Doing
so is equivalent to calling a non-static method statically, which has been
deprecated since PHP 7.0.
. Using "parent" inside a class without parent is deprecated, and will throw
. Unbinding $this of a non-static closure is deprecated.
. Using "parent" inside a class without a parent is deprecated, and will throw
a compile-time error in the future. Currently an error will only be
generated if/when the parent is accessed at run-time.
. The allow_url_include ini directive is deprecated. Enabling it will generate
a deprecation notice at startup.
- COM:
. Importing type libraries with case-insensitive constant registering has been
deprecated.
- Filter:
. FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES
instead.
- Mbstring:
. Passing a non-string pattern to mb_ereg_replace() is deprecated. Currently
non-string patterns are interpreted as ASCII codepoints. In PHP 8 the
pattern will be interpreted as a string instead.
. Passing the encoding as 3rd parameter to mb_strrpos() is deprecated. Instead
pass a 0 offset and encoding as 4th parameter.
- LDAP:
. ldap_control_paged_result_response and ldap_control_paged_result are
@@ -352,6 +392,13 @@ PHP 7.4 UPGRADE NOTES
This method has been deprecated in favor of ReflectionNamedType::getName()
in the documentation since PHP 7.1, but did not throw a deprecation notice
for technical reasons.
. The export() methods on all Reflection classes are deprecated. Construct a
Reflection object and convert it to string instead:
// ReflectionClass::export(Foo::class, false) is:
echo new ReflectionClass(Foo::class), "\n";
// $str = ReflectionClass::export(Foo::class, true) is:
$str = (string) new ReflectionClass(Foo::class);
- Standard:
. Passing invalid characters to ''base_convert()'', ''bindec()'', ''octdec()''
@@ -359,6 +406,22 @@ PHP 7.4 UPGRADE NOTES
still be computed as if the invalid characters did not exist. Leading and
trailing whitespace, as well as prefixes of type 0x (depending on base)
continue to be allowed.
. Using array_key_exists() on objects is deprecated. Instead either isset()
or property_exists() should be used.
. The is_real() function is deprecated, use is_float() instead.
. The get_magic_quotes_gpc() and get_magic_quotes_runtime() functions are
deprecated. They always return false.
. The hebrevc() function is deprecated. It can be replaced with
nl2br(hebrev($str)), or preferably the use of Unicode RTL support.
. The convert_cyr_string() function is deprecated. It can be replaced by one
of mb_convert_string(), iconv() or UConverter.
. The money_format() function is deprecated. It can be replaced by the
intl NumberFormatter functionality.
. The ezmlm_hash() function is deprecated.
. The restore_include_path() function is deprecated. It can be replaced by
ini_restore('include_path').
. Passing parameters to implode() in reverse order is deprecated, use
implode($glue, $parts) instead of implode($parts, $glue).
========================================
5. Changed Functions
@@ -392,7 +455,7 @@ PHP 7.4 UPGRADE NOTES
ArrayObject.
- GD:
. Added imagecreatefromtga() function, which allows to read images in TGA
. Added imagecreatefromtga() function, which allows reading images in TGA
format. TGA support is now also indicated by gd_info() and imagetypes().
Note that TGA images are not recognized by imagecreatefromstring() and
getimagesize().
@@ -404,22 +467,22 @@ PHP 7.4 UPGRADE NOTES
See <https://github.com/php/php-src/pull/3624>.
- Pcntl:
. Added bool pcntl_unshare(int flags) function which allows to dissociate
. Added bool pcntl_unshare(int flags) function which allows dissociating
parts of the process execution context which are currently being shared with
other processes. Explicitly, it allows you to unshare the mount, IPC, UTS,
network, PID, user and cgroup namespaces.
- SQLite3:
. Added SQLite3Stmt::getSQL() to retrieve the SQL of the statement. If TRUE is
passed as parameter, query parameters will be replaced in the return value
by their currently bound value, if libsqlite ≥ 3.14 is used.
. Added SQLite3Stmt::getSQL() to retrieve the SQL of the statement. If true is
passed as $expanded argument, query parameters will be replaced in the
return value by their currently bound value, if libsqlite ≥ 3.14 is used.
. Added SQLite3::backup() to create database backups via the SQLite3 online
backup API.
- Standard
. bool sapi_windows_set_ctrl_handler(callable handler, [, bool add = true]) -
set or remove a handler function upon receiving a CTRL event. The handler
function is expected have a signature "function handler(int $event)".
function is expected to have this signature: "function handler(int $event)".
. bool sapi_windows_generate_ctrl_event(int type, int pid) - send a CTRL event
to another process.
. array password_algos() - return a complete list of all registered password
@@ -445,6 +508,11 @@ PHP 7.4 UPGRADE NOTES
extension. For more details see the RFC:
https://wiki.php.net/rfc/deprecate-and-remove-ext-interbase
- Recode:
. The recode extension has been moved to PECL. For character set/encoding
conversion the iconv or mbstring extensions could be used instead.
RFC: https://wiki.php.net/rfc/unbundle_recode
- WDDX:
. The WDDX extension has been deprecated and moved to PECL.
RFC: https://wiki.php.net/rfc/deprecate-and-remove-ext-wddx
@@ -468,8 +536,8 @@ PHP 7.4 UPGRADE NOTES
can now reliably be built as shared when using ./configure once more.
- Hash:
. The hash extension cannot be disabled anymore and is always an integral
part of any PHP build, similar to the date extension.
. The hash extension cannot be disabled anymore and is always an integral part
of any PHP build, similar to the date extension.
- Intl:
. The Intl extension now requires at least ICU 50.1.
@@ -487,6 +555,13 @@ PHP 7.4 UPGRADE NOTES
. The --disable-opcache-file|--enable-opcache-file configure options have been
removed in favor of the opcache.file_cache INI directive.
- PDO:
. It is now possible to escape question marks in SQL queries to avoid them
being interpreted as parameter placeholders. Writing "??" allows sending
a single question mark to the database and e.g. use the PostgreSQL JSON key
exists "?" operator. For more details see the RFC:
https://wiki.php.net/rfc/pdo_escape_placeholders
- Reflection:
. Numeric value of class, property, function and constant modifiers was
changed. Don't filter methods and properties through
@@ -498,9 +573,9 @@ PHP 7.4 UPGRADE NOTES
. SimpleXMLElement now implements Countable.
- SQLite3:
. The bundled libsqlite has been removed. To build the SQLite3 extension
a system libsqlite3 ≥ 3.7.4 is now required. To build the PDO_SQLite
extension a system libsqlite3 ≥ 3.5.0 is now required.
. The bundled libsqlite has been removed. To build the SQLite3 extension a
system libsqlite3 ≥ 3.7.4 is now required. To build the PDO_SQLite extension
a system libsqlite3 ≥ 3.5.0 is now required.
. (Un)serialization of SQLite3, SQLite3Stmt and SQLite3Result is now
explicitly forbidden. Formerly, serialization of instances of these classes
was possible, but unserialization yielded unusable objects.
@@ -565,7 +640,7 @@ PHP 7.4 UPGRADE NOTES
========================================
- zend.exception_ignore_args
. New INI directive which displays or hides arguments from the stack traces
. New INI directive to include or exclude arguments from stack traces
generated for exceptions.
========================================
@@ -577,9 +652,9 @@ PHP 7.4 UPGRADE NOTES
- An inode number is delivered and is based on the NTFS file index.
- The device number is now based on the volume serial number.
Note, that both values derived from the system and provided as is on 64-bit
systems. On 32-bit system, these values might overflow the 32-bit integer in
PHP, so they're a fake.
Note that both values are derived from the system and provided as is on 64-bit
systems. On 32-bit systems, these values might overflow the 32-bit integer in
PHP, so they're fake.
- CTRL+C and CTRL+BREAK on console can be caught by setting a handler function
with sapi_windows_set_ctrl_handler().
@@ -587,16 +662,19 @@ PHP 7.4 UPGRADE NOTES
- configure now regards additional CFLAGS and LDFLAGS set as environment
variables.
- OPcache now supports an arbitrary amount of separate caches per user via the
the INI directive opcache.cache_id. All processes with the same cache ID and
user share an OPcache instance.
========================================
13. Migration to pkg-config
========================================
A number of extensions have been migrated to exclusively use pkg-config for
the detection of library dependencies. Generally, this means that instead of
using --with-foo-dir=DIR or similar only --with-foo is used. Custom library
paths can be specified either by adding additional directories to
PKG_CONFIG_PATH or by explicitly specifying compilation options through
FOO_CFLAGS and FOO_LIBS.
A number of extensions have been migrated to exclusively use pkg-config for the
detection of library dependencies. Generally, this means that instead of using
--with-foo-dir=DIR or similar only --with-foo is used. Custom library paths can
be specified either by adding additional directories to PKG_CONFIG_PATH or by
explicitly specifying compilation options through FOO_CFLAGS and FOO_LIBS.
The following extensions and SAPIs are affected:
@@ -634,8 +712,8 @@ The following extensions and SAPIs are affected:
- Libxml:
. --with-libxml-dir has been removed.
. --enable-libxml becomes --with-libxml.
. --with-libexpat-dir has been renamed to --with-expat and no longer
accepts a directory.
. --with-libexpat-dir has been renamed to --with-expat and no longer accepts a
directory.
- LiteSpeed:
. --with-litespeed becomes --enable-litespeed.
@@ -646,7 +724,7 @@ The following extensions and SAPIs are affected:
- ODBC:
. --with-iodbc no longer accepts a directory.
. --with-unixODBC without directory now use pkg-config (preferred).
. --with-unixODBC without a directory now uses pkg-config (preferred).
Directory is still accepted for old versions without libodbc.pc.
- OpenSSL:
@@ -680,10 +758,6 @@ The following extensions and SAPIs are affected:
14. Other Changes
========================================
- Core:
. Add zend.exception_ignore_args to force the omission of arguments from
stack traces collected for exceptions.
========================================
15. Performance Improvements
========================================
+19 -3
View File
@@ -23,7 +23,9 @@ PHP 7.4 INTERNALS UPGRADE NOTES
t. Exceptions thrown by string conversions.
u. Removed uint and ulong typedefs
v. Compound assignment opcodes
z. APACHE symbol removed
w. APACHE symbol removed
x. php_error_docref0() renamed to php_error_docref()
y. Stream wrapper read/write ops
2. Build system changes
a. Abstract
@@ -220,7 +222,12 @@ PHP 7.4 INTERNALS UPGRADE NOTES
ZEND_ASSIGN_DIM_OP, ZEND_ASSIGN_OBJ_OP and ZEND_ASSIGN_STATIC_PROP_OP with
ZEND_ADD (or other) in extended_value.
z. APACHE symbol has been removed and is no longer defined.
w. APACHE symbol has been removed and is no longer defined.
x. php_error_docref0() has been removed and renamed to php_error_docref().
y. The read and write operations of php_stream_ops now return ssize_t, with
negative values indicating an error.
========================
2. Build system changes
@@ -247,8 +254,12 @@ PHP 7.4 INTERNALS UPGRADE NOTES
PHP_SOLID_LIBS, PHP_EMPRESS_INCLUDE, PHP_EMPRESS_LIBS, PHP_SYBASE_INCLUDE,
PHP_SYBASE_LFLAGS, PHP_SYBASE_LIBS, PHP_DBM_TYPE, PHP_DBM_LIB,
PHP_LDAP_LFLAGS, PHP_LDAP_INCLUDE, PHP_LDAP_LIBS.
- Removed unused symbols: HAVE_CURL_EASY_STRERROR, HAVE_CURL_MULTI_STRERROR,
HAVE_MPIR, HAVE_MBSTR_CN, HAVE_MBSTR_JA, HAVE_MBSTR_KR, HAVE_MBSTR_RU,
HAVE_MBSTR_TW.
b. Unix build system changes
- Added --ini-path and --ini-dir options to php-config.
- configure --help now also outputs --program-suffix and --program-prefix
information by using the Autoconf AC_ARG_PROGRAM macro.
- Obsolescent macros AC_FUNC_VPRINTF and AC_FUNC_UTIME_NULL have been
@@ -285,7 +296,9 @@ PHP 7.4 INTERNALS UPGRADE NOTES
- Removed unused check for dev/arandom and the HAVE_DEV_ARANDOM symbol.
- Remove unused functions checks: HAVE_MBSINIT, HAVE_MEMPCPY, HAVE_SETPGID,
HAVE_STRPNCPY, HAVE_STRTOULL, HAVE_VSNPRINTF, HAVE_CUSERID, HAVE_LRAND48,
HAVE_RANDOM, HAVE_SRAND48, HAVE_SRANDOM, HAVE_STRDUP.
HAVE_RANDOM, HAVE_SRAND48, HAVE_SRANDOM, HAVE_STRDUP, HAVE_GCVT,
HAVE_ISASCII, HAVE_LINK, HAVE_LOCKF, HAVE_SOCKOPT, HAVE_SETVBUF, HAVE_SIN,
HAVE_TEMPNAM.
- Unused check for struct cmsghdr and symbol HAVE_CMSGHDR have been removed.
- Unused ApplicationServices/ApplicationServices.h headers check and
HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H symbol have been removed.
@@ -293,10 +306,13 @@ PHP 7.4 INTERNALS UPGRADE NOTES
- PHP_CHECK_CONFIGURE_OPTIONS macro has been removed. Default Autoconf's
--enable-option-checking=fatal option can be used in the configure step
to enable error when invalid options are used.
- Removed unused check and symbols HAVE_SHM_MMAP_ZERO, HAVE_SHM_MMAP_FILE.
- Removed unused check and symbol MISSING_MSGHDR_MSGFLAGS.
c. Windows build system changes
. Visual Studio 2019 is utilized for the Windows builds
. Removed unused defined symbol HAVE_LIBBIND.
========================
3. Module changes
+2 -4
View File
@@ -306,10 +306,8 @@ AC_ARG_ENABLE([zend-signals],
[ZEND_SIGNALS=$enableval],
[ZEND_SIGNALS=yes])
AC_CHECK_FUNC(sigaction, [
AC_DEFINE(HAVE_SIGACTION, 1, [Whether sigaction() is available])
], [
ZEND_SIGNALS=no
AC_CHECK_FUNCS([sigaction], [], [
ZEND_SIGNALS=no
])
if test "$ZEND_SIGNALS" = "yes"; then
AC_DEFINE(ZEND_SIGNALS, 1, [Use zend signal handling])
+10 -4
View File
@@ -16,19 +16,23 @@ var_dump($a->$b->{$c[1]});
?>
--EXPECTF--
Notice: Undefined variable: a in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
NULL
Notice: Undefined variable: %s in %s on line %d
Notice: Undefined variable: a in %s on line %d
Notice: Undefined variable: %s in %s on line %d
Notice: Undefined variable: c in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
NULL
Notice: Undefined variable: a in %s on line %d
int(1)
Notice: Undefined variable: %s in %s on line %d
Notice: Undefined variable: a in %s on line %d
Notice: Undefined variable: %s in %s on line %d
Notice: Undefined variable: b in %s on line %d
int(0)
Notice: Undefined variable: a in %s on line %d
@@ -45,6 +49,8 @@ NULL
Notice: Undefined variable: c in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to get property '1' of non-object in %s on line %d
Notice: Trying to get property '' of non-object in %s on line %d
+31 -1
View File
@@ -19,10 +19,40 @@ $arr[][]->bar = 2;
--EXPECTF--
Notice: Undefined variable: arr in %s on line %d
Notice: Undefined variable: arr in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Undefined variable: arr in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Undefined variable: arr in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to get property 'foo' of non-object in %s on line %d
Warning: Creating default object from empty value in %s on line %d
+3
View File
@@ -8,6 +8,9 @@ $a{function() { }} = 1;
?>
--EXPECTF--
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
Warning: Illegal offset type in %s on line %d
Warning: Illegal offset type in %s on line %d
+2 -1
View File
@@ -12,7 +12,8 @@ var_dump($var1);
echo "Done\n";
?>
--EXPECT--
--EXPECTF--
Notice: Trying to access array offset on value of type float in %s on line %d
NULL
NULL
Done
+3 -3
View File
@@ -3,7 +3,7 @@ Bug #33771 (error_reporting falls to 0 when @ was used inside try/catch block)
--FILE--
<?php
error_reporting(E_ALL | E_STRICT);
error_reporting(E_ALL);
var_dump(error_reporting());
@@ -14,7 +14,7 @@ function make_exception()
function make_exception_and_change_err_reporting()
{
error_reporting(E_ALL & ~E_STRICT);
error_reporting(E_ALL & ~E_NOTICE);
throw new Exception();
}
@@ -36,5 +36,5 @@ echo "Done\n";
--EXPECT--
int(32767)
int(32767)
int(30719)
int(32759)
Done
+3
View File
@@ -22,6 +22,9 @@ class Loader {
function stream_stat() {
return array('size' => strlen($this->data));
}
function stream_set_option($option, $arg1, $arg2) {
return false;
}
}
stream_wrapper_register('Loader', 'Loader');
require 'Loader://qqq.php';
+1 -1
View File
@@ -19,7 +19,7 @@ class x extends c implements a, b {
function foo() { }
}
ReflectionClass::export('x');
echo new ReflectionClass('x');
?>
--EXPECTF--
+1 -1
View File
@@ -1,5 +1,5 @@
--TEST--
Bug #52160 (Invalid E_STRICT redefined constructor error)
Bug #52160 (Invalid E_DEPRECATED redefined constructor error)
--FILE--
<?php
+1 -1
View File
@@ -1,5 +1,5 @@
--TEST--
Bug #62956: "incompatible" signatures for private methods should not cause E_STRICT
Bug #62956: "incompatible" signatures for private methods should not cause E_WARNING
--FILE--
<?php
class Base
+1 -1
View File
@@ -1,5 +1,5 @@
--TEST--
Bug #64988 (Class loading order affects E_STRICT warning)
Bug #64988 (Class loading order affects E_WARNING warning)
--FILE--
<?php
abstract class Base1 {
+1 -1
View File
@@ -1,5 +1,5 @@
--TEST--
bug67436: E_STRICT instead of custom error handler
bug67436: E_WARNING instead of custom error handler
--FILE--
<?php
+4 -4
View File
@@ -4,10 +4,10 @@ Bug #71572: String offset assignment from an empty string inserts null byte
<?php
$str = "abc";
var_dump($str{0} = "");
var_dump($str{1} = "");
var_dump($str{3} = "");
var_dump($str{10} = "");
var_dump($str[0] = "");
var_dump($str[1] = "");
var_dump($str[3] = "");
var_dump($str[10] = "");
var_dump($str);
?>
==DONE==
+32
View File
@@ -0,0 +1,32 @@
--TEST--
Bug #78010: Segmentation fault during GC
--INI--
memory_limit=2G
--FILE--
<?php
class foo
{
public function __construct()
{
$this->x = $this;
for ($i = 0; $i < 898; $i++) { //Will not trigger with <898
$obj = [new stdClass, new stdClass]; //This must have at least 2 elements
$this->y[] = $obj;
}
}
}
for ($i = 0; $i < 2; ++$i) { //This must run >=2 (increasing the number of elements in the array *2 will not do)
$x = []; //This must be reset
foreach (array_fill(0, 389, 'x') as &$params) { //Will not trigger <389
$x[] = new foo;
}
}
echo "Completed\n";
?>
--EXPECT--
Completed
+27
View File
@@ -0,0 +1,27 @@
--TEST--
Bug #78271: Invalid result of if-else
--FILE--
<?php
function test($a, $b){
if ($a==10) {
$w="x";
} else {
$w="y";
}
if ($b) {
$d1="none";
$d2="block";
} else {
$d1="block";
$d2="none";
}
echo $d2.$b."\n";
}
test(1, 1);
?>
--EXPECT--
block1
+54
View File
@@ -0,0 +1,54 @@
--TEST--
Bug #78340: Include of stream wrapper not reading whole file
--FILE--
<?php
class lib {
public static $files= [];
private $bytes, $pos;
function stream_open($path, $mode, $options, $opened_path) {
$this->bytes= self::$files[$path];
$this->pos= 0;
$this->ino= crc32($path);
return true;
}
function stream_read($count) {
$chunk= substr($this->bytes, $this->pos, $count);
$this->pos+= strlen($chunk);
return $chunk;
}
function stream_eof() {
return $this->pos >= strlen($this->bytes);
}
function stream_close() {
$this->bytes= null;
}
function stream_stat() {
return [
'dev' => 3632233996,
'size' => strlen($this->bytes),
'ino' => $this->ino
];
}
function stream_set_option($option, $arg1, $arg2) {
return false;
}
}
$fill = str_repeat('.', 8192);
lib::$files['lib://test.php']= '<?php /* '.$fill.' */ function test() { echo "Works!\n"; }';
stream_wrapper_register('lib', lib::class);
include('lib://test.php');
test();
?>
--EXPECT--
Works!
+24
View File
@@ -0,0 +1,24 @@
--TEST--
Bug #78344: Segmentation fault on zend_check_protected
--FILE--
<?php
class A {
protected const FOO = 1;
}
class B {}
class C extends B {
public function method() {
var_dump(A::FOO);
}
}
(new C)->method();
?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot access protected const A::FOO in %s:%d
Stack trace:
#0 %s(%d): C->method()
#1 {main}
thrown in %s on line %d
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #78356: Array returned from ArrayAccess is incorrectly unpacked as argument
--FILE--
<?php
$object = new class implements ArrayAccess {
public function offsetGet($offset)
{
return [1, 2];
}
public function offsetExists($offset)
{
return true;
}
public function offsetUnset($offset) {}
public function offsetSet($offset, $value) {}
};
var_dump(max(...$object[0]));
?>
--EXPECT--
int(2)
Binary file not shown.
+2
View File
@@ -13,6 +13,8 @@ var_dump($a);
--EXPECTF--
Notice: Undefined offset: 0 in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Warning: Parameter 1 to foo() expected to be a reference, value given in %s on line %d
array(0) {
}
+2
View File
@@ -80,6 +80,8 @@ scoped to A: bool(false)
bound: no
scoped to A: bool(true)
bound: no
Deprecated: Unbinding $this of closure is deprecated in %s on line %d
scoped to A: bool(true)
bound: no
After binding, with same-class instance for the bound ones
+5 -1
View File
@@ -38,7 +38,7 @@ $d = $nonstaticUnscoped->bindTo(new A, 'A'); $d(); echo "\n";
$d = $nonstaticScoped->bindTo(new A, 'A'); $d(); echo "\n";
echo "Done.\n";
--EXPECT--
--EXPECTF--
Before binding
bool(false)
bool(false)
@@ -50,6 +50,8 @@ After binding, null scope, no instance
bool(false)
bool(false)
Deprecated: Unbinding $this of closure is deprecated in %s on line %d
bool(false)
bool(false)
@@ -64,6 +66,8 @@ After binding, with scope, no instance
bool(true)
bool(false)
Deprecated: Unbinding $this of closure is deprecated in %s on line %d
bool(true)
bool(false)
+3 -1
View File
@@ -38,7 +38,7 @@ echo "After binding, with different instance for the bound one", "\n";
$d = $nonstaticScoped->bindTo(new B, "static"); $d(); echo "\n";
echo "Done.\n";
--EXPECT--
--EXPECTF--
Before binding
bool(false)
bool(false)
@@ -50,6 +50,8 @@ After binding, no instance
bool(false)
bool(false)
Deprecated: Unbinding $this of closure is deprecated in %s on line %d
bool(true)
bool(false)
@@ -5,6 +5,12 @@ Constant expressions with null coalescing operator ??
const A = [1 => [[]]];
// should produce deprecation notices
const D_1 = null ?? A[1]{'undefined'}['index'] ?? 1;
const D_2 = null ?? A['undefined']{'index'} ?? 2;
const D_3 = null ?? A[1]{0}{2} ?? 3; // 2 deprecation notices
const D_4 = A[1]{0} ?? 4;
const T_1 = null ?? A[1]['undefined']['index'] ?? 1;
const T_2 = null ?? A['undefined']['index'] ?? 2;
const T_3 = null ?? A[1][0][2] ?? 3;
@@ -12,6 +18,11 @@ const T_4 = A[1][0][2] ?? 4;
const T_5 = null ?? __LINE__;
const T_6 = __LINE__ ?? "bar";
var_dump(D_1);
var_dump(D_2);
var_dump(D_3);
var_dump(D_4);
var_dump(T_1);
var_dump(T_2);
var_dump(T_3);
@@ -31,6 +42,21 @@ var_dump((new class { public $var = A[1][0][2] ?? 4; })->var);
?>
--EXPECTF--
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
int(1)
int(2)
int(3)
array(0) {
}
int(1)
int(2)
int(3)
+2
View File
@@ -69,6 +69,8 @@ array(2) {
int(5)
}
int(1)
Notice: Trying to access array offset on value of type int in %s on line %d
NULL
Notice: Undefined offset: 4 in %s on line %d
+3
View File
@@ -21,7 +21,10 @@ var_dump(b()[1]);
?>
--EXPECTF--
Notice: Trying to access array offset on value of type int in %s on line %d
NULL
Notice: Trying to access array offset on value of type int in %s on line %d
NULL
Fatal error: Uncaught Error: Cannot use object of type stdClass as array in %s:%d
+4
View File
@@ -27,8 +27,12 @@ var_dump($h);
?>
--EXPECTF--
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to get property 'a' of non-object in %s on line %d
NULL
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to get property 'b' of non-object in %s on line %d
NULL
+2 -2
View File
@@ -3,13 +3,13 @@ testing @ and error_reporting - 2
--FILE--
<?php
error_reporting(E_ALL);
error_reporting(E_ALL & ~E_DEPRECATED);
function foo($arg) {
}
function bar() {
error_reporting(E_ALL|E_STRICT);
error_reporting(E_ALL);
throw new Exception("test");
}
+2 -2
View File
@@ -3,7 +3,7 @@ testing @ and error_reporting - 3
--FILE--
<?php
error_reporting(E_ALL);
error_reporting(E_ALL & ~E_DEPRECATED);
function foo($arg) {
echo @$nonex_foo;
@@ -16,7 +16,7 @@ function bar() {
function foo1() {
echo $undef1;
error_reporting(E_ALL|E_STRICT);
error_reporting(E_ALL);
echo $undef2;
}
+2 -2
View File
@@ -3,11 +3,11 @@ testing @ and error_reporting - 4
--FILE--
<?php
error_reporting(E_ALL);
error_reporting(E_ALL & ~E_DEPRECATED);
function foo() {
echo $undef;
error_reporting(E_ALL|E_STRICT);
error_reporting(E_ALL);
}
+2 -2
View File
@@ -3,7 +3,7 @@ testing @ and error_reporting - 8
--FILE--
<?php
error_reporting(E_ALL);
error_reporting(E_ALL & ~E_DEPRECATED);
function foo1($arg) {
}
@@ -12,7 +12,7 @@ function foo2($arg) {
}
function foo3() {
error_reporting(E_ALL|E_STRICT);
error_reporting(E_ALL);
echo $undef3;
throw new Exception("test");
}
+2 -2
View File
@@ -3,7 +3,7 @@ testing @ and error_reporting - 9
--FILE--
<?php
error_reporting(E_ALL);
error_reporting(E_ALL & ~E_DEPRECATED);
function bar() {
echo @$blah;
@@ -12,7 +12,7 @@ function bar() {
function foo() {
echo @$undef;
error_reporting(E_ALL|E_STRICT);
error_reporting(E_ALL);
echo $blah;
return bar();
}
-2
View File
@@ -3,8 +3,6 @@ Throwing exception using a class that isn't derived from the Exception base clas
--FILE--
<?php
error_reporting(E_ALL|E_STRICT);
class Foo { }
try {
@@ -0,0 +1,26 @@
--TEST--
get_class_vars() returns uninitialized typed properties with a null value
--FILE--
<?php
class Test {
public static int $int1;
public static int $int2 = 42;
public int $int3;
public int $int4 = 42;
}
var_dump(get_class_vars(Test::class));
?>
--EXPECT--
array(4) {
["int3"]=>
NULL
["int4"]=>
int(42)
["int1"]=>
NULL
["int2"]=>
int(42)
}
+2
View File
@@ -33,6 +33,8 @@ Notice: Undefined variable: c in %s on line %d
Notice: Undefined variable: d in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to get property '' of non-object in %s on line %d
bool(false)
bool(true)
@@ -18,7 +18,7 @@ class B {
}
$f = (new A)->f();
var_dump($f->bindTo(null, 'B')());
var_dump($f->bindTo(new B, 'B')());
?>
--EXPECT--
+18 -1
View File
@@ -24,14 +24,31 @@ var_dump($bool[$arr]);
echo "Done\n";
?>
--EXPECT--
--EXPECTF--
Notice: Trying to access array offset on value of type bool in %s on line %d
NULL
Notice: Trying to access array offset on value of type bool in %s on line %d
NULL
Notice: Trying to access array offset on value of type bool in %s on line %d
NULL
Notice: Trying to access array offset on value of type bool in %s on line %d
NULL
Notice: Trying to access array offset on value of type bool in %s on line %d
NULL
Notice: Trying to access array offset on value of type bool in %s on line %d
NULL
Notice: Trying to access array offset on value of type bool in %s on line %d
NULL
Notice: Trying to access array offset on value of type bool in %s on line %d
NULL
Notice: Trying to access array offset on value of type bool in %s on line %d
NULL
Done
+18 -1
View File
@@ -24,14 +24,31 @@ var_dump($long[$arr]);
echo "Done\n";
?>
--EXPECT--
--EXPECTF--
Notice: Trying to access array offset on value of type int in %s on line %d
NULL
Notice: Trying to access array offset on value of type int in %s on line %d
NULL
Notice: Trying to access array offset on value of type int in %s on line %d
NULL
Notice: Trying to access array offset on value of type int in %s on line %d
NULL
Notice: Trying to access array offset on value of type int in %s on line %d
NULL
Notice: Trying to access array offset on value of type int in %s on line %d
NULL
Notice: Trying to access array offset on value of type int in %s on line %d
NULL
Notice: Trying to access array offset on value of type int in %s on line %d
NULL
Notice: Trying to access array offset on value of type int in %s on line %d
NULL
Done
+18 -1
View File
@@ -24,14 +24,31 @@ var_dump($null[$arr]);
echo "Done\n";
?>
--EXPECT--
--EXPECTF--
Notice: Trying to access array offset on value of type null in %s on line %d
NULL
Notice: Trying to access array offset on value of type null in %s on line %d
NULL
Notice: Trying to access array offset on value of type null in %s on line %d
NULL
Notice: Trying to access array offset on value of type null in %s on line %d
NULL
Notice: Trying to access array offset on value of type null in %s on line %d
NULL
Notice: Trying to access array offset on value of type null in %s on line %d
NULL
Notice: Trying to access array offset on value of type null in %s on line %d
NULL
Notice: Trying to access array offset on value of type null in %s on line %d
NULL
Notice: Trying to access array offset on value of type null in %s on line %d
NULL
Done
+1
View File
@@ -0,0 +1 @@
<?php
+5
View File
@@ -0,0 +1,5 @@
--TEST--
File with just a <?php tag should be valid
--FILE_EXTERNAL--
php_tag_only.inc
--EXPECT--
+11
View File
@@ -0,0 +1,11 @@
--TEST--
The (real) cast is deprecated
--FILE--
<?php
var_dump((real) 42);
?>
--EXPECTF--
Deprecated: The (real) cast is deprecated, use (float) instead in %s on line %d
float(42)
+1
View File
@@ -42,6 +42,7 @@ var_dump("\u{ffffff}");');
?>
--EXPECT--
Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0
syntax error, unexpected end of file on line 2
syntax error, unexpected end of file on line 3
syntax error, unexpected end of file, expecting '(' on line 2
+1 -1
View File
@@ -9,7 +9,7 @@ class A {
}
}
ReflectionClass::export("A");
echo new ReflectionClass("A");
?>
--EXPECTF--
Class [ <user> class A ] {
+9 -9
View File
@@ -8,31 +8,31 @@ $str = "abcdefghijklmno";
$i = 3;
$j = -4;
$str{2} = 'C';
$str[2] = 'C';
var_dump($str);
$str{$i} = 'Z';
$str[$i] = 'Z';
var_dump($str);
$str{-5} = 'P';
$str[-5] = 'P';
var_dump($str);
$str{$j} = 'Q';
$str[$j] = 'Q';
var_dump($str);
$str{-20} = 'Y';
$str[-20] = 'Y';
var_dump($str);
$str{-strlen($str)} = strtoupper($str{0}); /* An exotic ucfirst() ;) */
$str[-strlen($str)] = strtoupper($str[0]); /* An exotic ucfirst() ;) */
var_dump($str);
$str{20} = 'N';
$str[20] = 'N';
var_dump($str);
$str{-2} = 'UFO';
$str[-2] = 'UFO';
var_dump($str);
$str{-$i} = $str{$j*2};
$str[-$i] = $str[$j*2];
var_dump($str);
?>
--EXPECTF--
+2 -1
View File
@@ -15,5 +15,6 @@ $my_var=array(1,2,3);
$data = call_user_func_array("implode",array(&$my_var, new Test()));
echo "Done.\n";
?>
--EXPECT--
--EXPECTF--
Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
Done.
+6
View File
@@ -1198,6 +1198,12 @@ ZEND_API int zend_update_class_constants(zend_class_entry *class_type) /* {{{ */
}
} ZEND_HASH_FOREACH_END();
if (class_type->default_static_members_count && !CE_STATIC_MEMBERS(class_type)) {
if (class_type->type == ZEND_INTERNAL_CLASS || (class_type->ce_flags & (ZEND_ACC_IMMUTABLE|ZEND_ACC_PRELOADED))) {
zend_class_init_statics(class_type);
}
}
ce = class_type;
while (ce) {
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
+1
View File
@@ -76,6 +76,7 @@ typedef struct _zend_fcall_info_cache {
#define ZEND_DEP_FALIAS(name, alias, arg_info) ZEND_FENTRY(name, ZEND_FN(alias), arg_info, ZEND_ACC_DEPRECATED)
#define ZEND_NAMED_ME(zend_name, name, arg_info, flags) ZEND_FENTRY(zend_name, name, arg_info, flags)
#define ZEND_ME(classname, name, arg_info, flags) ZEND_FENTRY(name, ZEND_MN(classname##_##name), arg_info, flags)
#define ZEND_DEP_ME(classname, name, arg_info, flags) ZEND_ME(classname, name, arg_info, flags | ZEND_ACC_DEPRECATED)
#define ZEND_ABSTRACT_ME(classname, name, arg_info) ZEND_FENTRY(name, NULL, arg_info, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
#define ZEND_MALIAS(classname, name, alias, arg_info, flags) \
ZEND_FENTRY(name, ZEND_MN(classname##_##alias), arg_info, flags)
+1 -1
View File
@@ -714,7 +714,7 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c
zval_ptr_dtor_nogc(&op1);
ret = FAILURE;
} else {
zend_fetch_dimension_const(result, &op1, &op2, (ast->attr == ZEND_DIM_IS) ? BP_VAR_IS : BP_VAR_R);
zend_fetch_dimension_const(result, &op1, &op2, (ast->attr & ZEND_DIM_IS) ? BP_VAR_IS : BP_VAR_R);
zval_ptr_dtor_nogc(&op1);
zval_ptr_dtor_nogc(&op2);
+8 -3
View File
@@ -1123,12 +1123,17 @@ static void add_class_vars(zend_class_entry *scope, zend_class_entry *ce, int st
} else if (!statics && (prop_info->flags & ZEND_ACC_STATIC) == 0) {
prop = &ce->default_properties_table[OBJ_PROP_TO_NUM(prop_info->offset)];
}
if (!prop || Z_TYPE_P(prop) == IS_UNDEF) {
if (!prop) {
continue;
}
/* copy: enforce read only access */
ZVAL_COPY_OR_DUP(&prop_copy, prop);
if (Z_ISUNDEF_P(prop)) {
/* Return uninitialized typed properties as a null value */
ZVAL_NULL(&prop_copy);
} else {
/* copy: enforce read only access */
ZVAL_COPY_OR_DUP(&prop_copy, prop);
}
prop = &prop_copy;
/* this is necessary to make it able to work with default array
+3
View File
@@ -90,6 +90,9 @@ static zend_bool zend_valid_closure_binding(
} else {
zend_error(E_DEPRECATED, "Unbinding $this of a method is deprecated");
}
} else if (!is_fake_closure && !Z_ISUNDEF(closure->this_ptr)) {
// TODO: Only deprecate if it had $this *originally*?
zend_error(E_DEPRECATED, "Unbinding $this of closure is deprecated");
}
if (scope && scope != func->common.scope && scope->type == ZEND_INTERNAL_CLASS) {
+66 -10
View File
@@ -329,7 +329,7 @@ void zend_init_compiler_data_structures(void) /* {{{ */
zend_stack_init(&CG(delayed_oplines_stack), sizeof(zend_op));
CG(active_class_entry) = NULL;
CG(in_compilation) = 0;
CG(start_lineno) = 0;
CG(skip_shebang) = 0;
CG(encoding_declared) = 0;
CG(memoized_exprs) = NULL;
@@ -1140,11 +1140,24 @@ ZEND_API uint32_t zend_build_delayed_early_binding_list(const zend_op_array *op_
}
/* }}} */
ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array, uint32_t first_early_binding_opline) /* {{{ */
ZEND_API void zend_do_delayed_early_binding(zend_op_array *op_array, uint32_t first_early_binding_opline) /* {{{ */
{
if (first_early_binding_opline != (uint32_t)-1) {
zend_bool orig_in_compilation = CG(in_compilation);
uint32_t opline_num = first_early_binding_opline;
void **run_time_cache;
if (!ZEND_MAP_PTR(op_array->run_time_cache)) {
void *ptr;
ZEND_ASSERT(op_array->fn_flags & ZEND_ACC_HEAP_RT_CACHE);
ptr = emalloc(op_array->cache_size + sizeof(void*));
ZEND_MAP_PTR_INIT(op_array->run_time_cache, ptr);
ptr = (char*)ptr + sizeof(void*);
ZEND_MAP_PTR_SET(op_array->run_time_cache, ptr);
memset(ptr, 0, op_array->cache_size);
}
run_time_cache = RUN_TIME_CACHE(op_array);
CG(in_compilation) = 1;
while (opline_num != (uint32_t)-1) {
@@ -1158,7 +1171,10 @@ ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array, uint3
zend_class_entry *parent_ce = zend_hash_find_ex_ptr(EG(class_table), lc_parent_name, 1);
if (parent_ce) {
zend_try_early_bind(ce, parent_ce, Z_STR_P(lcname), zv);
if (zend_try_early_bind(ce, parent_ce, Z_STR_P(lcname), zv)) {
/* Store in run-time cache */
((void**)((char*)run_time_cache + opline->extended_value))[0] = ce;
}
}
}
opline_num = op_array->opcodes[opline_num].result.opline_num;
@@ -1394,6 +1410,36 @@ static zend_bool zend_try_compile_const_expr_resolve_class_name(zval *zv, zend_a
}
/* }}} */
/* We don't use zend_verify_const_access because we need to deal with unlinked classes. */
static zend_bool zend_verify_ct_const_access(zend_class_constant *c, zend_class_entry *scope)
{
if (Z_ACCESS_FLAGS(c->value) & ZEND_ACC_PUBLIC) {
return 1;
} else if (Z_ACCESS_FLAGS(c->value) & ZEND_ACC_PRIVATE) {
return c->ce == scope;
} else {
zend_class_entry *ce = c->ce;
while (1) {
if (ce == scope) {
return 1;
}
if (!ce->parent) {
break;
}
if (ce->ce_flags & ZEND_ACC_RESOLVED_PARENT) {
ce = ce->parent;
} else {
ce = zend_hash_find_ptr_lc(CG(class_table), ZSTR_VAL(ce->parent_name), ZSTR_LEN(ce->parent_name));
if (!ce) {
break;
}
}
}
/* Reverse case cannot be true during compilation */
return 0;
}
}
static zend_bool zend_try_ct_eval_class_const(zval *zv, zend_string *class_name, zend_string *name) /* {{{ */
{
uint32_t fetch_type = zend_get_class_fetch_type(class_name);
@@ -1417,7 +1463,7 @@ static zend_bool zend_try_ct_eval_class_const(zval *zv, zend_string *class_name,
return 0;
}
if (!cc || !zend_verify_const_access(cc, CG(active_class_entry))) {
if (!cc || !zend_verify_ct_const_access(cc, CG(active_class_entry))) {
return 0;
}
@@ -2371,6 +2417,10 @@ static inline void zend_emit_assign_znode(zend_ast *var_ast, znode *value_node)
static zend_op *zend_delayed_compile_dim(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
{
if (ast->attr == ZEND_DIM_ALTERNATIVE_SYNTAX) {
zend_error(E_DEPRECATED, "Array and string offset access syntax with curly braces is deprecated");
}
zend_ast *var_ast = ast->child[0];
zend_ast *dim_ast = ast->child[1];
zend_op *opline;
@@ -3688,7 +3738,6 @@ int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_l
return zend_compile_func_typecheck(result, args, IS_LONG);
} else if (zend_string_equals_literal(lcname, "is_float")
|| zend_string_equals_literal(lcname, "is_double")
|| zend_string_equals_literal(lcname, "is_real")
) {
return zend_compile_func_typecheck(result, args, IS_DOUBLE);
} else if (zend_string_equals_literal(lcname, "is_string")) {
@@ -3960,11 +4009,10 @@ void zend_compile_new(znode *result, zend_ast *ast) /* {{{ */
zend_op *opline;
if (class_ast->kind == ZEND_AST_CLASS) {
/* jump over anon class declaration */
/* anon class declaration */
opline = zend_compile_class_decl(class_ast, 0);
class_node.op_type = opline->result_type;
class_node.u.op.var = opline->result.var;
opline->extended_value = get_next_op_number();
} else {
zend_compile_class_ref(&class_node, class_ast, ZEND_FETCH_CLASS_EXCEPTION);
}
@@ -5852,6 +5900,7 @@ static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_as
if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
opline = zend_emit_op_tmp(result, ZEND_DECLARE_LAMBDA_FUNCTION, NULL, NULL);
opline->extended_value = zend_alloc_cache_slot();
opline->op1_type = IS_CONST;
LITERAL_STR(opline->op1, key);
} else {
@@ -6471,6 +6520,7 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
if (decl->flags & ZEND_ACC_ANON_CLASS) {
opline->opcode = ZEND_DECLARE_ANON_CLASS;
opline->extended_value = zend_alloc_cache_slot();
opline->result_type = IS_VAR;
opline->result.var = get_temporary_variable();
@@ -6496,6 +6546,7 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
) {
CG(active_op_array)->fn_flags |= ZEND_ACC_EARLY_BINDING;
opline->opcode = ZEND_DECLARE_CLASS_DELAYED;
opline->extended_value = zend_alloc_cache_slot();
opline->result_type = IS_UNUSED;
opline->result.opline_num = -1;
}
@@ -8744,7 +8795,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
case ZEND_AST_COALESCE:
/* Set isset fetch indicator here, opcache disallows runtime altering of the AST */
if (ast->child[0]->kind == ZEND_AST_DIM) {
ast->child[0]->attr = ZEND_DIM_IS;
ast->child[0]->attr |= ZEND_DIM_IS;
}
zend_eval_const_expr(&ast->child[0]);
@@ -8798,9 +8849,14 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading");
}
if (ast->attr & ZEND_DIM_ALTERNATIVE_SYNTAX) {
ast->attr &= ~ZEND_DIM_ALTERNATIVE_SYNTAX; /* remove flag to avoid duplicate warning */
zend_error(E_DEPRECATED, "Array and string offset access syntax with curly braces is deprecated");
}
/* Set isset fetch indicator here, opcache disallows runtime altering of the AST */
if (ast->attr == ZEND_DIM_IS && ast->child[0]->kind == ZEND_AST_DIM) {
ast->child[0]->attr = ZEND_DIM_IS;
if (ast->attr & ZEND_DIM_IS && ast->child[0]->kind == ZEND_AST_DIM) {
ast->child[0]->attr |= ZEND_DIM_IS;
}
zend_eval_const_expr(&ast->child[0]);
+3 -2
View File
@@ -753,7 +753,7 @@ void zend_do_free(znode *op1);
ZEND_API int do_bind_function(zval *lcname);
ZEND_API int do_bind_class(zval *lcname, zend_string *lc_parent_name);
ZEND_API uint32_t zend_build_delayed_early_binding_list(const zend_op_array *op_array);
ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array, uint32_t first_early_binding_opline);
ZEND_API void zend_do_delayed_early_binding(zend_op_array *op_array, uint32_t first_early_binding_opline);
void zend_do_extended_info(void);
void zend_do_extended_fcall_begin(void);
@@ -924,7 +924,8 @@ void zend_assert_valid_class_name(const zend_string *const_name);
#define ZEND_SEND_BY_REF 1u
#define ZEND_SEND_PREFER_REF 2u
#define ZEND_DIM_IS 1
#define ZEND_DIM_IS (1 << 0) /* isset fetch needed for null coalesce */
#define ZEND_DIM_ALTERNATIVE_SYNTAX (1 << 1) /* deprecated curly brace usage */
#define IS_CONSTANT_UNQUALIFIED 0x010
#define IS_CONSTANT_CLASS 0x080 /* __CLASS__ in trait */
+64 -20
View File
@@ -364,16 +364,6 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_R(uint32_t var EXE
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_UNSET(uint32_t var EXECUTE_DATA_DC)
{
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return zval_undefined_cv(var EXECUTE_DATA_CC);
}
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_IS(uint32_t var EXECUTE_DATA_DC)
{
zval *ret = EX_VAR(var);
@@ -445,7 +435,7 @@ static zend_always_inline zval *_get_op_data_zval_ptr_r(int op_type, znode_op no
}
}
static zend_always_inline zval *_get_zval_ptr_deref(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_zval_ptr_deref(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type & (IS_TMP_VAR|IS_VAR)) {
if (op_type == IS_TMP_VAR) {
@@ -1323,11 +1313,14 @@ static zend_always_inline int zend_binary_op(zval *ret, zval *op1, zval *op2 OPL
return zend_binary_ops[opcode - ZEND_ADD](ret, op1, op2);
}
static zend_never_inline void zend_binary_assign_op_obj_dim(zval *object, zval *property, zval *value OPLINE_DC EXECUTE_DATA_DC)
static zend_never_inline void zend_binary_assign_op_obj_dim(zval *object, zval *property OPLINE_DC EXECUTE_DATA_DC)
{
zend_free_op free_op_data1;
zval *value;
zval *z;
zval rv, res;
value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
if ((z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R, &rv)) != NULL) {
if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) {
@@ -1355,6 +1348,7 @@ static zend_never_inline void zend_binary_assign_op_obj_dim(zval *object, zval *
ZVAL_NULL(EX_VAR(opline->result.var));
}
}
FREE_OP(free_op_data1);
}
static zend_never_inline void zend_binary_assign_op_typed_ref(zend_reference *ref, zval *value OPLINE_DC EXECUTE_DATA_DC)
@@ -2015,6 +2009,24 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_new_element_for_s
zend_throw_error(NULL, "[] operator not supported for strings");
}
static ZEND_COLD void zend_binary_assign_op_dim_slow(zval *container, zval *dim OPLINE_DC EXECUTE_DATA_DC)
{
zend_free_op free_op_data1;
if (UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
if (opline->op2_type == IS_UNUSED) {
zend_use_new_element_for_string();
} else {
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
}
} else if (EXPECTED(!Z_ISERROR_P(container))) {
zend_use_scalar_as_array();
}
get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
FREE_OP(free_op_data1);
}
static zend_never_inline zend_uchar slow_index_convert(const zval *dim, zend_value *value EXECUTE_DATA_DC)
{
switch (Z_TYPE_P(dim)) {
@@ -2295,7 +2307,7 @@ static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_UNSET(z
zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_UNSET EXECUTE_DATA_CC);
}
static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type, int support_strings, int slow EXECUTE_DATA_DC)
static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type, int is_list, int slow EXECUTE_DATA_DC)
{
zval *retval;
@@ -2312,7 +2324,7 @@ try_array:
}
}
}
if (support_strings && EXPECTED(Z_TYPE_P(container) == IS_STRING)) {
if (!is_list && EXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_long offset;
try_string_offset:
@@ -2390,11 +2402,15 @@ try_string_offset:
}
} else {
if (type != BP_VAR_IS && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
container = ZVAL_UNDEFINED_OP1();
}
if (/*dim_type == IS_CV &&*/ UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP2();
}
if (!is_list && type != BP_VAR_IS) {
zend_error(E_NOTICE, "Trying to access array offset on value of type %s",
zend_zval_type_name(container));
}
ZVAL_NULL(result);
}
}
@@ -2402,30 +2418,30 @@ try_string_offset:
static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_read_R(zval *container, zval *dim, int dim_type OPLINE_DC EXECUTE_DATA_DC)
{
zval *result = EX_VAR(opline->result.var);
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 1, 0 EXECUTE_DATA_CC);
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 0, 0 EXECUTE_DATA_CC);
}
static zend_never_inline void zend_fetch_dimension_address_read_R_slow(zval *container, zval *dim OPLINE_DC EXECUTE_DATA_DC)
{
zval *result = EX_VAR(opline->result.var);
zend_fetch_dimension_address_read(result, container, dim, IS_CV, BP_VAR_R, 1, 1 EXECUTE_DATA_CC);
zend_fetch_dimension_address_read(result, container, dim, IS_CV, BP_VAR_R, 0, 1 EXECUTE_DATA_CC);
}
static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_read_IS(zval *container, zval *dim, int dim_type OPLINE_DC EXECUTE_DATA_DC)
{
zval *result = EX_VAR(opline->result.var);
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS, 1, 0 EXECUTE_DATA_CC);
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS, 0, 0 EXECUTE_DATA_CC);
}
static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_LIST_r(zval *container, zval *dim, int dim_type OPLINE_DC EXECUTE_DATA_DC)
{
zval *result = EX_VAR(opline->result.var);
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 0, 0 EXECUTE_DATA_CC);
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 1, 0 EXECUTE_DATA_CC);
}
ZEND_API void zend_fetch_dimension_const(zval *result, zval *container, zval *dim, int type)
{
zend_fetch_dimension_address_read(result, container, dim, IS_TMP_VAR, type, 1, 0 NO_EXECUTE_DATA_CC);
zend_fetch_dimension_address_read(result, container, dim, IS_TMP_VAR, type, 0, 0 NO_EXECUTE_DATA_CC);
}
static zend_never_inline zval* ZEND_FASTCALL zend_find_array_dim_slow(HashTable *ht, zval *offset EXECUTE_DATA_DC)
@@ -2570,6 +2586,10 @@ num_key:
static zend_never_inline uint32_t ZEND_FASTCALL zend_array_key_exists_slow(zval *subject, zval *key OPLINE_DC EXECUTE_DATA_DC)
{
if (EXPECTED(Z_TYPE_P(subject) == IS_OBJECT)) {
zend_error(E_DEPRECATED, "array_key_exists(): "
"Using array_key_exists() on objects is deprecated. "
"Use isset() or property_exists() instead");
HashTable *ht = zend_get_properties_for(subject, ZEND_PROP_PURPOSE_ARRAY_CAST);
uint32_t result = zend_array_key_exists_fast(ht, key OPLINE_CC EXECUTE_DATA_CC);
zend_release_properties(ht);
@@ -2735,6 +2755,12 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
break;
}
if (container_op_type == IS_CV
&& type != BP_VAR_W
&& UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
container = ZVAL_UNDEFINED_OP1();
}
/* this should modify object only if it's empty */
if (type == BP_VAR_UNSET) {
return;
@@ -3895,6 +3921,7 @@ ZEND_API void zend_cleanup_unfinished_execution(zend_execute_data *execute_data,
cleanup_live_vars(execute_data, op_num, catch_op_num);
}
#if ZEND_VM_SPEC
static void zend_swap_operands(zend_op *op) /* {{{ */
{
znode_op tmp;
@@ -3908,6 +3935,7 @@ static void zend_swap_operands(zend_op *op) /* {{{ */
op->op2_type = tmp_type;
}
/* }}} */
#endif
static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_string *function, uint32_t num_args) /* {{{ */
{
@@ -4514,6 +4542,14 @@ static zend_never_inline int ZEND_FASTCALL zend_quick_check_constant(
ZEND_VM_CONTINUE(); \
} \
} while (0)
#define ZEND_VM_SMART_BRANCH_TRUE_JMPZ() do { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
ZEND_VM_CONTINUE(); \
} while (0)
#define ZEND_VM_SMART_BRANCH_TRUE_JMPNZ() do { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
ZEND_VM_CONTINUE(); \
} while (0)
#define ZEND_VM_SMART_BRANCH_FALSE() do { \
if (EXPECTED((opline+1)->opcode == ZEND_JMPNZ)) { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
@@ -4523,6 +4559,14 @@ static zend_never_inline int ZEND_FASTCALL zend_quick_check_constant(
ZEND_VM_CONTINUE(); \
} \
} while (0)
#define ZEND_VM_SMART_BRANCH_FALSE_JMPZ() do { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
ZEND_VM_CONTINUE(); \
} while (0)
#define ZEND_VM_SMART_BRANCH_FALSE_JMPNZ() do { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
ZEND_VM_CONTINUE(); \
} while (0)
#else
# define ZEND_VM_REPEATABLE_OPCODE
# define ZEND_VM_REPEAT_OPCODE(_opcode)
+5 -2
View File
@@ -150,7 +150,7 @@
#define GC_DEFAULT_BUF_SIZE (16 * 1024)
#define GC_BUF_GROW_STEP (128 * 1024)
#define GC_MAX_UNCOMPRESSED (1024 * 1024)
#define GC_MAX_UNCOMPRESSED (512 * 1024)
#define GC_MAX_BUF_SIZE 0x40000000
#define GC_THRESHOLD_DEFAULT 10000
@@ -316,7 +316,10 @@ static void gc_stack_free(gc_stack *stack)
static zend_always_inline uint32_t gc_compress(uint32_t idx)
{
return idx % GC_MAX_UNCOMPRESSED;
if (EXPECTED(idx < GC_MAX_UNCOMPRESSED)) {
return idx;
}
return (idx % GC_MAX_UNCOMPRESSED) | GC_MAX_UNCOMPRESSED;
}
static zend_always_inline gc_root_buffer* gc_decompress(zend_refcounted *ref, uint32_t idx)
+2 -2
View File
@@ -71,10 +71,10 @@ END_EXTERN_C()
static zend_always_inline void gc_check_possible_root(zend_refcounted *ref)
{
if (GC_TYPE_INFO(ref) == IS_REFERENCE) {
if (EXPECTED(GC_TYPE_INFO(ref) == IS_REFERENCE)) {
zval *zv = &((zend_reference*)ref)->val;
if (!Z_REFCOUNTED_P(zv)) {
if (!Z_COLLECTABLE_P(zv)) {
return;
}
ref = Z_COUNTED_P(zv);
+1 -1
View File
@@ -93,7 +93,7 @@ struct _zend_compiler_globals {
struct _zend_ini_parser_param *ini_parser_param;
uint32_t start_lineno;
zend_bool skip_shebang;
zend_bool increment_lineno;
zend_string *doc_comment;
+3 -2
View File
@@ -221,6 +221,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%token T_COALESCE "?? (T_COALESCE)"
%token T_POW "** (T_POW)"
%token T_POW_EQUAL "**= (T_POW_EQUAL)"
%token T_BAD_CHARACTER "invalid character (T_BAD_CHARACTER)"
/* Token used to force a parse error from the lexer */
%token T_ERROR
@@ -1154,7 +1155,7 @@ callable_variable:
| constant '[' optional_expr ']'
{ $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
| dereferencable '{' expr '}'
{ $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
{ $$ = zend_ast_create_ex(ZEND_AST_DIM, ZEND_DIM_ALTERNATIVE_SYNTAX, $1, $3); }
| dereferencable T_OBJECT_OPERATOR property_name argument_list
{ $$ = zend_ast_create(ZEND_AST_METHOD_CALL, $1, $3, $4); }
| function_call { $$ = $1; }
@@ -1339,7 +1340,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
if (LANG_SCNG(yy_text)[0] == 0 &&
LANG_SCNG(yy_leng) == 1 &&
memcmp(yystr, "\"end of file\"", sizeof("\"end of file\"") - 1) == 0) {
strcmp(yystr, "\"end of file\"") == 0) {
if (yyres) {
yystpcpy(yyres, "end of file");
}
+66 -55
View File
@@ -46,7 +46,6 @@
#include "zend_strtod.h"
#include "zend_exceptions.h"
#include "zend_virtual_cwd.h"
#include "tsrm_config_common.h"
#define YYCTYPE unsigned char
#define YYFILL(n) { if ((YYCURSOR + n) >= (YYLIMIT + ZEND_MMAP_AHEAD)) { return 0; } }
@@ -514,16 +513,9 @@ ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding)
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle)
{
char *buf;
size_t size, offset = 0;
size_t size;
zend_string *compiled_filename;
/* The shebang line was read, get the current position to obtain the buffer start */
if (CG(start_lineno) == 2 && file_handle->type == ZEND_HANDLE_FP && file_handle->handle.fp) {
if ((offset = ftell(file_handle->handle.fp)) == (size_t)-1) {
offset = 0;
}
}
if (zend_stream_fixup(file_handle, &buf, &size) == FAILURE) {
return FAILURE;
}
@@ -557,13 +549,18 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle)
size = SCNG(script_filtered_size);
}
}
SCNG(yy_start) = (unsigned char *)buf - offset;
SCNG(yy_start) = (unsigned char *)buf;
yy_scan_buffer(buf, (unsigned int)size);
} else {
zend_error_noreturn(E_COMPILE_ERROR, "zend_stream_mmap() failed");
}
BEGIN(INITIAL);
if (CG(skip_shebang)) {
CG(skip_shebang) = 0;
BEGIN(SHEBANG);
} else {
BEGIN(INITIAL);
}
if (file_handle->opened_path) {
compiled_filename = zend_string_copy(file_handle->opened_path);
@@ -574,14 +571,8 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle)
zend_set_compiled_filename(compiled_filename);
zend_string_release_ex(compiled_filename, 0);
if (CG(start_lineno)) {
CG(zend_lineno) = CG(start_lineno);
CG(start_lineno) = 0;
} else {
CG(zend_lineno) = 1;
}
RESET_DOC_COMMENT();
CG(zend_lineno) = 1;
CG(increment_lineno) = 0;
return SUCCESS;
}
@@ -668,11 +659,7 @@ zend_op_array *compile_filename(int type, zval *filename)
ZVAL_STR(&tmp, zval_get_string(filename));
filename = &tmp;
}
file_handle.filename = Z_STRVAL_P(filename);
file_handle.free_filename = 0;
file_handle.type = ZEND_HANDLE_FILENAME;
file_handle.opened_path = NULL;
file_handle.handle.fp = NULL;
zend_stream_init_filename(&file_handle, Z_STRVAL_P(filename));
retval = zend_compile_file(&file_handle, type);
if (retval && file_handle.handle.stream.handle) {
@@ -798,10 +785,7 @@ int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlight
zend_lex_state original_lex_state;
zend_file_handle file_handle;
file_handle.type = ZEND_HANDLE_FILENAME;
file_handle.filename = filename;
file_handle.free_filename = 0;
file_handle.opened_path = NULL;
zend_stream_init_filename(&file_handle, filename);
zend_save_lexical_state(&original_lex_state);
if (open_file_for_scanning(&file_handle)==FAILURE) {
zend_message_dispatcher(ZMSG_FAILED_HIGHLIGHT_FOPEN, filename);
@@ -1243,9 +1227,12 @@ static void copy_heredoc_label_stack(void *void_heredoc_label)
goto emit_token_with_str; \
} while (0)
#define SKIP_TOKEN(_token) do { \
#define RETURN_OR_SKIP_TOKEN(_token) do { \
token = _token; \
goto skip_token; \
if (PARSER_MODE()) { \
goto skip_token; \
} \
goto emit_token; \
} while (0)
int ZEND_FASTCALL lex_scan(zval *zendlval, zend_parser_stack_elem *elem)
@@ -1497,7 +1484,14 @@ NEWLINE ("\r"|"\n"|"\r\n")
RETURN_TOKEN(T_INT_CAST);
}
<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("real"|"double"|"float"){TABS_AND_SPACES}")" {
<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("double"|"float"){TABS_AND_SPACES}")" {
RETURN_TOKEN(T_DOUBLE_CAST);
}
<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"real"{TABS_AND_SPACES}")" {
if (PARSER_MODE()) {
zend_error(E_DEPRECATED, "The (real) cast is deprecated, use (float) instead");
}
RETURN_TOKEN(T_DOUBLE_CAST);
}
@@ -2010,6 +2004,17 @@ string:
RETURN_TOKEN(T_NS_C);
}
<SHEBANG>"#!" .* {NEWLINE} {
CG(zend_lineno)++;
BEGIN(INITIAL);
goto restart;
}
<SHEBANG>{ANY_CHAR} {
yyless(0);
BEGIN(INITIAL);
goto restart;
}
<INITIAL>"<?=" {
BEGIN(ST_IN_SCRIPTING);
@@ -2023,20 +2028,28 @@ string:
<INITIAL>"<?php"([ \t]|{NEWLINE}) {
HANDLE_NEWLINE(yytext[yyleng-1]);
BEGIN(ST_IN_SCRIPTING);
if (PARSER_MODE()) {
SKIP_TOKEN(T_OPEN_TAG);
}
RETURN_TOKEN(T_OPEN_TAG);
RETURN_OR_SKIP_TOKEN(T_OPEN_TAG);
}
<INITIAL>"<?php" {
/* Allow <?php followed by end of file. */
if (YYCURSOR == YYLIMIT) {
BEGIN(ST_IN_SCRIPTING);
RETURN_OR_SKIP_TOKEN(T_OPEN_TAG);
}
/* Degenerate case: <?phpX is interpreted as <? phpX with short tags. */
if (CG(short_tags)) {
yyless(2);
BEGIN(ST_IN_SCRIPTING);
RETURN_OR_SKIP_TOKEN(T_OPEN_TAG);
}
goto inline_char_handler;
}
<INITIAL>"<?" {
if (CG(short_tags)) {
BEGIN(ST_IN_SCRIPTING);
if (PARSER_MODE()) {
SKIP_TOKEN(T_OPEN_TAG);
}
RETURN_TOKEN(T_OPEN_TAG);
RETURN_OR_SKIP_TOKEN(T_OPEN_TAG);
} else {
goto inline_char_handler;
}
@@ -2059,8 +2072,12 @@ inline_char_handler:
}
if (*YYCURSOR == '?') {
if (CG(short_tags) || !strncasecmp((char*)YYCURSOR + 1, "php", 3) || (*(YYCURSOR + 1) == '=')) { /* Assume [ \t\n\r] follows "php" */
if (CG(short_tags) /* <? */
|| (*(YYCURSOR + 1) == '=') /* <?= */
|| (!strncasecmp((char*)YYCURSOR + 1, "php", 3) && /* <?php[ \t\r\n] */
(YYCURSOR[4] == ' ' || YYCURSOR[4] == '\t' ||
YYCURSOR[4] == '\n' || YYCURSOR[4] == '\r'))
) {
YYCURSOR--;
break;
}
@@ -2159,11 +2176,7 @@ inline_char_handler:
}
yyleng = YYCURSOR - SCNG(yy_text);
if (PARSER_MODE()) {
SKIP_TOKEN(T_COMMENT);
}
RETURN_TOKEN(T_COMMENT);
RETURN_OR_SKIP_TOKEN(T_COMMENT);
}
<ST_IN_SCRIPTING>"/*"|"/**"{WHITESPACE} {
@@ -2193,16 +2206,10 @@ inline_char_handler:
if (doc_com) {
CG(doc_comment) = zend_string_init(yytext, yyleng, 0);
if (PARSER_MODE()) {
SKIP_TOKEN(T_DOC_COMMENT);
}
RETURN_TOKEN(T_DOC_COMMENT);
RETURN_OR_SKIP_TOKEN(T_DOC_COMMENT);
}
if (PARSER_MODE()) {
SKIP_TOKEN(T_COMMENT);
}
RETURN_TOKEN(T_COMMENT);
RETURN_OR_SKIP_TOKEN(T_COMMENT);
}
<ST_IN_SCRIPTING>"?>"{NEWLINE}? {
@@ -2844,8 +2851,12 @@ nowdoc_scan_done:
RETURN_TOKEN(END);
}
zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
goto restart;
zend_error(E_COMPILE_WARNING, "Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
if (PARSER_MODE()) {
goto restart;
} else {
RETURN_TOKEN(T_BAD_CHARACTER);
}
}
*/
-1
View File
@@ -959,7 +959,6 @@ ZEND_API int pass_two(zend_op_array *op_array)
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op2);
break;
}
case ZEND_DECLARE_ANON_CLASS:
case ZEND_FE_FETCH_R:
case ZEND_FE_FETCH_RW:
/* absolute index to relative offset */
+16 -5
View File
@@ -328,13 +328,13 @@ void zend_signal_activate(void)
SIGG(active) = 1;
SIGG(depth) = 0;
SIGG(check) = ZEND_DEBUG;
} /* }}} */
/* {{{ zend_signal_deactivate
* */
void zend_signal_deactivate(void)
{
if (SIGG(check)) {
size_t x;
struct sigaction sa;
@@ -342,21 +342,32 @@ void zend_signal_deactivate(void)
if (SIGG(depth) != 0) {
zend_error(E_CORE_WARNING, "zend_signal: shutdown with non-zero blocking depth (%d)", SIGG(depth));
}
/* did anyone steal our installed handler */
for (x = 0; x < sizeof(zend_sigs) / sizeof(*zend_sigs); x++) {
sigaction(zend_sigs[x], NULL, &sa);
if (sa.sa_sigaction != zend_signal_handler_defer) {
if (sa.sa_sigaction != zend_signal_handler_defer &&
sa.sa_sigaction != (void *) SIG_IGN) {
zend_error(E_CORE_WARNING, "zend_signal: handler was replaced for signal (%d) after startup", zend_sigs[x]);
}
}
}
SIGNAL_BEGIN_CRITICAL();
SIGG(active) = 0;
/* After active=0 is set, signal handlers will be called directly and other
* state that is reset below will not be accessed. */
*((volatile int *) &SIGG(active)) = 0;
SIGG(running) = 0;
SIGG(blocked) = 0;
SIGG(depth) = 0;
SIGNAL_END_CRITICAL();
/* If there are any queued signals because of a missed unblock, drop them. */
if (SIGG(phead) && SIGG(ptail)) {
SIGG(ptail)->next = SIGG(pavail);
SIGG(pavail) = SIGG(phead);
SIGG(phead) = NULL;
SIGG(ptail) = NULL;
}
}
/* }}} */
+74 -169
View File
@@ -23,30 +23,9 @@
#include "zend_compile.h"
#include "zend_stream.h"
#if HAVE_MMAP
# if HAVE_UNISTD_H
# include <unistd.h>
# if defined(_SC_PAGESIZE)
# define REAL_PAGE_SIZE sysconf(_SC_PAGESIZE);
# elif defined(_SC_PAGE_SIZE)
# define REAL_PAGE_SIZE sysconf(_SC_PAGE_SIZE);
# endif
# endif
# if HAVE_SYS_MMAN_H
# include <sys/mman.h>
# endif
# ifndef REAL_PAGE_SIZE
# ifdef PAGE_SIZE
# define REAL_PAGE_SIZE PAGE_SIZE
# else
# define REAL_PAGE_SIZE 4096
# endif
# endif
#endif
ZEND_DLIMPORT int isatty(int fd);
static size_t zend_stream_stdio_reader(void *handle, char *buf, size_t len) /* {{{ */
static ssize_t zend_stream_stdio_reader(void *handle, char *buf, size_t len) /* {{{ */
{
return fread(buf, 1, len, (FILE*)handle);
} /* }}} */
@@ -69,72 +48,41 @@ static size_t zend_stream_stdio_fsizer(void *handle) /* {{{ */
#endif
return buf.st_size;
}
return 0;
} /* }}} */
static void zend_stream_unmap(zend_stream *stream) { /* {{{ */
#if HAVE_MMAP
if (stream->mmap.map) {
munmap(stream->mmap.map, stream->mmap.len + ZEND_MMAP_AHEAD);
} else
#endif
if (stream->mmap.buf) {
efree(stream->mmap.buf);
}
stream->mmap.len = 0;
stream->mmap.pos = 0;
stream->mmap.map = 0;
stream->mmap.buf = 0;
stream->handle = stream->mmap.old_handle;
} /* }}} */
static void zend_stream_mmap_closer(zend_stream *stream) /* {{{ */
{
zend_stream_unmap(stream);
if (stream->mmap.old_closer && stream->handle) {
stream->mmap.old_closer(stream->handle);
}
} /* }}} */
static inline int zend_stream_is_mmap(zend_file_handle *file_handle) { /* {{{ */
return file_handle->type == ZEND_HANDLE_MAPPED;
return -1;
} /* }}} */
static size_t zend_stream_fsize(zend_file_handle *file_handle) /* {{{ */
{
zend_stat_t buf;
if (zend_stream_is_mmap(file_handle)) {
return file_handle->handle.stream.mmap.len;
ZEND_ASSERT(file_handle->type == ZEND_HANDLE_STREAM);
if (file_handle->handle.stream.isatty) {
return 0;
}
if (file_handle->type == ZEND_HANDLE_STREAM || file_handle->type == ZEND_HANDLE_MAPPED) {
return file_handle->handle.stream.fsizer(file_handle->handle.stream.handle);
}
if (file_handle->handle.fp && zend_fstat(fileno(file_handle->handle.fp), &buf) == 0) {
#ifdef S_ISREG
if (!S_ISREG(buf.st_mode)) {
return 0;
}
#endif
return buf.st_size;
}
return -1;
return file_handle->handle.stream.fsizer(file_handle->handle.stream.handle);
} /* }}} */
ZEND_API void zend_stream_init_fp(zend_file_handle *handle, FILE *fp, const char *filename) {
memset(handle, 0, sizeof(zend_file_handle));
handle->type = ZEND_HANDLE_FP;
handle->handle.fp = fp;
handle->filename = filename;
}
ZEND_API void zend_stream_init_filename(zend_file_handle *handle, const char *filename) {
memset(handle, 0, sizeof(zend_file_handle));
handle->type = ZEND_HANDLE_FILENAME;
handle->filename = filename;
}
ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle) /* {{{ */
{
zend_string *opened_path;
if (zend_stream_open_function) {
return zend_stream_open_function(filename, handle);
}
handle->type = ZEND_HANDLE_FP;
handle->opened_path = NULL;
handle->handle.fp = zend_fopen(filename, &handle->opened_path);
handle->filename = filename;
handle->free_filename = 0;
memset(&handle->handle.stream.mmap, 0, sizeof(zend_mmap));
return (handle->handle.fp) ? SUCCESS : FAILURE;
zend_stream_init_fp(handle, zend_fopen(filename, &opened_path), filename);
handle->opened_path = opened_path;
return handle->handle.fp ? SUCCESS : FAILURE;
} /* }}} */
static int zend_stream_getc(zend_file_handle *file_handle) /* {{{ */
@@ -147,9 +95,9 @@ static int zend_stream_getc(zend_file_handle *file_handle) /* {{{ */
return EOF;
} /* }}} */
static size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len) /* {{{ */
static ssize_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len) /* {{{ */
{
if (!zend_stream_is_mmap(file_handle) && file_handle->handle.stream.isatty) {
if (file_handle->handle.stream.isatty) {
int c = '*';
size_t n;
@@ -167,8 +115,13 @@ static size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t
ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len) /* {{{ */
{
size_t size;
zend_stream_type old_type;
size_t file_size;
if (file_handle->buf) {
*buf = file_handle->buf;
*len = file_handle->len;
return SUCCESS;
}
if (file_handle->type == ZEND_HANDLE_FILENAME) {
if (zend_stream_open(file_handle->filename, file_handle) == FAILURE) {
@@ -176,75 +129,41 @@ ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t
}
}
switch (file_handle->type) {
case ZEND_HANDLE_FD:
file_handle->type = ZEND_HANDLE_FP;
file_handle->handle.fp = fdopen(file_handle->handle.fd, "rb");
/* no break; */
case ZEND_HANDLE_FP:
if (!file_handle->handle.fp) {
return FAILURE;
}
memset(&file_handle->handle.stream.mmap, 0, sizeof(zend_mmap));
file_handle->handle.stream.isatty = isatty(fileno((FILE *)file_handle->handle.stream.handle));
file_handle->handle.stream.reader = (zend_stream_reader_t)zend_stream_stdio_reader;
file_handle->handle.stream.closer = (zend_stream_closer_t)zend_stream_stdio_closer;
file_handle->handle.stream.fsizer = (zend_stream_fsizer_t)zend_stream_stdio_fsizer;
memset(&file_handle->handle.stream.mmap, 0, sizeof(file_handle->handle.stream.mmap));
/* no break; */
case ZEND_HANDLE_STREAM:
/* nothing to do */
break;
case ZEND_HANDLE_MAPPED:
file_handle->handle.stream.mmap.pos = 0;
*buf = file_handle->handle.stream.mmap.buf;
*len = file_handle->handle.stream.mmap.len;
return SUCCESS;
default:
if (file_handle->type == ZEND_HANDLE_FP) {
if (!file_handle->handle.fp) {
return FAILURE;
}
file_handle->type = ZEND_HANDLE_STREAM;
file_handle->handle.stream.handle = file_handle->handle.fp;
file_handle->handle.stream.isatty = isatty(fileno((FILE *)file_handle->handle.stream.handle));
file_handle->handle.stream.reader = (zend_stream_reader_t)zend_stream_stdio_reader;
file_handle->handle.stream.closer = (zend_stream_closer_t)zend_stream_stdio_closer;
file_handle->handle.stream.fsizer = (zend_stream_fsizer_t)zend_stream_stdio_fsizer;
}
size = zend_stream_fsize(file_handle);
if (size == (size_t)-1) {
file_size = zend_stream_fsize(file_handle);
if (file_size == (size_t)-1) {
return FAILURE;
}
old_type = file_handle->type;
file_handle->type = ZEND_HANDLE_STREAM; /* we might still be _FP but we need fsize() work */
if (old_type == ZEND_HANDLE_FP && !file_handle->handle.stream.isatty && size) {
#if HAVE_MMAP
size_t page_size = REAL_PAGE_SIZE;
if (file_handle->handle.fp &&
size != 0 &&
((size - 1) % page_size) <= page_size - ZEND_MMAP_AHEAD) {
/* *buf[size] is zeroed automatically by the kernel */
*buf = mmap(0, size + ZEND_MMAP_AHEAD, PROT_READ, MAP_PRIVATE, fileno(file_handle->handle.fp), 0);
if (*buf != MAP_FAILED) {
zend_long offset = ftell(file_handle->handle.fp);
file_handle->handle.stream.mmap.map = *buf;
if (offset != -1) {
*buf += offset;
size -= offset;
}
file_handle->handle.stream.mmap.buf = *buf;
file_handle->handle.stream.mmap.len = size;
goto return_mapped;
}
if (file_size) {
ssize_t read;
size_t size = 0;
*buf = safe_emalloc(1, file_size, ZEND_MMAP_AHEAD);
while ((read = zend_stream_read(file_handle, *buf + size, file_size - size)) > 0) {
size += read;
}
#endif
file_handle->handle.stream.mmap.map = 0;
file_handle->handle.stream.mmap.buf = *buf = safe_emalloc(1, size, ZEND_MMAP_AHEAD);
file_handle->handle.stream.mmap.len = zend_stream_read(file_handle, *buf, size);
if (read < 0) {
efree(*buf);
return FAILURE;
}
file_handle->buf = *buf;
file_handle->len = size;
} else {
size_t read, remain = 4*1024;
size_t size = 0, remain = 4*1024;
ssize_t read;
*buf = emalloc(remain);
size = 0;
while ((read = zend_stream_read(file_handle, *buf + size, remain)) > 0) {
size += read;
@@ -255,34 +174,27 @@ ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t
remain = size;
}
}
file_handle->handle.stream.mmap.map = 0;
file_handle->handle.stream.mmap.len = size;
if (read < 0) {
efree(*buf);
return FAILURE;
}
file_handle->len = size;
if (size && remain < ZEND_MMAP_AHEAD) {
*buf = safe_erealloc(*buf, size, 1, ZEND_MMAP_AHEAD);
}
file_handle->handle.stream.mmap.buf = *buf;
file_handle->buf = *buf;
}
if (file_handle->handle.stream.mmap.len == 0) {
if (file_handle->len == 0) {
*buf = erealloc(*buf, ZEND_MMAP_AHEAD);
file_handle->handle.stream.mmap.buf = *buf;
file_handle->buf = *buf;
}
if (ZEND_MMAP_AHEAD) {
memset(file_handle->handle.stream.mmap.buf + file_handle->handle.stream.mmap.len, 0, ZEND_MMAP_AHEAD);
}
#if HAVE_MMAP
return_mapped:
#endif
file_handle->type = ZEND_HANDLE_MAPPED;
file_handle->handle.stream.mmap.pos = 0;
file_handle->handle.stream.mmap.old_handle = file_handle->handle.stream.handle;
file_handle->handle.stream.mmap.old_closer = file_handle->handle.stream.closer;
file_handle->handle.stream.handle = &file_handle->handle.stream;
file_handle->handle.stream.closer = (zend_stream_closer_t)zend_stream_mmap_closer;
memset(file_handle->buf + file_handle->len, 0, ZEND_MMAP_AHEAD);
*buf = file_handle->handle.stream.mmap.buf;
*len = file_handle->handle.stream.mmap.len;
*buf = file_handle->buf;
*len = file_handle->len;
return SUCCESS;
} /* }}} */
@@ -290,14 +202,10 @@ return_mapped:
ZEND_API void zend_file_handle_dtor(zend_file_handle *fh) /* {{{ */
{
switch (fh->type) {
case ZEND_HANDLE_FD:
/* nothing to do */
break;
case ZEND_HANDLE_FP:
fclose(fh->handle.fp);
break;
case ZEND_HANDLE_STREAM:
case ZEND_HANDLE_MAPPED:
if (fh->handle.stream.closer && fh->handle.stream.handle) {
fh->handle.stream.closer(fh->handle.stream.handle);
}
@@ -313,6 +221,10 @@ ZEND_API void zend_file_handle_dtor(zend_file_handle *fh) /* {{{ */
zend_string_release_ex(fh->opened_path, 0);
fh->opened_path = NULL;
}
if (fh->buf) {
efree(fh->buf);
fh->buf = NULL;
}
if (fh->free_filename && fh->filename) {
efree((char*)fh->filename);
fh->filename = NULL;
@@ -326,17 +238,10 @@ ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *
return 0;
}
switch (fh1->type) {
case ZEND_HANDLE_FD:
return fh1->handle.fd == fh2->handle.fd;
case ZEND_HANDLE_FP:
return fh1->handle.fp == fh2->handle.fp;
case ZEND_HANDLE_STREAM:
return fh1->handle.stream.handle == fh2->handle.stream.handle;
case ZEND_HANDLE_MAPPED:
return (fh1->handle.stream.handle == &fh1->handle.stream &&
fh2->handle.stream.handle == &fh2->handle.stream &&
fh1->handle.stream.mmap.old_handle == fh2->handle.stream.mmap.old_handle)
|| fh1->handle.stream.handle == fh2->handle.stream.handle;
default:
return 0;
}
+9 -16
View File
@@ -29,32 +29,20 @@
* These functions are private to the engine.
* */
typedef size_t (*zend_stream_fsizer_t)(void* handle);
typedef size_t (*zend_stream_reader_t)(void* handle, char *buf, size_t len);
typedef ssize_t (*zend_stream_reader_t)(void* handle, char *buf, size_t len);
typedef void (*zend_stream_closer_t)(void* handle);
#define ZEND_MMAP_AHEAD 32
typedef enum {
ZEND_HANDLE_FILENAME,
ZEND_HANDLE_FD,
ZEND_HANDLE_FP,
ZEND_HANDLE_STREAM,
ZEND_HANDLE_MAPPED
ZEND_HANDLE_STREAM
} zend_stream_type;
typedef struct _zend_mmap {
size_t len;
size_t pos;
void *map;
char *buf;
void *old_handle;
zend_stream_closer_t old_closer;
} zend_mmap;
typedef struct _zend_stream {
void *handle;
int isatty;
zend_mmap mmap;
zend_stream_reader_t reader;
zend_stream_fsizer_t fsizer;
zend_stream_closer_t closer;
@@ -62,17 +50,22 @@ typedef struct _zend_stream {
typedef struct _zend_file_handle {
union {
int fd;
FILE *fp;
zend_stream stream;
} handle;
const char *filename;
zend_string *opened_path;
zend_stream_type type;
zend_bool free_filename;
/* free_filename is used by wincache */
/* TODO: Clean up filename vs opened_path mess */
zend_bool free_filename;
char *buf;
size_t len;
} zend_file_handle;
BEGIN_EXTERN_C()
ZEND_API void zend_stream_init_fp(zend_file_handle *handle, FILE *fp, const char *filename);
ZEND_API void zend_stream_init_filename(zend_file_handle *handle, const char *filename);
ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle);
ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len);
ZEND_API void zend_file_handle_dtor(zend_file_handle *fh);
+8 -2
View File
@@ -555,9 +555,11 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
/* zval.u1.v.type_flags */
#define IS_TYPE_REFCOUNTED (1<<0)
#define IS_TYPE_COLLECTABLE (1<<1)
#if 1
/* This optimized version assumes that we have a single "type_flag" */
/* IS_TYPE_COLLECTABLE may be used only with IS_TYPE_REFCOUNTED */
# define Z_TYPE_INFO_REFCOUNTED(t) (((t) & Z_TYPE_FLAGS_MASK) != 0)
#else
# define Z_TYPE_INFO_REFCOUNTED(t) (((t) & (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT)) != 0)
@@ -567,8 +569,8 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
#define IS_INTERNED_STRING_EX IS_STRING
#define IS_STRING_EX (IS_STRING | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
#define IS_ARRAY_EX (IS_ARRAY | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
#define IS_OBJECT_EX (IS_OBJECT | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
#define IS_ARRAY_EX (IS_ARRAY | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT) | (IS_TYPE_COLLECTABLE << Z_TYPE_FLAGS_SHIFT))
#define IS_OBJECT_EX (IS_OBJECT | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT) | (IS_TYPE_COLLECTABLE << Z_TYPE_FLAGS_SHIFT))
#define IS_RESOURCE_EX (IS_RESOURCE | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
#define IS_REFERENCE_EX (IS_REFERENCE | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
@@ -624,12 +626,16 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
#if 1
/* This optimized version assumes that we have a single "type_flag" */
/* IS_TYPE_COLLECTABLE may be used only with IS_TYPE_REFCOUNTED */
#define Z_REFCOUNTED(zval) (Z_TYPE_FLAGS(zval) != 0)
#else
#define Z_REFCOUNTED(zval) ((Z_TYPE_FLAGS(zval) & IS_TYPE_REFCOUNTED) != 0)
#endif
#define Z_REFCOUNTED_P(zval_p) Z_REFCOUNTED(*(zval_p))
#define Z_COLLECTABLE(zval) ((Z_TYPE_FLAGS(zval) & IS_TYPE_COLLECTABLE) != 0)
#define Z_COLLECTABLE_P(zval_p) Z_COLLECTABLE(*(zval_p))
/* deprecated: (COPYABLE is the same as IS_ARRAY) */
#define Z_COPYABLE(zval) (Z_TYPE(zval) == IS_ARRAY)
#define Z_COPYABLE_P(zval_p) Z_COPYABLE(*(zval_p))
+18 -1
View File
@@ -22,7 +22,6 @@
#define VIRTUAL_CWD_H
#include "TSRM.h"
#include "tsrm_config_common.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -33,6 +32,24 @@
#endif
#include <stdarg.h>
#include <limits.h>
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#ifndef MAXPATHLEN
# if _WIN32
# include "win32/ioutil.h"
# define MAXPATHLEN PHP_WIN32_IOUTIL_MAXPATHLEN
# elif PATH_MAX
# define MAXPATHLEN PATH_MAX
# elif defined(MAX_PATH)
# define MAXPATHLEN MAX_PATH
# else
# define MAXPATHLEN 256
# endif
#endif
#ifdef ZTS
#define VIRTUAL_DIR
+652 -431
View File
File diff suppressed because it is too large. Load diff
+6281 -6630
View File
File diff suppressed because it is too large. Load diff
+147 -38
View File
@@ -326,7 +326,7 @@ $op1_get_zval_ptr_ptr_undef = array(
"UNUSED" => "NULL",
"CV" => "EX_VAR(opline->op1.var)",
"TMPVAR" => "???",
"TMPVARCV" => "EX_VAR(opline->op1.var)",
"TMPVARCV" => "???",
);
$op2_get_zval_ptr_ptr_undef = array(
@@ -337,7 +337,7 @@ $op2_get_zval_ptr_ptr_undef = array(
"UNUSED" => "NULL",
"CV" => "EX_VAR(opline->op2.var)",
"TMPVAR" => "???",
"TMPVARCV" => "EX_VAR(opline->op2.var)",
"TMPVARCV" => "???",
);
$op1_get_obj_zval_ptr = array(
@@ -436,7 +436,7 @@ $op1_get_obj_zval_ptr_ptr_undef = array(
"UNUSED" => "&EX(This)",
"CV" => "EX_VAR(opline->op1.var)",
"TMPVAR" => "???",
"TMPVARCV" => "EX_VAR(opline->op1.var)",
"TMPVARCV" => "???",
);
$op2_get_obj_zval_ptr_ptr_undef = array(
@@ -447,7 +447,7 @@ $op2_get_obj_zval_ptr_ptr_undef = array(
"UNUSED" => "&EX(This)",
"CV" => "EX_VAR(opline->op2.var)",
"TMPVAR" => "???",
"TMPVARCV" => "EX_VAR(opline->op2.var)",
"TMPVARCV" => "???",
);
$op1_free_op = array(
@@ -812,10 +812,8 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
"/FREE_OP2_VAR_PTR\(\)/" => $op2_free_op_var_ptr[$op2],
"/FREE_UNFETCHED_OP1\(\)/" => $op1_free_unfetched[$op1],
"/FREE_UNFETCHED_OP2\(\)/" => $op2_free_unfetched[$op2],
"/^#(\s*)ifdef\s+ZEND_VM_SPEC\s*\n/m" => ($op1!="ANY"||$op2!="ANY")?"#\\1if 1\n":"#\\1if 0\n",
"/^#(\s*)ifndef\s+ZEND_VM_SPEC\s*\n/m" => ($op1!="ANY"||$op2!="ANY")?"#\\1if 0\n":"#\\1if 1\n",
"/\!defined\(ZEND_VM_SPEC\)/m" => ($op1!="ANY"||$op2!="ANY")?"0":"1",
"/defined\(ZEND_VM_SPEC\)/m" => ($op1!="ANY"||$op2!="ANY")?"1":"0",
"/\!ZEND_VM_SPEC/m" => ($op1!="ANY"||$op2!="ANY")?"0":"1",
"/ZEND_VM_SPEC/m" => ($op1!="ANY"||$op2!="ANY")?"1":"0",
"/ZEND_VM_C_LABEL\(\s*([A-Za-z_]*)\s*\)/m" => "\\1".(($spec && $kind != ZEND_VM_KIND_CALL)?("_SPEC".$prefix[$op1].$prefix[$op2].extra_spec_name($extra_spec)):""),
"/ZEND_VM_C_GOTO\(\s*([A-Za-z_]*)\s*\)/m" => "goto \\1".(($spec && $kind != ZEND_VM_KIND_CALL)?("_SPEC".$prefix[$op1].$prefix[$op2].extra_spec_name($extra_spec)):""),
"/^#(\s*)if\s+1\s*\\|\\|.*[^\\\\]$/m" => "#\\1if 1",
@@ -839,6 +837,18 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
: ($extra_spec['SMART_BRANCH'] == 2 ?
"ZEND_VM_SMART_BRANCH_JMPNZ(\\1, \\2)" : ""))
: "ZEND_VM_SMART_BRANCH(\\1, \\2)",
"/ZEND_VM_SMART_BRANCH_TRUE\(\s*\)/" => isset($extra_spec['SMART_BRANCH']) ?
($extra_spec['SMART_BRANCH'] == 1 ?
"ZEND_VM_SMART_BRANCH_TRUE_JMPZ()"
: ($extra_spec['SMART_BRANCH'] == 2 ?
"ZEND_VM_SMART_BRANCH_TRUE_JMPNZ()" : ""))
: "ZEND_VM_SMART_BRANCH_TRUE()",
"/ZEND_VM_SMART_BRANCH_FALSE\(\s*\)/" => isset($extra_spec['SMART_BRANCH']) ?
($extra_spec['SMART_BRANCH'] == 1 ?
"ZEND_VM_SMART_BRANCH_FALSE_JMPZ()"
: ($extra_spec['SMART_BRANCH'] == 2 ?
"ZEND_VM_SMART_BRANCH_FALSE_JMPNZ()" : ""))
: "ZEND_VM_SMART_BRANCH_FALSE()",
"/opline->extended_value\s*&\s*ZEND_ISEMPTY/" => isset($extra_spec['ISSET']) ?
($extra_spec['ISSET'] == 0 ? "0" : "1")
: "\\0",
@@ -871,14 +881,19 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
return "goto " . opcode_name($name, $spec, $op1, $op2, $extra_spec) . "_LABEL";
} else {
// ZEND_VM_DISPATCH_TO_HELPER
if (is_hot_helper($matches[1])) {
if (isset($matches[2])) {
// extra args
$args = preg_replace("/,\s*([A-Za-z0-9_]*)\s*,\s*([^,)\s]*)\s*/", "$1 = $2; ", $matches[2]);
return $args . "goto " . helper_name($matches[1], $spec, $op1, $op2, $extra_spec) . "_LABEL";
}
return "goto " . helper_name($matches[1], $spec, $op1, $op2, $extra_spec) . "_LABEL";
}
if (isset($matches[2])) {
// extra args
$args = substr(preg_replace("/,\s*[A-Za-z_]*\s*,\s*([^,)\s]*)\s*/", ", $1", $matches[2]), 2);
$args = substr(preg_replace("/,\s*[A-Za-z0-9_]*\s*,\s*([^,)\s]*)\s*/", ", $1", $matches[2]), 2);
return "ZEND_VM_TAIL_CALL(" . helper_name($matches[1], $spec, $op1, $op2, $extra_spec) . "(" . $args. " ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC))";
}
if (is_hot_helper($matches[1])) {
return "goto " . helper_name($matches[1], $spec, $op1, $op2, $extra_spec) . "_LABEL";
}
return "ZEND_VM_TAIL_CALL(" . helper_name($matches[1], $spec, $op1, $op2, $extra_spec) . "(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU))";
}
},
@@ -891,16 +906,26 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
"/ZEND_VM_DISPATCH_TO_HANDLER\(\s*([A-Z_]*)\s*\)/m",
"/ZEND_VM_DISPATCH_TO_HELPER\(\s*([A-Za-z_]*)\s*(,[^)]*)?\)/m",
),
function($matches) use ($spec, $prefix, $op1, $op2, $extra_spec) {
function($matches) use ($spec, $prefix, $op1, $op2, $extra_spec, $name) {
if (strncasecmp($matches[0], "EXECUTE_DATA", strlen("EXECUTE_DATA")) == 0) {
return "execute_data";
} else if (strncasecmp($matches[0], "ZEND_VM_DISPATCH_TO_HANDLER", strlen("ZEND_VM_DISPATCH_TO_HANDLER")) == 0) {
return "ZEND_VM_TAIL_CALL(" . opcode_name($matches[1], $spec, $op1, $op2, $extra_spec) . "_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU))";
global $opcodes, $opnames;
$handler = $matches[1];
$opcode = $opcodes[$opnames[$handler]];
$inline =
ZEND_VM_KIND == ZEND_VM_KIND_HYBRID &&
isset($opcode["use"]) &&
is_hot_handler($opcode["hot"], $op1, $op2, $extra_spec) &&
is_hot_handler($opcodes[$opnames[$name]]["hot"], $op1, $op2, $extra_spec) ?
"_INLINE" : "";
return "ZEND_VM_TAIL_CALL(" . opcode_name($handler, $spec, $op1, $op2, $extra_spec) . $inline . "_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU))";
} else {
// ZEND_VM_DISPATCH_TO_HELPER
if (isset($matches[2])) {
// extra args
$args = substr(preg_replace("/,\s*[A-Za-z_]*\s*,\s*([^,)\s]*)\s*/", ", $1", $matches[2]), 2);
$args = substr(preg_replace("/,\s*[A-Za-z0-9_]*\s*,\s*([^,)\s]*)\s*/", ", $1", $matches[2]), 2);
return "ZEND_VM_TAIL_CALL(" . helper_name($matches[1], $spec, $op1, $op2, $extra_spec) . "(" . $args. " ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC))";
}
return "ZEND_VM_TAIL_CALL(" . helper_name($matches[1], $spec, $op1, $op2, $extra_spec) . "(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU))";
@@ -924,7 +949,7 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
// ZEND_VM_DISPATCH_TO_HELPER
if (isset($matches[2])) {
// extra args
$args = preg_replace("/,\s*([A-Za-z_]*)\s*,\s*([^,)\s]*)\s*/", "$1 = $2; ", $matches[2]);
$args = preg_replace("/,\s*([A-Za-z0-9_]*)\s*,\s*([^,)\s]*)\s*/", "$1 = $2; ", $matches[2]);
return $args . "goto " . helper_name($matches[1], $spec, $op1, $op2, $extra_spec);
}
return "goto " . helper_name($matches[1], $spec, $op1, $op2, $extra_spec);
@@ -948,7 +973,7 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
// ZEND_VM_DISPATCH_TO_HELPER
if (isset($matches[2])) {
// extra args
$args = preg_replace("/,\s*([A-Za-z_]*)\s*,\s*([^,)\s]*)\s*/", "$1 = $2; ", $matches[2]);
$args = preg_replace("/,\s*([A-Za-z0-9_]*)\s*,\s*([^,)\s]*)\s*/", "$1 = $2; ", $matches[2]);
return $args . "goto " . helper_name($matches[1], $spec, $op1, $op2, $extra_spec);
}
return "goto " . helper_name($matches[1], $spec, $op1, $op2, $extra_spec);
@@ -1028,6 +1053,8 @@ function is_hot_handler($hot, $op1, $op2, $extra_spec) {
return true;
} else if ($hot === 'HOT_NOCONST_') {
return ($op1 !== 'CONST');
} else if ($hot === 'HOT_NOCONSTCONST_') {
return (($op1 !== 'CONST') || ($op2 !== 'CONST')) ;
} else if ($hot === 'HOT_OBJ_') {
return (($op1 === 'UNUSED') || ($op1 === 'CV')) && ($op2 === 'CONST');
} else if ($hot === 'HOT_SEND_') {
@@ -1048,6 +1075,8 @@ function is_cold_handler($hot, $op1, $op2, $extra_spec) {
return ($op1 === 'CONST');
} else if ($hot === 'HOT_NOCONST_') {
return ($op1 === 'CONST');
} else if ($hot === 'HOT_NOCONSTCONST_') {
return ($op1 === 'CONST' && $op2 === 'CONST');
} else {
return false;
}
@@ -1061,15 +1090,34 @@ function is_inline_hybrid_handler($name, $hot, $op1, $op2, $extra_spec) {
function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno, $opcode, $extra_spec = null, &$switch_labels = array()) {
global $definition_file, $prefix, $opnames, $gen_order;
if (isset($opcode['alias']) && ($spec || $kind != ZEND_VM_KIND_SWITCH)) {
return;
}
if ($spec && skip_extra_spec_function($op1, $op2, $extra_spec)) {
return;
}
/* Skip SMART_BRANCH specialization for "cold" CONST_CONST instructions */
if (isset($extra_spec["SMART_BRANCH"])) {
if ($opcode["hot"] === 'HOT_NOCONSTCONST_'
|| $opcode["hot"] === 'COLD_CONSTCONST_') {
if (($op1 === 'CONST') && ($op2 === 'CONST')) {
if ($extra_spec["SMART_BRANCH"] == 0) {
unset($extra_spec["SMART_BRANCH"]);
} else {
return;
}
}
}
}
if (ZEND_VM_LINES) {
out($f, "#line $lineno \"$definition_file\"\n");
}
// Generate opcode handler's entry point according to selected threading model
$additional_func = false;
$spec_name = $name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2].($spec?extra_spec_name($extra_spec):"");
switch($kind) {
case ZEND_VM_KIND_HYBRID:
@@ -1083,10 +1131,14 @@ function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno,
. stream_get_contents($out);
fclose($out);
} else {
$inline =
isset($opcode["use"]) &&
is_hot_handler($opcode["hot"], $op1, $op2, $extra_spec) ?
"_INLINE" : "";
$code =
"\t\t\tHYBRID_CASE({$spec_name}):\n"
. "\t\t\t\tVM_TRACE($spec_name)\n"
. "\t\t\t\t{$spec_name}_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n"
. "\t\t\t\t{$spec_name}{$inline}_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n"
. "\t\t\t\tHYBRID_BREAK();\n";
}
if (is_array($gen_order)) {
@@ -1097,7 +1149,12 @@ function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno,
return;
case ZEND_VM_KIND_CALL:
if ($opcode["hot"] && ZEND_VM_KIND == ZEND_VM_KIND_HYBRID && is_hot_handler($opcode["hot"], $op1, $op2, $extra_spec)) {
out($f,"static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n");
if (isset($opcode["use"])) {
out($f,"static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n");
$additional_func = true;
} else {
out($f,"static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n");
}
} else if ($opcode["hot"] && is_cold_handler($opcode["hot"], $op1, $op2, $extra_spec)) {
out($f,"static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n");
} else {
@@ -1126,6 +1183,14 @@ function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno,
// Generate opcode handler's code
gen_code($f, $spec, $kind, 0, $code, $op1, $op2, $name, $extra_spec);
if ($additional_func) {
out($f,"static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n");
out($f,"{\n");
out($f,"\tZEND_VM_TAIL_CALL({$spec_name}_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));\n");
out($f,"}\n");
out($f,"\n");
}
}
// Generates helper
@@ -1140,10 +1205,6 @@ function gen_helper($f, $spec, $kind, $name, $op1, $op2, $param, $code, $lineno,
return;
}
if ($spec && $name === "zend_binary_assign_op_helper") {
return;
}
if (ZEND_VM_LINES) {
out($f, "#line $lineno \"$definition_file\"\n");
}
@@ -1163,7 +1224,7 @@ function gen_helper($f, $spec, $kind, $name, $op1, $op2, $param, $code, $lineno,
if ($cold) {
$zend_attributes = " zend_never_inline ZEND_COLD";
} else {
$zend_attributes = "";
$zend_attributes = " zend_never_inline";
}
$zend_fastcall = " ZEND_FASTCALL";
}
@@ -1204,7 +1265,7 @@ function gen_null_label($f, $kind, $prolog) {
// Generates array of opcode handlers (specialized or unspecialized)
function gen_labels($f, $spec, $kind, $prolog, &$specs, $switch_labels = array()) {
global $opcodes, $op_types, $prefix, $op_types_ex;
global $opcodes, $opnames, $op_types, $prefix, $op_types_ex;
$list = [];
$next = 0;
@@ -1214,6 +1275,10 @@ function gen_labels($f, $spec, $kind, $prolog, &$specs, $switch_labels = array()
// For each opcode in opcode number order
foreach($opcodes as $num => $dsc) {
if (isset($dsc['alias'])) {
$specs[$num] = $specs[$opnames[$dsc['alias']]];
continue;
}
$specs[$num] = "$label";
$spec_op1 = $spec_op2 = $spec_extra = false;
$def_op1_type = $def_op2_type = "ANY";
@@ -1357,6 +1422,16 @@ function gen_labels($f, $spec, $kind, $prolog, &$specs, $switch_labels = array()
return;
}
/* Skip SMART_BRANCH specialization for "cold" CONST_CONST instructions */
if (isset($extra_spec["SMART_BRANCH"])) {
if ($dsc["hot"] === 'HOT_NOCONSTCONST_'
|| $dsc["hot"] === 'COLD_CONSTCONST_') {
if (($op1 === 'CONST') && ($op2 === 'CONST')) {
unset($extra_spec["SMART_BRANCH"]);
}
}
}
// Emit pointer to specialized handler
$spec_name = $dsc["op"]."_SPEC".$prefix[$op1].$prefix[$op2].extra_spec_name($extra_spec);
switch ($kind) {
@@ -1425,8 +1500,18 @@ function gen_labels($f, $spec, $kind, $prolog, &$specs, $switch_labels = array()
}
$next = $num+1;
//ugly trick for ZEND_VM_DEFINE_OP
if ($dsc["code"]) {
if (isset($dsc['alias']) && $kind != ZEND_VM_KIND_SWITCH) {
// Emit pointer to unspecialized handler
switch ($kind) {
case ZEND_VM_KIND_CALL:
out($f,$prolog.$dsc['alias']."_HANDLER,\n");
break;
case ZEND_VM_KIND_GOTO:
out($f,$prolog."(void*)&&".$dsc['alias']."_LABEL,\n");
break;
}
$list[] = $dsc["op"];
} else if ($dsc["code"]) { //ugly trick for ZEND_VM_DEFINE_OP
// Emit pointer to unspecialized handler
switch ($kind) {
case ZEND_VM_KIND_CALL:
@@ -1845,8 +1930,8 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
out($f,"# define ZEND_VM_RETURN() return -1\n");
if ($kind == ZEND_VM_KIND_HYBRID) {
out($f,"# define ZEND_VM_HOT\n");
out($f,"# define ZEND_VM_COLD ZEND_COLD ZEND_OPT_SIZE\n");
}
out($f,"# define ZEND_VM_COLD ZEND_COLD ZEND_OPT_SIZE\n");
out($f,"#endif\n");
out($f,"\n");
out($f,"typedef ZEND_OPCODE_HANDLER_RET (ZEND_FASTCALL *opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);\n");
@@ -2003,14 +2088,22 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
out($f, $m[1].$executor_name.$m[3]."\n");
break;
case "HELPER_VARS":
if ($kind != ZEND_VM_KIND_CALL && $kind != ZEND_VM_KIND_HYBRID) {
if ($kind == ZEND_VM_KIND_SWITCH) {
out($f,$m[1]."const void *dispatch_handler;\n");
if ($kind == ZEND_VM_KIND_SWITCH) {
out($f,$m[1]."const void *dispatch_handler;\n");
}
if ($kind != ZEND_VM_KIND_CALL && count($params)) {
if ($kind == ZEND_VM_KIND_HYBRID) {
out($f, "#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
}
// Emit local variables those are used for helpers' parameters
foreach ($params as $param => $x) {
out($f,$m[1].$param.";\n");
}
if ($kind == ZEND_VM_KIND_HYBRID) {
out($f, "#endif\n");
}
}
if ($kind != ZEND_VM_KIND_CALL && $kind != ZEND_VM_KIND_HYBRID) {
out($f,"#ifdef ZEND_VM_FP_GLOBAL_REG\n");
out($f,$m[1]."register zend_execute_data *execute_data __asm__(ZEND_VM_FP_GLOBAL_REG) = ex;\n");
out($f,"#else\n");
@@ -2301,6 +2394,7 @@ function gen_vm($def, $skel) {
strpos($line,"ZEND_VM_INLINE_HANDLER(") === 0 ||
strpos($line,"ZEND_VM_HOT_HANDLER(") === 0 ||
strpos($line,"ZEND_VM_HOT_NOCONST_HANDLER(") === 0 ||
strpos($line,"ZEND_VM_HOT_NOCONSTCONST_HANDLER(") === 0 ||
strpos($line,"ZEND_VM_HOT_SEND_HANDLER(") === 0 ||
strpos($line,"ZEND_VM_HOT_OBJ_HANDLER(") === 0 ||
strpos($line,"ZEND_VM_COLD_HANDLER(") === 0 ||
@@ -2308,7 +2402,7 @@ function gen_vm($def, $skel) {
strpos($line,"ZEND_VM_COLD_CONSTCONST_HANDLER(") === 0) {
// Parsing opcode handler's definition
if (preg_match(
"/^ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_|COLD_|COLD_CONST_|COLD_CONSTCONST_)?HANDLER\(\s*([0-9]+)\s*,\s*([A-Z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
"/^ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_|HOT_NOCONSTCONST_|COLD_|COLD_CONST_|COLD_CONSTCONST_)?HANDLER\(\s*([0-9]+)\s*,\s*([A-Z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
$line,
$m) == 0) {
die("ERROR ($def:$lineno): Invalid ZEND_VM_HANDLER definition.\n");
@@ -2354,11 +2448,12 @@ function gen_vm($def, $skel) {
strpos($line,"ZEND_VM_INLINE_TYPE_SPEC_HANDLER(") === 0 ||
strpos($line,"ZEND_VM_HOT_TYPE_SPEC_HANDLER(") === 0 ||
strpos($line,"ZEND_VM_HOT_NOCONST_TYPE_SPEC_HANDLER(") === 0 ||
strpos($line,"ZEND_VM_HOT_NOCONSTCONST_TYPE_SPEC_HANDLER(") === 0 ||
strpos($line,"ZEND_VM_HOT_SEND_TYPE_SPEC_HANDLER(") === 0 ||
strpos($line,"ZEND_VM_HOT_OBJ_TYPE_SPEC_HANDLER(") === 0) {
// Parsing opcode handler's definition
if (preg_match(
"/^ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_)?TYPE_SPEC_HANDLER\(\s*([A-Z_]+)\s*,\s*((?:[^(,]|\([^()]*|(?R)*\))*),\s*([A-Za-z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
"/^ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_|HOT_NOCONSTCONST_)?TYPE_SPEC_HANDLER\(\s*([A-Z_]+)\s*,\s*((?:[^(,]|\([^()]*|(?R)*\))*),\s*([A-Za-z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
$line,
$m) == 0) {
die("ERROR ($def:$lineno): Invalid ZEND_VM_TYPE_HANDLER_HANDLER definition.\n");
@@ -2421,10 +2516,14 @@ function gen_vm($def, $skel) {
}
// Store parameters
foreach (explode(",", $param) as $p) {
$p = trim($p);
if ($p !== "") {
$params[$p] = 1;
if (ZEND_VM_KIND == ZEND_VM_KIND_GOTO
|| ZEND_VM_KIND == ZEND_VM_KIND_SWITCH
|| (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID && $hot)) {
foreach (explode(",", $param) as $p) {
$p = trim($p);
if ($p !== "") {
$params[$p] = 1;
}
}
}
@@ -2496,7 +2595,17 @@ function gen_vm($def, $skel) {
// Search for opcode handlers those are used by other opcode handlers
foreach ($opcodes as $dsc) {
if (preg_match_all("/ZEND_VM_DISPATCH_TO_HANDLER\(\s*([A-Z_]*)\s*\)/m", $dsc["code"], $mm, PREG_SET_ORDER)) {
if (preg_match("/^\s*{\s*ZEND_VM_DISPATCH_TO_HANDLER\(\s*([A-Z_]*)\s*\)\s*;\s*}\s*/", $dsc["code"], $m)) {
$op = $m[1];
if (!isset($opnames[$op])) {
die("ERROR ($def:$lineno): Opcode with name '$op' is not defined.\n");
}
$opcodes[$opnames[$dsc['op']]]['alias'] = $op;
if (!ZEND_VM_SPEC && ZEND_VM_KIND == ZEND_VM_KIND_SWITCH) {
$code = $opnames[$op];
$opcodes[$code]['use'] = 1;
}
} else if (preg_match_all("/ZEND_VM_DISPATCH_TO_HANDLER\(\s*([A-Z_]*)\s*\)/m", $dsc["code"], $mm, PREG_SET_ORDER)) {
foreach ($mm as $m) {
$op = $m[1];
if (!isset($opnames[$op])) {
+1678 -1590
View File
File diff suppressed because it is too large. Load diff
+16 -16
View File
@@ -222,17 +222,17 @@ static const char *zend_vm_opcodes_names[195] = {
static uint32_t zend_vm_opcodes_flags[195] = {
0x00000000,
0x00000b0b,
0x00000b0b,
0x80000b0b,
0x00000707,
0x00000707,
0x80000707,
0x00000707,
0x00000707,
0x00000707,
0x00000707,
0x00000b0b,
0x00000b0b,
0x00000b0b,
0x40000707,
0x80000707,
0x80000707,
0x80000707,
0x80000b0b,
0x80000b0b,
0x80000b0b,
0x00000707,
0x00000007,
0x00000007,
@@ -241,8 +241,8 @@ static uint32_t zend_vm_opcodes_flags[195] = {
0x80000303,
0x80000707,
0x80000707,
0x00000707,
0x00000707,
0x00000b0b,
0x00000b0b,
0x00000301,
0x00006701,
0x00040751,
@@ -363,11 +363,11 @@ static uint32_t zend_vm_opcodes_flags[195] = {
0x00000000,
0x00000101,
0x00000000,
0x00000103,
0x00040103,
0x00000303,
0x00000003,
0x00000303,
0x03000000,
0x00040000,
0x00000000,
0x00060757,
0x00000000,
@@ -390,7 +390,7 @@ static uint32_t zend_vm_opcodes_flags[195] = {
0x00000003,
0x00000105,
0x00040301,
0x00002007,
0x00002003,
0x00000707,
0x00000101,
0x00000103,
@@ -411,8 +411,8 @@ static uint32_t zend_vm_opcodes_flags[195] = {
0x0300030b,
0x0300030b,
0x01000303,
0x00000103,
0x00000103,
0x00000107,
0x00000107,
0x00000101,
0x00000103,
0x00000707,
-1
View File
@@ -15,7 +15,6 @@ steps:
libenchant-dev \
libaspell-dev \
libpspell-dev \
librecode-dev \
libsasl2-dev \
libxpm-dev \
libzip-dev \
-1
View File
@@ -22,7 +22,6 @@ steps:
libenchant-dev:i386 \
libaspell-dev:i386 \
libpspell-dev:i386 \
librecode-dev:i386 \
libsasl2-dev:i386 \
libxpm-dev:i386 \
libjpeg-dev:i386 \
-3
View File
@@ -2,9 +2,6 @@ parameters:
packages: ''
steps:
- script: |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
displayName: 'Install Homebrew'
- script: |
brew install pkg-config \
autoconf \
-42
View File
@@ -1,42 +0,0 @@
# +----------------------------------------------------------------------+
# | PHP Version 7 |
# +----------------------------------------------------------------------+
# | Copyright (c) The PHP Group |
# +----------------------------------------------------------------------+
# | This source file is subject to version 3.01 of the PHP license, |
# | that is bundled with this package in the file LICENSE, and is |
# | available through the world-wide-web at the following url: |
# | http://www.php.net/license/3_01.txt |
# | If you did not receive a copy of the PHP license and are unable to |
# | obtain it through the world-wide-web, please send a note to |
# | license@php.net so we can mail you a copy immediately. |
# +----------------------------------------------------------------------+
# | Author: Sascha Schumann <sascha@schumann.cx> |
# +----------------------------------------------------------------------+
#
#
# Makefile to generate build tools
#
config_h_in = main/php_config.h.in
PHP_AUTOCONF = autoconf
PHP_AUTOHEADER = autoheader
PHP_AUTOCONF_FLAGS = -f
all: configure $(config_h_in)
configure: configure.ac $(PHP_M4_FILES)
# Remove aclocal.m4 if present. It is automatically included by autoconf but
# not used by the PHP build system since PHP 7.4.
@echo rebuilding $@
@rm -f $@ aclocal.m4
@$(PHP_AUTOCONF) $(PHP_AUTOCONF_FLAGS)
$(config_h_in): configure
# Explicitly remove target since autoheader does not seem to work correctly
# otherwise (timestamps are not updated). Also disable PACKAGE_* symbols in the
# generated php_config.h.in template.
@echo rebuilding $@
@rm -f $@
@$(PHP_AUTOHEADER) $(PHP_AUTOCONF_FLAGS)
@sed -e 's/^#undef PACKAGE_[^ ]*/\/\* & \*\//g' < $@ > $@.tmp && mv $@.tmp $@
+16 -20
View File
@@ -1322,26 +1322,6 @@ if test "$ac_cv_struct_flock" = "yes" ; then
fi
])
dnl
dnl PHP_SOCKLEN_T
dnl
AC_DEFUN([PHP_SOCKLEN_T],[
AC_CACHE_CHECK(for socklen_t,ac_cv_socklen_t,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/socket.h>
]],[[
socklen_t x;
]])],[
ac_cv_socklen_t=yes
],[
ac_cv_socklen_t=no
]))
if test "$ac_cv_socklen_t" = "yes"; then
AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t])
fi
])
dnl
dnl PHP_MISSING_FCLOSE_DECL
dnl
@@ -2715,3 +2695,19 @@ int main() {
AC_DEFINE_UNQUOTED(AS_TR_CPP([PHP_HAVE_$1_INSTRUCTIONS]),
[$have_ext_instructions], [Whether the compiler supports $1 instructions])
])
dnl
dnl PHP_PATCH_CONFIG_HEADERS([FILE])
dnl
dnl PACKAGE_* symbols are automatically defined by Autoconf. When including
dnl configuration header, warnings about redefined symbols are emitted for such
dnl symbols if they are defined by multiple libraries. This disables all
dnl PACKAGE_* symbols in the generated configuration header template FILE. For
dnl example, main/php_config.h.in for PHP or config.h.in for PHP extensions.
dnl
AC_DEFUN([PHP_PATCH_CONFIG_HEADERS], [
AC_MSG_NOTICE([patching $1])
$SED -e 's/^#undef PACKAGE_[^ ]*/\/\* & \*\//g' < $srcdir/$1 \
> $srcdir/$1.tmp && mv $srcdir/$1.tmp $srcdir/$1
])
+28 -27
View File
@@ -2,7 +2,6 @@
#
# A wrapper around Autoconf that generates files to build PHP on *nix systems.
MAKE=${MAKE:-make}
PHP_AUTOCONF=${PHP_AUTOCONF:-autoconf}
PHP_AUTOHEADER=${PHP_AUTOHEADER:-autoheader}
force=0
@@ -38,15 +37,13 @@ SYNOPSIS:
buildconf [<options>]
OPTIONS:
-f, --force Clean cache and overwrite configure files.
-f, --force Regenerate configure files in PHP release packages.
--debug Display warnings emitted by Autoconf.
-h, --help Display this help.
ENVIRONMENT:
The following optional variables are supported:
MAKE Overrides the path to make tool.
MAKE=/path/to/make ./buildconf
PHP_AUTOCONF Overrides the path to autoconf tool.
PHP_AUTOCONF=/path/to/autoconf ./buildconf
PHP_AUTOHEADER Overrides the path to autoheader tool.
@@ -66,24 +63,18 @@ HELP
shift
done
if test "$dev" = "0" -a "$force" = "0"; then
if test -f "configure"; then
echo "The configure script has already been built for you. All done."
echo "Run ./configure to proceed with customizing the PHP build."
if test "$dev" = "0" && test "$force" = "0"; then
if test -f "configure" && test -f "main/php_config.h.in"; then
echo "buildconf: The configure script is already built. All done."
echo " Run ./configure to proceed with customizing the PHP build."
exit 0
else
echo "Configure script is missing." >&2
echo "Run ./buildconf --force to create a configure script." >&2
echo "buildconf: Configure files are missing." >&2
echo " Run ./buildconf --force to create a configure script." >&2
exit 1
fi
fi
if test "$force" = "1"; then
echo "buildconf: Forcing buildconf"
echo "buildconf: Removing configure caches and files"
rm -rf autom4te.cache config.cache configure
fi
echo "buildconf: Checking installation"
# Get minimum required autoconf version from the configure.ac file.
@@ -114,23 +105,33 @@ else
echo "buildconf: autoconf version $ac_version (ok)"
fi
# Check if make exists.
if ! test -x "$(command -v $MAKE)"; then
echo "buildconf: make not found." >&2
echo " You need to have make installed to build PHP." >&2
exit 1
if test "$force" = "1"; then
echo "buildconf: Forcing buildconf. The configure files will be regenerated."
fi
echo "buildconf: Building configure files"
# Clean cache and explicitly remove all targets if present. Remove also
# aclocal.m4 if present. It is automatically included by autoconf but not used
# by the PHP build system since PHP 7.4.
echo "buildconf: Cleaning cache and configure files"
rm -rf \
aclocal.m4 \
autom4te.cache \
config.cache \
configure \
main/php_config.h.in
if test "$debug" = "1"; then
autoconf_flags="-f -Wall"
autoheader_flags="-Wall"
else
autoconf_flags="-f"
autoheader_flags=""
fi
$MAKE -s -f build/build.mk \
PHP_AUTOCONF="$PHP_AUTOCONF" \
PHP_AUTOHEADER="$PHP_AUTOHEADER" \
PHP_AUTOCONF_FLAGS="$autoconf_flags" \
PHP_M4_FILES="$(echo TSRM/*.m4 Zend/Zend.m4 build/*.m4 ext/*/config*.m4 sapi/*/config*.m4)"
echo "buildconf: Rebuilding configure"
$PHP_AUTOCONF $autoconf_flags
echo "buildconf: Rebuilding main/php_config.h.in"
$PHP_AUTOHEADER $autoheader_flags
echo "buildconf: Run ./configure to proceed with customizing the PHP build."
+17 -39
View File
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
dnl ----------------------------------------------------------------------------
AC_PREREQ([2.68])
AC_INIT([PHP],[7.4.0alpha3],[https://bugs.php.net],[php],[https://www.php.net])
AC_INIT([PHP],[7.4.0beta2],[https://bugs.php.net],[php],[https://www.php.net])
AC_CONFIG_SRCDIR([main/php_version.h])
AC_CONFIG_AUX_DIR([build])
AC_PRESERVE_HELP_ORDER
@@ -27,6 +27,7 @@ PHP_CONFIG_NICE(config.nice)
PHP_CANONICAL_HOST_TARGET
AC_CONFIG_HEADERS([main/php_config.h])
AH_TOP([
#ifndef PHP_CONFIG_H
#define PHP_CONFIG_H
@@ -104,8 +105,6 @@ extern "C++" {
#endif
#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */
#undef PTHREADS
#endif /* PHP_CONFIG_H */
])
@@ -279,7 +278,6 @@ case $host_alias in
CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
fi
fi
php_multiple_shlib_versions_ok=yes
;;
*mips*)
CPPFLAGS="$CPPFLAGS -D_XPG_IV"
@@ -400,8 +398,6 @@ PHP_CHECK_FUNC(socketpair, socket)
PHP_CHECK_FUNC(htonl, socket)
PHP_CHECK_FUNC(gethostname, nsl)
PHP_CHECK_FUNC(gethostbyaddr, nsl)
PHP_CHECK_FUNC(yp_get_default_domain, nsl)
PHP_CHECK_FUNC(dlopen, dl)
PHP_CHECK_FUNC(dlsym, dl)
if test "$ac_cv_func_dlopen" = "yes"; then
@@ -502,7 +498,15 @@ AC_STRUCT_TIMEZONE
PHP_MISSING_TIME_R_DECL
PHP_MISSING_FCLOSE_DECL
PHP_STRUCT_FLOCK
PHP_SOCKLEN_T
AC_CHECK_TYPES(socklen_t, [], [], [
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
])
dnl These are defined elsewhere than stdio.h.
PHP_CHECK_SIZEOF(intmax_t, 0)
@@ -546,13 +550,9 @@ PHP_CHECK_CPU_SUPPORTS([avx2])
dnl Check for structure members.
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exist. The
dnl WARNING_LEVEL required because cc in QNX hates -w option without an argument
dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exist.
if test "`uname -s 2>/dev/null`" != "QNX"; then
AC_STRUCT_ST_BLOCKS
else
AC_MSG_WARN([warnings level for cc set to 0])
WARNING_LEVEL=0
fi
dnl Checks for types.
@@ -594,7 +594,6 @@ fpclass \
ftok \
funopen \
gai_strerror \
gcvt \
getcwd \
getloadavg \
getlogin \
@@ -614,10 +613,7 @@ grantpt \
inet_ntoa \
inet_ntop \
inet_pton \
isascii \
link \
localtime_r \
lockf \
lchown \
mbrlen \
memmove \
@@ -633,11 +629,8 @@ rand_r \
scandir \
setitimer \
setenv \
setsockopt \
setvbuf \
shutdown \
sigprocmask \
sin \
statfs \
statvfs \
std_syslog \
@@ -647,7 +640,6 @@ strnlen \
strptime \
strtok_r \
symlink \
tempnam \
tzset \
unlockpt \
unsetenv \
@@ -1226,7 +1218,7 @@ fi
dnl Align segments on huge page boundary
case $host_alias in
*linux*)
i[[3456]]86-*-linux-* | x86_64-*-linux-*)
EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152"
;;
esac
@@ -1428,7 +1420,6 @@ PHP_SUBST_OLD(PHP_VERSION)
PHP_SUBST_OLD(PHP_VERSION_ID)
PHP_SUBST(SHELL)
PHP_SUBST(SHARED_LIBTOOL)
PHP_SUBST(WARNING_LEVEL)
PHP_SUBST(PHP_FRAMEWORKS)
PHP_SUBST(PHP_FRAMEWORKPATH)
PHP_SUBST(INSTALL_HEADERS)
@@ -1441,12 +1432,6 @@ if test "$PHP_THREAD_SAFETY" = "yes" && test -n "$ac_cv_pthreads_cflags"; then
CPPFLAGS="$CPPFLAGS $ac_cv_pthreads_cflags"
fi
dnl This will go away, if we have a facility to run per-extension code after the
dnl thread_safety decision was done.
if test "$PHP_THREAD_SAFETY" = "yes" && test "$PHP_MYSQL" = "yes"; then
CPPFLAGS="$CPPFLAGS -DTHREAD=1"
fi
if test "$PHP_WERROR" = "yes"; then
CFLAGS="$CFLAGS -Werror"
CPPFLAGS="$CPPFLAGS -Werror"
@@ -1459,16 +1444,6 @@ dnl
PHP_HELP_SEPARATOR([Libtool:])
PHP_CONFIGURE_PART(Configuring libtool)
LDFLAGS="$LDFLAGS $PHP_AIX_LDFLAGS"
dnl Autoconf 2.13's libtool checks go slightly nuts on Mac OS X 10.5 and 10.6.
dnl This hack works around it. Ugly.
case $host_alias in
*darwin9*|*darwin10*)
ac_cv_exeext=
;;
esac
dnl Silence warning: `ar: 'u' modifier ignored since 'D' is the default`
dnl See https://github.com/php/php-src/pull/3017
AC_SUBST(AR_FLAGS, [cr])
@@ -1520,7 +1495,7 @@ PHP_SUBST(install_binary_targets)
PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/])
PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_ADD_SOURCES(TSRM, TSRM.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c \
fopen_wrappers.c alloca.c php_scandir.c \
@@ -1585,6 +1560,9 @@ $PHP_OUTPUT_FILES"
dnl Generate build files.
AC_CONFIG_FILES([$ALL_OUTPUT_FILES])
AC_CONFIG_COMMANDS_PRE([PHP_PATCH_CONFIG_HEADERS([main/php_config.h.in])])
AC_CONFIG_COMMANDS([default],[
cat <<X
+25 -14
View File
@@ -91,7 +91,13 @@
5. Bump the version numbers in `main/php_version.h`, `Zend/zend.h`,
`configure.ac` and possibly `NEWS`. Do not use abbreviations for alpha and
beta. Do not use dashes, you should `#define PHP_VERSION "7.4.22RC1"` and
not `#define PHP_VERSION "7.4.22-RC1"`
not `#define PHP_VERSION "7.4.22-RC1"`.
When releasing the first alpha version, bump also API version numbers in
`Zend/zend_extensions.h`, `Zend/zend_modules.h`, and `main/php.h`. The API
versions between the alpha/beta/.0RCx releases can be left the same or
bumped as little as possible because PHP extensions will need to be rebuilt
with each bump.
6. Compile and run `make test`, with and without ZTS, using the right Bison and
re2c version (for PHP 7.4, minimum Bison 3.0.0 and re2c 0.13.4 are used).
@@ -112,13 +118,13 @@
10. Bump the version numbers in `main/php_version.h`, `Zend/zend.h`,
`configure.ac` and `NEWS` in the *main* branch (PHP-7.4 for example) to
prepare for the **next** version. F.e. if the RC is "7.4.1RC1" then the new
one should be `7.4.2-dev` - regardless if we get a new RC or not. This is to
make sure `version_compare()` can correctly work. Commit the changes to the
main branch.
prepare for the **next** version. For example, if the RC is "7.4.1RC1" then
the new one should be `7.4.2-dev` - regardless if we get a new RC or not.
This is to make sure `version_compare()` can correctly work. Commit the
changes to the main branch.
11. Push the changes to the main repo, the tag, the main branch and the release
branch. Release branches for alpha/beta/.0RCx releases before to GA release
branch. Release branches for alpha/beta/.0RCx releases before the GA release
don't need to be pushed (a local temporary branch should be used).
```sh
@@ -139,7 +145,7 @@
have this directory, create it.
15. Now the RC can be found on https://downloads.php.net/~yourname,
f.e. https://downloads.php.net/~derick/.
e.g. https://downloads.php.net/~derick/.
16. Once the release has been tagged, contact the release-managers@ distribution
list so that Windows binaries can be created. Once those are made, they can
@@ -204,7 +210,7 @@
`Zend/zend.h`, `configure.ac` and possibly `NEWS`.
2. If a CVE commit needs to be merged to the release, then have it committed to
the base branches and merged upwards as usual (f.e commit the CVE fix to
the base branches and merged upwards as usual (e.g. commit the CVE fix to
7.2, merge to 7.3, 7.4 etc...). Then you can cherry-pick it in your release
branch. Don't forget to update `NEWS` manually in an extra commit then.
@@ -219,9 +225,9 @@
6. Check `./sapi/cli/php -v` output for version matching.
7. Tag the repository with the version f.e. `git tag -u YOURKEYID php-7.4.1`
7. Tag the repository with the version e.g. `git tag -u YOURKEYID php-7.4.1`
8. Push the tag f.e. `git push origin php-7.4.1`.
8. Push the tag e.g. `git push origin php-7.4.1`.
9. Run: `./scripts/dev/makedist php-7.4.1`, this will export the tag,
create configure and build three tarballs (gz, bz2 and xz). Check if the
@@ -289,7 +295,7 @@
5. Update the ChangeLog file for the given major version
f.e. `ChangeLog-7.php` from the `NEWS` file
e.g. `ChangeLog-7.php` from the `NEWS` file
* Go over the list and put every element on one line.
* Check for `&`, `<` and `>` and escape them if necessary.
@@ -319,7 +325,7 @@
8. **Check website has been synced before announcing or pushing news**
Try, f.e. https://www.php.net/distributions/php-7.4.0.tar.xz
Try, e.g. https://www.php.net/distributions/php-7.4.0.tar.xz
Website may update slowly (may take an hour).
@@ -378,8 +384,13 @@
Add a commit on master after the branch point clearing the `NEWS`,
`UPGRADING` and `UPGRADING.INTERNALS` files, updating the version in
`configure.ac` (run `./configure` to automatically update
`main/php_versions.h`, too) and `Zend/zend.h`. Also list the new branch in
`CONTRIBUTING.md`.
`main/php_versions.h`, too) and `Zend/zend.h`. Bump the default initial
version also in `win32/build/confutils.js`.
Also list the new branch in `CONTRIBUTING.md`.
Bump API version numbers in `Zend/zend_extensions.h`, `Zend/zend_modules.h`,
and `main/php.h`.
Example: https://git.php.net/?p=php-src.git;a=commit;h=a63c99b
Push the new branch and the commit just added to master.
+53
View File
@@ -0,0 +1,53 @@
--TEST--
Bug #71263: fread() does not detects decoding errors from filter bzip2.decompress
--FILE--
<?php
// Should notices be generated?
function test($case) {
$plain = "The quick brown fox jumps over the lazy dog.";
$fn = "bug71263.bz2";
$compressed = (string) bzcompress($plain);
echo "Compressed len = ", strlen($compressed), "\n";
if ($case == 1) {
// Set a random byte in the middle of the compressed data
// --> php_bz2_decompress_filter() detects fatal error
// --> fread() displays empty string then garbage, no errors detected:
$compressed[strlen($compressed) - 15] = 'X';
} else if ($case == 2) {
// Truncate the compressed data
// --> php_bz2_decompress_filter() does not detect errors,
// --> fread() displays the empty string:
$compressed = substr($compressed, 0, strlen($compressed) - 20);
} else {
// Corrupted final CRC
// --> php_bz2_decompress_filter() detects fatal error
// --> fread() displays an empty string, then the correct plain text, no error detected:
$compressed[strlen($compressed)-2] = 'X';
}
file_put_contents($fn, $compressed);
$r = fopen($fn, "r");
stream_filter_append($r, 'bzip2.decompress', STREAM_FILTER_READ);
while (!feof($r)) {
$s = fread($r, 100);
echo "read: "; var_dump($s);
}
fclose($r);
unlink($fn);
}
test(1);
test(2);
test(3);
?>
--EXPECT--
Compressed len = 81
read: bool(false)
Compressed len = 81
read: string(0) ""
Compressed len = 81
read: bool(false)
+18 -10
View File
@@ -133,7 +133,7 @@ struct php_bz2_stream_data_t {
/* {{{ BZip2 stream implementation */
static size_t php_bz2iop_read(php_stream *stream, char *buf, size_t count)
static ssize_t php_bz2iop_read(php_stream *stream, char *buf, size_t count)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
size_t ret = 0;
@@ -149,6 +149,9 @@ static size_t php_bz2iop_read(php_stream *stream, char *buf, size_t count)
/* it is not safe to keep reading after an error, see #72613 */
stream->eof = 1;
if (just_read < 0) {
if (ret) {
return ret;
}
return -1;
}
break;
@@ -160,20 +163,24 @@ static size_t php_bz2iop_read(php_stream *stream, char *buf, size_t count)
return ret;
}
static size_t php_bz2iop_write(php_stream *stream, const char *buf, size_t count)
static ssize_t php_bz2iop_write(php_stream *stream, const char *buf, size_t count)
{
size_t wrote = 0;
ssize_t wrote = 0;
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
do {
int just_wrote;
size_t remain = count - wrote;
int to_write = (int)(remain <= INT_MAX ? remain : INT_MAX);
just_wrote = BZ2_bzwrite(self->bz_file, (char*)buf, to_write);
if (just_wrote < 1) {
if (just_wrote < 0) {
if (wrote == 0) {
return just_wrote;
}
return wrote;
}
if (just_wrote == 0) {
break;
}
@@ -381,11 +388,12 @@ static PHP_FUNCTION(bzread)
php_error_docref(NULL, E_WARNING, "length may not be negative");
RETURN_FALSE;
}
data = zend_string_alloc(len, 0);
ZSTR_LEN(data) = php_stream_read(stream, ZSTR_VAL(data), ZSTR_LEN(data));
ZSTR_VAL(data)[ZSTR_LEN(data)] = '\0';
RETURN_NEW_STR(data);
data = php_stream_read_to_str(stream, len);
if (!data) {
RETURN_FALSE;
}
RETURN_STR(data);
}
/* }}} */
+4 -4
View File
@@ -60,7 +60,7 @@ array(2) {
}
string(2) "OK"
int(0)
string(0) ""
bool(false)
array(2) {
["errno"]=>
int(-5)
@@ -69,7 +69,7 @@ array(2) {
}
string(16) "DATA_ERROR_MAGIC"
int(-5)
string(0) ""
bool(false)
array(2) {
["errno"]=>
int(-4)
@@ -78,7 +78,7 @@ array(2) {
}
string(10) "DATA_ERROR"
int(-4)
string(0) ""
bool(false)
array(2) {
["errno"]=>
int(-5)
@@ -87,7 +87,7 @@ array(2) {
}
string(16) "DATA_ERROR_MAGIC"
int(-5)
string(0) ""
bool(false)
array(2) {
["errno"]=>
int(-4)
+1 -1
View File
@@ -21,7 +21,7 @@ $data = bzcompress($string);
$data2 = bzcompress($string, 1, 10);
$data3 = $data2;
$data3{3} = 0;
$data3[3] = 0;
var_dump(bzdecompress());
var_dump(bzdecompress(1,1,1));
+1 -1
View File
@@ -20,4 +20,4 @@ bzclose($fp);
?>
DONE
--EXPECT--
DONE
ERROR: bzread()
+3 -3
View File
@@ -118,13 +118,13 @@ static HRESULT STDMETHODCALLTYPE stm_read(IStream *This, void *pv, ULONG cb, ULO
static HRESULT STDMETHODCALLTYPE stm_write(IStream *This, void const *pv, ULONG cb, ULONG *pcbWritten)
{
ULONG nwrote;
ssize_t nwrote;
FETCH_STM();
nwrote = (ULONG)php_stream_write(stm->stream, pv, cb);
nwrote = php_stream_write(stm->stream, pv, cb);
if (pcbWritten) {
*pcbWritten = nwrote > 0 ? nwrote : 0;
*pcbWritten = nwrote > 0 ? (ULONG)nwrote : 0;
}
if (nwrote > 0) {
return S_OK;
Loaded 100 of 559 files, more files were not shown because too many files have changed in this diff. Show more