Compare commits

...
405 Commits
Author SHA1 Message Date
Christoph M. Becker 5dbc909a12 Update version for PHP 7.3.4 2019-04-02 13:46:13 +00:00
Remi Collet 45c0cda030 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  fix paste issue

(cherry picked from commit 002983e463)
2019-04-02 11:19:13 +02:00
Christoph M. Becker 116ef46747 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Pointer arithmetic on void pointers is illegal

(cherry picked from commit b8fdaa7c42)
2019-04-02 10:47:34 +02:00
Stanislav Malyshev f6670180e2 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #77831 - Heap-buffer-overflow in exif_iif_add_value in EXIF

(cherry picked from commit da5fbb8c36)
2019-04-02 10:02:13 +02:00
Stanislav Malyshev 426ca8e961 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #77753 - Heap-buffer-overflow in php_ifd_get32s

(cherry picked from commit 9efaac30ae)
2019-04-02 10:00:54 +02:00
Christoph M. Becker 5b7a781a5d Revert "Fix #77609: Tests from mailparse extension fails"
This reverts commit 3ead672394.
2019-03-20 16:11:43 +01:00
Christoph M. Becker 9e4f47993a Update version for PHP 7.3.4RC1 2019-03-19 13:43:53 +00:00
Nikita Popov d53e9c7392 Merge branch 'PHP-7.2' into PHP-7.3 2019-03-19 10:03:05 +01:00
Vlad Temian fe2885d80a Fixed bug #77765
Set mode 40755 for directories, via FTP stream stat.

Because we already manage to CWD into the current directory,
we should set 40755 as mode, instead of 40644.
2019-03-19 10:02:38 +01:00
Nikita Popov 20c261b2fe Merge branch 'PHP-7.2' into PHP-7.3 2019-03-19 09:55:42 +01:00
Miriam Lauter 09e522322a Fix #77767: phpdbg break command help message shows incorrect aliases
Previously the aliases for at and del were listed as A and d
in the help message for break. This patch corrects the aliases
to be @ and ~ respectively.
2019-03-19 09:55:10 +01:00
Christoph M. Becker 5ead86a35e Fix order 2019-03-18 20:07:38 +01:00
Christoph M. Becker a529826d95 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77578: Crash when php unload
2019-03-18 19:24:56 +01:00
Christoph M. Becker 41bc51ce2d Fix #77578: Crash when php unload
Since we're putting `ITypeLib *`s into the hash, we're getting
`ITypeLib *`s back, not `ITypeLib **`s.
2019-03-18 19:21:38 +01:00
Christoph M. Becker 7ef2fa6d0d Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Add bison version check to configure
2019-03-18 15:04:09 +01:00
Christoph M. Becker f21c054903 Add bison version check to configure
Since we're already checking for the minimum required re2c version,
also checking for the minimum required bison version is sensible.
2019-03-18 15:02:52 +01:00
Xinchen Hui ab8782d1e6 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Simplfy test case
2019-03-18 19:30:11 +08:00
Xinchen Hui e072537e7f Simplfy test case
(I was working on the same bug while nikic committed the similar fix
2019-03-18 19:28:23 +08:00
Nikita Popov 763a7b8ca3 Merge branch 'PHP-7.2' into PHP-7.3 2019-03-18 12:16:12 +01:00
Nikita Popov b3a669bec1 Make test independent of icu version
We don't really care about the actual output here, just that it
doesn't fail.
2019-03-18 12:14:58 +01:00
Nikita Popov 623a11d7de Merge branch 'PHP-7.2' into PHP-7.3 2019-03-18 11:39:58 +01:00
Nikita Popov 433758ceb3 Allow DateTimeImmutable in datefmt_format_object()
As pointed out in a comment on bug #65683.
2019-03-18 11:39:16 +01:00
Nikita Popov 82fbaab53c Merge branch 'PHP-7.2' into PHP-7.3 2019-03-18 11:07:27 +01:00
Nikita Popov 4f03401628 Partial fix for bug #77751
This avoids the segfault, but it will not make writing to the
SplFileObject during output shutdown work.
2019-03-18 11:06:23 +01:00
Nikita Popov da7add3525 Merge branch 'PHP-7.2' into PHP-7.3 2019-03-18 10:51:00 +01:00
Nikita Popov 54bf8c820f Fixed bug #77743 2019-03-18 10:49:53 +01:00
Christoph M. Becker ad2d2e41de Fix #76956: Wrong value for 'syslog.filter' documented in php.ini 2019-03-18 10:19:30 +01:00
Nikita Popov c4464526cd Remove x86 bit test optimization
This is undefined behavior and we cannot rely on it. Additionally it
breaks builds using undefined behavior sanitizers.
2019-03-18 10:12:15 +01:00
Nikita Popov 00cfa1a367 Merge branch 'PHP-7.2' into PHP-7.3 2019-03-18 10:11:25 +01:00
Nikita Popov a573c0e9ed Fix unused variable warning 2019-03-18 10:11:00 +01:00
Nikita Popov 61eebb559e Merge branch 'PHP-7.2' into PHP-7.3 2019-03-18 10:04:29 +01:00
twosee bd6eabd659 Don't disable object slot reuse while running shutdown functions
We only need to do this once we're running destructors. The current
approach interferes with some event loop code that runs everything
inside a shutdown function.
2019-03-18 10:02:31 +01:00
Derick Rethans d209ccd4cc Merge branch 'PHP-7.2' into PHP-7.3 2019-03-17 14:55:53 -04:00
Derick Rethans ab07bc1fff Fixed 7.2 compat issue 2019-03-17 14:53:56 -04:00
Derick Rethans 7e7ef44fab Merge branch 'PHP-7.2' into PHP-7.3 2019-03-17 14:38:04 -04:00
Derick Rethans 1307275b43 Merge branch 'pr/3888' into PHP-7.2 2019-03-17 14:37:52 -04:00
Ignace Nyamagana Butera 6eb83a63e1 Fixed bug #75113: Added DatePeriod::getRecurrences() method. 2019-03-17 14:37:35 -04:00
Pedro Magalhães 3a04b507ec Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Added test for #77535 fix
2019-03-15 18:12:55 +00:00
Pedro Magalhães f167b06d4c Added test for #77535 fix 2019-03-15 18:11:51 +00:00
Nikita Popov 7899f6a906 Merge branch 'PHP-7.2' into PHP-7.3 2019-03-15 17:07:48 +01:00
Nikita Popov 97f9fd6949 Don't immediately destroy curl pushfunction 2019-03-15 17:07:19 +01:00
Xinchen Hui b419590893 Fixed bug #77697 (Crash on Big_Endian platform) 2019-03-15 16:58:08 +08:00
Nikita Popov 217c05da52 Merge branch 'PHP-7.2' into PHP-7.3 2019-03-14 17:25:54 +01:00
Nikita Popov e7d40afb7a Fixed bug #77742
By avoiding integer overflow in the implementation entirely. The
multiplication was already explicitly checked for overflow, so also
add a check for the addition and remove the overflow checks after
the calculation.
2019-03-14 17:24:50 +01:00
Xinchen Hui 82174e68b6 updated NEWS 2019-03-14 16:47:16 +08:00
Xinchen Hui e3965913c4 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #77738 (Nullptr deref in zend_compile_expr)
2019-03-14 16:46:46 +08:00
Xinchen Hui c7920aba3e Fixed bug #77738 (Nullptr deref in zend_compile_expr) 2019-03-14 16:46:04 +08:00
Nikita Popov a7739be22f Fixed bug #77722 2019-03-12 09:58:09 +01:00
Anatol Belski 95c8f67a4c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Die hard if mc.exe or mt.exe not found
2019-03-11 20:59:23 +01:00
Anatol Belski 6814ba11bc Die hard if mc.exe or mt.exe not found
Even configure would pass, that producess quite subtle build errors
which are better to avoid at configure stage already.
2019-03-11 20:41:45 +01:00
Christoph M. Becker e7ce7c6bb2 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  SQLite3: add DEFENSIVE config for SQLite >= 3.26.0 as a mitigation strategy against potential security flaws
2019-03-11 16:30:16 +01:00
bohwaz e93259bb23 SQLite3: add DEFENSIVE config for SQLite >= 3.26.0 as a mitigation strategy against potential security flaws 2019-03-11 16:26:15 +01:00
Nikita Popov 6818ca3c02 Merge branch 'PHP-7.2' into PHP-7.3 2019-03-11 15:36:27 +01:00
Nikita Popov 1fd32e9c2f Fixed bug #76717
Print INT_MIN as -INT_MAX-1 to avoid it getting parsed as a float
literal due to integer overflow.
2019-03-11 15:35:02 +01:00
Jakub Zelenka f8850ccd85 Speed up TLS wrapper test for min and max versions 2019-03-10 16:36:13 +00:00
Jakub Zelenka ee4fa7d482 Merge branch 'PHP-7.2' into PHP-7.3 2019-03-10 16:34:58 +00:00
Jakub Zelenka 769d2d9b62 Speed up TLS wrapper tests when SSLv3 disabled
If SSLv3 is disabled in OpenSSL, then sslv3 is not available so the accept
times out. This commit removes the extra accept if SSLv3 is disabled.
2019-03-10 16:23:44 +00:00
Anatol Belski 3e92365fa2 Update libmagic.patch [skip ci] 2019-03-08 21:55:15 +01:00
Fabien Villepinte d9a3cb0b36 Fix typo in libmagic version 2019-03-08 20:51:09 +01:00
Anatol Belski 65ffdc2adf Fixed bug #77576 pull the libmagic implementation of gmtime_r
PHP already has all the checks to handle the *_r function variants.
Thus, reusing it to get right symbols.
2019-03-08 20:32:15 +01:00
Anatol Belski 58cb3312d6 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Sync with behavior change in OpenSSL 1.1.1b
  fix news
  bump versions after release
2019-03-08 15:55:34 +01:00
Anatol Belski 9177542b4d Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Sync with behavior change in OpenSSL 1.1.1b
  fix news
  bump versions after release
2019-03-08 15:54:27 +01:00
Anatol Belski 66bd861fcd Sync with behavior change in OpenSSL 1.1.1b
A behavior change in revealed by some openssl_decrypt() based test,
where an encrypt API is used with a decrypt context. The EVP_Cipher*
functions will automatically choose the right operation depending on the
context passed.

(cherry picked from commit 19a44ffb7b)
2019-03-08 15:47:32 +01:00
Dmitry Stogov 0a416b3d97 ws 2019-03-07 13:59:18 +03:00
Dmitry Stogov 5da591c529 Fixed bug #77345 (Stack Overflow caused by circular reference in garbage collection) 2019-03-07 13:33:19 +03:00
Peter Kokot 59e76ec01d Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update editorconfig
2019-03-07 01:05:22 +01:00
Peter Kokot 488544b336 Update editorconfig
Changes:
- New property max_line_length
- COMMIT_EDITMSG file added when writing commit messages
- Markdown files can have trimmed trailing whitespace also to simplify
  settings.
- https link used to EditorConfig page.
- Added also *.y, *.cpp, and *.inc files
- The tab_width moved to a new all files section
2019-03-07 01:03:56 +01:00
Christoph M. Becker 0d88388912 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77700: Writing truecolor images as GIF ignores interlace flag
2019-03-06 00:37:38 +01:00
Christoph M. Becker 41fb0eaa11 Fix #77700: Writing truecolor images as GIF ignores interlace flag
We  revert the interlace flag related part of commit ff2822a[1], since
contrary to the transparent color, the interlace flag is not retained
by `gdImageCreatePaletteFromTrueColor()`.  This also matches upstream
libgd.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=ff2822a82b740edb8ccf307f080bae188c200fb9>
2019-03-06 00:34:40 +01:00
Joe Watkins b6308f5b48 fix news 2019-03-05 20:50:07 +01:00
Joe Watkins 58c5df3d37 bump versions after release 2019-03-05 18:28:47 +01:00
Remi Collet 72bfb2523a Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  add NEWS entry
2019-03-05 07:32:54 +01:00
Remi Collet 0e836f523a add NEWS entry 2019-03-05 07:32:24 +01:00
Christoph M. Becker 007ac353dd Update NEWS 2019-03-04 19:50:41 +01:00
Stanislav Malyshev 609195e991 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #77630 - safer rename() procedure
2019-03-04 09:18:22 -08:00
Stanislav Malyshev 2cc1ab81c2 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #77630 - safer rename() procedure
2019-03-04 09:17:14 -08:00
Stanislav Malyshev e3133e4db7 Fix bug #77630 - safer rename() procedure
In order to rename safer, we do the following:
- set umask to 077 (unfortunately, not TS, so excluding ZTS)
- chown() first, to set proper group before allowing group access
- chmod() after, even if chown() fails
2019-03-04 09:15:11 -08:00
Anatol Belski a976283c34 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix test portability
2019-03-04 14:30:01 +01:00
Anatol Belski 040196972c Fix test portability 2019-03-04 14:28:47 +01:00
Christoph M. Becker 6ff0b24ef4 Update NEWS 2019-03-04 13:47:14 +01:00
Nikita Popov 4c68aaabf1 Merge branch 'PHP-7.2' into PHP-7.3 2019-03-04 13:16:01 +01:00
Nikita Popov 3f00c9367d Fixed bug #77691
We cannot replace an op1_def opcode with an ASSIGN, if it also has
a used res_def. Usually this doesn't happen because the res_def use
can be eliminated first. The example is a case where operand replacement
on the res_def use fails.
2019-03-04 13:11:12 +01:00
Remi Collet 06f7c177c8 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  add NEWS entries
2019-03-04 11:09:17 +01:00
Remi Collet 2694953ada add NEWS entries 2019-03-04 11:09:01 +01:00
Stanislav Malyshev 6d60ed69a1 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #77586 - phar_tar_writeheaders_int() buffer overflow
2019-03-03 23:33:48 -08:00
Stanislav Malyshev 3e8d8f7fb3 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #77586 - phar_tar_writeheaders_int() buffer overflow
2019-03-03 23:33:43 -08:00
Stanislav Malyshev e0f5d62bd6 Fix bug #77586 - phar_tar_writeheaders_int() buffer overflow 2019-03-03 23:05:32 -08:00
Stanislav Malyshev e3f7c352dc Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS
  Fix test error message
  Fix bug #77563 - Uninitialized read in exif_process_IFD_in_MAKERNOTE
  Fix bug #77540 - Invalid Read on exif_process_SOFn
  Fix integer overflows on 32-bits
  Fix #77431 SplFileInfo::__construct() accepts NUL bytes
  Fix bug #77396 - Null Pointer Dereference in phar_create_or_parse_filename
2019-03-03 22:20:42 -08:00
Stanislav Malyshev 8363df3703 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS
  Fix test error message
  Fix bug #77563 - Uninitialized read in exif_process_IFD_in_MAKERNOTE
  Fix bug #77540 - Invalid Read on exif_process_SOFn
  Fix integer overflows on 32-bits
  Fix #77431 SplFileInfo::__construct() accepts NUL bytes
  Fix bug #77396 - Null Pointer Dereference in phar_create_or_parse_filename
2019-03-03 22:20:35 -08:00
Stanislav Malyshev 759e841b24 Update NEWS 2019-03-03 20:10:12 -08:00
Stanislav Malyshev 44f87fbf36 Fix test error message 2019-03-03 19:30:14 -08:00
Stanislav Malyshev 8ac6fee856 Fix bug #77563 - Uninitialized read in exif_process_IFD_in_MAKERNOTE
Also fix for bug #77659
2019-03-03 18:35:43 -08:00
Stanislav Malyshev 5f0e62a3e5 Fix bug #77540 - Invalid Read on exif_process_SOFn 2019-03-03 18:35:26 -08:00
Stanislav Malyshev 5e824a88d0 Fix integer overflows on 32-bits 2019-03-03 18:35:04 -08:00
Christoph M. Becker 254a5914ad Fix #77431 SplFileInfo::__construct() accepts NUL bytes
`SplFileInfo::__construct()` has to expect a path instead of a string,
analogous to `SplFileObject::__construct()`.
2019-03-03 18:23:46 -08:00
Stanislav Malyshev 7f0ab7c20c Fix bug #77396 - Null Pointer Dereference in phar_create_or_parse_filename 2019-03-03 18:22:32 -08:00
Peter Kokot fa574ddd6f Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS
  Fix shared module generation on AIX bug #77676
2019-03-02 18:52:01 +01:00
Peter Kokot 637713c1a4 Update NEWS 2019-03-02 18:50:33 +01:00
Kevin Adler 700f876a1a Fix shared module generation on AIX bug #77676
Makefiles for PHP extensions generated by phpize expect the PHP_MODULES
to contain a list of libtool .la files so that it can read the $dlname
variable from them by sourcing them in to a shell. On AIX, the code was
setting PHP_MODULES to a list of .so files, which meant the dlname was
blank, preventing the tests from being able to run.

Change the AIX code path in the PHP_SHARED_MODULE macro to match the
output on other platforms, using libtool .la files.
2019-03-02 18:45:55 +01:00
Peter Kokot c2fb85547d Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS
  Fix #77609: Tests from mailparse extension fails
2019-03-01 22:44:37 +01:00
Peter Kokot c39fb1fc4f Update NEWS 2019-03-01 22:44:22 +01:00
Ralf Habacker 3ead672394 Fix #77609: Tests from mailparse extension fails
Add installed php extensions to temporary created ini file

In php extensions configured with phpize, a temporarily generated
php.ini is used for testing, but currently contains no installed
PHP extensions, which is required by the mailparse extension,
for example.

Installed extensions must be added with their absolute path,
because the extension_dir parameter is already occupied.

See https://bugs.php.net/bug.php?id=77609
2019-03-01 22:32:01 +01:00
Nikita Popov 8be12e770f Merge branch 'PHP-7.2' into PHP-7.3 2019-03-01 14:55:15 +01:00
Jay Satiro 5025eb05bd curl_error: return an empty string if no error occurred
CURLOPT_ERRORBUFFER doc says "Do not rely on the contents of the
buffer unless an error code was returned." [1]

Prior to this change the error buffer was returned even if no error had
occurred, and that buffer may contain incorrect information in such a
case. [2]

[1]: https://curl.haxx.se/libcurl/c/CURLOPT_ERRORBUFFER.html
[2]: https://github.com/curl/curl/issues/3629
2019-03-01 14:54:37 +01:00
Nikita Popov 16cda039b5 Merge branch 'PHP-7.2' into PHP-7.3 2019-03-01 14:51:55 +01:00
Kevin Adler 006355c9fa Fix bug #77677: WCOREDUMP not available on all systems
Add #ifdef WCOREDUMP around all uses.

Also Change core dump message to yes/no/unknown in lsapilib.
2019-03-01 14:51:15 +01:00
Nikita Popov 4dc0662eca Check for NULL GC type in objects_store_del
This might happen if OBJ_RELEASE is used on an object that was already
released by GC. Specific cases of this issue were previously fixed in
ffaee27478 and
72104d2b6e, however the issue still
affects 3rd-party extensions using OBJ_RELEASE.

The whole GC type NULL + OBJ_IS_VALID + IS_FREE_CALLED system seems
overly complicated and can probably be simplified in 7.4.
2019-03-01 14:32:11 +01:00
Derick Rethans d63a7aa6cf Merge branch 'PHP-7.2' into PHP-7.3 2019-02-28 13:51:10 +00:00
Derick Rethans 7d001aff03 Merge branch 'DateIntervalBogusData' into PHP-7.2 2019-02-28 13:50:58 +00:00
Derick Rethans a890c5beb8 Fixed bug #50020 (DateInterval:createDateFromString() silently fails) 2019-02-28 13:50:35 +00:00
Anatol Belski 58d3dd466f Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Sync with behavior change in OpenSSL 1.1.1b
2019-02-28 12:52:28 +01:00
Anatol Belski 19a44ffb7b Sync with behavior change in OpenSSL 1.1.1b
A behavior change in revealed by some openssl_decrypt() based test,
where an encrypt API is used with a decrypt context. The EVP_Cipher*
functions will automatically choose the right operation depending on the
context passed.
2019-02-28 12:48:47 +01:00
Nikita Popov 019fd1d9ba Merge branch 'PHP-7.2' into PHP-7.3 2019-02-28 09:58:47 +01:00
Nikita Popov 9ad9cc71ff Fixed bug #77669 2019-02-28 09:58:01 +01:00
Nikita Popov 461e140afc Merge branch 'PHP-7.2' into PHP-7.3 2019-02-25 13:01:18 +01:00
Nikita Popov af37d58cf7 Fix assertion in Exception::getMessage() if $message is a ref
And same for other properties. Encountered in Symfony.
2019-02-25 13:00:16 +01:00
Xinchen Hui 4ac954ac3e Fixed compiler warning 2019-02-25 15:04:04 +08:00
Xinchen Hui fb3f078eeb Update NEWS 2019-02-25 15:00:37 +08:00
Xinchen Hui e8768b338c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #77660 (Segmentation fault on break 2147483648)
2019-02-25 15:00:23 +08:00
Xinchen Hui 1c22ace058 Fixed bug #77660 (Segmentation fault on break 2147483648) 2019-02-25 15:00:14 +08:00
Xinchen Hui 3b5475e9ee Update NEWS 2019-02-25 14:42:18 +08:00
Xinchen Hui 3c3d59aa39 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #77664 (Segmentation fault when using undefined constant in custom wrapper)
2019-02-25 14:42:01 +08:00
Xinchen Hui 4a72dd782d Fixed bug #77664 (Segmentation fault when using undefined constant in custom wrapper) 2019-02-25 14:41:46 +08:00
Jakub Zelenka 900d4cdb9e Merge branch 'PHP-7.2' into PHP-7.3 2019-02-24 13:14:36 +00:00
Jakub Zelenka 01c00953ff Print empty string in test for but 77390 just once 2019-02-24 13:11:27 +00:00
Jakub Zelenka c814b34b1d Use spaces instead of tabs in bug 77390 test 2019-02-24 13:05:43 +00:00
Nikita Popov 66fda0cdb1 Remove result def during jmp_set optimization 2019-02-22 13:41:47 +01:00
Nikita Popov 33c2b47de3 Merge branch 'PHP-7.2' into PHP-7.3 2019-02-22 12:00:20 +01:00
Nikita Popov 2cfb09caa7 Fix inference warning about missing key type 2019-02-22 11:55:16 +01:00
Christoph M. Becker 831eba0eac Fix #77648: BOM in sapi/apache2handler/php_functions.c 2019-02-22 11:10:50 +01:00
Nikita Popov bd2a00acdf Merge branch 'PHP-7.2' into PHP-7.3 2019-02-22 10:13:21 +01:00
Nikita Popov 5388143855 Fixed bug #77652 2019-02-22 10:11:54 +01:00
Frank Denis 5c221bcd01 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #77646
2019-02-21 16:34:42 +01:00
Frank Denis 08089b575b Fix bug #77646 2019-02-21 16:33:03 +01:00
Frank Denis e7ca69f1fa Fix bug #77646 2019-02-21 16:14:33 +01:00
Nikita Popov e5d8ac92a4 Merge branch 'PHP-7.2' into PHP-7.3 2019-02-21 13:45:53 +01:00
Nikita Popov 934691fabb Fixed bug #77597
The same variable was reused in two nested loops... The test doesn't
fail on 7.2, but I'm fixing this here anyway as the code is clearly
wrong, and probably erroneous in other situations.
2019-02-21 13:42:47 +01:00
Nikita Popov af324e24df Fix issue mentioned in #77302
Apparently Serializable::serialize() can return NULL, which is encoded
as N;. As we do not allow back-references to non-object values in
PHP 7.3 we need to make sure that any references are also compiled to
N;.
2019-02-21 12:04:49 +01:00
Nikita Popov b3e0e555c8 Merge branch 'PHP-7.2' into PHP-7.3 2019-02-20 12:11:56 +01:00
Abyr Valg 74888bede8 OpenSSL: Improve non-blocking eof test 2019-02-20 12:11:30 +01:00
Christopher Jones 4a6a9c79fd Merge branch 'PHP-7.2' into PHP-7.3 2019-02-20 11:11:06 +11:00
Christopher Jones 7a9c20f3fd Correct skipif use for OCI8 password tests 2019-02-20 11:10:57 +11:00
Christoph M. Becker 2ec59b3ef3 Prepare main branch for PHP 7.3.4 2019-02-19 13:06:40 +01:00
Remi Collet 961900fa17 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  bump version to 7.2.17-dev
2019-02-19 12:47:00 +01:00
Remi Collet b243f2feca bump version to 7.2.17-dev 2019-02-19 12:46:52 +01:00
Nikita Popov 3b3fafa637 Merge branch 'PHP-7.2' into PHP-7.3 2019-02-18 14:04:15 +01:00
Nikita Popov 928c42211f Make MADV_HUGEPAGE conditional on USE_ZEND_ALLOC_HUGE_PAGES
There have been multiple reports of large slowdowns due to the
use of MADV_HUGEPAGE, so make it conditional on
USE_ZEND_ALLOC_HUGE_PAGES, just like MAP_HUGETLB already is.
2019-02-18 14:03:07 +01:00
Christoph M. Becker 767fa3dc02 Fix #77626: Persistence confusion in php_com_import_typelib()
We apply only the most minimal fix here, and will cater to the
unnecessary re-allocation for PHP-7.4.

We don't need to add a regression test, since bug39606.phpt and
bug77621.phpt already show the misbehavior.
2019-02-15 18:56:24 +01:00
Christoph M. Becker 8946ad3000 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77621: Already defined constants are not properly reported
2019-02-15 00:37:39 +01:00
Christoph M. Becker de738496c2 Fix #77621: Already defined constants are not properly reported
We must not check uninitialized values (i.e. `c.value`), and we have to
use proper types for printf-style formats (i.e. `char *` instead of
`zend_string *`).
2019-02-15 00:35:21 +01:00
Nikita Popov eb063c8a9f Fixed bug #77612
Port php_setcookie() to use the smart_str API to ensure that there
can be no string truncation issues.
2019-02-14 10:42:59 +01:00
Nikita Popov 7bc162f928 Work around compiler flag dependent ABI 2019-02-14 09:59:10 +01:00
Peter Kokot a89948320b Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Refactor timelib.m4
2019-02-13 19:26:02 +01:00
Peter Kokot 0ffa84d740 Refactor timelib.m4
The ext/date/lib is bundled library and also includes additional
timelib.m4 macros and checks specific for PHP.

All the checks in the timelib.m4 are already done in the PHP's
configure.ac:
- headers except for io.h and strings.h
- two functions checked strftime and gettimeofday
- if size of longint is 8
- if size of int is 4
- int32_t and uint32_t types using the PHP_CHECK_STDINT_TYPES

Macro `AC_TIMELIB_C_BIGENDIAN` defined in timelib.m4 is not used.

The two checkings for strtoll and atoll have been moved to date extension's
config0.m4 file.

Additional check for headers <io.h> and <strings.h> has been added to
config0.m4 of the date extension.

Therefore the timelib.m4 can be simplified and removed from the bundled
library to have easier maintenance in the later branches and also
upstream library.
2019-02-13 19:24:39 +01:00
Johannes Schlüter aa7fbdf2cd Merge branch 'PHP-7.2' into PHP-7.3 2019-02-12 15:00:15 +01:00
Johannes Schlüter a4bce453bc Merge remote-tracking branch 'origin/PHP-7.3' into PHP-7.3 2019-02-12 14:59:59 +01:00
Johannes Schlüter 56dba3f3d0 Merge remote-tracking branch 'origin/PHP-7.2' into PHP-7.2 2019-02-12 14:59:27 +01:00
Nikita Popov 5297bed454 Merge branch 'PHP-7.2' into PHP-7.3 2019-02-12 11:43:34 +01:00
DanielCiochiu 07877c46e3 Fixed bug #75546
By respecting the SILENT flag when checking the visibility of a
class constant.
2019-02-12 11:42:33 +01:00
Nikita Popov 2ea5a9cc64 Merge branch 'PHP-7.2' into PHP-7.3 2019-02-12 10:50:22 +01:00
Nikita Popov 8e34de4756 Fixed bug #77608
Remove special handling of doubles and escape them as usual instead.
2019-02-12 10:49:20 +01:00
Nikita Popov 97dd1591af Merge branch 'PHP-7.2' into PHP-7.3 2019-02-12 10:10:22 +01:00
hsldymq b5cb3ac8ec Make pid & uid available while handling realtime signals 2019-02-12 10:09:33 +01:00
Nikita Popov 8ed775f548 Merge branch 'PHP-7.2' into PHP-7.3 2019-02-12 09:57:18 +01:00
Nikita Popov a109fddba4 Remove "defensive copy" of DatePeriod properties
get_properties() constructs these as fresh objects with no relation
to the internals, there is no need to clone them again. Additionally
the current implementation leaks memory, because the original objects
are never freed (see PR #3121).
2019-02-12 09:54:52 +01:00
Nikita Popov c553d17f11 Merge branch 'PHP-7.2' into PHP-7.3 2019-02-12 09:29:05 +01:00
Ben Ramsey c4294440ff Fixed bug #77564: Memory leak in exif_process_IFD_TAG
The memory leak occurs when more than one UserComment tag is present in
the EXIF data. It's still considered corrupt EXIF data, but this ensures
the memory is freed before trying to set to already allocated memory.
2019-02-12 09:28:33 +01:00
Dmitry Stogov b6e58dcd22 Fixed bug #77599 (Unbuffered queries; native prepared statements memory leak) 2019-02-12 10:55:05 +03:00
Dmitry Stogov 470f5891d4 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Avoid dependency on "struct flock" fields order.
2019-02-12 10:21:59 +03:00
Dmitry Stogov 9222702633 Avoid dependency on "struct flock" fields order. 2019-02-12 10:15:16 +03:00
Anatol Belski b71146bde4 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Replace broken binary SDK version
2019-02-11 22:30:28 -08:00
Anatol Belski 186b5de575 Replace broken binary SDK version 2019-02-11 22:28:34 -08:00
Anatol Belski ee0963c58c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update SDK version for AppVeyor
2019-02-11 22:13:42 -08:00
Anatol Belski e74a918621 Update SDK version for AppVeyor 2019-02-11 22:12:16 -08:00
Darek Slusarczyk 6f7a47db5d Merge branch 'PHP-7.2' into PHP-7.3 2019-02-11 18:18:57 +01:00
Darek Slusarczyk 83d2bc9b6d Merge branch 'PHP-7.1' into PHP-7.2 2019-02-11 18:08:21 +01:00
Darek Slusarczyk 2eaabf06fc security fix - by default 'local infile' is disabled:
- set default for mysqli.allow_local_infile=0
- explicitly disable PDO::MYSQL_ATTR_LOCAL_INFILE in case of lack of driver options
- add getAttribute support for PDO::MYSQL_ATTR_LOCAL_INFILE
- update existing tests where needed
- add new tests [checking default value and setting on] the 'local infile' in ext/mysqli and ext/pdo_mysql
2019-02-11 18:04:51 +01:00
Nikita Popov 4da67537c1 Merge branch 'PHP-7.2' into PHP-7.3 2019-02-11 15:50:47 +01:00
Ahmed Abdou ec28d4c247 Fix bug #51068 (glob:// do not support current path relative)
Fix DirectoryIterator glob://* current path relative queries
2019-02-11 15:50:27 +01:00
Nikita Popov be64a06b1c Merge branch 'PHP-7.2' into PHP-7.3 2019-02-11 11:33:04 +01:00
johnstevenson fe4d7248cc Fix #77552: Uninitialized buffer in stat functions 2019-02-11 11:31:55 +01:00
Guilliam Xavier b3935ed2af Fix tests bareword fallback with error suppression
(cherry picked from commit aad39879f2)
(cherry picked from commit 76f8a908bb)
2019-02-11 09:36:03 +01:00
Xinchen Hui 515c51953f regenerate with re2c 1.0.3 2019-02-11 15:42:55 +08:00
Xinchen Hui 4f044f680c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #77589 (Core dump using parse_ini_string with numeric sections)

Conflicts:
	Zend/zend_ini_scanner.c
2019-02-11 15:33:59 +08:00
Xinchen Hui 92055ca79b Fixed bug #77589 (Core dump using parse_ini_string with numeric sections)
Section name should not be typed(NULL, FALSE, TRUE etc)
2019-02-11 15:27:29 +08:00
Christopher Jones bdce2954c3 Merge PDO_OCI PR 2019-02-11 16:38:23 +11:00
Christopher Jones 983ba59e3e Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  PDO_OCI tracing attribute PR merge
  pdo_oci: Add client identifier and module attrs
  pdo_oci: Register new attr constants and add tests
  pdo_oci: Add PDO_OCI_ATTR_ACTION and CLIENT_INFO
2019-02-11 16:36:39 +11:00
Christopher Jones 1f86dcdd13 PDO_OCI tracing attribute PR merge 2019-02-11 16:19:13 +11:00
Cameron Porter 38363f4820 pdo_oci: Add client identifier and module attrs
Add tests for the new attributes, and check the setAttribute return
value.
2019-02-11 16:10:47 +11:00
Cameron Porter fc940f0703 pdo_oci: Register new attr constants and add tests 2019-02-11 16:10:47 +11:00
Cameron Porter a095472e62 pdo_oci: Add PDO_OCI_ATTR_ACTION and CLIENT_INFO
Add the ability to set the action and client info on the database
session for PDO OCI using PDO attributes.
2019-02-11 16:10:47 +11:00
Nikita Popov 471b1d54d5 Merge branch 'PHP-7.2' into PHP-7.3 2019-02-08 10:09:39 +01:00
YanTao 3b09123de3 Fix FTPS passive mode of data channel event poll
Bugfix: when using passive mode of FTPS protocol, data channel events
should be polled when creating data connection channel, instead of polling
the event of ftp's self control channel, which may cause ftp transfer
problem while using ftps and passive mode.
2019-02-08 09:50:29 +01:00
Anatol Belski 1bbf7013c8 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Sync test with changes in libcurl 7.64.0
  Sync test for libcurl 7.64.0
2019-02-07 22:28:45 -08:00
Anatol Belski e27301c7b3 Sync test with changes in libcurl 7.64.0 2019-02-07 22:22:38 -08:00
Anatol Belski c9f0e12353 Sync test for libcurl 7.64.0 2019-02-07 22:21:59 -08:00
Derick Rethans 65d81833bb Use pkg-config for ICU, as the old icu-config has been deprecated 2019-02-07 14:00:39 +01:00
Derick Rethans 8be649d908 Merge branch 'PHP-7.2' into PHP-7.3 2019-02-07 11:12:42 +00:00
Derick Rethans e2edaa0cee Use pkg-config for ICU, as the old icu-config has been deprecated 2019-02-07 10:18:32 +00:00
Christoph M. Becker b2907527e9 Fix NEWS
Bug #77287 is already fixed in PHP 7.3.2.
2019-02-05 23:04:31 +01:00
Christoph M. Becker c0228f741e [ci skip] Add missing notes regarding gc_status() 2019-02-03 18:28:43 +01:00
Joe Watkins e1c93d1fb2 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Properly check for array_replace_recursive in sccp.c
2019-02-03 08:41:26 +01:00
Tyson Andre cf56832d00 Properly check for array_replace_recursive in sccp.c
Due to a typo, this code used to check for array_merge_recursive
twice.
2019-02-03 08:40:21 +01:00
Dmitry Stogov 203a2da30a Fixed bug #77329 (Buffer Overflow via overly long Error Messages) 2019-02-01 11:11:15 +03:00
Joe Watkins 7d1df603ad Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug 76596: phpdbg supports display_errors=stderr
2019-01-30 18:28:25 +01:00
Kevin Abel 3890c8bce5 Fix bug 76596: phpdbg supports display_errors=stderr 2019-01-30 18:27:57 +01:00
Guillaume Degoulet f27f902266 Fix #77546 iptcembed broken function 2019-01-30 17:09:12 +01:00
Christoph M. Becker 362d6ce834 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Prepare main branch for PHP 7.2.16
2019-01-30 01:29:05 +01:00
Christoph M. Becker cbc5a141f7 Prepare main branch for PHP 7.2.16 2019-01-30 01:27:57 +01:00
Nikita Popov 14684af0d0 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-29 09:40:06 +01:00
Nikita Popov 34898e9766 Make special assert() handling independent of compiler flags 2019-01-29 09:39:12 +01:00
Nikita Popov ab3c94a54f Merge branch 'PHP-7.2' into PHP-7.3 2019-01-28 09:23:23 +01:00
ekinhbayar ef68cd3249 Fixed bug #77530: PHP crashes when parsing "(2)::class" 2019-01-28 09:22:18 +01:00
Jakub Zelenka 0da13086bd Merge branch 'PHP-7.2' into PHP-7.3 2019-01-25 14:16:08 +00:00
Jakub Zelenka dc2ffdeed7 Fix bug #77390 (feof might hang on TLS streams in case of fragmented TLS records)
Simplified version of the fix from Abyl Valg so credit to him.
2019-01-25 14:13:11 +00:00
Jakub Zelenka d9b29029f9 Update and integrate openssl client proxy test 2019-01-25 14:09:55 +00:00
Abyr Valg 0c84c2ef50 Add a test for fragmented SSL packets 2019-01-25 14:09:55 +00:00
Nikita Popov f78e681428 Fixed bug #77498
I've renamed the function to the same name as the exported symbol
in master.
2019-01-25 11:01:06 +01:00
Nikita Popov 3c98c2d0cb Fixed bug #77514 2019-01-24 15:13:49 +01:00
Nikita Popov d460e06cb9 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-24 13:45:40 +01:00
Nikita Popov 08c5679380 Merge remote-tracking branch 'php-src/PHP-7.2' into PHP-7.2 2019-01-24 13:45:27 +01:00
Nikita Popov e926dc9305 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-24 13:40:36 +01:00
Nikita Popov cce2e33c84 Revert "Prefix error_code with underscore in FastZPP implementation"
This reverts commit 6305119a51.

This is a source-compatibility break for extensions that define
custom FastZPP macros, such as ext/uv:

https://github.com/bwoebi/php-uv/blob/a983eb17b69f74a45d785ddc6a7bff3d4531b88c/php_uv.c#L75

I don't think that FastZPP was intended to be used this way, but
let's revert this from release branches to avoid extension breakage.
2019-01-24 13:36:47 +01:00
Dmitry Stogov aa9a8dbda3 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #77494 (Disabling class causes segfault on member access)
2019-01-24 13:07:31 +03:00
Dmitry Stogov 73f222d722 Fixed bug #77494 (Disabling class causes segfault on member access) 2019-01-24 13:06:36 +03:00
Nikita Popov e0f97ae7ec Merge branch 'PHP-7.2' into PHP-7.3 2019-01-24 10:57:45 +01:00
Nikita Popov 526344aa5e Add flag to disable jumptable optimization
This is useful for coverage. While it is currently safe to just
skip over the SWITCH_* opcodes, this may not be true in the future
due to opcache optimizations, so it's safer to disable emission of
SWITCH_* opcodes entirely.
2019-01-24 10:56:04 +01:00
Christoph M. Becker 19a9a6ba24 Prepare main branch for PHP 7.3.3 2019-01-22 14:04:03 +01:00
Nikita Popov 76760901fa Fixed bug #77287
There may be an EXT_NOP opcode before the parameter list, we should
skip over it.
2019-01-22 12:15:06 +01:00
George Wang 6a0a600176 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-20 15:11:37 -05:00
George Wang 66d72377d0 Checkin LiteSpeed SAPI 7.2. 2019-01-20 15:10:19 -05:00
Anatol Belski a1b1c53d13 Update NEWS [ci skip] 2019-01-20 16:00:25 +01:00
Anatol Belski 969e57c7ac Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS [ci skip]
2019-01-20 15:59:08 +01:00
Anatol Belski d978590c74 Update NEWS [ci skip] 2019-01-20 15:58:19 +01:00
Anatol Belski 52730fa30a Skip test on unsuitable build
This test reveals a difference between TS and NTS through all the
versions, which is probably too late to fix at this stage of 7.3.
While NTS always relies on the system getcwd(), TS uses a fake CWD
which might get out of sync when the real dir is deleted. Thus,
skip test on unsuitable build. Investigate possibilities to fix this
edge case for later versions.
2019-01-19 13:53:32 +01:00
Christoph M. Becker 2966da70cf Fix failing test 2019-01-19 11:13:13 +01:00
Christoph M. Becker 1907cbd8b3 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77479: imagewbmp() segfaults with very large images
2019-01-19 10:18:20 +01:00
Christoph M. Becker 44fa0b0f31 Fix #77479: imagewbmp() segfaults with very large images
We must not proceed working with the Wbmp structure, if it hasn't been
allocated.
2019-01-19 10:16:02 +01:00
Anatol Belski 4254bf87ba Make test output more reliable 2019-01-19 03:33:37 +01:00
Anatol Belski 8b20e7b68b Fixed bug #77484 Zend engine crashes when calling realpath in invalid working dir 2019-01-19 02:36:51 +01:00
Nikita Popov 986b9b5ae3 Add additional no_sanitize_address attributes
To fix bug #77447 in release mode as well.
2019-01-18 15:02:30 +01:00
Nikita Popov 14b5302591 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-18 12:48:52 +01:00
Lauri Kenttä dbe7f2a41a Fix seeking in php://input 2019-01-18 12:44:47 +01:00
Nikita Popov de38ce1a2e Merge branch 'PHP-7.2' into PHP-7.3 2019-01-18 12:05:11 +01:00
Pedro Magalhães 32ae716037 Fixed bug #76675
Leave a reference to the resource in the php_curl.
2019-01-18 12:04:25 +01:00
Jakub Zelenka 25ffdc8dc9 List me in the openssl maintainers
I have been basically doing that since 2015 or so
2019-01-17 20:04:44 +00:00
Jakub Zelenka 766b4fd515 Fix bug #77430 (php-fpm crashes with Main process exited) 2019-01-17 18:37:09 +00:00
Christoph M. Becker 26b5aa8584 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #73614: gdImageFilledArc() doesn't properly draw pies
2019-01-16 20:22:37 +01:00
Christoph M. Becker 61cfa34e11 Fix #73614: gdImageFilledArc() doesn't properly draw pies
The fix for PHP bug 43828[1] changed the algorithm from drawing filled
pies from drawing multiple triangles to drawing a single polygon.  Due
to quirks of the filled polygon drawing algorithm, we had to filter out
extraneous vertices.  This lead, however, to a bug regarding displaced
starting and ending points near 90° and 270° degrees, which we fix by
reinserting these vertices if they had been removed.

This fix is a port of libgd/libgd@1406b1a.

[1] <https://bugs.php.net/bug.php?id=43828>
2019-01-16 20:10:04 +01:00
Dmitry Stogov 1a306cc9a1 Fixed bug #77308 (Unbuffered queries memory leak) 2019-01-14 13:59:30 +03:00
Nikita Popov 5c3b17ca68 Merge branch 'PHP-7.2' into PHP-7.3
[ci skip]
2019-01-14 11:49:58 +01:00
wbob 5ac9990ddf document open_basedir and realpath cache coupling in php.ini
[ci skip]
2019-01-14 11:49:45 +01:00
Nikita Popov c8c5a3ab8a Fixed bug #77447
By disabling asan for CPU support helpers used in ifunc resolvers.
2019-01-14 11:44:48 +01:00
Dmitry Stogov 920450534e Fixed bug #77263 (Segfault when using 2 RecursiveFilterIterator) 2019-01-14 13:18:28 +03:00
Nikita Popov d6212835f2 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-14 10:23:44 +01:00
Nikita Popov 3ad0ebdf5c Fixed bug #77454 2019-01-14 10:22:48 +01:00
Anatol Belski e3e2a7f7a8 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update SDK version for AppVeyor
2019-01-12 22:14:35 +01:00
Anatol Belski 8f66ca8189 Update SDK version for AppVeyor 2019-01-12 22:13:14 +01:00
Nikita Popov b35a20e919 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-11 10:55:26 +01:00
Ondřej Surý 1ea58b6e78 Fix rl_completion_matches detection
Also fix a typo when checking for rl_on_new_line in readline library.
2019-01-11 10:55:07 +01:00
Nikita Popov e6eac08abd Merge branch 'PHP-7.2' into PHP-7.3 2019-01-11 10:29:34 +01:00
Kevin Adler 332b58f865 Fix bug #77361 (configure fails on 64-bit AIX when opcache enabled)
In f904830012, support for GNU Hurd was added to the opcache and
the configure check to ensure the opcache knows the flock struct
layout prior to building was changed check for two cases: BSD layout
and Linux layout. All the existing hard-coded cases in
ZendAccelerator.h follow these two cases, except for 64-bit AIX.
This means that even though building on 64-bit AIX would work,
the configure script refuses to continue.

Add a new configure check for the 64-bit AIX case and a new
compiler definition HAVE_FLOCK_AIX64. Now that all the cases are
covered, simplify the ifdef logic around these three HAVE_FLOCK_*
macros:
- The macOS and the various BSD flavors fall under HAVE_FLOCK_BSD
- Linux, HP-UX, GNU Hurd, 32-bit AIX, and SVR4 environments
  fall under HAVE_FLOCK_LINUX
- 64-bit AIX falls under HAVE_FLOCK_AIX64

The only difference between the existing HAVE_FLOCK_LINUX and
the hard-coded Linux/HP-UX/Hurd case is that the latter
initialized the 5th member to 0, but since the C standard already
says that un-initialized members will be initialized to 0,
it's effectively the same.
2019-01-11 10:21:02 +01:00
Jakub Zelenka 9c010cefa3 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-10 20:16:06 +00:00
Alexander Kurilo 1a1e12c2a9 Fix cleaning up after openssl_pkcs7_verify_basic test 2019-01-10 20:09:42 +00:00
Alexander Kurilo 1fab01be5b Generate certs for openssl tests on the fly
The idea is to create an easy way to provide a certificate that never
expires. In order to make it cross-platform, PHP is used rather than
openssl CLI app. Using openssl to generate certificates for tests that
test openssl might be not the best idea but pros seem to outweight cons
that this "recursice dependency" adds
2019-01-10 20:09:42 +00:00
Christoph M. Becker 3f9ddeb122 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #73281: imagescale(…, IMG_BILINEAR_FIXED) can cause black border
2019-01-10 16:27:43 +01:00
Christoph M. Becker 6b4cdbaade Fix #73281: imagescale(…, IMG_BILINEAR_FIXED) can cause black border
We port the upstream fixes for libgd/libgd#329 and libgd/libgd#224.
2019-01-10 16:11:23 +01:00
Christoph M. Becker 1e407256f2 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77272: imagescale() may return image resource on failure
2019-01-10 14:25:11 +01:00
Christoph M. Becker 772b1cb245 Fix #77272: imagescale() may return image resource on failure
`_gdScaleHoriz()` and `_gdScaleVert()` may fail, but don't signal
failure since they are void functions.  We change that according to
upstream libgd.

We also remove the unused `Scale()` function, which doesn't exist in
upstream libgd either, right away.
2019-01-10 14:05:09 +01:00
Nikita Popov 00e5d0e859 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-10 10:57:41 +01:00
Nikita Popov 5d33024a5d Fixed bug #77439 2019-01-10 10:57:04 +01:00
Nikita Popov ade702a0d2 Fixed bug #77434
Mark arrays containing partial arrays as partial. This was already
done for the ADD_ARRAY_ELEMENT case, but not for ASSIGN_DIM.
2019-01-10 10:25:55 +01:00
Xinchen Hui 16176ad0e3 Incase of invalid read 2019-01-10 14:50:39 +08:00
Anatol Belski 300249226b Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Revert visibility
2019-01-09 16:16:47 +01:00
Andrey Hristov 7a88f89a90 Revert visibility
(cherry picked from commit 71ffae9605)
2019-01-09 13:39:48 +01:00
Christoph M. Becker c4c6b80b9c Sync NEWS with 7.3.1
All these bugs are fixed in PHP-7.3.1 already.
2019-01-09 11:46:48 +01:00
Lauri Kenttä 63c38c9e49 Fixed bug #77289
Use mysqlnd_restart_psession and mysqlnd_end_psession in PDO MySQL.
This makes sure we free last_message while ZMM is still live.
2019-01-09 09:50:26 +01:00
Nikita Popov bf4dab0163 Make operator swapping depend on IGNORE_OVERLOADING flag
Add MUL back to the list and instead make the entire optimization
depend on IGNORE_OVERLOADING, which is there exactly so we can make
these kinds of assumptions.
2019-01-09 09:27:56 +01:00
Sara Golemon 85f440362b Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Bump for 7.1.27
2019-01-08 14:20:18 -05:00
Sara Golemon bbc10549e8 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Bump for 7.1.27
2019-01-08 14:19:37 -05:00
Sara Golemon fabade1573 Bump for 7.1.27 2019-01-08 14:17:43 -05:00
Xinchen Hui cd49db9d47 Fixed bug #77266 (Assertion failed in dce_live_ranges) 2019-01-08 19:19:01 +08:00
Nikita Popov 76c687feaf Fixed bug #77428
mb_ereg_replace historically has not supported escaping backslashes
with backslashes. Go back to that behavior for BC reasons.
2019-01-08 10:21:01 +01:00
Nikita Popov 7f8cab2535 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-08 09:38:02 +01:00
Nikita Popov 1165a9068c Don't swap operands of ZEND_MUL
If this is used with operator overloading, then the operation does
not necessarily commute (for example, matrix multiplication).
2019-01-08 09:37:49 +01:00
Remi Collet b9072788cd Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  cleanup merge
2019-01-08 09:34:05 +01:00
Remi Collet 0d9935739c cleanup merge 2019-01-08 09:33:41 +01:00
Nikita Popov f7a7d32e65 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-08 09:26:31 +01:00
twosee 6305119a51 Prefix error_code with underscore in FastZPP implementation
To avoid conflicts with parameter names.
2019-01-08 09:25:35 +01:00
Derick Rethans 24b446291d Merge branch 'PHP-7.2' into PHP-7.3 2019-01-07 12:48:49 +00:00
Derick Rethans bd1d2c7bfe Update tests due to data changes in tzdata 2018i 2019-01-07 12:48:42 +00:00
Christoph M. Becker deb88f2269 Fix NEWS
The fixes for bug #77359 and #77360 have been ported to PHP-7.3.1, and
the release has been postponed by one week.
2019-01-07 13:11:04 +01:00
Derick Rethans 11105e90c4 Updated to version 2018.9 (2018i) 2019-01-07 11:50:16 +00:00
Derick Rethans 7ad9d6a63b Empty merge 2019-01-07 11:50:16 +00:00
Derick Rethans 81da7f75e3 Updated to version 2018.9 (2018i) 2019-01-07 11:50:14 +00:00
Remi Collet ddccc1db73 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  [ci skip] fix NEWS
2019-01-07 11:12:46 +01:00
Remi Collet 3e780d7f25 [ci skip] fix NEWS 2019-01-07 11:12:13 +01:00
Remi Collet 88fc59d4c9 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  [ci skip] fix NEWS
2019-01-07 11:02:58 +01:00
Remi Collet 03a630ded7 [ci skip] fix NEWS 2019-01-07 11:02:40 +01:00
Nikita Popov 6f75890e7b Fix one issue reported in bug #77310
SCCP did not handle array ASSIGN_* with a BOT operand correctly.
2019-01-07 10:05:23 +01:00
Stanislav Malyshev b5669d207b Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Still leaking for some reason, XFAIL for now, I'll look into it later.
2019-01-07 01:04:16 -08:00
Stanislav Malyshev 289c45109c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Still leaking for some reason, XFAIL for now, I'll look into it later.
2019-01-07 01:03:26 -08:00
Stanislav Malyshev 27625f063e Still leaking for some reason, XFAIL for now, I'll look into it later. 2019-01-07 01:03:04 -08:00
Stanislav Malyshev aeec40cb50 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #77418 - Heap overflow in utf32be_mbc_to_code
  Add NEWS
  [ci skip] Add NEWS
  Fix more issues with encodilng length
  Fix #77270: imagecolormatch Out Of Bounds Write on Heap
  Fix bug #77380  (Global out of bounds read in xmlrpc base64 code)
  Fix bug #77371 (heap buffer overflow in mb regex functions - compile_string_node)
  Fix bug #77370 - check that we do not read past buffer end when parsing multibytes
  Fix #77269: Potential unsigned underflow in gdImageScale
  Fix bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext)
  Fix bug #77242 (heap out of bounds read in xmlrpc_decode())
  Regenerate certs for openssl tests
2019-01-06 23:35:09 -08:00
Stanislav Malyshev cfe77ea543 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #77418 - Heap overflow in utf32be_mbc_to_code
  Add NEWS
  [ci skip] Add NEWS
  Fix more issues with encodilng length
  Fix #77270: imagecolormatch Out Of Bounds Write on Heap
  Fix bug #77380  (Global out of bounds read in xmlrpc base64 code)
  Fix bug #77371 (heap buffer overflow in mb regex functions - compile_string_node)
  Fix bug #77370 - check that we do not read past buffer end when parsing multibytes
  Fix #77269: Potential unsigned underflow in gdImageScale
  Fix bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext)
  Fix bug #77242 (heap out of bounds read in xmlrpc_decode())
  Regenerate certs for openssl tests
2019-01-06 23:34:26 -08:00
Stanislav Malyshev 1afebfb3fa Merge branch 'PHP-5.6' into PHP-7.1
* PHP-5.6:
  Fix bug #77418 - Heap overflow in utf32be_mbc_to_code
  [ci skip] Add NEWS
  Fix more issues with encodilng length
  Fix #77270: imagecolormatch Out Of Bounds Write on Heap
  Fix bug #77380  (Global out of bounds read in xmlrpc base64 code)
  Fix bug #77371 (heap buffer overflow in mb regex functions - compile_string_node)
  Fix bug #77370 - check that we do not read past buffer end when parsing multibytes
  Fix #77269: Potential unsigned underflow in gdImageScale
  Fix bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext)
  Fix bug #77242 (heap out of bounds read in xmlrpc_decode())
  Regenerate certs for openssl tests
2019-01-06 23:33:34 -08:00
Stanislav Malyshev 9d6c59eeea Fix bug #77418 - Heap overflow in utf32be_mbc_to_code 2019-01-06 23:31:15 -08:00
Stanislav Malyshev 7ed3cfb2e8 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix tests - newer versions check Unicode
  Add NEWS
  Fix test
2019-01-06 13:50:28 -08:00
Stanislav Malyshev d0d0d922de Fix tests - newer versions check Unicode 2019-01-06 13:28:30 -08:00
Stanislav Malyshev 1b7c599a02 Add NEWS 2019-01-06 13:11:55 -08:00
Stanislav Malyshev fc02e7e3fe Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Add NEWS
2019-01-06 13:08:48 -08:00
Stanislav Malyshev 08bb0ce4e4 Add NEWS 2019-01-06 13:08:24 -08:00
Stanislav Malyshev 25c95752d6 Add NEWS 2019-01-06 13:04:51 -08:00
Stanislav Malyshev b51eaf4166 [ci skip] Add NEWS 2019-01-06 13:03:38 -08:00
Stanislav Malyshev ed4db1bb22 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix test
2019-01-06 12:54:09 -08:00
Stanislav Malyshev 0c35032012 Fix test 2019-01-06 12:30:44 -08:00
Christoph M. Becker e617f03066 Fix #77367: Negative size parameter in mb_split
When adding the last element to the result value of `mb_split`, the
`chunk_pos` may point beyond the end of the string, in which case the
unsigned `n` would underflow.  Therefore, we check whether this is the
case in the first place, and only calculate `n` otherwise.  Since `n`
is no longer used outside the block, we move its declaration inside.
2019-01-06 12:24:15 -08:00
Stanislav Malyshev e40027ef0f Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77369 - memcpy with negative length via crafted DNS response
  Fix more issues with encodilng length
  Fix #77270: imagecolormatch Out Of Bounds Write on Heap
  Fix bug #77380  (Global out of bounds read in xmlrpc base64 code)
  Fix bug #77371 (heap buffer overflow in mb regex functions - compile_string_node)
  Fix bug #77370 - check that we do not read past buffer end when parsing multibytes
  Fix #77269: Potential unsigned underflow in gdImageScale
  Fix bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext)
  Fix bug #77242 (heap out of bounds read in xmlrpc_decode())
  Regenerate certs for openssl tests
2019-01-06 12:23:53 -08:00
Stanislav Malyshev fe820fcba6 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #77369 - memcpy with negative length via crafted DNS response
  Fix more issues with encodilng length
  Fix #77270: imagecolormatch Out Of Bounds Write on Heap
  Fix bug #77380  (Global out of bounds read in xmlrpc base64 code)
  Fix bug #77371 (heap buffer overflow in mb regex functions - compile_string_node)
  Fix bug #77370 - check that we do not read past buffer end when parsing multibytes
  Fix #77269: Potential unsigned underflow in gdImageScale
  Fix bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext)
  Fix bug #77242 (heap out of bounds read in xmlrpc_decode())
  Regenerate certs for openssl tests
2019-01-06 11:57:16 -08:00
Stanislav Malyshev 8d3dfabef4 Fix #77369 - memcpy with negative length via crafted DNS response 2019-01-06 11:39:09 -08:00
Stanislav Malyshev 31f59e1f30 Fix more issues with encodilng length
Should fix bug #77381, bug #77382, bug #77385, bug #77394.
2019-01-06 11:38:46 -08:00
Christoph M. Becker 567c9f5842 Fix #77270: imagecolormatch Out Of Bounds Write on Heap
At least some of the image reading functions may return images which
use color indexes greater than or equal to im->colorsTotal.  We cater
to this by always using a buffer size which is sufficient for
`gdMaxColors` in `gdImageColorMatch()`.
2019-01-06 11:38:46 -08:00
Stanislav Malyshev 4feb9e66ff Fix bug #77380 (Global out of bounds read in xmlrpc base64 code) 2019-01-06 11:38:46 -08:00
Stanislav Malyshev c6e34d91b8 Fix bug #77371 (heap buffer overflow in mb regex functions - compile_string_node) 2019-01-06 11:38:46 -08:00
Stanislav Malyshev deb06bbb9c Fix bug #77370 - check that we do not read past buffer end when parsing multibytes 2019-01-06 11:38:46 -08:00
Christoph M. Becker dfd8237aec Fix #77269: Potential unsigned underflow in gdImageScale
Belatedly, we're porting the respective upstream patch[1].

[1] <https://github.com/libgd/libgd/commit/60bfb401ad5a4a8ae995dcd36372fe15c71e1a35>
2019-01-06 11:38:46 -08:00
Stanislav Malyshev 78bd347774 Fix bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext) 2019-01-06 11:38:46 -08:00
Stanislav Malyshev 9c62b95e5e Fix bug #77242 (heap out of bounds read in xmlrpc_decode()) 2019-01-06 11:38:46 -08:00
Alexander Kurilo e3e3289bd1 Regenerate certs for openssl tests 2019-01-06 11:38:46 -08:00
Stanislav Malyshev c95daa9c75 Fix more issues with encodilng length
Should fix bug #77381, bug #77382, bug #77385, bug #77394.
2019-01-06 11:34:27 -08:00
Christoph M. Becker 7a12dad4dd Fix #77270: imagecolormatch Out Of Bounds Write on Heap
At least some of the image reading functions may return images which
use color indexes greater than or equal to im->colorsTotal.  We cater
to this by always using a buffer size which is sufficient for
`gdMaxColors` in `gdImageColorMatch()`.
2019-01-06 11:34:20 -08:00
Stanislav Malyshev 1cc2182bcc Fix bug #77380 (Global out of bounds read in xmlrpc base64 code) 2019-01-06 11:34:00 -08:00
Stanislav Malyshev 28362ed4fa Fix bug #77371 (heap buffer overflow in mb regex functions - compile_string_node) 2019-01-06 11:33:54 -08:00
Stanislav Malyshev 20407d06ca Fix bug #77370 - check that we do not read past buffer end when parsing multibytes 2019-01-06 11:33:44 -08:00
Christoph M. Becker a918020c03 Fix #77269: Potential unsigned underflow in gdImageScale
Belatedly, we're porting the respective upstream patch[1].

[1] <https://github.com/libgd/libgd/commit/60bfb401ad5a4a8ae995dcd36372fe15c71e1a35>
2019-01-06 11:33:38 -08:00
Stanislav Malyshev 428d8164ff Fix bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext) 2019-01-06 11:33:32 -08:00
Stanislav Malyshev 4fc0bceb7c Fix bug #77242 (heap out of bounds read in xmlrpc_decode()) 2019-01-06 11:33:25 -08:00
Nikita Popov 361d3ede93 Fix bug #77410 2019-01-04 12:40:28 +01:00
Nikita Popov 1ed20669c5 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-04 09:53:30 +01:00
Nikita Popov 41af1e6781 Fix self::class inside constant in global scope
Previously this triggered an assertion failure. The behavior is
not quite correct, in that self::class should generate an exception
if there is no self, but returns an empty string here. Fixing that
would be a bit too intrusive for the 7.2 branch.
2019-01-04 09:52:04 +01:00
Nikita Popov 07873fab3c Add NEWS entry for bug #77357
The fix has been confirmed.

[ci skip]
2019-01-04 09:07:50 +01:00
Nikita Popov 5a361c3a54 Possible fix for bug #77357
Don't invoke CPUID with feature levels above the supported maximum.
In this case CPUID will return the highest supported basic information
leaf, which will have unrelated bits in the relevant positions.
2019-01-03 10:24:48 +01:00
Nikita Popov 349dbb7938 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-03 09:40:42 +01:00
Nikita Popov cb009b12a5 Fixed bug #77273 2019-01-03 09:40:07 +01:00
Alexander Kurilo f51062523d Regenerate certs for openssl tests 2019-01-02 10:00:36 -08:00
Nikita Popov 325a113974 Possible fix for bug #77287
The cache size could be off by 4, if we're on a 32-bit system and
the slot had to be bumped for alignment reasons.

I wasn't able to reproduce the issue reported in bug #77287, but I
think this might be the cause.
2019-01-02 14:12:58 +01:00
Nikita Popov 291589114a Disable ifuncs on FreeBSD
Intended as at least a preliminary fix for bug #77284. If/when we
figure out what exactly the issue is, we can relax this.
2019-01-02 12:59:22 +01:00
Nikita Popov 613683580b Merge branch 'PHP-7.2' into PHP-7.3 2019-01-02 11:34:15 +01:00
Nikita Popov 73596c56e7 Partial fix for bug #75426
This does not print the exact line of the comma, but rather the line
of the previous element. This should generally be "good enough", as
the line number is close (off by one) to the actual issue now.
Previously it would point to the start of the array, which may be
very far away.
2019-01-02 11:32:48 +01:00
Vincent JARDIN 91e44a27f6 skeleton: support PHP 7.2
skeleton can still be leveraged with older PHP releases, including
PHP 7.2.

I wanted to add this capability since PHP 7.2 is still widely provided
with most Linux distributions.

I am using ext_skel.php on a vanilla Ubuntu 18.04 and Windows
in order to illustrate how to develop a PHP extension for both
OS using the default tools provided by the distributions.
  see: https://github.com/vjardin/php-bonjour
2019-01-02 11:21:25 +01:00
Anatol Belski 1732ce9c23 Update NEWS 2019-01-02 11:02:29 +01:00
Anatol Belski d1c616f077 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #75684 In mysqlnd_ext_plugin.h the plugin methods family has no external visibility
2019-01-02 11:01:34 +01:00
Anatol Belski 7b3f8e746a Fixed bug #75684 In mysqlnd_ext_plugin.h the plugin methods family has no external visibility 2019-01-02 11:00:33 +01:00
Xinchen Hui 1b86f84908 Entry get lost while merging 2019-01-02 16:46:41 +08:00
Xinchen Hui 33011be5bf Merge branch 'PHP-7.3' of git.php.net:/php-src into PHP-7.3
* 'PHP-7.3' of git.php.net:/php-src:
  Fixed bug #77257
2019-01-02 16:45:38 +08:00
Xinchen Hui 54a58a7380 Fixed bug #77387 (Recursion detection broken when printing GLOBALS) 2019-01-02 16:42:05 +08:00
Nikita Popov 91888cc372 Fixed bug #77257
Correctly handle the case of duplicate predecessors, by removing the
duplicate predecessor and corresponding phi node operands.

For the future, it would be better to instead allow duplicate
predecessors and avoid this kind of fragile code...
2019-01-02 09:31:50 +01:00
Xinchen Hui e01f08f679 Fixed bug #77376 ("undefined function" message no longer includes namespace) 2019-01-02 15:32:17 +08:00
Xinchen Hui 703ccd5d27 Update NEWS 2019-01-02 12:10:23 +08:00
Xinchen Hui e527626d9f Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #77395 (segfault about array_multisort)
2019-01-02 12:10:04 +08:00
Xinchen Hui 8ebae84674 Fixed bug #77395 (segfault about array_multisort) 2019-01-02 12:09:47 +08:00
Christoph M. Becker 6f663c3a2e Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77391: 1bpp BMPs may fail to be loaded
2018-12-31 20:50:19 +01:00
Christoph M. Becker b0cfa28d6d Fix #77391: 1bpp BMPs may fail to be loaded
We port the upstream fix[1].

[1] <https://github.com/libgd/libgd/commit/d0859134fcbd8817f87895bd1cb158096568a7a2>
2018-12-31 20:45:47 +01:00
Christoph M. Becker b051ab56dc Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Regenerate certs for openssl tests
2018-12-31 18:27:26 +01:00
Alexander Kurilo 687dad3674 Regenerate certs for openssl tests 2018-12-31 18:20:34 +01:00
Christoph M. Becker 42b0bbd758 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Drop deprecated /Gm compile option
2018-12-30 14:37:04 +01:00
Christoph M. Becker 20de58f51d Drop deprecated /Gm compile option
The `/Gm` option of `cl` is deprecated[1], and `cl` claims that it will
be removed in the future, so we're dropping it right away.

[1] <https://docs.microsoft.com/en-us/cpp/build/reference/gm-enable-minimal-rebuild?view=vs-2017>
2018-12-30 14:36:05 +01:00
Anatol Belski d4b7cc1dba Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Increase timeout for test on AppVeyor
2018-12-29 17:51:39 +01:00
Anatol Belski 54a2b42778 Increase timeout for test on AppVeyor 2018-12-29 17:48:25 +01:00
Anatol Belski 2567eba330 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Add memory check to the test
2018-12-29 16:23:24 +01:00
Anatol Belski 222fa032d2 Add memory check to the test 2018-12-29 16:22:31 +01:00
Anatol Belski 6896d2a685 [ci skip] Update NEWS 2018-12-28 16:40:06 +01:00
Anatol Belski d874d4a15c Fixed bug #77346 webm files incorrectly detected as application/octet-stream
HEADSUP data from file 5.34 is used from now on
2018-12-28 13:25:40 +01:00
Lauri Kenttä 16c62a8179 Fix #77360: class_uses causes segfault 2018-12-27 15:34:02 +01:00
Lauri Kenttä 89bf3df67d Fix #77359: spl_autoload causes segfault
Use the correct function to free the string.
2018-12-27 15:28:25 +01:00
Anatol Belski d2621c3185 Update NEWS [ci skip] 2018-12-26 20:45:19 +01:00
Anatol Belski b53d2b69f2 Update NEWS [ci skip] 2018-12-26 20:07:31 +01:00
Anatol Belski b48823101c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS [ci skip]
2018-12-26 20:06:01 +01:00
Anatol Belski a2cb8228fe Update NEWS [ci skip] 2018-12-26 20:05:15 +01:00
Anatol Belski e38e44e3c6 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Initialize s_un (sockaddr_un) to zero before using it. Fixes #76839.
2018-12-26 19:01:36 +01:00
Michael Meyer 3c42c784c2 Initialize s_un (sockaddr_un) to zero before using it. Fixes #76839. 2018-12-26 18:58:27 +01:00
Nikita Popov b1deb98c42 Fixed bug #77338
Set preg_options to 0 in php_pcre_get_compiled_regex(_ex). These
options are intended to be passed to pcre2_match. However, we do
not have any flags that actually need to be set during matching
(all relevant flags are set during compilation), and the preg_flags
value is used for PHP-specific flags instead.

This parameter should be removed entirely in master to avoid confusion.
2018-12-26 17:11:27 +01:00
Anatol Belski 078c1d8ef7 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update binary SDK version for AppVeyor
2018-12-26 14:17:56 +01:00
Anatol Belski 3c7dc7b4c4 Update binary SDK version for AppVeyor 2018-12-26 14:15:21 +01:00
Anatol Belski 199914b42d Fixed bug #77317 __DIR__, __FILE__, realpath() reveal physical path for subst virtual drive
Keep compatibility with 7.2 and below which better comply with
realpath(3). This might have been fixable another way, say by checking
of QueryDosDevice or alike, sadly that comes with a huge performance
impact. The new internal realpath API is kept available so is
usable when bind or network mount or other OS specific realpath
variants are needed. If not used by default, a userspace function for
this specific case might be considered to be offered in next minor.
2018-12-26 12:59:00 +01:00
Dmitry Stogov b45774eed0 Respect EG(vm_stack_page_size) 2018-12-26 13:09:32 +03:00
Dmitry Stogov 1ce7cbe590 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Backport later interned strings destruction.
2018-12-24 13:45:40 +03:00
Dmitry Stogov 5888fbde0d Backport later interned strings destruction. 2018-12-24 13:45:02 +03:00
Dmitry Stogov ddfb44f2cf Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #77339 (__callStatic may get incorrect arguments)
2018-12-24 13:23:47 +03:00
Dmitry Stogov 7e597f48e9 Fixed bug #77339 (__callStatic may get incorrect arguments) 2018-12-24 13:22:43 +03:00
Nikita Popov 69f54dd549 Merge branch 'PHP-7.2' into PHP-7.3 2018-12-23 20:20:53 +01:00
Nikita Popov 64de5bc224 Fix invalid efree in browscap
Related to bug #77338.
2018-12-23 20:20:04 +01:00
Derick Rethans c4e46c3043 Merge branch 'timelib-201801RC3' into PHP-7.3 2018-12-23 17:57:09 +00:00
Derick Rethans a9a084c092 Update API use due to changes in timelib 2018.01RC3 2018-12-23 17:54:57 +00:00
Derick Rethans 3e4a3d005a Upgrade timelib to 2018.01RC3 2018-12-23 17:54:37 +00:00
CHU Zhaowei b15189f4d8 Fix #77298: segfault occurs when add property to unserialized empty ArrayObject 2018-12-21 17:45:52 +01:00
Dmitry Stogov 95193c3872 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Removed /e modifirer and fixed ws.
2018-12-21 19:01:18 +03:00
Dmitry Stogov 8db63adb6d Removed /e modifirer and fixed ws. 2018-12-21 18:58:50 +03:00
Christoph M. Becker b1e25ce319 [ci skip] Add missing entry for bug 77020 2018-12-18 23:23:08 +01:00
Remi Collet 4efa618b9e Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  missing entry for #77020
2018-12-18 16:29:53 +01:00
Remi Collet 3245d1bb09 missing entry for #77020 2018-12-18 16:29:31 +01:00
Remi Collet c04ef40026 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  bump to 7.2.15-dev
2018-12-18 13:12:05 +01:00
Remi Collet 7161fe629d bump to 7.2.15-dev 2018-12-18 13:11:32 +01:00
Christoph M. Becker 8734d6a73d [ci skip] Fix release date 2018-12-18 13:10:03 +01:00
Christoph M. Becker a65133a17a Prepare main branch for 7.3.2 2018-12-18 12:15:25 +01:00
327 changed files with 182502 additions and 170137 deletions

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@ environment:
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
PHP_BUILD_OBJ_DIR: c:\obj
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
PHP_BUILD_SDK_BRANCH: php-sdk-2.1.9beta1
PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0beta3
PHP_BUILD_CRT: vc15
# ext and env setup for tests
#MYSQL_TEST_PASSWD: Password12!
+17 -5
View File
@@ -1,17 +1,19 @@
# http://editorconfig.org/
# https://editorconfig.org/
root = true
[*.{c,h,awk,w32,bat,mk,frag}]
[*]
tab_width = 4
[*.{c,h,y,awk,w32,bat,mk,frag,cpp}]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
tab_width = 4
trim_trailing_whitespace = true
insert_final_newline = true
[*.{php,phpt}]
[*.{php,phpt,inc}]
charset = utf-8
end_of_line = lf
indent_size = 4
@@ -31,5 +33,15 @@ insert_final_newline = true
charset = utf-8
end_of_line = lf
indent_style = space
trim_trailing_whitespace = false
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 80
[COMMIT_EDITMSG]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 80
+1
View File
@@ -387,6 +387,7 @@ SINCE: 5.5.0
EXTENSION: openssl
PRIMARY MAINTAINER: Wez Furlong <wez@php.net> (2001 - 2006)
Pierre-Alain Joye <pajoye@php.net> (2006 - 2011)
Jakub Zelenka <bukka@php.net> (2015 - 2019)
MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.0.4
+254 -1
View File
@@ -1,6 +1,229 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.1
04 April 2019, PHP 7.3.4
- Core:
. Fixed bug #77738 (Nullptr deref in zend_compile_expr). (Laruence)
. Fixed bug #77660 (Segmentation fault on break 2147483648). (Laruence)
. Fixed bug #77652 (Anonymous classes can lose their interface information).
(Nikita)
. Fixed bug #77345 (Stack Overflow caused by circular reference in garbage
collection). (Alexandru Patranescu, Nikita, Dmitry)
. Fixed bug #76956 (Wrong value for 'syslog.filter' documented in php.ini).
(cmb)
- Apache2Handler:
. Fixed bug #77648 (BOM in sapi/apache2handler/php_functions.c). (cmb)
- Bcmath:
. Fixed bug #77742 (bcpow() implementation related to gcc compiler
optimization). (Nikita)
- CLI Server:
. Fixed bug #77722 (Incorrect IP set to $_SERVER['REMOTE_ADDR'] on the
localhost). (Nikita)
- COM:
. Fixed bug #77578 (Crash when php unload). (cmb)
- EXIF:
. Fixed bug #77753 (Heap-buffer-overflow in php_ifd_get32s). (Stas)
. Fixed bug #77831 (Heap-buffer-overflow in exif_iif_add_value). (Stas)
- FPM:
. Fixed bug #77677 (FPM fails to build on AIX due to missing WCOREDUMP).
(Kevin Adler)
- GD:
. Fixed bug #77700 (Writing truecolor images as GIF ignores interlace flag).
(cmb)
- MySQLi:
. Fixed bug #77597 (mysqli_fetch_field hangs scripts). (Nikita)
- Opcache:
. Fixed bug #77743 (Incorrect pi node insertion for jmpznz with identical
successors). (Nikita)
- Phar:
. Fxied bug #77697 (Crash on Big_Endian platform). (Laruence)
- phpdbg:
. Fixed bug #77767 (phpdbg break cmd aliases listed in help do not match
actual aliases). (Miriam Lauter)
- sodium:
. Fixed bug #77646 (sign_detached() strings not terminated). (Frank)
- SQLite3:
. Added sqlite3.defensive INI directive. (BohwaZ)
- Standard:
. Fixed bug #77664 (Segmentation fault when using undefined constant in
custom wrapper). (Laruence)
. Fixed bug #77669 (Crash in extract() when overwriting extracted array).
(Nikita)
. Fixed bug #76717 (var_export() does not create a parsable value for
PHP_INT_MIN). (Nikita)
. Fixed bug #77765 (FTP stream wrapper should set the directory as
executable). (Vlad Temian)
07 Mar 2019, PHP 7.3.3
- Core:
. Fixed bug #77589 (Core dump using parse_ini_string with numeric sections).
(Laruence)
. Fixed bug #77329 (Buffer Overflow via overly long Error Messages).
(Dmitry)
. Fixed bug #77494 (Disabling class causes segfault on member access).
(Dmitry)
. Fixed bug #77498 (Custom extension Segmentation fault when declare static
property). (Nikita)
. Fixed bug #77530 (PHP crashes when parsing `(2)::class`). (Ekin)
. Fixed bug #77546 (iptcembed broken function). (gdegoulet)
. Fixed bug #77630 (rename() across the device may allow unwanted access
during processing). (Stas)
- COM:
. Fixed bug #77621 (Already defined constants are not properly reported).
(cmb)
. Fixed bug #77626 (Persistence confusion in php_com_import_typelib()). (cmb)
- EXIF:
. Fixed bug #77509 (Uninitialized read in exif_process_IFD_in_TIFF). (Stas)
. Fixed bug #77540 (Invalid Read on exif_process_SOFn). (Stas)
. Fixed bug #77563 (Uninitialized read in exif_process_IFD_in_MAKERNOTE). (Stas)
. Fixed bug #77659 (Uninitialized read in exif_process_IFD_in_MAKERNOTE). (Stas)
- Mbstring:
. Fixed bug #77514 (mb_ereg_replace() with trailing backslash adds null byte).
(Nikita)
- MySQL
. Disabled LOCAL INFILE by default, can be enabled using php.ini directive
mysqli.allow_local_infile for mysqli, or PDO::MYSQL_ATTR_LOCAL_INFILE
attribute for pdo_mysql. (Darek Slusarczyk)
- OpenSSL:
. Fixed bug #77390 (feof might hang on TLS streams in case of fragmented TLS
records). (Abyl Valg, Jakub Zelenka)
- PDO_OCI:
. Support Oracle Database tracing attributes ACTION, MODULE,
CLIENT_INFO, and CLIENT_IDENTIFIER. (Cameron Porter)
- PHAR:
. Fixed bug #77396 (Null Pointer Dereference in phar_create_or_parse_filename).
(bishop)
. Fixed bug #77586 (phar_tar_writeheaders_int() buffer overflow). (bishop)
- phpdbg:
. Fixed bug #76596 (phpdbg support for display_errors=stderr). (kabel)
- SPL:
. Fixed bug #51068 (DirectoryIterator glob:// don't support current path
relative queries). (Ahmed Abdou)
. Fixed bug #77431 (openFile() silently truncates after a null byte). (cmb)
- Standard:
. Fixed bug #77552 (Unintialized php_stream_statbuf in stat functions).
(John Stevenson)
. Fixed bug #77612 (setcookie() sets incorrect SameSite header if all of its
options filled). (Nikita)
07 Feb 2019, PHP 7.3.2
- Core:
. Fixed bug #77369 (memcpy with negative length via crafted DNS response). (Stas)
. Fixed bug #77387 (Recursion detection broken when printing GLOBALS).
(Laruence)
. Fixed bug #77376 ("undefined function" message no longer includes
namespace). (Laruence)
. Fixed bug #77357 (base64_encode / base64_decode doest not work on nested
VM). (Nikita)
. Fixed bug #77339 (__callStatic may get incorrect arguments). (Dmitry)
. Fixed bug #77317 (__DIR__, __FILE__, realpath() reveal physical path for
subst virtual drive). (Anatol)
. Fixed bug #77263 (Segfault when using 2 RecursiveFilterIterator). (Dmitry)
. Fixed bug #77447 (PHP 7.3 built with ASAN crashes in
zend_cpu_supports_avx2). (Nikita)
. Fixed bug #77484 (Zend engine crashes when calling realpath in invalid
working dir). (Anatol)
- Curl:
. Fixed bug #76675 (Segfault with H2 server push). (Pedro Magalhães)
- Fileinfo:
. Fixed bug #77346 (webm files incorrectly detected as
application/octet-stream). (Anatol)
- FPM:
. Fixed bug #77430 (php-fpm crashes with Main process exited, code=dumped,
status=11/SEGV). (Jakub Zelenka)
- GD:
. Fixed bug #73281 (imagescale(…, IMG_BILINEAR_FIXED) can cause black border).
(cmb)
. Fixed bug #73614 (gdImageFilledArc() doesn't properly draw pies). (cmb)
. Fixed bug #77272 (imagescale() may return image resource on failure). (cmb)
. Fixed bug #77391 (1bpp BMPs may fail to be loaded). (Romain Déoux, cmb)
. Fixed bug #77479 (imagewbmp() segfaults with very large images). (cmb)
- ldap:
. Fixed bug #77440 (ldap_bind using ldaps or ldap_start_tls()=exception in
libcrypto-1_1-x64.dll). (Anatol)
- Mbstring:
. Fixed bug #77428 (mb_ereg_replace() doesn't replace a substitution
variable). (Nikita)
. Fixed bug #77454 (mb_scrub() silently truncates after a null byte).
(64796c6e69 at gmail dot com)
- MySQLnd:
. Fixed bug #77308 (Unbuffered queries memory leak). (Dmitry)
. Fixed bug #75684 (In mysqlnd_ext_plugin.h the plugin methods family has
no external visibility). (Anatol)
- Opcache:
. Fixed bug #77266 (Assertion failed in dce_live_ranges). (Laruence)
. Fixed bug #77257 (value of variable assigned in a switch() construct gets
lost). (Nikita)
. Fixed bug #77434 (php-fpm workers are segfaulting in zend_gc_addre).
(Nikita)
. Fixed bug #77361 (configure fails on 64-bit AIX when opcache enabled).
(Kevin Adler)
. Fixed bug #77287 (Opcache literal compaction is incompatible with EXT
opcodes). (Nikita)
- PCRE:
. Fixed bug #77338 (get_browser with empty string). (Nikita)
- PDO:
. Fixed bug #77273 (array_walk_recursive corrupts value types leading to PDO
failure). (Nikita)
- PDO MySQL:
. Fixed bug #77289 (PDO MySQL segfaults with persistent connection).
(Lauri Kenttä)
- SOAP:
. Fixed bug #77410 (Segmentation Fault when executing method with an empty
parameter). (Nikita)
- Sockets:
. Fixed bug #76839 (socket_recvfrom may return an invalid 'from' address
on MacOS). (Michael Meyer)
- SPL:
. Fixed bug #77298 (segfault occurs when add property to unserialized empty
ArrayObject). (jhdxr)
- Standard:
. Fixed bug #77395 (segfault about array_multisort). (Laruence)
. Fixed bug #77439 (parse_str segfaults when inserting item into existing
array). (Nikita)
10 Jan 2019, PHP 7.3.1
- Core:
. Fixed bug #76654 (Build failure on Mac OS X on 32-bit Intel). (Ryandesign)
@@ -27,6 +250,23 @@ PHP NEWS
. Fixed bug #77198 (auto cropping has insufficient precision). (cmb)
. Fixed bug #77200 (imagecropauto(…, GD_CROP_SIDES) crops left but not right).
(cmb)
. Fixed bug #77269 (efree() on uninitialized Heap data in imagescale leads to
use-after-free). (cmb)
. Fixed bug #77270 (imagecolormatch Out Of Bounds Write on Heap). (cmb)
- MBString:
. Fixed bug #77367 (Negative size parameter in mb_split). (Stas)
. Fixed bug #77370 (Buffer overflow on mb regex functions - fetch_token).
(Stas)
. Fixed bug #77371 (heap buffer overflow in mb regex functions
- compile_string_node). (Stas)
. Fixed bug #77381 (heap buffer overflow in multibyte match_at). (Stas)
. Fixed bug #77382 (heap buffer overflow due to incorrect length in
expand_case_fold_string). (Stas)
. Fixed bug #77385 (buffer overflow in fetch_token). (Stas)
. Fixed bug #77394 (Buffer overflow in multibyte case folding - unicode).
(Stas)
. Fixed bug #77418 (Heap overflow in utf32be_mbc_to_code). (Stas)
- OCI8:
. Fixed bug #76804 (oci_pconnect with OCI_CRED_EXT not working). (KoenigsKind)
@@ -46,6 +286,9 @@ PHP NEWS
. Handle invalid index passed to PDOStatement::fetchColumn() as error. (Sergei
Morozov)
- Phar:
. Fixed bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext). (Stas)
- Soap:
. Fixed bug #77088 (Segfault when using SoapClient with null options).
(Laruence)
@@ -57,9 +300,17 @@ PHP NEWS
- Sodium:
. Fixed bug #77297 (SodiumException segfaults on PHP 7.3). (Nikita, Scott)
- SPL:
. Fixed bug #77359 (spl_autoload causes segfault). (Lauri Kenttä)
. Fixed bug #77360 (class_uses causes segfault). (Lauri Kenttä)
- SQLite3:
. Fixed bug #77051 (Issue with re-binding on SQLite3). (BohwaZ)
- Xmlrpc:
. Fixed bug #77242 (heap out of bounds read in xmlrpc_decode()). (cmb)
. Fixed bug #77380 (Global out of bounds read in xmlrpc base64 code). (Stas)
06 Dec 2018, PHP 7.3.0
- Core:
@@ -70,6 +321,7 @@ PHP NEWS
. Removed support for BeOS. (Kalle)
. Add PHP_VERSION to phpinfo() <title/>. (github/MattJeevas)
. Add net_get_interfaces(). (Sara, Joe, Anatol)
. Added gc_status(). (Benjamin Eberlei)
. Implemented flexible heredoc and nowdoc syntax, per
RFC https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes.
(Thomas Punt)
@@ -215,6 +467,7 @@ PHP NEWS
(cmb)
- IMAP:
. Fixed bug #77020 (null pointer dereference in imap_mail). (cmb)
. Fixed bug #77153 (imap_open allows to run arbitrary shell commands via
mailbox parameter). (Stas)
+2
View File
@@ -399,6 +399,8 @@ Core:
platform, the function returns false.
. Added net_get_interfaces() to retrieve an array of available network
interfaces including several details.
. Added the gc_status() function to retrieve status information regarding the
cyclic GC.
Date:
. Added the DateTime::createFromImmutable() method, which mirrors
+7
View File
@@ -45,6 +45,13 @@ elseif (PHP_OS == 'FreeBSD') {
if ($freeMemory < 2100*1024*1024) {
die('skip Not enough memory.');
}
} elseif (PHP_OS == "WINNT") {
$s = trim(shell_exec("wmic OS get FreeVirtualMemory /Value 2>nil"));
$freeMemory = explode('=', $s)[1]*1;
if ($freeMemory < 2.1*1024*1024) {
die('skip Not enough memory.');
}
}
?>
--INI--
+15
View File
@@ -0,0 +1,15 @@
--TEST--
Bug #75426: "Cannot use empty array elements" reports wrong position
--FILE--
<?php
$a = [
1,
2,
3,
,
5,
6,
];
?>
--EXPECTF--
Fatal error: Cannot use empty array elements in arrays in %s on line 5
+33
View File
@@ -0,0 +1,33 @@
--TEST--
Bug #77339 (__callStatic may get incorrect arguments)
--FILE--
<?php
class Foo
{
static function __callStatic($name, $arguments) {
if ($name === 'get') {
if (!isset($arguments[0])) {
var_dump(['getSomeWhat']);
var_dump($arguments);
exit;
}
}
echo "OK\n";
}
protected function get ($key) {
echo "BUG!!!\n";
}
}
class Bar
{
static function __callStatic($name, $arguments) {
echo Foo::get('getSomeWhat');
}
}
Bar::someUndefinedStaticFunction();
?>
--EXPECT--
OK
+42
View File
@@ -0,0 +1,42 @@
--TEST--
Bug #77345 (Segmentation faults stack overflow in cyclic garbage collector) (Bug #77427)
--INI--
zend.enable_gc = 1
--FILE--
<?php
class Node
{
/** @var Node */
public $previous;
/** @var Node */
public $next;
}
var_dump(gc_enabled());
var_dump('start');
$firstNode = new Node();
$firstNode->previous = $firstNode;
$firstNode->next = $firstNode;
$circularDoublyLinkedList = $firstNode;
for ($i = 0; $i < 200000; $i++) {
$currentNode = $circularDoublyLinkedList;
$nextNode = $circularDoublyLinkedList->next;
$newNode = new Node();
$newNode->previous = $currentNode;
$currentNode->next = $newNode;
$newNode->next = $nextNode;
$nextNode->previous = $newNode;
$circularDoublyLinkedList = $nextNode;
}
var_dump('end');
--EXPECT--
bool(true)
string(5) "start"
string(3) "end"
+48
View File
@@ -0,0 +1,48 @@
--TEST--
Bug #77345 (Segmentation faults stack overflow in cyclic garbage collector) (Bug #77427)
--INI--
zend.enable_gc = 1
--FILE--
<?php
class Node
{
/** @var Node */
public $previous;
/** @var Node */
public $next;
}
var_dump(gc_enabled());
var_dump('start');
function xxx() {
$firstNode = new Node();
$firstNode->previous = $firstNode;
$firstNode->next = $firstNode;
$circularDoublyLinkedList = $firstNode;
for ($i = 0; $i < 300000; $i++) {
$currentNode = $circularDoublyLinkedList;
$nextNode = $circularDoublyLinkedList->next;
$newNode = new Node();
$newNode->previous = $currentNode;
$currentNode->next = $newNode;
$newNode->next = $nextNode;
$nextNode->previous = $newNode;
$circularDoublyLinkedList = $nextNode;
}
}
xxx();
gc_collect_cycles();
var_dump('end');
--EXPECT--
bool(true)
string(5) "start"
string(3) "end"
+12
View File
@@ -0,0 +1,12 @@
--TEST--
Bug #77376 ("undefined function" message no longer includes namespace)
--FILE--
<?php
namespace Hello;
World();
?>
--EXPECTF--
Fatal error: Uncaught Error: Call to undefined function Hello\World() %sbug77376.php:%d
Stack trace:
#0 {main}
thrown in %sbug77376.php on line %d
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #77494 (Disabling class causes segfault on member access)
--SKIPIF--
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
--INI--
disable_classes=CURLFile
--FILE--
<?php
$a = new CURLFile();
var_dump($a->name);
?>
--EXPECTF--
Warning: CURLFile() has been disabled for security reasons in %sbug77494.php on line 2
Notice: Undefined property: CURLFile::$name in %sbug77494.php on line 3
NULL
+10
View File
@@ -0,0 +1,10 @@
--TEST--
Bug #77530: PHP crashes when parsing '(2)::class'
--FILE--
<?php
echo (2)::class;
?>
--EXPECTF--
Fatal error: Illegal class name in %s on line %d
+40
View File
@@ -0,0 +1,40 @@
--TEST--
BUG #77589 (Core dump using parse_ini_string with numeric sections)
--FILE--
<?php
var_dump(
parse_ini_string(<<<INI
[0]
a = 1
b = on
c = true
["true"]
a = 100
b = null
c = yes
INI
, TRUE, INI_SCANNER_TYPED));
?>
--EXPECT--
array(2) {
[0]=>
array(3) {
["a"]=>
int(1)
["b"]=>
bool(true)
["c"]=>
bool(true)
}
["true"]=>
array(3) {
["a"]=>
int(100)
["b"]=>
NULL
["c"]=>
bool(true)
}
}
+6
View File
@@ -0,0 +1,6 @@
<?php
return [
'I' => function() {
return new class implements I {};
},
];
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #77652: Anonymous classes can lose their interface information
--FILE--
<?php
interface I {}
require __DIR__ . '/bug77652.inc';
$data = require __DIR__ . '/bug77652.inc';
print_r(class_implements($data['I']()));
?>
--EXPECT--
Array
(
[I] => I
)
+10
View File
@@ -0,0 +1,10 @@
--TEST--
Bug #77660 (Segmentation fault on break 2147483648)
--SKIPIF--
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
--FILE--
<?php
for(;;) break 2147483648;
?>
--EXPECTF--
Fatal error: Cannot 'break' 2147483648 levels in %sbug77660.php on line %d
+8
View File
@@ -0,0 +1,8 @@
--TEST--
Bug #77738 (Nullptr deref in zend_compile_expr)
--FILE--
<?php
__COMPILER_HALT_OFFSET__;
; // <- important
--EXPECTF--
Warning: Use of undefined constant __COMPILER_HALT_OFFSET__ - assumed '__COMPILER_HALT_OFFSET__' %sbug77738.php on line %d
@@ -0,0 +1,30 @@
--TEST--
Calling exception getters when properties hold references
--FILE--
<?php
class MyException extends Exception {
public function __construct(&$refMsg, &$refCode, &$refFile, &$refLine) {
$this->message =& $refMsg;
$this->code =& $refCode;
$this->file =& $refFile;
$this->line =& $refLine;
}
}
$refMsg = "foo";
$refCode = 0;
$refFile = "foobar";
$refLine = 42;
$ex = new MyException($refMsg, $refCode, $refFile, $refLine);
var_dump($ex->getMessage());
var_dump($ex->getCode());
var_dump($ex->getFile());
var_dump($ex->getLine());
?>
--EXPECT--
string(3) "foo"
int(0)
string(6) "foobar"
int(42)
+18
View File
@@ -0,0 +1,18 @@
--TEST--
Inherit internal static property into userland class
--SKIPIF--
<?php if (!extension_loaded('zend-test')) die('skip requires zend-test'); ?>
--FILE--
<?php
class Test extends _ZendTestClass {
}
var_dump(Test::$_StaticProp);
_ZendTestClass::$_StaticProp = 42;
var_dump(Test::$_StaticProp);
?>
--EXPECT--
NULL
int(42)
+14
View File
@@ -0,0 +1,14 @@
--TEST--
Bug object gc not working in shutdown
--FILE--
<?php
ini_set('memory_limit', '2M');
register_shutdown_function(function () {
for ($n = 1000 * 1000; $n--;) {
new stdClass;
}
echo "OK\n";
});
?>
--EXPECT--
OK
@@ -0,0 +1,23 @@
--TEST--
Use of self::class inside a constant in an unknown scope
--FILE--
<?php
class Test {
public function foobar() {
eval("
const FOO = self::class;
var_dump(FOO);
");
}
}
(new Test)->foobar();
// This should error, but doesn't
const BAR = self::class;
var_dump(BAR);
?>
--EXPECT--
string(4) "Test"
string(0) ""
+16 -16
View File
@@ -373,17 +373,17 @@ ZEND_API void zend_print_flat_zval_r(zval *expr) /* {{{ */
switch (Z_TYPE_P(expr)) {
case IS_ARRAY:
ZEND_PUTS("Array (");
if (Z_REFCOUNTED_P(expr)) {
if (Z_IS_RECURSIVE_P(expr)) {
if (!(GC_FLAGS(Z_ARRVAL_P(expr)) & GC_IMMUTABLE)) {
if (GC_IS_RECURSIVE(Z_ARRVAL_P(expr))) {
ZEND_PUTS(" *RECURSION*");
return;
}
Z_PROTECT_RECURSION_P(expr);
GC_PROTECT_RECURSION(Z_ARRVAL_P(expr));
}
print_flat_hash(Z_ARRVAL_P(expr));
ZEND_PUTS(")");
if (Z_REFCOUNTED_P(expr)) {
Z_UNPROTECT_RECURSION_P(expr);
if (!(GC_FLAGS(Z_ARRVAL_P(expr)) & GC_IMMUTABLE)) {
GC_UNPROTECT_RECURSION(Z_ARRVAL_P(expr));
}
break;
case IS_OBJECT:
@@ -393,7 +393,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr) /* {{{ */
zend_printf("%s Object (", ZSTR_VAL(class_name));
zend_string_release_ex(class_name, 0);
if (Z_IS_RECURSIVE_P(expr)) {
if (GC_IS_RECURSIVE(Z_OBJ_P(expr))) {
ZEND_PUTS(" *RECURSION*");
return;
}
@@ -402,9 +402,9 @@ ZEND_API void zend_print_flat_zval_r(zval *expr) /* {{{ */
properties = Z_OBJPROP_P(expr);
}
if (properties) {
Z_PROTECT_RECURSION_P(expr);
GC_PROTECT_RECURSION(Z_OBJ_P(expr));
print_flat_hash(properties);
Z_UNPROTECT_RECURSION_P(expr);
GC_UNPROTECT_RECURSION(Z_OBJ_P(expr));
}
ZEND_PUTS(")");
break;
@@ -424,16 +424,16 @@ static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /*
switch (Z_TYPE_P(expr)) {
case IS_ARRAY:
smart_str_appends(buf, "Array\n");
if (Z_REFCOUNTED_P(expr)) {
if (Z_IS_RECURSIVE_P(expr)) {
if (!(GC_FLAGS(Z_ARRVAL_P(expr)) & GC_IMMUTABLE)) {
if (GC_IS_RECURSIVE(Z_ARRVAL_P(expr))) {
smart_str_appends(buf, " *RECURSION*");
return;
}
Z_PROTECT_RECURSION_P(expr);
GC_PROTECT_RECURSION(Z_ARRVAL_P(expr));
}
print_hash(buf, Z_ARRVAL_P(expr), indent, 0);
if (Z_REFCOUNTED_P(expr)) {
Z_UNPROTECT_RECURSION_P(expr);
if (!(GC_FLAGS(Z_ARRVAL_P(expr)) & GC_IMMUTABLE)) {
GC_UNPROTECT_RECURSION(Z_ARRVAL_P(expr));
}
break;
case IS_OBJECT:
@@ -446,7 +446,7 @@ static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /*
zend_string_release_ex(class_name, 0);
smart_str_appends(buf, " Object\n");
if (Z_IS_RECURSIVE_P(expr)) {
if (GC_IS_RECURSIVE(Z_OBJ_P(expr))) {
smart_str_appends(buf, " *RECURSION*");
return;
}
@@ -454,9 +454,9 @@ static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /*
break;
}
Z_PROTECT_RECURSION_P(expr);
GC_PROTECT_RECURSION(Z_OBJ_P(expr));
print_hash(buf, properties, indent, 1);
Z_UNPROTECT_RECURSION_P(expr);
GC_UNPROTECT_RECURSION(Z_OBJ_P(expr));
if (is_temp) {
zend_hash_destroy(properties);
+1 -1
View File
@@ -20,7 +20,7 @@
#ifndef ZEND_H
#define ZEND_H
#define ZEND_VERSION "3.3.1-dev"
#define ZEND_VERSION "3.3.4"
#define ZEND_ENGINE_3
+11
View File
@@ -2861,6 +2861,17 @@ static zend_object *display_disabled_class(zend_class_entry *class_type) /* {{{
zend_object *intern;
intern = zend_objects_new(class_type);
/* Initialize default properties */
if (EXPECTED(class_type->default_properties_count != 0)) {
zval *p = intern->properties_table;
zval *end = p + class_type->default_properties_count;
do {
ZVAL_UNDEF(p);
p++;
} while (p != end);
}
zend_error(E_WARNING, "%s() has been disabled for security reasons", ZSTR_VAL(class_type->name));
return intern;
}
+7 -8
View File
@@ -191,9 +191,7 @@ typedef struct _zend_mm_free_slot zend_mm_free_slot;
typedef struct _zend_mm_chunk zend_mm_chunk;
typedef struct _zend_mm_huge_list zend_mm_huge_list;
#ifdef MAP_HUGETLB
int zend_mm_use_huge_pages = 0;
#endif
/*
* Memory is retrived from OS by chunks of fixed size 2MB.
@@ -714,7 +712,9 @@ static void *zend_mm_chunk_alloc_int(size_t size, size_t alignment)
return NULL;
} else if (ZEND_MM_ALIGNED_OFFSET(ptr, alignment) == 0) {
#ifdef MADV_HUGEPAGE
madvise(ptr, size, MADV_HUGEPAGE);
if (zend_mm_use_huge_pages) {
madvise(ptr, size, MADV_HUGEPAGE);
}
#endif
return ptr;
} else {
@@ -745,7 +745,9 @@ static void *zend_mm_chunk_alloc_int(size_t size, size_t alignment)
zend_mm_munmap((char*)ptr + size, alignment - REAL_PAGE_SIZE);
}
# ifdef MADV_HUGEPAGE
madvise(ptr, size, MADV_HUGEPAGE);
if (zend_mm_use_huge_pages) {
madvise(ptr, size, MADV_HUGEPAGE);
}
# endif
#endif
return ptr;
@@ -2668,9 +2670,7 @@ ZEND_API void shutdown_memory_manager(int silent, int full_shutdown)
static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
{
#if ZEND_MM_CUSTOM || MAP_HUGETLB
char *tmp;
#endif
#if ZEND_MM_CUSTOM
tmp = getenv("USE_ZEND_ALLOC");
@@ -2684,12 +2684,11 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
return;
}
#endif
#ifdef MAP_HUGETLB
tmp = getenv("USE_ZEND_ALLOC_HUGE_PAGES");
if (tmp && zend_atoi(tmp, 0)) {
zend_mm_use_huge_pages = 1;
}
#endif
ZEND_TSRMLS_CACHE_UPDATE();
alloc_globals->mm_heap = zend_mm_init();
}
+69 -21
View File
@@ -1480,6 +1480,7 @@ static void zend_ensure_valid_class_fetch_type(uint32_t fetch_type) /* {{{ */
static zend_bool zend_try_compile_const_expr_resolve_class_name(zval *zv, zend_ast *class_ast, zend_ast *name_ast, zend_bool constant) /* {{{ */
{
uint32_t fetch_type;
zval *class_name;
if (name_ast->kind != ZEND_AST_ZVAL) {
return 0;
@@ -1494,12 +1495,18 @@ static zend_bool zend_try_compile_const_expr_resolve_class_name(zval *zv, zend_a
"Dynamic class names are not allowed in compile-time ::class fetch");
}
fetch_type = zend_get_class_fetch_type(zend_ast_get_str(class_ast));
class_name = zend_ast_get_zval(class_ast);
if (Z_TYPE_P(class_name) != IS_STRING) {
zend_error_noreturn(E_COMPILE_ERROR, "Illegal class name");
}
fetch_type = zend_get_class_fetch_type(Z_STR_P(class_name));
zend_ensure_valid_class_fetch_type(fetch_type);
switch (fetch_type) {
case ZEND_FETCH_CLASS_SELF:
if (constant || (CG(active_class_entry) && zend_is_scope_known())) {
if (CG(active_class_entry) && zend_is_scope_known()) {
ZVAL_STR_COPY(zv, CG(active_class_entry)->name);
} else {
ZVAL_NULL(zv);
@@ -3651,7 +3658,7 @@ int zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcnam
}
/* }}} */
static int zend_compile_assert(znode *result, zend_ast_list *args, zend_string *name, zend_function *fbc) /* {{{ */
static void zend_compile_assert(znode *result, zend_ast_list *args, zend_string *name, zend_function *fbc) /* {{{ */
{
if (EG(assertions) >= 0) {
znode name_node;
@@ -3694,8 +3701,6 @@ static int zend_compile_assert(znode *result, zend_ast_list *args, zend_string *
result->op_type = IS_CONST;
ZVAL_TRUE(&result->u.constant);
}
return SUCCESS;
}
/* }}} */
@@ -3902,10 +3907,6 @@ int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_l
return FAILURE;
}
if (zend_string_equals_literal(lcname, "assert")) {
return zend_compile_assert(result, args, lcname, fbc);
}
if (CG(compiler_options) & ZEND_COMPILE_NO_BUILTINS) {
return FAILURE;
}
@@ -4008,8 +4009,16 @@ void zend_compile_call(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
zend_op *opline;
lcname = zend_string_tolower(Z_STR_P(name));
fbc = zend_hash_find_ptr(CG(function_table), lcname);
/* Special assert() handling should apply independently of compiler flags. */
if (fbc && zend_string_equals_literal(lcname, "assert")) {
zend_compile_assert(result, zend_ast_get_list(args_ast), lcname, fbc);
zend_string_release(lcname);
zval_ptr_dtor(&name_node.u.constant);
return;
}
if (!fbc
|| (fbc->type == ZEND_INTERNAL_FUNCTION && (CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS))
|| (fbc->type == ZEND_USER_FUNCTION && (CG(compiler_options) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS))
@@ -4153,6 +4162,14 @@ void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type) /* {{
if (ce) {
zend_string *lcname = Z_STR_P(CT_CONSTANT(opline->op2) + 1);
fbc = zend_hash_find_ptr(&ce->function_table, lcname);
if (fbc && !(fbc->common.fn_flags & ZEND_ACC_PUBLIC)) {
if (ce != CG(active_class_entry)
&&((fbc->common.fn_flags & ZEND_ACC_PRIVATE)
|| !zend_check_protected(zend_get_function_root_class(fbc), CG(active_class_entry)))) {
/* incompatibe function */
fbc = NULL;
}
}
}
}
@@ -4511,7 +4528,7 @@ void zend_compile_break_continue(zend_ast *ast) /* {{{ */
zend_ast *depth_ast = ast->child[0];
zend_op *opline;
int depth;
zend_long depth;
ZEND_ASSERT(ast->kind == ZEND_AST_BREAK || ast->kind == ZEND_AST_CONTINUE);
@@ -4538,7 +4555,7 @@ void zend_compile_break_continue(zend_ast *ast) /* {{{ */
ast->kind == ZEND_AST_BREAK ? "break" : "continue");
} else {
if (!zend_handle_loops_and_finally_ex(depth, NULL)) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot '%s' %d level%s",
zend_error_noreturn(E_COMPILE_ERROR, "Cannot '%s' " ZEND_LONG_FMT " level%s",
ast->kind == ZEND_AST_BREAK ? "break" : "continue",
depth, depth == 1 ? "" : "s");
}
@@ -4555,12 +4572,12 @@ void zend_compile_break_continue(zend_ast *ast) /* {{{ */
if (depth == 1) {
zend_error(E_WARNING,
"\"continue\" targeting switch is equivalent to \"break\". " \
"Did you mean to use \"continue %d\"?",
"Did you mean to use \"continue " ZEND_LONG_FMT "\"?",
depth + 1);
} else {
zend_error(E_WARNING,
"\"continue %d\" targeting switch is equivalent to \"break %d\". " \
"Did you mean to use \"continue %d\"?",
"\"continue " ZEND_LONG_FMT "\" targeting switch is equivalent to \"break " ZEND_LONG_FMT "\". " \
"Did you mean to use \"continue " ZEND_LONG_FMT "\"?",
depth, depth, depth + 1);
}
}
@@ -4948,6 +4965,10 @@ static zend_uchar determine_switch_jumptable_type(zend_ast_list *cases) {
}
static zend_bool should_use_jumptable(zend_ast_list *cases, zend_uchar jumptable_type) {
if (CG(compiler_options) & ZEND_COMPILE_NO_JUMPTABLES) {
return 0;
}
/* Thresholds are chosen based on when the average switch time for equidistributed
* input becomes smaller when using the jumptable optimization. */
if (jumptable_type == IS_LONG) {
@@ -6419,10 +6440,32 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */
if (!zend_hash_exists(CG(class_table), lcname)) {
zend_hash_add_ptr(CG(class_table), lcname, ce);
} else {
/* this anonymous class has been included */
/* This anonymous class has been included, reuse the existing definition.
* NB: This behavior is buggy, and this should always result in a separate
* class declaration. However, until the problem of RTD key collisions is
* solved, this gives a behavior close to what is expected. */
zval zv;
ZVAL_PTR(&zv, ce);
destroy_zend_class(&zv);
ce = zend_hash_find_ptr(CG(class_table), lcname);
/* Manually replicate emission of necessary inheritance opcodes here. We cannot
* reuse the general code, as we only want to emit the opcodes, without modifying
* the reused class definition. */
if (ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS) {
zend_emit_op(NULL, ZEND_BIND_TRAITS, &declare_node, NULL);
}
if (implements_ast) {
zend_ast_list *iface_list = zend_ast_get_list(implements_ast);
uint32_t i;
for (i = 0; i < iface_list->children; i++) {
opline = zend_emit_op(NULL, ZEND_ADD_INTERFACE, &declare_node, NULL);
opline->op2_type = IS_CONST;
opline->op2.constant = zend_add_class_name_literal(CG(active_op_array),
zend_resolve_class_name_ast(iface_list->child[i]));
}
zend_emit_op(NULL, ZEND_VERIFY_ABSTRACT_CLASS, &declare_node, NULL);
}
return;
}
} else {
@@ -6987,6 +7030,7 @@ static inline void zend_ct_eval_greater(zval *result, zend_ast_kind kind, zval *
static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */
{
zend_ast_list *list = zend_ast_get_list(ast);
zend_ast *last_elem_ast = NULL;
uint32_t i;
zend_bool is_constant = 1;
@@ -6999,6 +7043,10 @@ static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */
zend_ast *elem_ast = list->child[i];
if (elem_ast == NULL) {
/* Report error at line of last non-empty element */
if (last_elem_ast) {
CG(zend_lineno) = zend_ast_get_lineno(last_elem_ast);
}
zend_error(E_COMPILE_ERROR, "Cannot use empty array elements in arrays");
}
@@ -7010,6 +7058,8 @@ static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */
) {
is_constant = 0;
}
last_elem_ast = elem_ast;
}
if (!is_constant) {
@@ -7711,11 +7761,11 @@ void zend_compile_const(znode *result, zend_ast *ast) /* {{{ */
if (zend_string_equals_literal(resolved_name, "__COMPILER_HALT_OFFSET__") || (name_ast->attr != ZEND_NAME_RELATIVE && zend_string_equals_literal(orig_name, "__COMPILER_HALT_OFFSET__"))) {
zend_ast *last = CG(ast);
while (last->kind == ZEND_AST_STMT_LIST) {
while (last && last->kind == ZEND_AST_STMT_LIST) {
zend_ast_list *list = zend_ast_get_list(last);
last = list->child[list->children-1];
}
if (last->kind == ZEND_AST_HALT_COMPILER) {
if (last && last->kind == ZEND_AST_HALT_COMPILER) {
result->op_type = IS_CONST;
ZVAL_LONG(&result->u.constant, Z_LVAL_P(zend_ast_get_zval(last->child[0])));
zend_string_release_ex(resolved_name, 0);
@@ -8071,9 +8121,7 @@ void zend_compile_const_expr_magic_const(zend_ast **ast_ptr) /* {{{ */
zend_ast *ast = *ast_ptr;
/* Other cases already resolved by constant folding */
ZEND_ASSERT(ast->attr == T_CLASS_C &&
CG(active_class_entry) &&
(CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) != 0);
ZEND_ASSERT(ast->attr == T_CLASS_C);
zend_ast_destroy(ast);
*ast_ptr = zend_ast_create(ZEND_AST_CONSTANT_CLASS);
+3
View File
@@ -1048,6 +1048,9 @@ END_EXTERN_C()
/* result of compilation may be stored in file cache */
#define ZEND_COMPILE_WITH_FILE_CACHE (1<<11)
/* disable jumptable optimization for switch statements */
#define ZEND_COMPILE_NO_JUMPTABLES (1<<12)
/* The default value for CG(compiler_options) */
#define ZEND_COMPILE_DEFAULT ZEND_COMPILE_HANDLE_OP_ARRAY
+3 -1
View File
@@ -378,7 +378,9 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
ret_constant = NULL;
} else {
if (!zend_verify_const_access(c, scope)) {
zend_throw_error(NULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(class_name), ZSTR_VAL(constant_name));
if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) {
zend_throw_error(NULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(class_name), ZSTR_VAL(constant_name));
}
goto failure;
}
ret_constant = &c->value;
+11 -3
View File
@@ -77,16 +77,24 @@ void zend_cpu_startup(void)
{
if (!cpuinfo.initialized) {
zend_cpu_info ebx;
int max_feature;
cpuinfo.initialized = 1;
__zend_cpuid(0, 0, &cpuinfo);
if (cpuinfo.eax == 0) {
max_feature = cpuinfo.eax;
if (max_feature == 0) {
return;
}
__zend_cpuid(1, 0, &cpuinfo);
/* for avx2 */
__zend_cpuid(7, 0, &ebx);
cpuinfo.ebx = ebx.ebx;
if (max_feature >= 7) {
__zend_cpuid(7, 0, &ebx);
cpuinfo.ebx = ebx.ebx;
} else {
cpuinfo.ebx = 0;
}
}
}
+16
View File
@@ -100,12 +100,22 @@ typedef enum _zend_cpu_feature {
void zend_cpu_startup();
ZEND_API int zend_cpu_supports(zend_cpu_feature feature);
/* Address sanitizer is incompatible with ifunc resolvers, so exclude the
* CPU support helpers from asan.
* See also https://github.com/google/sanitizers/issues/342. */
#if __has_attribute(no_sanitize_address)
# define ZEND_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
#else
# define ZEND_NO_SANITIZE_ADDRESS
#endif
#if PHP_HAVE_BUILTIN_CPU_SUPPORTS
/* NOTE: you should use following inline function in
* resolver functions (ifunc), as it could be called
* before all PLT symbols are resloved. in other words,
* resolver functions should not depends any external
* functions */
ZEND_NO_SANITIZE_ADDRESS
static zend_always_inline int zend_cpu_supports_sse2() {
#if PHP_HAVE_BUILTIN_CPU_INIT
__builtin_cpu_init();
@@ -113,6 +123,7 @@ static zend_always_inline int zend_cpu_supports_sse2() {
return __builtin_cpu_supports("sse2");
}
ZEND_NO_SANITIZE_ADDRESS
static zend_always_inline int zend_cpu_supports_sse3() {
#if PHP_HAVE_BUILTIN_CPU_INIT
__builtin_cpu_init();
@@ -120,6 +131,7 @@ static zend_always_inline int zend_cpu_supports_sse3() {
return __builtin_cpu_supports("sse3");
}
ZEND_NO_SANITIZE_ADDRESS
static zend_always_inline int zend_cpu_supports_ssse3() {
#if PHP_HAVE_BUILTIN_CPU_INIT
__builtin_cpu_init();
@@ -127,6 +139,7 @@ static zend_always_inline int zend_cpu_supports_ssse3() {
return __builtin_cpu_supports("ssse3");
}
ZEND_NO_SANITIZE_ADDRESS
static zend_always_inline int zend_cpu_supports_sse41() {
#if PHP_HAVE_BUILTIN_CPU_INIT
__builtin_cpu_init();
@@ -134,6 +147,7 @@ static zend_always_inline int zend_cpu_supports_sse41() {
return __builtin_cpu_supports("sse4.1");
}
ZEND_NO_SANITIZE_ADDRESS
static zend_always_inline int zend_cpu_supports_sse42() {
#if PHP_HAVE_BUILTIN_CPU_INIT
__builtin_cpu_init();
@@ -141,6 +155,7 @@ static zend_always_inline int zend_cpu_supports_sse42() {
return __builtin_cpu_supports("sse4.2");
}
ZEND_NO_SANITIZE_ADDRESS
static zend_always_inline int zend_cpu_supports_avx() {
#if PHP_HAVE_BUILTIN_CPU_INIT
__builtin_cpu_init();
@@ -148,6 +163,7 @@ static zend_always_inline int zend_cpu_supports_avx() {
return __builtin_cpu_supports("avx");
}
ZEND_NO_SANITIZE_ADDRESS
static zend_always_inline int zend_cpu_supports_avx2() {
#if PHP_HAVE_BUILTIN_CPU_INIT
__builtin_cpu_init();
+24 -12
View File
@@ -400,11 +400,13 @@ ZEND_METHOD(error_exception, __construct)
Get the file in which the exception occurred */
ZEND_METHOD(exception, getFile)
{
zval rv;
zval *prop, rv;
DEFAULT_0_PARAMS;
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_FILE));
prop = GET_PROPERTY(getThis(), ZEND_STR_FILE);
ZVAL_DEREF(prop);
ZVAL_COPY(return_value, prop);
}
/* }}} */
@@ -412,11 +414,13 @@ ZEND_METHOD(exception, getFile)
Get the line in which the exception occurred */
ZEND_METHOD(exception, getLine)
{
zval rv;
zval *prop, rv;
DEFAULT_0_PARAMS;
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_LINE));
prop = GET_PROPERTY(getThis(), ZEND_STR_LINE);
ZVAL_DEREF(prop);
ZVAL_COPY(return_value, prop);
}
/* }}} */
@@ -424,11 +428,13 @@ ZEND_METHOD(exception, getLine)
Get the exception message */
ZEND_METHOD(exception, getMessage)
{
zval rv;
zval *prop, rv;
DEFAULT_0_PARAMS;
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_MESSAGE));
prop = GET_PROPERTY(getThis(), ZEND_STR_MESSAGE);
ZVAL_DEREF(prop);
ZVAL_COPY(return_value, prop);
}
/* }}} */
@@ -436,11 +442,13 @@ ZEND_METHOD(exception, getMessage)
Get the exception code */
ZEND_METHOD(exception, getCode)
{
zval rv;
zval *prop, rv;
DEFAULT_0_PARAMS;
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_CODE));
prop = GET_PROPERTY(getThis(), ZEND_STR_CODE);
ZVAL_DEREF(prop);
ZVAL_COPY(return_value, prop);
}
/* }}} */
@@ -448,11 +456,13 @@ ZEND_METHOD(exception, getCode)
Get the stack trace for the location in which the exception occurred */
ZEND_METHOD(exception, getTrace)
{
zval rv;
zval *prop, rv;
DEFAULT_0_PARAMS;
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_TRACE));
prop = GET_PROPERTY(getThis(), ZEND_STR_TRACE);
ZVAL_DEREF(prop);
ZVAL_COPY(return_value, prop);
}
/* }}} */
@@ -460,11 +470,13 @@ ZEND_METHOD(exception, getTrace)
Get the exception severity */
ZEND_METHOD(error_exception, getSeverity)
{
zval rv;
zval *prop, rv;
DEFAULT_0_PARAMS;
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_SEVERITY));
prop = GET_PROPERTY(getThis(), ZEND_STR_SEVERITY);
ZVAL_DEREF(prop);
ZVAL_COPY(return_value, prop);
}
/* }}} */
+13 -3
View File
@@ -170,9 +170,9 @@ ZEND_API const zend_internal_function zend_pass_function = {
#define ZEND_VM_STACK_PAGE_SIZE (ZEND_VM_STACK_PAGE_SLOTS * sizeof(zval))
#define ZEND_VM_STACK_PAGE_ALIGNED_SIZE(size) \
#define ZEND_VM_STACK_PAGE_ALIGNED_SIZE(size, page_size) \
(((size) + ZEND_VM_STACK_HEADER_SLOTS * sizeof(zval) \
+ (ZEND_VM_STACK_PAGE_SIZE - 1)) & ~(ZEND_VM_STACK_PAGE_SIZE - 1))
+ ((page_size) - 1)) & ~((page_size) - 1))
static zend_always_inline zend_vm_stack zend_vm_stack_new_page(size_t size, zend_vm_stack prev) {
zend_vm_stack page = (zend_vm_stack)emalloc(size);
@@ -192,6 +192,16 @@ ZEND_API void zend_vm_stack_init(void)
EG(vm_stack_end) = EG(vm_stack)->end;
}
ZEND_API void zend_vm_stack_init_ex(size_t page_size)
{
/* page_size must be a power of 2 */
ZEND_ASSERT(page_size > 0 && (page_size & (page_size - 1)) == 0);
EG(vm_stack_page_size) = page_size;
EG(vm_stack) = zend_vm_stack_new_page(page_size, NULL);
EG(vm_stack_top) = EG(vm_stack)->top;
EG(vm_stack_end) = EG(vm_stack)->end;
}
ZEND_API void zend_vm_stack_destroy(void)
{
zend_vm_stack stack = EG(vm_stack);
@@ -212,7 +222,7 @@ ZEND_API void* zend_vm_stack_extend(size_t size)
stack->top = EG(vm_stack_top);
EG(vm_stack) = stack = zend_vm_stack_new_page(
EXPECTED(size < EG(vm_stack_page_size) - (ZEND_VM_STACK_HEADER_SLOTS * sizeof(zval))) ?
EG(vm_stack_page_size) : ZEND_VM_STACK_PAGE_ALIGNED_SIZE(size),
EG(vm_stack_page_size) : ZEND_VM_STACK_PAGE_ALIGNED_SIZE(size, EG(vm_stack_page_size)),
stack);
ptr = stack->top;
EG(vm_stack_top) = (void*)(((char*)ptr) + size);
+1
View File
@@ -168,6 +168,7 @@ struct _zend_vm_stack {
#endif
ZEND_API void zend_vm_stack_init(void);
ZEND_API void zend_vm_stack_init_ex(size_t page_size);
ZEND_API void zend_vm_stack_destroy(void);
ZEND_API void* zend_vm_stack_extend(size_t size);
+241 -89
View File
@@ -48,7 +48,7 @@
* gc_scan_roots will be called, and each root will be called with
* gc_scan(root->ref)
*
* gc_scan checkes the colors of possible members.
* gc_scan checks the colors of possible members.
*
* If the node is marked as grey and the refcount > 0
* gc_scan_black will be called on that node to scan it's subgraph.
@@ -245,6 +245,73 @@ static zend_gc_globals gc_globals;
# define GC_TRACE(str)
#endif
#define GC_STACK_SEGMENT_SIZE (((4096 - ZEND_MM_OVERHEAD) / sizeof(void*)) - 2)
typedef struct _gc_stack gc_stack;
struct _gc_stack {
gc_stack *prev;
gc_stack *next;
zend_refcounted *data[GC_STACK_SEGMENT_SIZE];
};
#define GC_STACK_DCL(init) \
gc_stack *_stack = init; \
size_t _top = 0;
#define GC_STACK_PUSH(ref) \
gc_stack_push(&_stack, &_top, ref);
#define GC_STACK_POP() \
gc_stack_pop(&_stack, &_top)
static zend_never_inline gc_stack* gc_stack_next(gc_stack *stack)
{
if (UNEXPECTED(!stack->next)) {
gc_stack *segment = emalloc(sizeof(gc_stack));
segment->prev = stack;
segment->next = NULL;
stack->next = segment;
}
return stack->next;
}
static zend_always_inline void gc_stack_push(gc_stack **stack, size_t *top, zend_refcounted *ref)
{
if (UNEXPECTED(*top == GC_STACK_SEGMENT_SIZE)) {
(*stack) = gc_stack_next(*stack);
(*top) = 0;
}
(*stack)->data[(*top)++] = ref;
}
static zend_always_inline zend_refcounted* gc_stack_pop(gc_stack **stack, size_t *top)
{
if (UNEXPECTED((*top) == 0)) {
if (!(*stack)->prev) {
return NULL;
} else {
(*stack) = (*stack)->prev;
(*top) = GC_STACK_SEGMENT_SIZE - 1;
return (*stack)->data[GC_STACK_SEGMENT_SIZE - 1];
}
} else {
return (*stack)->data[--(*top)];
}
}
static void gc_stack_free(gc_stack *stack)
{
gc_stack *p = stack->next;
while (p) {
stack = p->next;
efree(p);
p = stack;
}
}
static zend_always_inline uint32_t gc_compress(uint32_t idx)
{
return idx % GC_MAX_UNCOMPRESSED;
@@ -606,16 +673,14 @@ ZEND_API void ZEND_FASTCALL gc_remove_from_buffer(zend_refcounted *ref)
gc_remove_from_roots(root);
}
static void gc_scan_black(zend_refcounted *ref)
static void gc_scan_black(zend_refcounted *ref, gc_stack *stack)
{
HashTable *ht;
HashTable *ht = NULL;
Bucket *p, *end;
zval *zv;
GC_STACK_DCL(stack);
tail_call:
ht = NULL;
GC_REF_SET_BLACK(ref);
if (GC_TYPE(ref) == IS_OBJECT) {
zend_object_get_gc_t get_gc;
zend_object *obj = (zend_object*)ref;
@@ -630,9 +695,9 @@ tail_call:
ht = get_gc(&tmp, &zv, &n);
end = zv + n;
if (EXPECTED(!ht)) {
if (!n) return;
if (!n) goto next;
while (!Z_REFCOUNTED_P(--end)) {
if (zv == end) return;
if (zv == end) goto next;
}
}
while (zv != end) {
@@ -640,7 +705,8 @@ tail_call:
ref = Z_COUNTED_P(zv);
GC_ADDREF(ref);
if (!GC_REF_CHECK_COLOR(ref, GC_BLACK)) {
gc_scan_black(ref);
GC_REF_SET_BLACK(ref);
GC_STACK_PUSH(ref);
}
}
zv++;
@@ -649,33 +715,35 @@ tail_call:
ref = Z_COUNTED_P(zv);
GC_ADDREF(ref);
if (!GC_REF_CHECK_COLOR(ref, GC_BLACK)) {
GC_REF_SET_BLACK(ref);
goto tail_call;
}
return;
goto next;
}
} else {
return;
goto next;
}
} else if (GC_TYPE(ref) == IS_ARRAY) {
if ((zend_array*)ref != &EG(symbol_table)) {
ht = (zend_array*)ref;
} else {
return;
goto next;
}
} else if (GC_TYPE(ref) == IS_REFERENCE) {
if (Z_REFCOUNTED(((zend_reference*)ref)->val)) {
ref = Z_COUNTED(((zend_reference*)ref)->val);
GC_ADDREF(ref);
if (!GC_REF_CHECK_COLOR(ref, GC_BLACK)) {
GC_REF_SET_BLACK(ref);
goto tail_call;
}
}
return;
goto next;
} else {
return;
goto next;
}
if (!ht->nNumUsed) return;
if (!ht->nNumUsed) goto next;
p = ht->arData;
end = p + ht->nNumUsed;
while (1) {
@@ -687,7 +755,7 @@ tail_call:
if (Z_REFCOUNTED_P(zv)) {
break;
}
if (p == end) return;
if (p == end) goto next;
}
while (p != end) {
zv = &p->val;
@@ -698,7 +766,8 @@ tail_call:
ref = Z_COUNTED_P(zv);
GC_ADDREF(ref);
if (!GC_REF_CHECK_COLOR(ref, GC_BLACK)) {
gc_scan_black(ref);
GC_REF_SET_BLACK(ref);
GC_STACK_PUSH(ref);
}
}
p++;
@@ -710,28 +779,33 @@ tail_call:
ref = Z_COUNTED_P(zv);
GC_ADDREF(ref);
if (!GC_REF_CHECK_COLOR(ref, GC_BLACK)) {
GC_REF_SET_BLACK(ref);
goto tail_call;
}
next:
ref = GC_STACK_POP();
if (ref) {
goto tail_call;
}
}
static void gc_mark_grey(zend_refcounted *ref)
static void gc_mark_grey(zend_refcounted *ref, gc_stack *stack)
{
HashTable *ht;
HashTable *ht = NULL;
Bucket *p, *end;
zval *zv;
GC_STACK_DCL(stack);
tail_call:
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
ht = NULL;
do {
GC_BENCH_INC(zval_marked_grey);
GC_REF_SET_COLOR(ref, GC_GREY);
if (GC_TYPE(ref) == IS_OBJECT) {
zend_object_get_gc_t get_gc;
zend_object *obj = (zend_object*)ref;
if (EXPECTED(!(OBJ_FLAGS(ref) & IS_OBJ_FREE_CALLED) &&
(get_gc = obj->handlers->get_gc) != NULL)) {
(get_gc = obj->handlers->get_gc) != NULL)) {
int n;
zval *zv, *end;
zval tmp;
@@ -740,31 +814,38 @@ tail_call:
ht = get_gc(&tmp, &zv, &n);
end = zv + n;
if (EXPECTED(!ht)) {
if (!n) return;
if (!n) goto next;
while (!Z_REFCOUNTED_P(--end)) {
if (zv == end) return;
if (zv == end) goto next;
}
}
while (zv != end) {
if (Z_REFCOUNTED_P(zv)) {
ref = Z_COUNTED_P(zv);
GC_DELREF(ref);
gc_mark_grey(ref);
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_GREY);
GC_STACK_PUSH(ref);
}
}
zv++;
}
if (EXPECTED(!ht)) {
ref = Z_COUNTED_P(zv);
GC_DELREF(ref);
goto tail_call;
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_GREY);
continue;
}
goto next;
}
} else {
return;
goto next;
}
} else if (GC_TYPE(ref) == IS_ARRAY) {
if (((zend_array*)ref) == &EG(symbol_table)) {
GC_REF_SET_BLACK(ref);
return;
goto next;
} else {
ht = (zend_array*)ref;
}
@@ -772,14 +853,17 @@ tail_call:
if (Z_REFCOUNTED(((zend_reference*)ref)->val)) {
ref = Z_COUNTED(((zend_reference*)ref)->val);
GC_DELREF(ref);
goto tail_call;
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_GREY);
continue;
}
}
return;
goto next;
} else {
return;
goto next;
}
if (!ht->nNumUsed) return;
if (!ht->nNumUsed) goto next;
p = ht->arData;
end = p + ht->nNumUsed;
while (1) {
@@ -791,7 +875,7 @@ tail_call:
if (Z_REFCOUNTED_P(zv)) {
break;
}
if (p == end) return;
if (p == end) goto next;
}
while (p != end) {
zv = &p->val;
@@ -801,7 +885,10 @@ tail_call:
if (Z_REFCOUNTED_P(zv)) {
ref = Z_COUNTED_P(zv);
GC_DELREF(ref);
gc_mark_grey(ref);
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_GREY);
GC_STACK_PUSH(ref);
}
}
p++;
}
@@ -811,8 +898,14 @@ tail_call:
}
ref = Z_COUNTED_P(zv);
GC_DELREF(ref);
goto tail_call;
}
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_GREY);
continue;
}
next:
ref = GC_STACK_POP();
} while (ref);
}
/* Two-Finger compaction algorithm */
@@ -852,7 +945,7 @@ static void gc_compact(void)
}
}
static void gc_mark_roots(void)
static void gc_mark_roots(gc_stack *stack)
{
gc_root_buffer *current, *last;
@@ -863,31 +956,41 @@ static void gc_mark_roots(void)
while (current != last) {
if (GC_IS_ROOT(current->ref)) {
if (GC_REF_CHECK_COLOR(current->ref, GC_PURPLE)) {
gc_mark_grey(current->ref);
GC_REF_SET_COLOR(current->ref, GC_GREY);
gc_mark_grey(current->ref, stack);
}
}
current++;
}
}
static void gc_scan(zend_refcounted *ref)
static void gc_scan(zend_refcounted *ref, gc_stack *stack)
{
HashTable *ht;
HashTable *ht = NULL;
Bucket *p, *end;
zval *zv;
GC_STACK_DCL(stack);
tail_call:
if (GC_REF_CHECK_COLOR(ref, GC_GREY)) {
if (GC_REF_CHECK_COLOR(ref, GC_WHITE)) {
if (GC_REFCOUNT(ref) > 0) {
gc_scan_black(ref);
if (!GC_REF_CHECK_COLOR(ref, GC_BLACK)) {
GC_REF_SET_BLACK(ref);
if (UNEXPECTED(!_stack->next)) {
gc_stack_next(_stack);
}
/* Split stack and reuse the tail */
_stack->next->prev = NULL;
gc_scan_black(ref, _stack->next);
_stack->next->prev = _stack;
}
} else {
GC_REF_SET_COLOR(ref, GC_WHITE);
if (GC_TYPE(ref) == IS_OBJECT) {
zend_object_get_gc_t get_gc;
zend_object *obj = (zend_object*)ref;
if (EXPECTED(!(OBJ_FLAGS(ref) & IS_OBJ_FREE_CALLED) &&
(get_gc = obj->handlers->get_gc) != NULL)) {
(get_gc = obj->handlers->get_gc) != NULL)) {
int n;
zval *zv, *end;
zval tmp;
@@ -896,43 +999,53 @@ tail_call:
ht = get_gc(&tmp, &zv, &n);
end = zv + n;
if (EXPECTED(!ht)) {
if (!n) return;
if (!n) goto next;
while (!Z_REFCOUNTED_P(--end)) {
if (zv == end) return;
if (zv == end) goto next;
}
}
while (zv != end) {
if (Z_REFCOUNTED_P(zv)) {
ref = Z_COUNTED_P(zv);
gc_scan(ref);
if (GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_WHITE);
GC_STACK_PUSH(ref);
}
}
zv++;
}
if (EXPECTED(!ht)) {
ref = Z_COUNTED_P(zv);
goto tail_call;
if (GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_WHITE);
goto tail_call;
}
goto next;
}
} else {
return;
goto next;
}
} else if (GC_TYPE(ref) == IS_ARRAY) {
if ((zend_array*)ref == &EG(symbol_table)) {
GC_REF_SET_BLACK(ref);
return;
goto next;
} else {
ht = (zend_array*)ref;
}
} else if (GC_TYPE(ref) == IS_REFERENCE) {
if (Z_REFCOUNTED(((zend_reference*)ref)->val)) {
ref = Z_COUNTED(((zend_reference*)ref)->val);
goto tail_call;
if (GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_WHITE);
goto tail_call;
}
}
return;
goto next;
} else {
return;
goto next;
}
if (!ht->nNumUsed) return;
if (!ht->nNumUsed) goto next;
p = ht->arData;
end = p + ht->nNumUsed;
while (1) {
@@ -944,7 +1057,7 @@ tail_call:
if (Z_REFCOUNTED_P(zv)) {
break;
}
if (p == end) return;
if (p == end) goto next;
}
while (p != end) {
zv = &p->val;
@@ -953,7 +1066,10 @@ tail_call:
}
if (Z_REFCOUNTED_P(zv)) {
ref = Z_COUNTED_P(zv);
gc_scan(ref);
if (GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_WHITE);
GC_STACK_PUSH(ref);
}
}
p++;
}
@@ -962,19 +1078,31 @@ tail_call:
zv = Z_INDIRECT_P(zv);
}
ref = Z_COUNTED_P(zv);
goto tail_call;
if (GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_WHITE);
goto tail_call;
}
}
}
next:
ref = GC_STACK_POP();
if (ref) {
goto tail_call;
}
}
static void gc_scan_roots(void)
static void gc_scan_roots(gc_stack *stack)
{
gc_root_buffer *current = GC_IDX2PTR(GC_FIRST_ROOT);
gc_root_buffer *last = GC_IDX2PTR(GC_G(first_unused));
while (current != last) {
if (GC_IS_ROOT(current->ref)) {
gc_scan(current->ref);
if (GC_REF_CHECK_COLOR(current->ref, GC_GREY)) {
GC_REF_SET_COLOR(current->ref, GC_WHITE);
gc_scan(current->ref, stack);
}
}
current++;
}
@@ -1005,18 +1133,15 @@ static void gc_add_garbage(zend_refcounted *ref)
GC_G(num_roots)++;
}
static int gc_collect_white(zend_refcounted *ref, uint32_t *flags)
static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *stack)
{
int count = 0;
HashTable *ht;
HashTable *ht = NULL;
Bucket *p, *end;
zval *zv;
GC_STACK_DCL(stack);
tail_call:
if (GC_REF_CHECK_COLOR(ref, GC_WHITE)) {
ht = NULL;
GC_REF_SET_BLACK(ref);
do {
/* don't count references for compatibility ??? */
if (GC_TYPE(ref) != IS_REFERENCE) {
count++;
@@ -1027,7 +1152,7 @@ tail_call:
zend_object *obj = (zend_object*)ref;
if (EXPECTED(!(OBJ_FLAGS(ref) & IS_OBJ_FREE_CALLED) &&
(get_gc = obj->handlers->get_gc) != NULL)) {
(get_gc = obj->handlers->get_gc) != NULL)) {
int n;
zval *zv, *end;
zval tmp;
@@ -1037,28 +1162,31 @@ tail_call:
gc_add_garbage(ref);
}
if (obj->handlers->dtor_obj &&
((obj->handlers->dtor_obj != zend_objects_destroy_object) ||
(obj->ce->destructor != NULL))) {
((obj->handlers->dtor_obj != zend_objects_destroy_object) ||
(obj->ce->destructor != NULL))) {
*flags |= GC_HAS_DESTRUCTORS;
}
ZVAL_OBJ(&tmp, obj);
ht = get_gc(&tmp, &zv, &n);
end = zv + n;
if (EXPECTED(!ht)) {
if (!n) return count;
if (!n) goto next;
while (!Z_REFCOUNTED_P(--end)) {
/* count non-refcounted for compatibility ??? */
if (Z_TYPE_P(zv) != IS_UNDEF) {
count++;
}
if (zv == end) return count;
if (zv == end) goto next;
}
}
while (zv != end) {
if (Z_REFCOUNTED_P(zv)) {
ref = Z_COUNTED_P(zv);
GC_ADDREF(ref);
count += gc_collect_white(ref, flags);
if (GC_REF_CHECK_COLOR(ref, GC_WHITE)) {
GC_REF_SET_BLACK(ref);
GC_STACK_PUSH(ref);
}
/* count non-refcounted for compatibility ??? */
} else if (Z_TYPE_P(zv) != IS_UNDEF) {
count++;
@@ -1068,10 +1196,14 @@ tail_call:
if (EXPECTED(!ht)) {
ref = Z_COUNTED_P(zv);
GC_ADDREF(ref);
goto tail_call;
if (GC_REF_CHECK_COLOR(ref, GC_WHITE)) {
GC_REF_SET_BLACK(ref);
continue;
}
goto next;
}
} else {
return count;
goto next;
}
} else if (GC_TYPE(ref) == IS_ARRAY) {
/* optimization: color is GC_BLACK (0) */
@@ -1083,14 +1215,17 @@ tail_call:
if (Z_REFCOUNTED(((zend_reference*)ref)->val)) {
ref = Z_COUNTED(((zend_reference*)ref)->val);
GC_ADDREF(ref);
goto tail_call;
if (GC_REF_CHECK_COLOR(ref, GC_WHITE)) {
GC_REF_SET_BLACK(ref);
continue;
}
}
return count;
goto next;
} else {
return count;
goto next;
}
if (!ht->nNumUsed) return count;
if (!ht->nNumUsed) goto next;
p = ht->arData;
end = p + ht->nNumUsed;
while (1) {
@@ -1106,7 +1241,7 @@ tail_call:
if (Z_TYPE_P(zv) != IS_UNDEF) {
count++;
}
if (p == end) return count;
if (p == end) goto next;
}
while (p != end) {
zv = &p->val;
@@ -1116,7 +1251,10 @@ tail_call:
if (Z_REFCOUNTED_P(zv)) {
ref = Z_COUNTED_P(zv);
GC_ADDREF(ref);
count += gc_collect_white(ref, flags);
if (GC_REF_CHECK_COLOR(ref, GC_WHITE)) {
GC_REF_SET_BLACK(ref);
GC_STACK_PUSH(ref);
}
/* count non-refcounted for compatibility ??? */
} else if (Z_TYPE_P(zv) != IS_UNDEF) {
count++;
@@ -1129,12 +1267,19 @@ tail_call:
}
ref = Z_COUNTED_P(zv);
GC_ADDREF(ref);
goto tail_call;
}
if (GC_REF_CHECK_COLOR(ref, GC_WHITE)) {
GC_REF_SET_BLACK(ref);
continue;
}
next:
ref = GC_STACK_POP();
} while (ref);
return count;
}
static int gc_collect_roots(uint32_t *flags)
static int gc_collect_roots(uint32_t *flags, gc_stack *stack)
{
uint32_t idx, end;
zend_refcounted *ref;
@@ -1165,7 +1310,8 @@ static int gc_collect_roots(uint32_t *flags)
ZEND_ASSERT(GC_IS_ROOT(ref));
current->ref = GC_MAKE_GARBAGE(ref);
if (GC_REF_CHECK_COLOR(ref, GC_WHITE)) {
count += gc_collect_white(ref, flags);
GC_REF_SET_BLACK(ref);
count += gc_collect_white(ref, flags, stack);
}
idx++;
}
@@ -1280,6 +1426,10 @@ ZEND_API int zend_gc_collect_cycles(void)
zend_refcounted *p;
uint32_t gc_flags = 0;
uint32_t idx, end;
gc_stack stack;
stack.prev = NULL;
stack.next = NULL;
if (GC_G(gc_active)) {
return 0;
@@ -1290,12 +1440,14 @@ ZEND_API int zend_gc_collect_cycles(void)
GC_G(gc_active) = 1;
GC_TRACE("Marking roots");
gc_mark_roots();
gc_mark_roots(&stack);
GC_TRACE("Scanning roots");
gc_scan_roots();
gc_scan_roots(&stack);
GC_TRACE("Collecting roots");
count = gc_collect_roots(&gc_flags);
count = gc_collect_roots(&gc_flags, &stack);
gc_stack_free(&stack);
if (!GC_G(num_roots)) {
/* nothing to free */
+2 -4
View File
@@ -123,8 +123,7 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
/* always free the CV's, in the symtable are only not-free'd IS_INDIRECT's */
zend_free_compiled_variables(execute_data);
if ((EX_CALL_INFO() & ZEND_CALL_RELEASE_THIS) &&
EXPECTED(GC_TYPE(Z_OBJ(execute_data->This)) == IS_OBJECT)) {
if (EX_CALL_INFO() & ZEND_CALL_RELEASE_THIS) {
OBJ_RELEASE(Z_OBJ(execute_data->This));
}
@@ -144,8 +143,7 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
}
/* Free closure object */
if ((EX_CALL_INFO() & ZEND_CALL_CLOSURE) &&
EXPECTED(GC_TYPE(ZEND_CLOSURE_OBJECT(EX(func))) == IS_OBJECT)) {
if (EX_CALL_INFO() & ZEND_CALL_CLOSURE) {
OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
}
+3 -2
View File
@@ -233,8 +233,9 @@ struct _zend_executor_globals {
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
};
#define EG_FLAGS_INITIAL 0x00
#define EG_FLAGS_IN_SHUTDOWN 0x01
#define EG_FLAGS_INITIAL (0)
#define EG_FLAGS_IN_SHUTDOWN (1<<0)
#define EG_FLAGS_OBJECT_STORE_NO_REUSE (1<<1)
struct _zend_ini_scanner_globals {
zend_file_handle *yy_in;
+3
View File
@@ -894,6 +894,9 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
}
if (UNEXPECTED(parent_ce->type != ce->type)) {
/* User class extends internal */
if (CE_STATIC_MEMBERS(parent_ce) == NULL) {
zend_class_init_statics(parent_ce);
}
if (UNEXPECTED(zend_update_class_constants(parent_ce) != SUCCESS)) {
ZEND_ASSERT(0);
}
+122 -121
View File
@@ -143,13 +143,14 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals;
ZVAL_NEW_STR(retval, zend_string_init(str, len, ZEND_SYSTEM_INI))
#define RETURN_TOKEN(type, str, len) { \
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_TYPED) { \
zend_ini_copy_typed_value(ini_lval, type, str, len); \
} else { \
zend_ini_copy_value(ini_lval, str, len); \
} \
return type; \
#define RETURN_TOKEN(type, str, len) { \
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_TYPED && \
(YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW))) {\
zend_ini_copy_typed_value(ini_lval, type, str, len); \
} else { \
zend_ini_copy_value(ini_lval, str, len); \
} \
return type; \
}
static inline int convert_to_number(zval *retval, const char *str, const int str_len)
@@ -382,7 +383,7 @@ restart:
}
}
#line 386 "Zend/zend_ini_scanner.c"
#line 387 "Zend/zend_ini_scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -504,7 +505,7 @@ yy4:
yy5:
YYDEBUG(5, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 481 "Zend/zend_ini_scanner.l"
#line 482 "Zend/zend_ini_scanner.l"
{ /* Get option name */
/* Eat leading whitespace */
EAT_LEADING_WHITESPACE();
@@ -514,7 +515,7 @@ yy5:
RETURN_TOKEN(TC_LABEL, yytext, yyleng);
}
#line 518 "Zend/zend_ini_scanner.c"
#line 519 "Zend/zend_ini_scanner.c"
yy6:
YYDEBUG(6, *YYCURSOR);
++YYCURSOR;
@@ -538,24 +539,24 @@ yy6:
yy8:
YYDEBUG(8, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 634 "Zend/zend_ini_scanner.l"
#line 635 "Zend/zend_ini_scanner.l"
{
/* eat whitespace */
goto restart;
}
#line 547 "Zend/zend_ini_scanner.c"
#line 548 "Zend/zend_ini_scanner.c"
yy9:
YYDEBUG(9, *YYCURSOR);
++YYCURSOR;
yy10:
YYDEBUG(10, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 639 "Zend/zend_ini_scanner.l"
#line 640 "Zend/zend_ini_scanner.l"
{
SCNG(lineno)++;
return END_OF_LINE;
}
#line 559 "Zend/zend_ini_scanner.c"
#line 560 "Zend/zend_ini_scanner.c"
yy11:
YYDEBUG(11, *YYCURSOR);
yych = *++YYCURSOR;
@@ -616,11 +617,11 @@ yy14:
++YYCURSOR;
YYDEBUG(15, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 562 "Zend/zend_ini_scanner.l"
#line 563 "Zend/zend_ini_scanner.l"
{ /* Disallow these chars outside option values */
return yytext[0];
}
#line 624 "Zend/zend_ini_scanner.c"
#line 625 "Zend/zend_ini_scanner.c"
yy16:
YYDEBUG(16, *YYCURSOR);
++YYCURSOR;
@@ -642,7 +643,7 @@ yy18:
if (yych == ' ') goto yy18;
YYDEBUG(20, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 491 "Zend/zend_ini_scanner.l"
#line 492 "Zend/zend_ini_scanner.l"
{ /* Start option value */
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
BEGIN(ST_RAW);
@@ -651,7 +652,7 @@ yy18:
}
return '=';
}
#line 655 "Zend/zend_ini_scanner.c"
#line 656 "Zend/zend_ini_scanner.c"
yy21:
YYDEBUG(21, *YYCURSOR);
yych = *++YYCURSOR;
@@ -707,7 +708,7 @@ yy26:
++YYCURSOR;
YYDEBUG(27, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 406 "Zend/zend_ini_scanner.l"
#line 407 "Zend/zend_ini_scanner.l"
{ /* Section start */
/* Enter section data lookup state */
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
@@ -717,7 +718,7 @@ yy26:
}
return TC_SECTION;
}
#line 721 "Zend/zend_ini_scanner.c"
#line 722 "Zend/zend_ini_scanner.c"
yy28:
YYDEBUG(28, *YYCURSOR);
++YYCURSOR;
@@ -728,7 +729,7 @@ yy28:
if (yych == ' ') goto yy28;
YYDEBUG(30, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 431 "Zend/zend_ini_scanner.l"
#line 432 "Zend/zend_ini_scanner.l"
{ /* Start of option with offset */
/* Eat leading whitespace */
EAT_LEADING_WHITESPACE();
@@ -741,20 +742,20 @@ yy28:
RETURN_TOKEN(TC_OFFSET, yytext, yyleng);
}
#line 745 "Zend/zend_ini_scanner.c"
#line 746 "Zend/zend_ini_scanner.c"
yy31:
YYDEBUG(31, *YYCURSOR);
++YYCURSOR;
yy32:
YYDEBUG(32, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 644 "Zend/zend_ini_scanner.l"
#line 645 "Zend/zend_ini_scanner.l"
{ /* Comment */
BEGIN(INITIAL);
SCNG(lineno)++;
return END_OF_LINE;
}
#line 758 "Zend/zend_ini_scanner.c"
#line 759 "Zend/zend_ini_scanner.c"
yy33:
YYDEBUG(33, *YYCURSOR);
yych = *++YYCURSOR;
@@ -809,11 +810,11 @@ yy35:
yy36:
YYDEBUG(36, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 473 "Zend/zend_ini_scanner.l"
#line 474 "Zend/zend_ini_scanner.l"
{ /* FALSE value (when used outside option value/offset this causes parse error!)*/
RETURN_TOKEN(BOOL_FALSE, "", 0);
}
#line 817 "Zend/zend_ini_scanner.c"
#line 818 "Zend/zend_ini_scanner.c"
yy37:
YYDEBUG(37, *YYCURSOR);
yych = *++YYCURSOR;
@@ -870,11 +871,11 @@ yy39:
yy41:
YYDEBUG(41, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 469 "Zend/zend_ini_scanner.l"
#line 470 "Zend/zend_ini_scanner.l"
{ /* TRUE value (when used outside option value/offset this causes parse error!) */
RETURN_TOKEN(BOOL_TRUE, "1", 1);
}
#line 878 "Zend/zend_ini_scanner.c"
#line 879 "Zend/zend_ini_scanner.c"
yy42:
YYDEBUG(42, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1021,11 +1022,11 @@ yy54:
yy56:
YYDEBUG(56, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 477 "Zend/zend_ini_scanner.l"
#line 478 "Zend/zend_ini_scanner.l"
{
RETURN_TOKEN(NULL_NULL, "", 0);
}
#line 1029 "Zend/zend_ini_scanner.c"
#line 1030 "Zend/zend_ini_scanner.c"
yy57:
YYDEBUG(57, *YYCURSOR);
++YYCURSOR;
@@ -1134,11 +1135,11 @@ yy62:
yy63:
YYDEBUG(63, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 580 "Zend/zend_ini_scanner.l"
#line 581 "Zend/zend_ini_scanner.l"
{ /* Get rest as section/offset value */
RETURN_TOKEN(TC_STRING, yytext, yyleng);
}
#line 1142 "Zend/zend_ini_scanner.c"
#line 1143 "Zend/zend_ini_scanner.c"
yy64:
YYDEBUG(64, *YYCURSOR);
yyaccept = 0;
@@ -1178,22 +1179,22 @@ yy66:
yy67:
YYDEBUG(67, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 655 "Zend/zend_ini_scanner.l"
#line 656 "Zend/zend_ini_scanner.l"
{
return 0;
}
#line 1186 "Zend/zend_ini_scanner.c"
#line 1187 "Zend/zend_ini_scanner.c"
yy68:
YYDEBUG(68, *YYCURSOR);
++YYCURSOR;
YYDEBUG(69, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 584 "Zend/zend_ini_scanner.l"
#line 585 "Zend/zend_ini_scanner.l"
{ /* Double quoted '"' string start */
yy_push_state(ST_DOUBLE_QUOTES);
return '"';
}
#line 1197 "Zend/zend_ini_scanner.c"
#line 1198 "Zend/zend_ini_scanner.c"
yy70:
YYDEBUG(70, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1258,11 +1259,11 @@ yy73:
yy75:
YYDEBUG(75, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 558 "Zend/zend_ini_scanner.l"
#line 559 "Zend/zend_ini_scanner.l"
{ /* Get number option value as string */
RETURN_TOKEN(TC_NUMBER, yytext, yyleng);
}
#line 1266 "Zend/zend_ini_scanner.c"
#line 1267 "Zend/zend_ini_scanner.c"
yy76:
YYDEBUG(76, *YYCURSOR);
yyaccept = 2;
@@ -1295,11 +1296,11 @@ yy76:
yy78:
YYDEBUG(78, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 554 "Zend/zend_ini_scanner.l"
#line 555 "Zend/zend_ini_scanner.l"
{ /* Get constant option value */
RETURN_TOKEN(TC_CONSTANT, yytext, yyleng);
}
#line 1303 "Zend/zend_ini_scanner.c"
#line 1304 "Zend/zend_ini_scanner.c"
yy79:
YYDEBUG(79, *YYCURSOR);
++YYCURSOR;
@@ -1311,12 +1312,12 @@ yy80:
++YYCURSOR;
YYDEBUG(81, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 444 "Zend/zend_ini_scanner.l"
#line 445 "Zend/zend_ini_scanner.l"
{ /* End of section or an option offset */
BEGIN(INITIAL);
return ']';
}
#line 1320 "Zend/zend_ini_scanner.c"
#line 1321 "Zend/zend_ini_scanner.c"
yy82:
YYDEBUG(82, *YYCURSOR);
++YYCURSOR;
@@ -1356,12 +1357,12 @@ yy86:
++YYCURSOR;
YYDEBUG(87, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 449 "Zend/zend_ini_scanner.l"
#line 450 "Zend/zend_ini_scanner.l"
{ /* Variable start */
yy_push_state(ST_VARNAME);
return TC_DOLLAR_CURLY;
}
#line 1365 "Zend/zend_ini_scanner.c"
#line 1366 "Zend/zend_ini_scanner.c"
yy88:
YYDEBUG(88, *YYCURSOR);
++YYCURSOR;
@@ -1415,7 +1416,7 @@ yy92:
++YYCURSOR;
YYDEBUG(93, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 416 "Zend/zend_ini_scanner.l"
#line 417 "Zend/zend_ini_scanner.l"
{ /* Raw string */
/* Eat leading and trailing single quotes */
if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') {
@@ -1424,7 +1425,7 @@ yy92:
}
RETURN_TOKEN(TC_RAW, yytext, yyleng);
}
#line 1428 "Zend/zend_ini_scanner.c"
#line 1429 "Zend/zend_ini_scanner.c"
}
/* *********************************** */
yyc_ST_SECTION_VALUE:
@@ -1524,11 +1525,11 @@ yy97:
yy98:
YYDEBUG(98, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 580 "Zend/zend_ini_scanner.l"
#line 581 "Zend/zend_ini_scanner.l"
{ /* Get rest as section/offset value */
RETURN_TOKEN(TC_STRING, yytext, yyleng);
}
#line 1532 "Zend/zend_ini_scanner.c"
#line 1533 "Zend/zend_ini_scanner.c"
yy99:
YYDEBUG(99, *YYCURSOR);
yyaccept = 0;
@@ -1568,22 +1569,22 @@ yy101:
yy102:
YYDEBUG(102, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 655 "Zend/zend_ini_scanner.l"
#line 656 "Zend/zend_ini_scanner.l"
{
return 0;
}
#line 1576 "Zend/zend_ini_scanner.c"
#line 1577 "Zend/zend_ini_scanner.c"
yy103:
YYDEBUG(103, *YYCURSOR);
++YYCURSOR;
YYDEBUG(104, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 584 "Zend/zend_ini_scanner.l"
#line 585 "Zend/zend_ini_scanner.l"
{ /* Double quoted '"' string start */
yy_push_state(ST_DOUBLE_QUOTES);
return '"';
}
#line 1587 "Zend/zend_ini_scanner.c"
#line 1588 "Zend/zend_ini_scanner.c"
yy105:
YYDEBUG(105, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1648,11 +1649,11 @@ yy108:
yy110:
YYDEBUG(110, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 558 "Zend/zend_ini_scanner.l"
#line 559 "Zend/zend_ini_scanner.l"
{ /* Get number option value as string */
RETURN_TOKEN(TC_NUMBER, yytext, yyleng);
}
#line 1656 "Zend/zend_ini_scanner.c"
#line 1657 "Zend/zend_ini_scanner.c"
yy111:
YYDEBUG(111, *YYCURSOR);
yyaccept = 2;
@@ -1685,11 +1686,11 @@ yy111:
yy113:
YYDEBUG(113, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 554 "Zend/zend_ini_scanner.l"
#line 555 "Zend/zend_ini_scanner.l"
{ /* Get constant option value */
RETURN_TOKEN(TC_CONSTANT, yytext, yyleng);
}
#line 1693 "Zend/zend_ini_scanner.c"
#line 1694 "Zend/zend_ini_scanner.c"
yy114:
YYDEBUG(114, *YYCURSOR);
++YYCURSOR;
@@ -1713,13 +1714,13 @@ yy115:
yy117:
YYDEBUG(117, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 425 "Zend/zend_ini_scanner.l"
#line 426 "Zend/zend_ini_scanner.l"
{ /* End of section */
BEGIN(INITIAL);
SCNG(lineno)++;
return ']';
}
#line 1723 "Zend/zend_ini_scanner.c"
#line 1724 "Zend/zend_ini_scanner.c"
yy118:
YYDEBUG(118, *YYCURSOR);
++YYCURSOR;
@@ -1759,12 +1760,12 @@ yy122:
++YYCURSOR;
YYDEBUG(123, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 449 "Zend/zend_ini_scanner.l"
#line 450 "Zend/zend_ini_scanner.l"
{ /* Variable start */
yy_push_state(ST_VARNAME);
return TC_DOLLAR_CURLY;
}
#line 1768 "Zend/zend_ini_scanner.c"
#line 1769 "Zend/zend_ini_scanner.c"
yy124:
YYDEBUG(124, *YYCURSOR);
++YYCURSOR;
@@ -1827,7 +1828,7 @@ yy130:
++YYCURSOR;
YYDEBUG(131, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 416 "Zend/zend_ini_scanner.l"
#line 417 "Zend/zend_ini_scanner.l"
{ /* Raw string */
/* Eat leading and trailing single quotes */
if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') {
@@ -1836,7 +1837,7 @@ yy130:
}
RETURN_TOKEN(TC_RAW, yytext, yyleng);
}
#line 1840 "Zend/zend_ini_scanner.c"
#line 1841 "Zend/zend_ini_scanner.c"
}
/* *********************************** */
yyc_ST_VALUE:
@@ -1972,12 +1973,12 @@ yy134:
yy135:
YYDEBUG(135, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 650 "Zend/zend_ini_scanner.l"
#line 651 "Zend/zend_ini_scanner.l"
{ /* End of option value (if EOF is reached before EOL */
BEGIN(INITIAL);
return END_OF_LINE;
}
#line 1981 "Zend/zend_ini_scanner.c"
#line 1982 "Zend/zend_ini_scanner.c"
yy136:
YYDEBUG(136, *YYCURSOR);
yyaccept = 0;
@@ -1994,11 +1995,11 @@ yy137:
yy138:
YYDEBUG(138, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 576 "Zend/zend_ini_scanner.l"
#line 577 "Zend/zend_ini_scanner.l"
{ /* Get everything else as option/offset value */
RETURN_TOKEN(TC_STRING, yytext, yyleng);
}
#line 2002 "Zend/zend_ini_scanner.c"
#line 2003 "Zend/zend_ini_scanner.c"
yy139:
YYDEBUG(139, *YYCURSOR);
++YYCURSOR;
@@ -2022,24 +2023,24 @@ yy139:
yy141:
YYDEBUG(141, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 630 "Zend/zend_ini_scanner.l"
#line 631 "Zend/zend_ini_scanner.l"
{
RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng);
}
#line 2030 "Zend/zend_ini_scanner.c"
#line 2031 "Zend/zend_ini_scanner.c"
yy142:
YYDEBUG(142, *YYCURSOR);
++YYCURSOR;
yy143:
YYDEBUG(143, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 548 "Zend/zend_ini_scanner.l"
#line 549 "Zend/zend_ini_scanner.l"
{ /* End of option value */
BEGIN(INITIAL);
SCNG(lineno)++;
return END_OF_LINE;
}
#line 2043 "Zend/zend_ini_scanner.c"
#line 2044 "Zend/zend_ini_scanner.c"
yy144:
YYDEBUG(144, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2055,22 +2056,22 @@ yy145:
if (yych == ' ') goto yy145;
YYDEBUG(147, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 566 "Zend/zend_ini_scanner.l"
#line 567 "Zend/zend_ini_scanner.l"
{ /* Boolean operators */
return yytext[0];
}
#line 2063 "Zend/zend_ini_scanner.c"
#line 2064 "Zend/zend_ini_scanner.c"
yy148:
YYDEBUG(148, *YYCURSOR);
++YYCURSOR;
YYDEBUG(149, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 584 "Zend/zend_ini_scanner.l"
#line 585 "Zend/zend_ini_scanner.l"
{ /* Double quoted '"' string start */
yy_push_state(ST_DOUBLE_QUOTES);
return '"';
}
#line 2074 "Zend/zend_ini_scanner.c"
#line 2075 "Zend/zend_ini_scanner.c"
yy150:
YYDEBUG(150, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2144,11 +2145,11 @@ yy153:
yy155:
YYDEBUG(155, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 558 "Zend/zend_ini_scanner.l"
#line 559 "Zend/zend_ini_scanner.l"
{ /* Get number option value as string */
RETURN_TOKEN(TC_NUMBER, yytext, yyleng);
}
#line 2152 "Zend/zend_ini_scanner.c"
#line 2153 "Zend/zend_ini_scanner.c"
yy156:
YYDEBUG(156, *YYCURSOR);
++YYCURSOR;
@@ -2165,13 +2166,13 @@ yy158:
++YYCURSOR;
YYDEBUG(159, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 570 "Zend/zend_ini_scanner.l"
#line 571 "Zend/zend_ini_scanner.l"
{ /* Make = used in option value to trigger error */
yyless(0);
BEGIN(INITIAL);
return END_OF_LINE;
}
#line 2175 "Zend/zend_ini_scanner.c"
#line 2176 "Zend/zend_ini_scanner.c"
yy160:
YYDEBUG(160, *YYCURSOR);
yyaccept = 2;
@@ -2218,11 +2219,11 @@ yy160:
yy162:
YYDEBUG(162, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 554 "Zend/zend_ini_scanner.l"
#line 555 "Zend/zend_ini_scanner.l"
{ /* Get constant option value */
RETURN_TOKEN(TC_CONSTANT, yytext, yyleng);
}
#line 2226 "Zend/zend_ini_scanner.c"
#line 2227 "Zend/zend_ini_scanner.c"
yy163:
YYDEBUG(163, *YYCURSOR);
yyaccept = 2;
@@ -2556,12 +2557,12 @@ yy171:
++YYCURSOR;
YYDEBUG(172, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 449 "Zend/zend_ini_scanner.l"
#line 450 "Zend/zend_ini_scanner.l"
{ /* Variable start */
yy_push_state(ST_VARNAME);
return TC_DOLLAR_CURLY;
}
#line 2565 "Zend/zend_ini_scanner.c"
#line 2566 "Zend/zend_ini_scanner.c"
yy173:
YYDEBUG(173, *YYCURSOR);
++YYCURSOR;
@@ -2627,13 +2628,13 @@ yy177:
yy178:
YYDEBUG(178, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 644 "Zend/zend_ini_scanner.l"
#line 645 "Zend/zend_ini_scanner.l"
{ /* Comment */
BEGIN(INITIAL);
SCNG(lineno)++;
return END_OF_LINE;
}
#line 2637 "Zend/zend_ini_scanner.c"
#line 2638 "Zend/zend_ini_scanner.c"
yy179:
YYDEBUG(179, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2744,11 +2745,11 @@ yy181:
yy182:
YYDEBUG(182, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 473 "Zend/zend_ini_scanner.l"
#line 474 "Zend/zend_ini_scanner.l"
{ /* FALSE value (when used outside option value/offset this causes parse error!)*/
RETURN_TOKEN(BOOL_FALSE, "", 0);
}
#line 2752 "Zend/zend_ini_scanner.c"
#line 2753 "Zend/zend_ini_scanner.c"
yy183:
YYDEBUG(183, *YYCURSOR);
yyaccept = 2;
@@ -2895,11 +2896,11 @@ yy185:
yy186:
YYDEBUG(186, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 469 "Zend/zend_ini_scanner.l"
#line 470 "Zend/zend_ini_scanner.l"
{ /* TRUE value (when used outside option value/offset this causes parse error!) */
RETURN_TOKEN(BOOL_TRUE, "1", 1);
}
#line 2903 "Zend/zend_ini_scanner.c"
#line 2904 "Zend/zend_ini_scanner.c"
yy187:
YYDEBUG(187, *YYCURSOR);
yyaccept = 2;
@@ -3019,7 +3020,7 @@ yy191:
++YYCURSOR;
YYDEBUG(192, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 416 "Zend/zend_ini_scanner.l"
#line 417 "Zend/zend_ini_scanner.l"
{ /* Raw string */
/* Eat leading and trailing single quotes */
if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') {
@@ -3028,7 +3029,7 @@ yy191:
}
RETURN_TOKEN(TC_RAW, yytext, yyleng);
}
#line 3032 "Zend/zend_ini_scanner.c"
#line 3033 "Zend/zend_ini_scanner.c"
yy193:
YYDEBUG(193, *YYCURSOR);
yyaccept = 2;
@@ -3343,11 +3344,11 @@ yy202:
yy203:
YYDEBUG(203, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 477 "Zend/zend_ini_scanner.l"
#line 478 "Zend/zend_ini_scanner.l"
{
RETURN_TOKEN(NULL_NULL, "", 0);
}
#line 3351 "Zend/zend_ini_scanner.c"
#line 3352 "Zend/zend_ini_scanner.c"
yy204:
YYDEBUG(204, *YYCURSOR);
++YYCURSOR;
@@ -3414,21 +3415,21 @@ yy208:
}
YYDEBUG(210, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 544 "Zend/zend_ini_scanner.l"
#line 545 "Zend/zend_ini_scanner.l"
{ /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
RETURN_TOKEN(TC_RAW, yytext, yyleng);
}
#line 3422 "Zend/zend_ini_scanner.c"
#line 3423 "Zend/zend_ini_scanner.c"
yy211:
YYDEBUG(211, *YYCURSOR);
++YYCURSOR;
YYDEBUG(212, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 655 "Zend/zend_ini_scanner.l"
#line 656 "Zend/zend_ini_scanner.l"
{
return 0;
}
#line 3432 "Zend/zend_ini_scanner.c"
#line 3433 "Zend/zend_ini_scanner.c"
yy213:
YYDEBUG(213, *YYCURSOR);
++YYCURSOR;
@@ -3444,13 +3445,13 @@ yy213:
yy215:
YYDEBUG(215, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 425 "Zend/zend_ini_scanner.l"
#line 426 "Zend/zend_ini_scanner.l"
{ /* End of section */
BEGIN(INITIAL);
SCNG(lineno)++;
return ']';
}
#line 3454 "Zend/zend_ini_scanner.c"
#line 3455 "Zend/zend_ini_scanner.c"
yy216:
YYDEBUG(216, *YYCURSOR);
++YYCURSOR;
@@ -3508,7 +3509,7 @@ yyc_ST_DOUBLE_QUOTES:
yy221:
YYDEBUG(221, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 594 "Zend/zend_ini_scanner.l"
#line 595 "Zend/zend_ini_scanner.l"
{ /* Escape double quoted string contents */
if (YYCURSOR > YYLIMIT) {
return 0;
@@ -3544,7 +3545,7 @@ yy221:
zend_ini_escape_string(ini_lval, yytext, yyleng, '"');
return TC_QUOTED_STRING;
}
#line 3548 "Zend/zend_ini_scanner.c"
#line 3549 "Zend/zend_ini_scanner.c"
yy222:
YYDEBUG(222, *YYCURSOR);
++YYCURSOR;
@@ -3556,12 +3557,12 @@ yy222:
}
YYDEBUG(224, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 589 "Zend/zend_ini_scanner.l"
#line 590 "Zend/zend_ini_scanner.l"
{ /* Double quoted '"' string ends */
yy_pop_state();
return '"';
}
#line 3565 "Zend/zend_ini_scanner.c"
#line 3566 "Zend/zend_ini_scanner.c"
yy225:
YYDEBUG(225, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3570,12 +3571,12 @@ yy225:
++YYCURSOR;
YYDEBUG(227, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 449 "Zend/zend_ini_scanner.l"
#line 450 "Zend/zend_ini_scanner.l"
{ /* Variable start */
yy_push_state(ST_VARNAME);
return TC_DOLLAR_CURLY;
}
#line 3579 "Zend/zend_ini_scanner.c"
#line 3580 "Zend/zend_ini_scanner.c"
}
/* *********************************** */
yyc_ST_VARNAME:
@@ -3633,7 +3634,7 @@ yy230:
}
YYDEBUG(232, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 454 "Zend/zend_ini_scanner.l"
#line 455 "Zend/zend_ini_scanner.l"
{ /* Variable name */
/* Eat leading whitespace */
EAT_LEADING_WHITESPACE();
@@ -3643,28 +3644,28 @@ yy230:
RETURN_TOKEN(TC_VARNAME, yytext, yyleng);
}
#line 3647 "Zend/zend_ini_scanner.c"
#line 3648 "Zend/zend_ini_scanner.c"
yy233:
YYDEBUG(233, *YYCURSOR);
++YYCURSOR;
YYDEBUG(234, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 655 "Zend/zend_ini_scanner.l"
#line 656 "Zend/zend_ini_scanner.l"
{
return 0;
}
#line 3657 "Zend/zend_ini_scanner.c"
#line 3658 "Zend/zend_ini_scanner.c"
yy235:
YYDEBUG(235, *YYCURSOR);
++YYCURSOR;
YYDEBUG(236, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 464 "Zend/zend_ini_scanner.l"
#line 465 "Zend/zend_ini_scanner.l"
{ /* Variable end */
yy_pop_state();
return '}';
}
#line 3668 "Zend/zend_ini_scanner.c"
#line 3669 "Zend/zend_ini_scanner.c"
}
/* *********************************** */
yyc_ST_RAW:
@@ -3728,19 +3729,19 @@ yyc_ST_RAW:
++YYCURSOR;
YYDEBUG(240, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 650 "Zend/zend_ini_scanner.l"
#line 651 "Zend/zend_ini_scanner.l"
{ /* End of option value (if EOF is reached before EOL */
BEGIN(INITIAL);
return END_OF_LINE;
}
#line 3737 "Zend/zend_ini_scanner.c"
#line 3738 "Zend/zend_ini_scanner.c"
yy241:
YYDEBUG(241, *YYCURSOR);
++YYCURSOR;
yy242:
YYDEBUG(242, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 500 "Zend/zend_ini_scanner.l"
#line 501 "Zend/zend_ini_scanner.l"
{ /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
unsigned char *sc = NULL;
EAT_LEADING_WHITESPACE();
@@ -3784,7 +3785,7 @@ end_raw_value_chars:
RETURN_TOKEN(TC_RAW, yytext, yyleng);
}
#line 3788 "Zend/zend_ini_scanner.c"
#line 3789 "Zend/zend_ini_scanner.c"
yy243:
YYDEBUG(243, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3808,13 +3809,13 @@ yy244:
yy245:
YYDEBUG(245, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 548 "Zend/zend_ini_scanner.l"
#line 549 "Zend/zend_ini_scanner.l"
{ /* End of option value */
BEGIN(INITIAL);
SCNG(lineno)++;
return END_OF_LINE;
}
#line 3818 "Zend/zend_ini_scanner.c"
#line 3819 "Zend/zend_ini_scanner.c"
yy246:
YYDEBUG(246, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3851,25 +3852,25 @@ yy250:
yy251:
YYDEBUG(251, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 634 "Zend/zend_ini_scanner.l"
#line 635 "Zend/zend_ini_scanner.l"
{
/* eat whitespace */
goto restart;
}
#line 3860 "Zend/zend_ini_scanner.c"
#line 3861 "Zend/zend_ini_scanner.c"
yy252:
YYDEBUG(252, *YYCURSOR);
++YYCURSOR;
yy253:
YYDEBUG(253, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 644 "Zend/zend_ini_scanner.l"
#line 645 "Zend/zend_ini_scanner.l"
{ /* Comment */
BEGIN(INITIAL);
SCNG(lineno)++;
return END_OF_LINE;
}
#line 3873 "Zend/zend_ini_scanner.c"
#line 3874 "Zend/zend_ini_scanner.c"
yy254:
YYDEBUG(254, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3877,6 +3878,6 @@ yy254:
goto yy253;
}
}
#line 659 "Zend/zend_ini_scanner.l"
#line 660 "Zend/zend_ini_scanner.l"
}
+8 -7
View File
@@ -140,13 +140,14 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals;
ZVAL_NEW_STR(retval, zend_string_init(str, len, ZEND_SYSTEM_INI))
#define RETURN_TOKEN(type, str, len) { \
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_TYPED) { \
zend_ini_copy_typed_value(ini_lval, type, str, len); \
} else { \
zend_ini_copy_value(ini_lval, str, len); \
} \
return type; \
#define RETURN_TOKEN(type, str, len) { \
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_TYPED && \
(YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW))) {\
zend_ini_copy_typed_value(ini_lval, type, str, len); \
} else { \
zend_ini_copy_value(ini_lval, str, len); \
} \
return type; \
}
static inline int convert_to_number(zval *retval, const char *str, const int str_len)
+3 -3
View File
@@ -1374,14 +1374,14 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
}
/* }}} */
static void zend_intenal_class_init_statics(zend_class_entry *class_type) /* {{{ */
ZEND_API void zend_class_init_statics(zend_class_entry *class_type) /* {{{ */
{
int i;
zval *p;
if (!CE_STATIC_MEMBERS(class_type) && class_type->default_static_members_count) {
if (class_type->parent) {
zend_intenal_class_init_statics(class_type->parent);
zend_class_init_statics(class_type->parent);
}
#if ZTS
@@ -1431,7 +1431,7 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
if (ce->type == ZEND_INTERNAL_CLASS) {
zend_intenal_class_init_statics(ce);
zend_class_init_statics(ce);
} else {
undeclared_property:
if (!silent) {
+1
View File
@@ -175,6 +175,7 @@ extern const ZEND_API zend_object_handlers std_object_handlers;
#define ZEND_PROPERTY_NOT_EMPTY ZEND_ISEMPTY /* Property is not empty */
#define ZEND_PROPERTY_EXISTS 0x2 /* Property exists */
ZEND_API void zend_class_init_statics(zend_class_entry *ce);
ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_string *function_name_strval, const zval *key);
ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent);
ZEND_API ZEND_COLD zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name);
+12 -6
View File
@@ -41,6 +41,7 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_destroy(zend_objects_store *objec
ZEND_API void ZEND_FASTCALL zend_objects_store_call_destructors(zend_objects_store *objects)
{
EG(flags) |= EG_FLAGS_OBJECT_STORE_NO_REUSE;
if (objects->top > 1) {
uint32_t i;
for (i = 1; i < objects->top; i++) {
@@ -131,10 +132,10 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_put(zend_object *object)
{
int handle;
/* When in shutdown sequesnce - do not reuse previously freed handles, to make sure
/* When in shutdown sequence - do not reuse previously freed handles, to make sure
* the dtors for newly created objects are called in zend_objects_store_call_destructors() loop
*/
if (!(EG(flags) & EG_FLAGS_IN_SHUTDOWN) && EG(objects_store).free_list_head != -1) {
if (EG(objects_store).free_list_head != -1 && EXPECTED(!(EG(flags) & EG_FLAGS_OBJECT_STORE_NO_REUSE))) {
handle = EG(objects_store).free_list_head;
EG(objects_store).free_list_head = GET_OBJ_BUCKET_NUMBER(EG(objects_store).object_buckets[handle]);
} else {
@@ -152,14 +153,17 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_put(zend_object *object)
ZEND_API void ZEND_FASTCALL zend_objects_store_del(zend_object *object) /* {{{ */
{
ZEND_ASSERT(GC_REFCOUNT(object) == 0);
/* GC might have released this object already. */
if (UNEXPECTED(GC_TYPE(object) == IS_NULL)) {
return;
}
/* Make sure we hold a reference count during the destructor call
otherwise, when the destructor ends the storage might be freed
when the refcount reaches 0 a second time
*/
ZEND_ASSERT(EG(objects_store).object_buckets != NULL);
ZEND_ASSERT(IS_OBJ_VALID(EG(objects_store).object_buckets[object->handle]));
ZEND_ASSERT(GC_REFCOUNT(object) == 0);
if (!(OBJ_FLAGS(object) & IS_OBJ_DESTRUCTOR_CALLED)) {
GC_ADD_FLAGS(object, IS_OBJ_DESTRUCTOR_CALLED);
@@ -176,6 +180,8 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_del(zend_object *object) /* {{{ *
uint32_t handle = object->handle;
void *ptr;
ZEND_ASSERT(EG(objects_store).object_buckets != NULL);
ZEND_ASSERT(IS_OBJ_VALID(EG(objects_store).object_buckets[object->handle]));
EG(objects_store).object_buckets[handle] = SET_OBJ_INVALID(object);
if (!(OBJ_FLAGS(object) & IS_OBJ_FREE_CALLED)) {
GC_ADD_FLAGS(object, IS_OBJ_FREE_CALLED);
+3 -7
View File
@@ -440,12 +440,8 @@ char *alloca();
#define MAX(a, b) (((a)>(b))?(a):(b))
#define MIN(a, b) (((a)<(b))?(a):(b))
/* x86 instructions BT, SHL, SHR don't require masking */
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) || defined(ZEND_WIN32)
# define ZEND_BIT_TEST(bits, bit) (((bits)[(bit) / (sizeof((bits)[0])*8)] >> (bit)) & 1)
#else
# define ZEND_BIT_TEST(bits, bit) (((bits)[(bit) / (sizeof((bits)[0])*8)] >> ((bit) & (sizeof((bits)[0])*8-1))) & 1)
#endif
#define ZEND_BIT_TEST(bits, bit) \
(((bits)[(bit) / (sizeof((bits)[0])*8)] >> ((bit) & (sizeof((bits)[0])*8-1))) & 1)
/* We always define a function, even if there's a macro or expression we could
* alias, so that using it in contexts where we can't make function calls
@@ -577,7 +573,7 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
# define ZEND_INTRIN_SSSE3_FUNC_DECL(func)
#endif
#ifdef __SSE4_2__
#if defined(HAVE_SSE4_2_DEF) || (defined(ZEND_WIN32) && defined(__SSE4_2__))
/* Instructions compiled directly. */
# define ZEND_INTRIN_SSE4_2_NATIVE 1
#elif (defined(HAVE_FUNC_ATTRIBUTE_TARGET) && defined(PHP_HAVE_SSE4_2)) || defined(ZEND_WIN32)
+6 -1
View File
@@ -155,7 +155,12 @@ ZEND_API void ZEND_FASTCALL _smart_string_alloc(smart_string *str, size_t len)
str->c = emalloc(SMART_STRING_START_LEN + 1);
} else {
str->a = ZEND_MM_ALIGNED_SIZE_EX(len + SMART_STRING_OVERHEAD, SMART_STRING_PAGE) - SMART_STRING_OVERHEAD;
str->c = emalloc_large(str->a + 1);
if (EXPECTED(str->a < (ZEND_MM_CHUNK_SIZE - SMART_STRING_OVERHEAD))) {
str->c = emalloc_large(str->a + 1);
} else {
/* allocate a huge chunk */
str->c = emalloc(str->a + 1);
}
}
} else {
if (UNEXPECTED((size_t) len > SIZE_MAX - str->len)) {
+1 -55
View File
@@ -764,7 +764,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
if (i == len ||
(i + 1 == len && path[i] == '.')) {
/* remove double slashes and '.' */
len = i - 1;
len = EXPECTED(i > 0) ? i - 1 : 0;
is_dir = 1;
continue;
} else if (i + 2 == len && path[i] == '.' && path[i+1] == '.') {
@@ -1207,40 +1207,6 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
}
/* }}} */
#ifdef ZEND_WIN32
static size_t tsrm_win32_realpath_quick(char *path, size_t len, time_t *t) /* {{{ */
{
char tmp_resolved_path[MAXPATHLEN];
int tmp_resolved_path_len;
BY_HANDLE_FILE_INFORMATION info;
realpath_cache_bucket *bucket;
if (!*t) {
*t = time(0);
}
if (CWDG(realpath_cache_size_limit) && (bucket = realpath_cache_find(path, len, *t)) != NULL) {
memcpy(path, bucket->realpath, bucket->realpath_len + 1);
return bucket->realpath_len;
}
if (!php_win32_ioutil_realpath_ex0(path, tmp_resolved_path, &info)) {
DWORD err = GetLastError();
SET_ERRNO_FROM_WIN32_CODE(err);
return (size_t)-1;
}
tmp_resolved_path_len = strlen(tmp_resolved_path);
if (CWDG(realpath_cache_size_limit)) {
realpath_cache_add(path, len, tmp_resolved_path, tmp_resolved_path_len, info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY, *t);
}
memmove(path, tmp_resolved_path, tmp_resolved_path_len + 1);
return tmp_resolved_path_len;
}
/* }}} */
#endif
/* Resolve path relatively to state and put the real path into state */
/* returns 0 for ok, 1 for error */
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath) /* {{{ */
@@ -1368,27 +1334,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
add_slash = (use_realpath != CWD_REALPATH) && path_length > 0 && IS_SLASH(resolved_path[path_length-1]);
t = CWDG(realpath_cache_ttl) ? 0 : -1;
#ifdef ZEND_WIN32
if (CWD_EXPAND != use_realpath) {
size_t tmp_len = tsrm_win32_realpath_quick(resolved_path, path_length, &t);
if ((size_t)-1 != tmp_len) {
path_length = tmp_len;
} else {
DWORD err = GetLastError();
/* The access denied error can mean something completely else,
fallback to complicated way. */
if (CWD_REALPATH == use_realpath && ERROR_ACCESS_DENIED != err) {
SET_ERRNO_FROM_WIN32_CODE(err);
return 1;
}
path_length = tsrm_realpath_r(resolved_path, start, path_length, &ll, &t, use_realpath, 0, NULL);
}
} else {
path_length = tsrm_realpath_r(resolved_path, start, path_length, &ll, &t, use_realpath, 0, NULL);
}
#else
path_length = tsrm_realpath_r(resolved_path, start, path_length, &ll, &t, use_realpath, 0, NULL);
#endif
if (path_length == (size_t)-1) {
errno = ENOENT;
+7 -4
View File
@@ -3099,6 +3099,10 @@ ZEND_VM_HOT_OBJ_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|THIS|CV,
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
}
if ((OP1_TYPE & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(obj != orig_obj)) {
/* Reset "object" to trigger reference counting */
object = NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
init_func_run_time_cache(&fbc->op_array);
}
@@ -3443,11 +3447,10 @@ ZEND_VM_HOT_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST, NUM|CACHE_SLOT)
fbc = CACHED_PTR(opline->result.num);
if (UNEXPECTED(fbc == NULL)) {
func_name = RT_CONSTANT(opline, opline->op2) + 1;
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
func_name = (zval *)RT_CONSTANT(opline, opline->op2);
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name + 1), 1);
if (func == NULL) {
func_name++;
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name + 2), 1);
if (UNEXPECTED(func == NULL)) {
ZEND_VM_DISPATCH_TO_HELPER(zend_undefined_function_helper, function_name, func_name);
}
+51 -4
View File
@@ -2153,11 +2153,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_NS_FCALL_BY_N
fbc = CACHED_PTR(opline->result.num);
if (UNEXPECTED(fbc == NULL)) {
func_name = RT_CONSTANT(opline, opline->op2) + 1;
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
func_name = (zval *)RT_CONSTANT(opline, opline->op2);
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name + 1), 1);
if (func == NULL) {
func_name++;
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name + 2), 1);
if (UNEXPECTED(func == NULL)) {
ZEND_VM_TAIL_CALL(zend_undefined_function_helper_SPEC(func_name ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
}
@@ -5149,6 +5148,10 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
}
if ((IS_CONST & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(obj != orig_obj)) {
/* Reset "object" to trigger reference counting */
object = NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
init_func_run_time_cache(&fbc->op_array);
}
@@ -7326,6 +7329,10 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
}
if ((IS_CONST & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(obj != orig_obj)) {
/* Reset "object" to trigger reference counting */
object = NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
init_func_run_time_cache(&fbc->op_array);
}
@@ -10422,6 +10429,10 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
}
if ((IS_CONST & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(obj != orig_obj)) {
/* Reset "object" to trigger reference counting */
object = NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
init_func_run_time_cache(&fbc->op_array);
}
@@ -14150,6 +14161,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
}
if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(obj != orig_obj)) {
/* Reset "object" to trigger reference counting */
object = NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
init_func_run_time_cache(&fbc->op_array);
}
@@ -15760,6 +15775,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
}
if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(obj != orig_obj)) {
/* Reset "object" to trigger reference counting */
object = NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
init_func_run_time_cache(&fbc->op_array);
}
@@ -17637,6 +17656,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
}
if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(obj != orig_obj)) {
/* Reset "object" to trigger reference counting */
object = NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
init_func_run_time_cache(&fbc->op_array);
}
@@ -32082,6 +32105,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
}
if ((IS_UNUSED & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(obj != orig_obj)) {
/* Reset "object" to trigger reference counting */
object = NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
init_func_run_time_cache(&fbc->op_array);
}
@@ -33813,6 +33840,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
}
if ((IS_UNUSED & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(obj != orig_obj)) {
/* Reset "object" to trigger reference counting */
object = NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
init_func_run_time_cache(&fbc->op_array);
}
@@ -36188,6 +36219,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
}
if ((IS_UNUSED & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(obj != orig_obj)) {
/* Reset "object" to trigger reference counting */
object = NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
init_func_run_time_cache(&fbc->op_array);
}
@@ -41209,6 +41244,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
}
if ((IS_CV & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(obj != orig_obj)) {
/* Reset "object" to trigger reference counting */
object = NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
init_func_run_time_cache(&fbc->op_array);
}
@@ -44972,6 +45011,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
}
if ((IS_CV & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(obj != orig_obj)) {
/* Reset "object" to trigger reference counting */
object = NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
init_func_run_time_cache(&fbc->op_array);
}
@@ -50770,6 +50813,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
}
if ((IS_CV & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(obj != orig_obj)) {
/* Reset "object" to trigger reference counting */
object = NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
init_func_run_time_cache(&fbc->op_array);
}
+2 -1
View File
@@ -992,7 +992,7 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
}
/* Remove unused free_op1 and free_op2 declarations */
if ($spec && preg_match_all('/^\s*zend_free_op\s+[^;]+;\s*$/me', $code, $matches, PREG_SET_ORDER)) {
if ($spec && preg_match_all('/^\s*zend_free_op\s+[^;]+;\s*$/m', $code, $matches, PREG_SET_ORDER)) {
$n = 0;
foreach ($matches as $match) {
$code = preg_replace('/'.preg_quote($match[0],'/').'/', "\$D$n", $code);
@@ -2671,6 +2671,7 @@ function gen_vm($def, $skel) {
// Generate specialized executor
gen_executor($f, $skl, ZEND_VM_SPEC, ZEND_VM_KIND, "execute", "zend_vm_init");
out($f, "\n");
// Generate zend_vm_get_opcode_handler() function
out($f, "static const void* ZEND_FASTCALL zend_vm_get_opcode_handler_ex(uint32_t spec, const zend_op* op)\n");
+73 -43
View File
@@ -833,15 +833,11 @@ dnl from object_var in build-dir.
dnl
AC_DEFUN([PHP_SHARED_MODULE],[
install_modules="install-modules"
suffix=la
case $host_alias in
*aix*[)]
suffix=so
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -Wl,-G -o '$3'/$1.la -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD) && mv -f '$3'/.libs/$1.so '$3'/$1.so'
;;
*[)]
suffix=la
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
additional_flags="-Wl,-G"
;;
esac
@@ -856,7 +852,7 @@ AC_DEFUN([PHP_SHARED_MODULE],[
\$(LIBTOOL) --mode=install cp $3/$1.$suffix \$(phplibdir)
$3/$1.$suffix: \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_DEPENDENCIES)
$link_cmd
\$(LIBTOOL) --mode=link ifelse($4,,[\$(CC)],[\$(CXX)]) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) $additional_flags -o [\$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
EOF
])
@@ -2173,50 +2169,84 @@ AC_DEFUN([PHP_SETUP_ICU],[
PHP_ICU_DIR=DEFAULT
fi
if test "$PHP_ICU_DIR" = "DEFAULT"; then
dnl Try to find icu-config
AC_PATH_PROG(ICU_CONFIG, icu-config, no, [$PATH:/usr/local/bin])
else
ICU_CONFIG="$PHP_ICU_DIR/bin/icu-config"
AC_MSG_CHECKING([for location of ICU headers and libraries])
found_icu=no
dnl First try to find pkg-config
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
AC_MSG_CHECKING([for location of ICU headers and libraries])
dnl If pkg-config is found try using it
if test "$PHP_ICU_DIR" = "DEFAULT" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists icu-uc icu-io icu-i18n; then
if $PKG_CONFIG --atleast-version=40 icu-uc; then
found_icu=yes
icu_version_full=`$PKG_CONFIG --modversion icu-uc`
ac_IFS=$IFS
IFS="."
set $icu_version_full
IFS=$ac_IFS
icu_version=`expr [$]1 \* 1000 + [$]2`
AC_MSG_RESULT([found $icu_version_full])
dnl Trust icu-config to know better what the install prefix is..
icu_install_prefix=`$ICU_CONFIG --prefix 2> /dev/null`
if test "$?" != "0" || test -z "$icu_install_prefix"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Unable to detect ICU prefix or $ICU_CONFIG failed. Please verify ICU install prefix and make sure icu-config works.])
else
AC_MSG_RESULT([$icu_install_prefix])
ICU_LIBS=`$PKG_CONFIG --libs icu-uc icu-io icu-i18n`
ICU_INCS=`$PKG_CONFIG --cflags-only-I icu-uc icu-io icu-i18n`
ICU_CXXFLAGS="-DU_USING_ICU_NAMESPACE=1"
dnl Check ICU version
AC_MSG_CHECKING([for ICU 4.0 or greater])
icu_version_full=`$ICU_CONFIG --version`
ac_IFS=$IFS
IFS="."
set $icu_version_full
IFS=$ac_IFS
icu_version=`expr [$]1 \* 1000 + [$]2`
AC_MSG_RESULT([found $icu_version_full])
AC_MSG_RESULT([found $ICU_VERSION])
if test "$icu_version" -lt "4000"; then
AC_MSG_ERROR([ICU version 4.0 or later is required])
PHP_EVAL_LIBLINE($ICU_LIBS, $1)
PHP_EVAL_INCLINE($ICU_INCS)
else
AC_MSG_ERROR([ICU version 4.0 or later required.])
fi
fi
dnl If pkg-config fails for some reason, revert to the old method
if test "$found_icu" = "no"; then
if test "$PHP_ICU_DIR" = "DEFAULT"; then
dnl Try to find icu-config
AC_PATH_PROG(ICU_CONFIG, icu-config, no, [$PATH:/usr/local/bin])
else
ICU_CONFIG="$PHP_ICU_DIR/bin/icu-config"
fi
ICU_VERSION=$icu_version
ICU_INCS=`$ICU_CONFIG --cppflags-searchpath`
ICU_LIBS=`$ICU_CONFIG --ldflags --ldflags-icuio`
PHP_EVAL_INCLINE($ICU_INCS)
PHP_EVAL_LIBLINE($ICU_LIBS, $1)
dnl Trust icu-config to know better what the install prefix is..
icu_install_prefix=`$ICU_CONFIG --prefix 2> /dev/null`
if test "$?" != "0" || test -z "$icu_install_prefix"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Unable to detect ICU prefix or $ICU_CONFIG failed. Please verify ICU install prefix and make sure icu-config works.])
else
AC_MSG_RESULT([$icu_install_prefix])
ICU_CXXFLAGS=`$ICU_CONFIG --cxxflags`
if test "$icu_version" -ge "49000"; then
ICU_CXXFLAGS="$ICU_CXXFLAGS -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit"
ICU_CFLAGS="-DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
fi
if test "$icu_version" -ge "60000"; then
ICU_CFLAGS="$ICU_CFLAGS -DU_HIDE_OBSOLETE_UTF_OLD_H=1"
dnl Check ICU version
AC_MSG_CHECKING([for ICU 4.0 or greater])
icu_version_full=`$ICU_CONFIG --version`
ac_IFS=$IFS
IFS="."
set $icu_version_full
IFS=$ac_IFS
icu_version=`expr [$]1 \* 1000 + [$]2`
AC_MSG_RESULT([found $icu_version_full])
if test "$icu_version" -lt "4000"; then
AC_MSG_ERROR([ICU version 4.0 or later is required])
fi
ICU_VERSION=$icu_version
ICU_INCS=`$ICU_CONFIG --cppflags-searchpath`
ICU_LIBS=`$ICU_CONFIG --ldflags --ldflags-icuio`
PHP_EVAL_INCLINE($ICU_INCS)
PHP_EVAL_LIBLINE($ICU_LIBS, $1)
ICU_CXXFLAGS=`$ICU_CONFIG --cxxflags`
if test "$icu_version" -ge "49000"; then
ICU_CXXFLAGS="$ICU_CXXFLAGS -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit"
ICU_CFLAGS="-DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
fi
if test "$icu_version" -ge "60000"; then
ICU_CFLAGS="$ICU_CFLAGS -DU_HIDE_OBSOLETE_UTF_OLD_H=1"
fi
fi
fi
])
+24 -3
View File
@@ -107,8 +107,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=7
PHP_MINOR_VERSION=3
PHP_RELEASE_VERSION=1
PHP_EXTRA_VERSION="-dev"
PHP_RELEASE_VERSION=4
PHP_EXTRA_VERSION=""
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
@@ -565,6 +565,24 @@ PHP_CHECK_CPU_SUPPORTS([sse4.2])
PHP_CHECK_CPU_SUPPORTS([avx])
PHP_CHECK_CPU_SUPPORTS([avx2])
dnl The ABI of php_addslashes in PHP 7.3 is dependent on __SSE4_2__,
dnl which depends on target attributes. Use this check to make sure that
dnl SSE 4.2 availability during the PHP compilation is used, independently
dnl of whether extensions are compiled with SSE 4.2 support.
AC_MSG_CHECKING([whether __SSE4_2__ is defined])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
int main() {
#if defined(__SSE4_2__)
return 0;
#else
return 1;
#endif
}
]])], [
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_SSE4_2_DEF, 1, [Define if __SSE4_2__ has been defined])
], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([no])])
dnl Check for members of the stat structure
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
@@ -585,7 +603,10 @@ PHP_SOCKADDR_CHECKS
dnl Checks for GCC function attributes on all systems except ones without glibc
dnl Fix for these systems is already included in GCC 7, but not on GCC 6
AS_CASE([$host_alias], [*-*-*android*|*-*-*uclibc*|*-*-*musl*], [true], [
dnl
dnl At least some versions of FreeBSD seem to have buggy ifunc support, see
dnl bug #77284. Conservatively don't use ifuncs on FreeBSD.
AS_CASE([$host_alias], [*-*-*android*|*-*-*uclibc*|*-*-*musl*|*freebsd*], [true], [
AX_GCC_FUNC_ATTRIBUTE([ifunc])
AX_GCC_FUNC_ATTRIBUTE([target])
])
+12 -5
View File
@@ -54,12 +54,19 @@ bc_num2long (num)
/* Extract the int value, ignore the fraction. */
val = 0;
nptr = num->n_value;
for (index=num->n_len; (index>0) && (val<=(LONG_MAX/BASE)); index--)
val = val*BASE + *nptr++;
for (index = num->n_len; index > 0; index--) {
char n = *nptr++;
/* Check for overflow. If overflow, return zero. */
if (index>0) val = 0;
if (val < 0) val = 0;
if (val > LONG_MAX/BASE) {
return 0;
}
val *= BASE;
if (val > LONG_MAX - n) {
return 0;
}
val += n;
}
/* Return the value. */
if (num->n_sign == PLUS)
+7 -7
View File
@@ -184,7 +184,7 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa
}
const_name = php_com_olestring_to_string(bstr_ids, &len, codepage);
c.name = zend_string_init(const_name, len, 1);
c.name = zend_string_init(const_name, len, mode & CONST_PERSISTENT);
// TODO: avoid reallocation???
efree(const_name);
if(c.name == NULL) {
@@ -195,17 +195,17 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa
SysFreeString(bstr_ids);
/* sanity check for the case where the constant is already defined */
php_com_zval_from_variant(&value, pVarDesc->lpvarValue, codepage);
if ((exists = zend_get_constant(c.name)) != NULL) {
if (COMG(autoreg_verbose) && !compare_function(&results, &c.value, exists)) {
php_error_docref(NULL, E_WARNING, "Type library constant %s is already defined", c.name);
if (COMG(autoreg_verbose) && !compare_function(&results, &value, exists)) {
php_error_docref(NULL, E_WARNING, "Type library constant %s is already defined", ZSTR_VAL(c.name));
}
zend_string_release_ex(c.name, 1);
zend_string_release_ex(c.name, mode & CONST_PERSISTENT);
ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc);
continue;
}
/* register the constant */
php_com_zval_from_variant(&value, pVarDesc->lpvarValue, codepage);
if (Z_TYPE(value) == IS_LONG) {
ZEND_CONSTANT_SET_FLAGS(&c, mode, 0);
ZVAL_LONG(&c.value, Z_LVAL(value));
@@ -222,8 +222,8 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa
/* Type-library stuff */
void php_com_typelibrary_dtor(zval *pDest)
{
ITypeLib **Lib = (ITypeLib**)Z_PTR_P(pDest);
ITypeLib_Release(*Lib);
ITypeLib *Lib = (ITypeLib*)Z_PTR_P(pDest);
ITypeLib_Release(Lib);
}
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string,
+23
View File
@@ -0,0 +1,23 @@
--TEST--
Bug #77578 (Crash when php unload)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
?>
--FILE--
<?php
// To actually be able to verify the crash during shutdown on Windows, we have
// to execute a PHP subprocess, and check its exit status.
$php = PHP_BINARY;
$ini = php_ini_loaded_file();
$iniopt = $ini ? "-c $ini" : '';
$command = "$php $iniopt -d com.autoregister_typelib=1 -r \"new COM('WbemScripting.SWbemLocator');\"";
exec($command, $output, $status);
var_dump($output, $status);
?>
===DONE===
--EXPECT--
array(0) {
}
int(0)
===DONE===
+18
View File
@@ -0,0 +1,18 @@
--TEST--
Bug #77621 (Already defined constants are not properly reported)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
?>
--INI--
com.autoregister_verbose=1
--FILE--
<?php
define('ADSTYPE_INVALID', 0);
$root = dirname(array_change_key_case($_SERVER, CASE_UPPER)['COMSPEC']);
com_load_typelib("$root\activeds.tlb");
?>
===DONE===
--EXPECTF--
Warning: com_load_typelib(): Type library constant ADSTYPE_INVALID is already defined in %s on line %d
===DONE===
+6 -2
View File
@@ -3429,8 +3429,12 @@ PHP_FUNCTION(curl_error)
RETURN_FALSE;
}
ch->err.str[CURL_ERROR_SIZE] = 0;
RETURN_STRING(ch->err.str);
if (ch->err.no) {
ch->err.str[CURL_ERROR_SIZE] = 0;
RETURN_STRING(ch->err.str);
} else {
RETURN_EMPTY_STRING();
}
}
/* }}} */
+2 -5
View File
@@ -420,6 +420,7 @@ void _php_curl_multi_close(zend_resource *rsrc) /* {{{ */
curl_multi_cleanup(mh->multi);
zend_llist_clean(&mh->easyh);
if (mh->handlers->server_push) {
zval_ptr_dtor(&mh->handlers->server_push->func_name);
efree(mh->handlers->server_push);
}
if (mh->handlers) {
@@ -502,6 +503,7 @@ static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_hea
Z_ADDREF_P(pz_parent_ch);
res = zend_register_resource(ch, le_curl);
ch->res = res;
ZVAL_RES(&pz_ch, res);
size_t i;
@@ -576,11 +578,6 @@ static int _php_curl_multi_setopt(php_curlm *mh, zend_long option, zval *zvalue,
ZVAL_COPY(&mh->handlers->server_push->func_name, zvalue);
mh->handlers->server_push->method = PHP_CURL_USER;
if (!Z_ISUNDEF(mh->handlers->server_push->func_name)) {
zval_ptr_dtor(&mh->handlers->server_push->func_name);
mh->handlers->server_push->fci_cache = empty_fcall_info_cache;
}
error = curl_multi_setopt(mh->multi, option, _php_server_push_callback);
if (error != CURLM_OK) {
return 0;
+53
View File
@@ -0,0 +1,53 @@
--TEST--
Bug #76675 (Segfault with H2 server push write/writeheader handlers)
--SKIPIF--
<?php
include 'skipif.inc';
if (getenv("SKIP_ONLINE_TESTS")) {
die("skip online test");
}
$curl_version = curl_version();
if ($curl_version['version_number'] < 0x073d00) {
exit("skip: test may crash with curl < 7.61.0");
}
?>
--FILE--
<?php
$transfers = 1;
$callback = function($parent, $passed) use (&$transfers) {
curl_setopt($passed, CURLOPT_WRITEFUNCTION, function ($ch, $data) {
echo "Received ".strlen($data);
return strlen($data);
});
$transfers++;
return CURL_PUSH_OK;
};
$mh = curl_multi_init();
curl_multi_setopt($mh, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);
curl_multi_setopt($mh, CURLMOPT_PUSHFUNCTION, $callback);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://http2.golang.org/serverpush');
curl_setopt($ch, CURLOPT_HTTP_VERSION, 3);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_multi_add_handle($mh, $ch);
$active = null;
do {
$status = curl_multi_exec($mh, $active);
do {
$info = curl_multi_info_read($mh);
if (false !== $info && $info['msg'] == CURLMSG_DONE) {
$handle = $info['handle'];
if ($handle !== null) {
$transfers--;
curl_multi_remove_handle($mh, $handle);
curl_close($handle);
}
}
} while ($info);
} while ($transfers);
curl_multi_close($mh);
?>
--EXPECTREGEX--
(Received \d+)+
+77
View File
@@ -0,0 +1,77 @@
--TEST--
Bug #77535 (Invalid callback, h2 server push)
--SKIPIF--
<?php
include 'skipif.inc';
if (getenv("SKIP_ONLINE_TESTS")) {
die("skip online test");
}
$curl_version = curl_version();
if ($curl_version['version_number'] < 0x073d00) {
exit("skip: test may crash with curl < 7.61.0");
}
?>
--FILE--
<?php
class MyHttpClient
{
private $mh;
private $curl;
public function sendRequest()
{
if (false === $this->mh = curl_multi_init()) {
throw new \RuntimeException('Unable to create a new cURL multi handle');
}
$this->addServerPushCallback();
$this->curl = curl_init();
curl_setopt($this->curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
curl_setopt($this->curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
curl_setopt($this->curl, CURLOPT_HEADER, false);
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, false);
curl_setopt($this->curl, CURLOPT_FAILONERROR, false);
curl_setopt($this->curl, CURLOPT_URL, 'https://http2.golang.org/serverpush');
curl_setopt($this->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
curl_setopt($this->curl, CURLOPT_HEADERFUNCTION, function ($ch, $data) {
return \strlen($data);
});
curl_setopt($this->curl, CURLOPT_WRITEFUNCTION, function ($ch, $data) {
return \strlen($data);
});
curl_multi_add_handle($this->mh, $this->curl);
$stillRunning = null;
while (true) {
do {
$mrc = curl_multi_exec($this->mh, $stillRunning);
} while (CURLM_CALL_MULTI_PERFORM === $mrc);
$info = curl_multi_info_read($this->mh);
while (false !== $info && $info['msg'] == CURLMSG_DONE) {
if (CURLMSG_DONE !== $info['msg']) {
continue;
}
die("Start handle request.");
}
}
}
private function addServerPushCallback(): void
{
$callback = static function () {
return CURL_PUSH_OK;
};
curl_multi_setopt($this->mh, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);
curl_multi_setopt($this->mh, CURLMOPT_PUSHFUNCTION, $callback);
}
}
$buzz = new MyHttpClient();
$buzz->sendRequest();
--EXPECT--
Start handle request.
+1 -1
View File
@@ -48,7 +48,7 @@ PSL => No
HTTPS_PROXY => Yes
MULTI_SSL => %s
BROTLI => %s
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
Host => %s-pc-win32
SSL Version => OpenSSL/%s
ZLib Version => %s
+3 -3
View File
@@ -18,6 +18,6 @@ curl_close($ch);
?>
--EXPECTF--
string(%d) "%Srotocol%s"
int(1)
--EXPECTREGEX--
string\(\d+\) "([^\r\n]*rotocol[^\r\n]+|Could not resolve host: .+)"
int\(\d\)
+8 -2
View File
@@ -1,7 +1,13 @@
dnl config.m4 for date extension
sinclude(ext/date/lib/timelib.m4)
sinclude(lib/timelib.m4)
dnl Check for headers needed by timelib
AC_CHECK_HEADERS([ \
strings.h \
io.h
])
dnl Check for strtoll, atoll
AC_CHECK_FUNCS(strtoll atoll)
PHP_DATE_CFLAGS="-I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1"
timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c
+165 -128
View File
@@ -51,17 +51,37 @@ static inline uint32_t timelib_conv_int_unsigned(uint32_t value)
{
return value;
}
static inline uint64_t timelib_conv_int64_unsigned(uint64_t value)
{
return value;
}
#else
static inline uint32_t timelib_conv_int_unsigned(uint32_t value)
{
return ((value & 0x000000ff) << 24) +
((value & 0x0000ff00) << 8) +
((value & 0x00ff0000) >> 8) +
return
((value & 0x000000ff) << 24) +
((value & 0x0000ff00) << 8) +
((value & 0x00ff0000) >> 8) +
((value & 0xff000000) >> 24);
}
static inline uint64_t timelib_conv_int64_unsigned(uint64_t value)
{
return
((value & 0x00000000000000ff) << 56) +
((value & 0x000000000000ff00) << 40) +
((value & 0x0000000000ff0000) << 24) +
((value & 0x00000000ff000000) << 8) +
((value & 0x000000ff00000000) >> 8) +
((value & 0x0000ff0000000000) >> 24) +
((value & 0x00ff000000000000) >> 40) +
((value & 0xff00000000000000) >> 56);
}
#endif
#define timelib_conv_int_signed(value) ((int32_t) timelib_conv_int_unsigned((int32_t) value))
#define timelib_conv_int64_signed(value) ((int64_t) timelib_conv_int64_unsigned((int64_t) value))
static int read_php_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
{
@@ -132,56 +152,49 @@ static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz, unsigned
}
}
static void read_header(const unsigned char **tzf, timelib_tzinfo *tz)
static void read_32bit_header(const unsigned char **tzf, timelib_tzinfo *tz)
{
uint32_t buffer[6];
memcpy(&buffer, *tzf, sizeof(buffer));
tz->bit32.ttisgmtcnt = timelib_conv_int_unsigned(buffer[0]);
tz->bit32.ttisstdcnt = timelib_conv_int_unsigned(buffer[1]);
tz->bit32.leapcnt = timelib_conv_int_unsigned(buffer[2]);
tz->bit32.timecnt = timelib_conv_int_unsigned(buffer[3]);
tz->bit32.typecnt = timelib_conv_int_unsigned(buffer[4]);
tz->bit32.charcnt = timelib_conv_int_unsigned(buffer[5]);
tz->_bit32.ttisgmtcnt = timelib_conv_int_unsigned(buffer[0]);
tz->_bit32.ttisstdcnt = timelib_conv_int_unsigned(buffer[1]);
tz->_bit32.leapcnt = timelib_conv_int_unsigned(buffer[2]);
tz->_bit32.timecnt = timelib_conv_int_unsigned(buffer[3]);
tz->_bit32.typecnt = timelib_conv_int_unsigned(buffer[4]);
tz->_bit32.charcnt = timelib_conv_int_unsigned(buffer[5]);
*tzf += sizeof(buffer);
}
static void skip_64bit_transitions(const unsigned char **tzf, timelib_tzinfo *tz)
static int read_64bit_transitions(const unsigned char **tzf, timelib_tzinfo *tz)
{
if (tz->bit64.timecnt) {
*tzf += (sizeof(int64_t) * tz->bit64.timecnt);
*tzf += (sizeof(unsigned char) * tz->bit64.timecnt);
}
}
static int read_transitions(const unsigned char **tzf, timelib_tzinfo *tz)
{
int32_t *buffer = NULL;
int64_t *buffer = NULL;
uint32_t i;
unsigned char *cbuffer = NULL;
if (tz->bit32.timecnt) {
buffer = (int32_t*) timelib_malloc(tz->bit32.timecnt * sizeof(int32_t));
if (tz->bit64.timecnt) {
buffer = (int64_t*) timelib_malloc(tz->bit64.timecnt * sizeof(int64_t));
if (!buffer) {
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
memcpy(buffer, *tzf, sizeof(int32_t) * tz->bit32.timecnt);
*tzf += (sizeof(int32_t) * tz->bit32.timecnt);
for (i = 0; i < tz->bit32.timecnt; i++) {
buffer[i] = timelib_conv_int_signed(buffer[i]);
memcpy(buffer, *tzf, sizeof(int64_t) * tz->bit64.timecnt);
*tzf += (sizeof(int64_t) * tz->bit64.timecnt);
for (i = 0; i < tz->bit64.timecnt; i++) {
buffer[i] = timelib_conv_int64_signed(buffer[i]);
/* Sanity check to see whether TS is just increasing */
if (i > 0 && !(buffer[i] > buffer[i - 1])) {
return TIMELIB_ERROR_CORRUPT_TRANSITIONS_DONT_INCREASE;
}
}
cbuffer = (unsigned char*) timelib_malloc(tz->bit32.timecnt * sizeof(unsigned char));
cbuffer = (unsigned char*) timelib_malloc(tz->bit64.timecnt * sizeof(unsigned char));
if (!cbuffer) {
timelib_free(buffer);
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->bit32.timecnt);
*tzf += sizeof(unsigned char) * tz->bit32.timecnt;
memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->bit64.timecnt);
*tzf += sizeof(unsigned char) * tz->bit64.timecnt;
}
tz->trans = buffer;
@@ -190,41 +203,35 @@ static int read_transitions(const unsigned char **tzf, timelib_tzinfo *tz)
return 0;
}
static void skip_64bit_types(const unsigned char **tzf, timelib_tzinfo *tz)
static void skip_32bit_transitions(const unsigned char **tzf, timelib_tzinfo *tz)
{
*tzf += sizeof(unsigned char) * 6 * tz->bit64.typecnt;
*tzf += sizeof(char) * tz->bit64.charcnt;
if (tz->bit64.leapcnt) {
*tzf += sizeof(int64_t) * tz->bit64.leapcnt * 2;
}
if (tz->bit64.ttisstdcnt) {
*tzf += sizeof(unsigned char) * tz->bit64.ttisstdcnt;
}
if (tz->bit64.ttisgmtcnt) {
*tzf += sizeof(unsigned char) * tz->bit64.ttisgmtcnt;
if (tz->_bit32.timecnt) {
*tzf += (sizeof(int32_t) * tz->_bit32.timecnt);
*tzf += sizeof(unsigned char) * tz->_bit32.timecnt;
}
}
static int read_types(const unsigned char **tzf, timelib_tzinfo *tz)
static int read_64bit_types(const unsigned char **tzf, timelib_tzinfo *tz)
{
unsigned char *buffer;
int32_t *leap_buffer;
unsigned int i, j;
buffer = (unsigned char*) timelib_malloc(tz->bit32.typecnt * sizeof(unsigned char) * 6);
/* Offset Types */
buffer = (unsigned char*) timelib_malloc(tz->bit64.typecnt * sizeof(unsigned char) * 6);
if (!buffer) {
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
memcpy(buffer, *tzf, sizeof(unsigned char) * 6 * tz->bit32.typecnt);
*tzf += sizeof(unsigned char) * 6 * tz->bit32.typecnt;
memcpy(buffer, *tzf, sizeof(unsigned char) * 6 * tz->bit64.typecnt);
*tzf += sizeof(unsigned char) * 6 * tz->bit64.typecnt;
tz->type = (ttinfo*) timelib_malloc(tz->bit32.typecnt * sizeof(ttinfo));
tz->type = (ttinfo*) timelib_malloc(tz->bit64.typecnt * sizeof(ttinfo));
if (!tz->type) {
timelib_free(buffer);
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
for (i = 0; i < tz->bit32.typecnt; i++) {
for (i = 0; i < tz->bit64.typecnt; i++) {
j = i * 6;
tz->type[i].offset = 0;
tz->type[i].offset += (int32_t) (((uint32_t) buffer[j]) << 24) + (buffer[j + 1] << 16) + (buffer[j + 2] << 8) + tz->type[i].offset + buffer[j + 3];
@@ -233,56 +240,60 @@ static int read_types(const unsigned char **tzf, timelib_tzinfo *tz)
}
timelib_free(buffer);
tz->timezone_abbr = (char*) timelib_malloc(tz->bit32.charcnt);
/* Abbreviations */
tz->timezone_abbr = (char*) timelib_malloc(tz->bit64.charcnt);
if (!tz->timezone_abbr) {
return TIMELIB_ERROR_CORRUPT_NO_ABBREVIATION;
}
memcpy(tz->timezone_abbr, *tzf, sizeof(char) * tz->bit32.charcnt);
*tzf += sizeof(char) * tz->bit32.charcnt;
memcpy(tz->timezone_abbr, *tzf, sizeof(char) * tz->bit64.charcnt);
*tzf += sizeof(char) * tz->bit64.charcnt;
if (tz->bit32.leapcnt) {
leap_buffer = (int32_t *) timelib_malloc(tz->bit32.leapcnt * 2 * sizeof(int32_t));
/* Leap seconds (only use in 'right/') format */
if (tz->bit64.leapcnt) {
leap_buffer = (int32_t *) timelib_malloc(tz->bit64.leapcnt * (sizeof(int64_t) + sizeof(int32_t)));
if (!leap_buffer) {
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
memcpy(leap_buffer, *tzf, sizeof(int32_t) * tz->bit32.leapcnt * 2);
*tzf += sizeof(int32_t) * tz->bit32.leapcnt * 2;
memcpy(leap_buffer, *tzf, tz->bit64.leapcnt * (sizeof(int64_t) + sizeof(int32_t)));
*tzf += tz->bit64.leapcnt * (sizeof(int64_t) + sizeof(int32_t));
tz->leap_times = (tlinfo*) timelib_malloc(tz->bit32.leapcnt * sizeof(tlinfo));
tz->leap_times = (tlinfo*) timelib_malloc(tz->bit64.leapcnt * sizeof(tlinfo));
if (!tz->leap_times) {
timelib_free(leap_buffer);
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
for (i = 0; i < tz->bit32.leapcnt; i++) {
tz->leap_times[i].trans = timelib_conv_int_signed(leap_buffer[i * 2]);
tz->leap_times[i].offset = timelib_conv_int_signed(leap_buffer[i * 2 + 1]);
for (i = 0; i < tz->bit64.leapcnt; i++) {
tz->leap_times[i].trans = timelib_conv_int64_signed(leap_buffer[i * 3 + 1] * 4294967296 + leap_buffer[i * 3]);
tz->leap_times[i].offset = timelib_conv_int_signed(leap_buffer[i * 3 + 2]);
}
timelib_free(leap_buffer);
}
if (tz->bit32.ttisstdcnt) {
buffer = (unsigned char*) timelib_malloc(tz->bit32.ttisstdcnt * sizeof(unsigned char));
/* Standard/Wall Indicators (unused) */
if (tz->bit64.ttisstdcnt) {
buffer = (unsigned char*) timelib_malloc(tz->bit64.ttisstdcnt * sizeof(unsigned char));
if (!buffer) {
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit32.ttisstdcnt);
*tzf += sizeof(unsigned char) * tz->bit32.ttisstdcnt;
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit64.ttisstdcnt);
*tzf += sizeof(unsigned char) * tz->bit64.ttisstdcnt;
for (i = 0; i < tz->bit32.ttisstdcnt; i++) {
for (i = 0; i < tz->bit64.ttisstdcnt; i++) {
tz->type[i].isstdcnt = buffer[i];
}
timelib_free(buffer);
}
if (tz->bit32.ttisgmtcnt) {
buffer = (unsigned char*) timelib_malloc(tz->bit32.ttisgmtcnt * sizeof(unsigned char));
/* UT/Local Time Indicators (unused) */
if (tz->bit64.ttisgmtcnt) {
buffer = (unsigned char*) timelib_malloc(tz->bit64.ttisgmtcnt * sizeof(unsigned char));
if (!buffer) {
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit32.ttisgmtcnt);
*tzf += sizeof(unsigned char) * tz->bit32.ttisgmtcnt;
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit64.ttisgmtcnt);
*tzf += sizeof(unsigned char) * tz->bit64.ttisgmtcnt;
for (i = 0; i < tz->bit32.ttisgmtcnt; i++) {
for (i = 0; i < tz->bit64.ttisgmtcnt; i++) {
tz->type[i].isgmtcnt = buffer[i];
}
timelib_free(buffer);
@@ -291,6 +302,30 @@ static int read_types(const unsigned char **tzf, timelib_tzinfo *tz)
return 0;
}
static void skip_32bit_types(const unsigned char **tzf, timelib_tzinfo *tz)
{
/* Offset Types */
*tzf += sizeof(unsigned char) * 6 * tz->_bit32.typecnt;
/* Abbreviations */
*tzf += sizeof(char) * tz->_bit32.charcnt;
/* Leap seconds (only use in 'right/') format */
if (tz->_bit32.leapcnt) {
*tzf += sizeof(int32_t) * tz->_bit32.leapcnt * 2;
}
/* Standard/Wall Indicators (unused) */
if (tz->_bit32.ttisstdcnt) {
*tzf += sizeof(unsigned char) * tz->_bit32.ttisstdcnt;
}
/* UT/Local Time Indicators (unused) */
if (tz->_bit32.ttisgmtcnt) {
*tzf += sizeof(unsigned char) * tz->_bit32.ttisgmtcnt;
}
}
static void skip_posix_string(const unsigned char **tzf, timelib_tzinfo *tz)
{
int n_count = 0;
@@ -339,14 +374,16 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
printf("Geo Location: %f,%f\n", tz->location.latitude, tz->location.longitude);
printf("Comments:\n%s\n", tz->location.comments);
printf("BC: %s\n", tz->bc ? "" : "yes");
printf("UTC/Local count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.ttisgmtcnt);
printf("Std/Wall count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.ttisstdcnt);
printf("Leap.sec. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.leapcnt);
printf("Trans. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.timecnt);
printf("Local types count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.typecnt);
printf("Zone Abbr. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.charcnt);
printf ("%8s (%12s) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
printf("\n64-bit:\n");
printf("UTC/Local count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit64.ttisgmtcnt);
printf("Std/Wall count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit64.ttisstdcnt);
printf("Leap.sec. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit64.leapcnt);
printf("Trans. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit64.timecnt);
printf("Local types count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit64.typecnt);
printf("Zone Abbr. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit64.charcnt);
printf ("%16s (%20s) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
"", "", 0,
(long int) tz->type[0].offset,
tz->type[0].isdst,
@@ -355,8 +392,8 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
tz->type[0].isstdcnt,
tz->type[0].isgmtcnt
);
for (i = 0; i < tz->bit32.timecnt; i++) {
printf ("%08X (%12d) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
for (i = 0; i < tz->bit64.timecnt; i++) {
printf ("%016lX (%20ld) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
tz->trans[i], tz->trans[i], tz->trans_idx[i],
(long int) tz->type[tz->trans_idx[i]].offset,
tz->type[tz->trans_idx[i]].isdst,
@@ -366,8 +403,8 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
tz->type[tz->trans_idx[i]].isgmtcnt
);
}
for (i = 0; i < tz->bit32.leapcnt; i++) {
printf ("%08X (%12ld) = %d\n",
for (i = 0; i < tz->bit64.leapcnt; i++) {
printf ("%016lX (%20ld) = %d\n",
tz->leap_times[i].trans,
(long) tz->leap_times[i].trans,
tz->leap_times[i].offset);
@@ -470,31 +507,35 @@ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, i
timelib_tzinfo_dtor(tmp);
return NULL;
}
if (version < 2 || version > 3) {
*error_code = TIMELIB_ERROR_UNSUPPORTED_VERSION;
timelib_tzinfo_dtor(tmp);
return NULL;
}
//printf("- timezone: %s, version: %0d\n", timezone, version);
read_header(&tzf, tmp);
if ((transitions_result = read_transitions(&tzf, tmp)) != 0) {
read_32bit_header(&tzf, tmp);
skip_32bit_transitions(&tzf, tmp);
skip_32bit_types(&tzf, tmp);
if (!skip_64bit_preamble(&tzf, tmp)) {
/* 64 bit preamble is not in place */
*error_code = TIMELIB_ERROR_CORRUPT_NO_64BIT_PREAMBLE;
return NULL;
}
read_64bit_header(&tzf, tmp);
if ((transitions_result = read_64bit_transitions(&tzf, tmp)) != 0) {
/* Corrupt file as transitions do not increase */
*error_code = transitions_result;
timelib_tzinfo_dtor(tmp);
return NULL;
}
if ((types_result = read_types(&tzf, tmp)) != 0) {
if ((types_result = read_64bit_types(&tzf, tmp)) != 0) {
*error_code = types_result;
timelib_tzinfo_dtor(tmp);
return NULL;
}
if (version == 2 || version == 3) {
if (!skip_64bit_preamble(&tzf, tmp)) {
/* 64 bit preamble is not in place */
*error_code = TIMELIB_ERROR_CORRUPT_NO_64BIT_PREAMBLE;
return NULL;
}
read_64bit_header(&tzf, tmp);
skip_64bit_transitions(&tzf, tmp);
skip_64bit_types(&tzf, tmp);
skip_posix_string(&tzf, tmp);
}
skip_posix_string(&tzf, tmp);
if (type == TIMELIB_TZINFO_PHP) {
read_location(&tzf, tmp);
@@ -525,29 +566,35 @@ void timelib_tzinfo_dtor(timelib_tzinfo *tz)
timelib_tzinfo *timelib_tzinfo_clone(timelib_tzinfo *tz)
{
timelib_tzinfo *tmp = timelib_tzinfo_ctor(tz->name);
tmp->bit32.ttisgmtcnt = tz->bit32.ttisgmtcnt;
tmp->bit32.ttisstdcnt = tz->bit32.ttisstdcnt;
tmp->bit32.leapcnt = tz->bit32.leapcnt;
tmp->bit32.timecnt = tz->bit32.timecnt;
tmp->bit32.typecnt = tz->bit32.typecnt;
tmp->bit32.charcnt = tz->bit32.charcnt;
tmp->_bit32.ttisgmtcnt = tz->_bit32.ttisgmtcnt;
tmp->_bit32.ttisstdcnt = tz->_bit32.ttisstdcnt;
tmp->_bit32.leapcnt = tz->_bit32.leapcnt;
tmp->_bit32.timecnt = tz->_bit32.timecnt;
tmp->_bit32.typecnt = tz->_bit32.typecnt;
tmp->_bit32.charcnt = tz->_bit32.charcnt;
tmp->bit64.ttisgmtcnt = tz->bit64.ttisgmtcnt;
tmp->bit64.ttisstdcnt = tz->bit64.ttisstdcnt;
tmp->bit64.leapcnt = tz->bit64.leapcnt;
tmp->bit64.timecnt = tz->bit64.timecnt;
tmp->bit64.typecnt = tz->bit64.typecnt;
tmp->bit64.charcnt = tz->bit64.charcnt;
if (tz->bit32.timecnt) {
tmp->trans = (int32_t *) timelib_malloc(tz->bit32.timecnt * sizeof(int32_t));
tmp->trans_idx = (unsigned char*) timelib_malloc(tz->bit32.timecnt * sizeof(unsigned char));
memcpy(tmp->trans, tz->trans, tz->bit32.timecnt * sizeof(int32_t));
memcpy(tmp->trans_idx, tz->trans_idx, tz->bit32.timecnt * sizeof(unsigned char));
if (tz->bit64.timecnt) {
tmp->trans = (int64_t *) timelib_malloc(tz->bit64.timecnt * sizeof(int64_t));
tmp->trans_idx = (unsigned char*) timelib_malloc(tz->bit64.timecnt * sizeof(unsigned char));
memcpy(tmp->trans, tz->trans, tz->bit64.timecnt * sizeof(int64_t));
memcpy(tmp->trans_idx, tz->trans_idx, tz->bit64.timecnt * sizeof(unsigned char));
}
tmp->type = (ttinfo*) timelib_malloc(tz->bit32.typecnt * sizeof(ttinfo));
memcpy(tmp->type, tz->type, tz->bit32.typecnt * sizeof(ttinfo));
tmp->type = (ttinfo*) timelib_malloc(tz->bit64.typecnt * sizeof(ttinfo));
memcpy(tmp->type, tz->type, tz->bit64.typecnt * sizeof(ttinfo));
tmp->timezone_abbr = (char*) timelib_malloc(tz->bit32.charcnt);
memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->bit32.charcnt);
tmp->timezone_abbr = (char*) timelib_malloc(tz->bit64.charcnt);
memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->bit64.charcnt);
if (tz->bit32.leapcnt) {
tmp->leap_times = (tlinfo*) timelib_malloc(tz->bit32.leapcnt * sizeof(tlinfo));
memcpy(tmp->leap_times, tz->leap_times, tz->bit32.leapcnt * sizeof(tlinfo));
if (tz->bit64.leapcnt) {
tmp->leap_times = (tlinfo*) timelib_malloc(tz->bit64.leapcnt * sizeof(tlinfo));
memcpy(tmp->leap_times, tz->leap_times, tz->bit64.leapcnt * sizeof(tlinfo));
}
return tmp;
@@ -559,9 +606,9 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
/* If there is no transition time, we pick the first one, if that doesn't
* exist we return NULL */
if (!tz->bit32.timecnt || !tz->trans) {
if (!tz->bit64.timecnt || !tz->trans) {
*transition_time = 0;
if (tz->bit32.typecnt == 1) {
if (tz->bit64.typecnt == 1) {
return &(tz->type[0]);
}
return NULL;
@@ -572,40 +619,30 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
* one in case there are only DST entries. Not sure which smartass came up
* with this idea in the first though :) */
if (ts < tz->trans[0]) {
uint32_t j;
*transition_time = 0;
j = 0;
while (j < tz->bit32.timecnt && tz->type[tz->trans_idx[j]].isdst) {
++j;
}
if (j == tz->bit32.timecnt) {
j = 0;
}
return &(tz->type[tz->trans_idx[j]]);
return &(tz->type[0]);
}
/* In all other cases we loop through the available transition times to find
* the correct entry */
for (i = 0; i < tz->bit32.timecnt; i++) {
for (i = 0; i < tz->bit64.timecnt; i++) {
if (ts < tz->trans[i]) {
*transition_time = tz->trans[i - 1];
return &(tz->type[tz->trans_idx[i - 1]]);
}
}
*transition_time = tz->trans[tz->bit32.timecnt - 1];
return &(tz->type[tz->trans_idx[tz->bit32.timecnt - 1]]);
*transition_time = tz->trans[tz->bit64.timecnt - 1];
return &(tz->type[tz->trans_idx[tz->bit64.timecnt - 1]]);
}
static tlinfo* fetch_leaptime_offset(timelib_tzinfo *tz, timelib_sll ts)
{
int i;
if (!tz->bit32.leapcnt || !tz->leap_times) {
if (!tz->bit64.leapcnt || !tz->leap_times) {
return NULL;
}
for (i = tz->bit32.leapcnt - 1; i > 0; i--) {
for (i = tz->bit64.leapcnt - 1; i > 0; i--) {
if (ts > tz->leap_times[i].trans) {
return &(tz->leap_times[i]);
}
+4 -4
View File
@@ -153,7 +153,7 @@ typedef struct _timelib_tzinfo
uint32_t timecnt;
uint32_t typecnt;
uint32_t charcnt;
} bit32;
} _bit32;
struct {
uint64_t ttisgmtcnt;
uint64_t ttisstdcnt;
@@ -163,7 +163,7 @@ typedef struct _timelib_tzinfo
uint64_t charcnt;
} bit64;
int32_t *trans;
int64_t *trans;
unsigned char *trans_idx;
ttinfo *type;
@@ -322,8 +322,8 @@ typedef struct _timelib_tzdb {
#endif
#define TIMELIB_VERSION 201801
#define TIMELIB_EXTENDED_VERSION 20180104
#define TIMELIB_ASCII_VERSION "2018.01RC2"
#define TIMELIB_EXTENDED_VERSION 20180105
#define TIMELIB_ASCII_VERSION "2018.01RC3"
#define TIMELIB_NONE 0x00
#define TIMELIB_OVERRIDE_TIME 0x01
-80
View File
@@ -1,80 +0,0 @@
dnl
dnl TL_DEF_HAVE(what [, why])
dnl
dnl Generates 'AC_DEFINE(HAVE_WHAT, 1, [WHY])'
dnl
AC_DEFUN([TL_DEF_HAVE],[AC_DEFINE([HAVE_]translit($1,a-z_.-,A-Z___),1,[ $2 ])])dnl
dnl
dnl TL_CHECK_INT_TYPE(type)
dnl
AC_DEFUN([TL_CHECK_INT_TYPE],[
AC_CACHE_CHECK([for $1], ac_cv_int_type_$1, [
AC_TRY_COMPILE([
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
#elif HAVE_STDINT_H
# include <stdint.h>
#endif],
[if (($1 *) 0)
return 0;
if (sizeof ($1))
return 0;
], [ac_cv_int_type_$1=yes], [ac_cv_int_type_$1=no])
])
if test "$ac_cv_int_type_$1" = "yes"; then
TL_DEF_HAVE($1, [Define if $1 type is present.])
fi
])dnl
dnl
dnl AC_TIMELIB_C_BIGENDIAN
dnl Replacement macro for AC_C_BIGENDIAN
dnl
AC_DEFUN([AC_TIMELIB_C_BIGENDIAN],
[AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian_php,
[
ac_cv_c_bigendian_php=unknown
AC_TRY_RUN(
[
int main(void)
{
short one = 1;
char *cp = (char *)&one;
if (*cp == 0) {
return(0);
} else {
return(1);
}
}
], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown])
])
if test $ac_cv_c_bigendian_php = yes; then
AC_DEFINE(WORDS_BIGENDIAN, [], [Define if processor uses big-endian word])
fi
])dnl
dnl Check for types, sizes, etc. needed by timelib
AC_CHECK_SIZEOF(long, 8)
AC_CHECK_SIZEOF(int, 4)
TL_CHECK_INT_TYPE(int32_t)
TL_CHECK_INT_TYPE(uint32_t)
dnl Check for headers needed by timelib
AC_CHECK_HEADERS([ \
sys/time.h \
sys/types.h \
stdint.h \
dirent.h \
string.h \
strings.h \
unistd.h \
io.h
])
dnl Check for strtoll, atoll
AC_CHECK_FUNCS(strtoll atoll strftime gettimeofday)
+1 -1
View File
@@ -123,7 +123,7 @@ struct _ttinfo
struct _tlinfo
{
int32_t trans;
int64_t trans;
int32_t offset;
};
+30916 -30950
View File
File diff suppressed because it is too large. Load diff
+39 -15
View File
@@ -551,6 +551,7 @@ static const zend_function_entry date_funcs_period[] = {
PHP_ME(DatePeriod, getStartDate, NULL, ZEND_ACC_PUBLIC)
PHP_ME(DatePeriod, getEndDate, NULL, ZEND_ACC_PUBLIC)
PHP_ME(DatePeriod, getDateInterval, NULL, ZEND_ACC_PUBLIC)
PHP_ME(DatePeriod, getRecurrences, NULL, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -4032,7 +4033,7 @@ PHP_FUNCTION(timezone_transitions_get)
add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx]); \
add_next_index_zval(return_value, &element);
#define add_last() add(tzobj->tzi.tz->bit32.timecnt - 1, timestamp_begin)
#define add_last() add(tzobj->tzi.tz->bit64.timecnt - 1, timestamp_begin)
array_init(return_value);
@@ -4043,7 +4044,7 @@ PHP_FUNCTION(timezone_transitions_get)
} else {
begin = 0;
found = 0;
if (tzobj->tzi.tz->bit32.timecnt > 0) {
if (tzobj->tzi.tz->bit64.timecnt > 0) {
do {
if (tzobj->tzi.tz->trans[begin] > timestamp_begin) {
if (begin > 0) {
@@ -4055,19 +4056,19 @@ PHP_FUNCTION(timezone_transitions_get)
break;
}
begin++;
} while (begin < tzobj->tzi.tz->bit32.timecnt);
} while (begin < tzobj->tzi.tz->bit64.timecnt);
}
}
if (!found) {
if (tzobj->tzi.tz->bit32.timecnt > 0) {
if (tzobj->tzi.tz->bit64.timecnt > 0) {
add_last();
} else {
add_nominal();
}
} else {
unsigned int i;
for (i = begin; i < tzobj->tzi.tz->bit32.timecnt; ++i) {
for (i = begin; i < tzobj->tzi.tz->bit64.timecnt; ++i) {
if (tzobj->tzi.tz->trans[i] < timestamp_end) {
add(i, tzobj->tzi.tz->trans[i]);
}
@@ -4430,12 +4431,21 @@ PHP_FUNCTION(date_interval_create_from_date_string)
Z_PARAM_STR(time_str)
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_date_instantiate(date_ce_interval, return_value);
time = timelib_strtotime(ZSTR_VAL(time_str), ZSTR_LEN(time_str), &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
if (err->error_count > 0) {
php_error_docref(NULL, E_WARNING, "Unknown or bad format (%s) at position %d (%c): %s", ZSTR_VAL(time_str),
err->error_messages[0].position, err->error_messages[0].character ? err->error_messages[0].character : ' ', err->error_messages[0].message);
RETVAL_FALSE;
goto cleanup;
}
php_date_instantiate(date_ce_interval, return_value);
diobj = Z_PHPINTERVAL_P(return_value);
diobj->diff = timelib_rel_time_clone(&time->relative);
diobj->initialized = 1;
cleanup:
timelib_time_dtor(time);
timelib_error_container_dtor(err);
}
@@ -4721,6 +4731,27 @@ PHP_METHOD(DatePeriod, getDateInterval)
}
/* }}} */
/* {{{ proto int DatePeriod::getRecurrences()
Get recurrences.
*/
PHP_METHOD(DatePeriod, getRecurrences)
{
php_period_obj *dpobj;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
dpobj = Z_PHPPERIOD_P(getThis());
if (0 == dpobj->recurrences - dpobj->include_start_date) {
return;
}
RETURN_LONG(dpobj->recurrences - dpobj->include_start_date);
}
/* }}} */
static int check_id_allowed(char *id, zend_long what) /* {{{ */
{
if (what & PHP_DATE_TIMEZONE_GROUP_AFRICA && strncasecmp(id, "Africa/", 7) == 0) return 1;
@@ -5275,7 +5306,6 @@ PHP_METHOD(DatePeriod, __wakeup)
/* {{{ date_period_read_property */
static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
{
zval *zv;
if (type != BP_VAR_IS && type != BP_VAR_R) {
zend_throw_error(NULL, "Retrieval of DatePeriod properties for modification is unsupported");
return &EG(uninitialized_zval);
@@ -5283,13 +5313,7 @@ static zval *date_period_read_property(zval *object, zval *member, int type, voi
Z_OBJPROP_P(object); /* build properties hash table */
zv = zend_std_read_property(object, member, type, cache_slot, rv);
if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJ_HANDLER_P(zv, clone_obj)) {
/* defensive copy */
ZVAL_OBJ(zv, Z_OBJ_HANDLER_P(zv, clone_obj)(zv));
}
return zv;
return zend_std_read_property(object, member, type, cache_slot, rv);
}
/* }}} */
+1
View File
@@ -111,6 +111,7 @@ PHP_METHOD(DatePeriod, __set_state);
PHP_METHOD(DatePeriod, getStartDate);
PHP_METHOD(DatePeriod, getEndDate);
PHP_METHOD(DatePeriod, getDateInterval);
PHP_METHOD(DatePeriod, getRecurrences);
/* Options and Configuration */
PHP_FUNCTION(date_default_timezone_set);
+16
View File
@@ -8,6 +8,7 @@ $start = new DateTime('2000-01-01 00:00:00', new DateTimeZone('Europe/Berlin'));
$end = new DateTime('2000-01-31 00:00:00', new DateTimeZone('UTC'));
$interval = new DateInterval('P1D');
$period = new DatePeriod($start, $interval, $end);
$recurrences = 4;
var_dump($period->getStartDate()->format('Y-m-d H:i:s'));
var_dump($period->getStartDate()->getTimeZone()->getName());
@@ -16,6 +17,17 @@ var_dump($period->getEndDate()->format('Y-m-d H:i:s'));
var_dump($period->getEndDate()->getTimeZone()->getName());
var_dump($period->getDateInterval()->format('%R%y-%m-%d-%h-%i-%s'));
var_dump($period->getRecurrences());
$periodWithRecurrences = new DatePeriod($start, $interval, $recurrences);
var_dump($periodWithRecurrences->getRecurrences());
var_dump($periodWithRecurrences->getEndDate());
$periodWithRecurrencesWithoutStart = new DatePeriod($start, $interval, $recurrences, DatePeriod::EXCLUDE_START_DATE);
var_dump($periodWithRecurrences->getRecurrences());
?>
--EXPECT--
string(19) "2000-01-01 00:00:00"
@@ -23,3 +35,7 @@ string(13) "Europe/Berlin"
string(19) "2000-01-31 00:00:00"
string(3) "UTC"
string(12) "+0-0-1-0-0-0"
NULL
int(4)
NULL
int(4)
+6 -6
View File
@@ -95,11 +95,11 @@ print "wanted=Friday 00:00:00\n\n";
print "TZ=Pacific/Kwajalein - wrong day.\n";
date_default_timezone_set("Pacific/Kwajalein");
$tStamp = mktime (17, 17, 17, 1, 8626, 1970);
$tStamp = mktime (17, 17, 17, 1, 8627, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Friday", $tStamp);
$strtotime_tstamp = strtotime("next Saturday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Friday 00:00:00\n\n";
print "wanted=Sunday 00:00:00\n\n";
print "TZ=Asia/Ulan_Bator - wrong day.\n";
date_default_timezone_set("Asia/Ulan_Bator");
@@ -256,9 +256,9 @@ result=Friday 2003-04-04 00:00:00 EEST 1
wanted=Friday 00:00:00
TZ=Pacific/Kwajalein - wrong day.
tStamp=Friday 1993-08-13 17:17:17 -12 0
result=Saturday 1993-08-21 00:00:00 +12 0
wanted=Friday 00:00:00
tStamp=Saturday 1993-08-14 17:17:17 -12 0
result=Sunday 1993-08-22 00:00:00 +12 0
wanted=Sunday 00:00:00
TZ=Asia/Ulan_Bator - wrong day.
tStamp=Saturday 2001-09-22 17:17:17 +09 1
+6 -6
View File
@@ -132,11 +132,11 @@ print "wanted=Wednesday 00:15:00\n\n";
print "TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes\n";
date_default_timezone_set('Pacific/Nauru');
$tStamp = mktime (17, 17, 17, 1, 3401, 1970);
$tStamp = mktime (17, 17, 17, 2, 3, 1979);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
$strtotime_tstamp = strtotime("next Saturday +2 hours", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday 00:30:00\n\n";
print "wanted=Saturday 02:30:00\n\n";
print "TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? yes\n";
date_default_timezone_set('Pacific/Niue');
@@ -292,9 +292,9 @@ result=Wednesday 1986-01-01 00:15:00 +0545 0
wanted=Wednesday 00:15:00
TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes
tStamp=Tuesday 1979-04-24 17:17:17 +1130 0
result=Tuesday 1979-05-01 00:30:00 +12 0
wanted=Tuesday 00:30:00
tStamp=Saturday 1979-02-03 17:17:17 +1130 0
result=Saturday 1979-02-10 02:30:00 +12 0
wanted=Saturday 02:30:00
TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? yes
tStamp=Sunday 1978-09-24 17:17:17 -1130 0
@@ -0,0 +1,10 @@
--TEST--
Test date_interval_create_from_date_string() function : nonsense data
--FILE--
<?php
$i = date_interval_create_from_date_string("foobar");
var_dump($i);
?>
--EXPECTF--
Warning: date_interval_create_from_date_string(): Unknown or bad format (foobar) at position 0 (f): The timezone could not be found in the database in %sdate_interval_create_from_date_string_broken.php on line 2
bool(false)
@@ -4,41 +4,9 @@ Test date_interval_create_from_date_string() function : null parameter
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--FILE--
<?php
$i = date_interval_create_from_date_string(null); //returns a empty object
$i = date_interval_create_from_date_string(null);
var_dump($i);
?>
--EXPECTF--
object(DateInterval)#%d (16) {
["y"]=>
int(0)
["m"]=>
int(0)
["d"]=>
int(0)
["h"]=>
int(0)
["i"]=>
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
int(0)
["first_last_day_of"]=>
int(0)
["invert"]=>
int(0)
["days"]=>
int(0)
["special_type"]=>
int(0)
["special_amount"]=>
int(0)
["have_weekday_relative"]=>
int(0)
["have_special_relative"]=>
int(0)
}
Warning: date_interval_create_from_date_string(): Unknown or bad format () at position 0 ( ): Empty string in %sdate_interval_create_from_date_string_nullparam.php on line 2
bool(false)
+3 -3
View File
@@ -3,7 +3,7 @@ date_modify() function [1]
--FILE--
<?php
date_default_timezone_set("Pacific/Kwajalein");
$ts = date_create("Thu Aug 19 1993 23:59:59");
$ts = date_create("Fri Aug 20 1993 23:59:59");
echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
$ts->modify("+1 second");
echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
@@ -20,8 +20,8 @@ $ts->modify("+ 1 hour 1 second");
echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
?>
--EXPECT--
Thu, 19 Aug 1993 23:59:59 -12
Sat, 21 Aug 1993 00:00:00 +12
Fri, 20 Aug 1993 23:59:59 -12
Sun, 22 Aug 1993 00:00:00 +12
Sun, 27 Mar 2005 01:59:59 CET
Sun, 27 Mar 2005 03:00:00 CEST
Sun, 30 Oct 2005 01:59:59 CEST
+53 -25
View File
@@ -2037,10 +2037,10 @@ static int exif_file_sections_free(image_info_type *ImageInfo)
/* {{{ exif_iif_add_value
Add a value to image_info
*/
static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, int motorola_intel)
static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, size_t value_len, int motorola_intel)
{
size_t idex;
void *vptr;
void *vptr, *vptr_end;
image_info_value *info_value;
image_info_data *info_data;
image_info_data *list;
@@ -2062,8 +2062,12 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
switch (format) {
case TAG_FMT_STRING:
if (length > value_len) {
exif_error_docref("exif_iif_add_value" EXIFERR_CC, image_info, E_WARNING, "length > value_len: %d > %zu", length, value_len);
value = NULL;
}
if (value) {
length = php_strnlen(value, length);
length = (int)php_strnlen(value, length);
info_value->s = estrndup(value, length);
info_data->length = length;
} else {
@@ -2085,6 +2089,10 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
if (!length)
break;
case TAG_FMT_UNDEFINED:
if (length > value_len) {
exif_error_docref("exif_iif_add_value" EXIFERR_CC, image_info, E_WARNING, "length > value_len: %d > %zu", length, value_len);
value = NULL;
}
if (value) {
if (tag == TAG_MAKER_NOTE) {
length = (int) php_strnlen(value, length);
@@ -2115,7 +2123,12 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
} else {
info_value = &info_data->value;
}
vptr_end = (char *) value + value_len;
for (idex=0,vptr=value; idex<(size_t)length; idex++,vptr=(char *) vptr + php_tiff_bytes_per_format[format]) {
if ((char *) vptr_end - (char *) vptr < php_tiff_bytes_per_format[format]) {
exif_error_docref("exif_iif_add_value" EXIFERR_CC, image_info, E_WARNING, "Value too short");
break;
}
if (length>1) {
info_value = &info_data->value.list[idex];
}
@@ -2151,7 +2164,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
php_error_docref(NULL, E_WARNING, "Found value of type single");
#endif
info_value->f = *(float *)value;
break;
case TAG_FMT_DOUBLE:
#ifdef EXIF_DEBUG
php_error_docref(NULL, E_WARNING, "Found value of type double");
@@ -2169,9 +2182,9 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
/* {{{ exif_iif_add_tag
Add a tag from IFD to image_info
*/
static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value)
static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value, size_t value_len)
{
exif_iif_add_value(image_info, section_index, name, tag, format, (int)length, value, image_info->motorola_intel);
exif_iif_add_value(image_info, section_index, name, tag, format, (int)length, value, value_len, image_info->motorola_intel);
}
/* }}} */
@@ -2592,7 +2605,7 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
*/
static void exif_process_COM (image_info_type *image_info, char *value, size_t length)
{
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2);
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2, length-2);
}
/* }}} */
@@ -2607,17 +2620,17 @@ static void exif_process_CME (image_info_type *image_info, char *value, size_t l
if (length>3) {
switch(value[2]) {
case 0:
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, length, value);
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, length, value, length);
break;
case 1:
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length, value);
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length, value, length);
break;
default:
php_error_docref(NULL, E_NOTICE, "Undefined JPEG2000 comment encoding");
break;
}
} else {
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, 0, NULL);
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, 0, NULL, 0);
php_error_docref(NULL, E_NOTICE, "JPEG2000 comment section too small");
}
}
@@ -3125,7 +3138,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
break;
}
if (maker_note->offset >= value_len) {
if (value_len < 2 || maker_note->offset >= value_len - 1) {
/* Do not go past the value end */
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data too short: 0x%04X offset 0x%04X", value_len, maker_note->offset);
return FALSE;
@@ -3180,6 +3193,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
#endif
default:
case MN_OFFSET_NORMAL:
data_len = value_len;
break;
}
@@ -3187,6 +3201,10 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 2 + 0x%04X*12 = 0x%04X > 0x%04X", NumDirEntries, 2+NumDirEntries*12, value_len);
return FALSE;
}
if ((dir_start - value_ptr) > value_len - (2+NumDirEntries*12)) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 0x%04X > 0x%04X", (dir_start - value_ptr) + (2+NumDirEntries*12), value_len);
return FALSE;
}
for (de=0;de<NumDirEntries;de++) {
if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
@@ -3208,7 +3226,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table)
{
size_t length;
int tag, format, components;
unsigned int tag, format, components;
char *value_ptr, tagname[64], cbuf[32], *outside=NULL;
size_t byte_count, offset_val, fpos, fgot;
int64_t byte_count_signed;
@@ -3378,6 +3396,10 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
break;
case TAG_USERCOMMENT:
EFREE_IF(ImageInfo->UserComment);
ImageInfo->UserComment = NULL;
EFREE_IF(ImageInfo->UserCommentEncoding);
ImageInfo->UserCommentEncoding = NULL;
ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(ImageInfo->UserCommentEncoding), value_ptr, byte_count);
break;
@@ -3519,7 +3541,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
}
}
}
exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname), tag_table), tag, format, components, value_ptr);
exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname), tag_table), tag, format, components, value_ptr, byte_count);
EFREE_IF(outside);
return TRUE;
}
@@ -3681,10 +3703,10 @@ static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, size_t
size_t l1, l2=0;
if ((l1 = php_strnlen(buffer+2, length-2)) > 0) {
exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2);
exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2, l1);
if (length > 2+l1+1) {
l2 = php_strnlen(buffer+2+l1+1, length-2-l1-1);
exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1);
exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1, l2);
}
}
#ifdef EXIF_DEBUG
@@ -3899,7 +3921,7 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
return FALSE;
marker = c;
length = php_jpg_get16(data+pos);
if (pos+length>=ImageInfo->Thumbnail.size) {
if (length > ImageInfo->Thumbnail.size || pos >= ImageInfo->Thumbnail.size - length) {
return FALSE;
}
#ifdef EXIF_DEBUG
@@ -3920,6 +3942,10 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
case M_SOF14:
case M_SOF15:
/* handle SOFn block */
if (length < 8 || ImageInfo->Thumbnail.size - 8 < pos) {
/* exif_process_SOFn needs 8 bytes */
return FALSE;
}
exif_process_SOFn(data+pos, marker, &sof_info);
ImageInfo->Thumbnail.height = sof_info.height;
ImageInfo->Thumbnail.width = sof_info.width;
@@ -3957,10 +3983,10 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
tag_table_type tag_table = exif_get_tag_table(section_index);
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
return FALSE;
}
return FALSE;
}
if (ImageInfo->FileSize >= dir_offset+2) {
if (ImageInfo->FileSize >= 2 && ImageInfo->FileSize - 2 >= dir_offset) {
sn = exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL);
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, 2);
@@ -3968,8 +3994,8 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
php_stream_seek(ImageInfo->infile, dir_offset, SEEK_SET); /* we do not know the order of sections */
php_stream_read(ImageInfo->infile, (char*)ImageInfo->file.list[sn].data, 2);
num_entries = php_ifd_get16u(ImageInfo->file.list[sn].data, ImageInfo->motorola_intel);
dir_size = 2/*num dir entries*/ +12/*length of entry*/*num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/;
if (ImageInfo->FileSize >= dir_offset+dir_size) {
dir_size = 2/*num dir entries*/ +12/*length of entry*/*(size_t)num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/;
if (ImageInfo->FileSize >= dir_size && ImageInfo->FileSize - dir_size >= dir_offset) {
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X), IFD entries(%d)", ImageInfo->FileSize, dir_offset+2, dir_size-2, num_entries);
#endif
@@ -4052,9 +4078,9 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
}
}
}
if (ImageInfo->FileSize >= dir_offset + ImageInfo->file.list[sn].size) {
if (ImageInfo->FileSize >= ImageInfo->file.list[sn].size && ImageInfo->FileSize - ImageInfo->file.list[sn].size >= dir_offset) {
if (ifd_size > dir_size) {
if (dir_offset + ifd_size > ImageInfo->FileSize) {
if (ImageInfo->FileSize < ifd_size || dir_offset > ImageInfo->FileSize - ifd_size) {
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Error in TIFF: filesize(x%04X) less than size of IFD(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, ifd_size);
return FALSE;
}
@@ -4548,7 +4574,7 @@ PHP_FUNCTION(exif_read_data)
if (ImageInfo.Thumbnail.size) {
if (read_thumbnail) {
/* not exif_iif_add_str : this is a buffer */
exif_iif_add_tag(&ImageInfo, SECTION_THUMBNAIL, "THUMBNAIL", TAG_NONE, TAG_FMT_UNDEFINED, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.data);
exif_iif_add_tag(&ImageInfo, SECTION_THUMBNAIL, "THUMBNAIL", TAG_NONE, TAG_FMT_UNDEFINED, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size);
}
if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
/* try to evaluate if thumbnail data is present */
@@ -4651,7 +4677,9 @@ PHP_FUNCTION(exif_thumbnail)
ZVAL_STRINGL(return_value, ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size);
if (arg_c >= 3) {
if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
exif_scan_thumbnail(&ImageInfo);
if (!exif_scan_thumbnail(&ImageInfo)) {
ImageInfo.Thumbnail.width = ImageInfo.Thumbnail.height = 0;
}
}
zval_ptr_dtor(z_width);
zval_ptr_dtor(z_height);
Binary file not shown.
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug 77540 (Invalid Read on exif_process_SOFn)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
$width = $height = 42;
$s = exif_thumbnail(__DIR__."/bug77540.jpg", $width, $height);
echo "Width ".$width."\n";
echo "Height ".$height."\n";
?>
DONE
--EXPECTF--
Width 0
Height 0
DONE
Binary file not shown.
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug 77563 (Uninitialized read in exif_process_IFD_in_MAKERNOTE)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
$s = exif_thumbnail(__DIR__."/bug77563.jpg");
?>
DONE
--EXPECTF--
Warning: exif_thumbnail(bug77563.jpg): IFD data too short: 0x0009 offset 0x0008 in %s%ebug77563.php on line %d
Warning: exif_thumbnail(bug77563.jpg): File structure corrupted in %s%ebug77563.php on line %d
Warning: exif_thumbnail(bug77563.jpg): Invalid JPEG file in %s%ebug77563.php on line %d
DONE
Binary file not shown.
+18
View File
@@ -0,0 +1,18 @@
--TEST--
Bug 77564 (Memory leak in exif_process_IFD_TAG)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
var_dump(exif_read_data(dirname(__FILE__) . '/bug77564.jpg'));
?>
DONE
--EXPECTF--
Warning: exif_read_data(bug77564.jpg): Illegal IFD offset in %sbug77564.php on line %d
Warning: exif_read_data(bug77564.jpg): File structure corrupted in %sbug77564.php on line %d
Warning: exif_read_data(bug77564.jpg): Invalid JPEG file in %sbug77564.php on line %d
bool(false)
DONE
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #77753 (Heap-buffer-overflow in php_ifd_get32s)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
var_dump(exif_read_data(__DIR__."/bug77753.tiff"));
?>
DONE
--EXPECTF--
%A
Warning: exif_read_data(bug77753.tiff): Illegal IFD size: 0x006A > 0x0065 in %sbug77753.php on line %d
Warning: exif_read_data(bug77753.tiff): Invalid TIFF file in %sbug77753.php on line %d
bool(false)
DONE
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
--TEST--
Bug #77831 (Heap-buffer-overflow in exif_iif_add_value in EXIF)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
var_dump(exif_read_data(__DIR__."/bug77831.tiff"));
?>
DONE
--EXPECTF--
%A
bool(false)
DONE
Binary file not shown.
+144179 -137019
View File
File diff suppressed because it is too large. Load diff
+60 -72
View File
@@ -1,6 +1,6 @@
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
--- libmagic.orig/apprentice.c 2018-03-11 01:46:42.000000000 +0100
+++ libmagic/apprentice.c 2018-11-05 21:33:14.919371593 +0100
+++ libmagic/apprentice.c 2018-11-05 00:16:58.812821826 +0100
@@ -2,7 +2,7 @@
* Copyright (c) Ian F. Darwin 1986-1995.
* Software written by Ian F. Darwin and others;
@@ -1245,7 +1245,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
switch (m->str_flags & PSTRING_LEN) {
diff -u libmagic.orig/apptype.c libmagic/apptype.c
--- libmagic.orig/apptype.c 2011-09-07 23:57:15.000000000 +0200
+++ libmagic/apptype.c 2018-08-10 11:51:05.107276763 +0200
+++ libmagic/apptype.c 2018-08-10 11:46:29.210671445 +0200
@@ -1,15 +1,15 @@
/*
* Adapted from: apptype.c, Written by Eberhard Mattes and put into the
@@ -1280,7 +1280,7 @@ diff -u libmagic.orig/apptype.c libmagic/apptype.c
#include "file.h"
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
--- libmagic.orig/ascmagic.c 2017-11-02 21:25:39.000000000 +0100
+++ libmagic/ascmagic.c 2018-08-10 11:51:05.107276763 +0200
+++ libmagic/ascmagic.c 2018-08-10 11:46:29.210671445 +0200
@@ -90,7 +90,7 @@
rv = file_ascmagic_with_encoding(ms, &bb,
ubuf, ulen, code, type, text);
@@ -1311,7 +1311,7 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
}
diff -u libmagic.orig/buffer.c libmagic/buffer.c
--- libmagic.orig/buffer.c 2018-03-11 01:46:42.000000000 +0100
+++ libmagic/buffer.c 2018-08-10 11:51:05.107276763 +0200
+++ libmagic/buffer.c 2018-08-10 11:46:29.210671445 +0200
@@ -31,7 +31,11 @@
#endif /* lint */
@@ -1362,7 +1362,7 @@ diff -u libmagic.orig/buffer.c libmagic/buffer.c
diff -u libmagic.orig/cdf.c libmagic/cdf.c
--- libmagic.orig/cdf.c 2018-03-11 01:46:42.000000000 +0100
+++ libmagic/cdf.c 2018-08-10 11:51:05.107276763 +0200
+++ libmagic/cdf.c 2018-08-10 11:46:29.214671395 +0200
@@ -43,7 +43,17 @@
#include <err.h>
#endif
@@ -1620,7 +1620,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
#endif
diff -u libmagic.orig/cdf.h libmagic/cdf.h
--- libmagic.orig/cdf.h 2017-03-09 17:57:17.000000000 +0100
+++ libmagic/cdf.h 2018-08-10 11:51:05.107276763 +0200
+++ libmagic/cdf.h 2018-08-10 11:46:29.214671395 +0200
@@ -35,10 +35,10 @@
#ifndef _H_CDF_
#define _H_CDF_
@@ -1646,8 +1646,16 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
--- libmagic.orig/cdf_time.c 2017-03-29 17:57:48.000000000 +0200
+++ libmagic/cdf_time.c 2018-08-10 11:51:05.107276763 +0200
@@ -56,7 +56,7 @@
+++ libmagic/cdf_time.c 2019-03-08 21:00:46.636733574 +0100
@@ -23,6 +23,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "php.h"
#include "file.h"
@@ -56,7 +57,7 @@
for (y = CDF_BASE_YEAR; y < year; y++)
days += isleap(y) + 365;
@@ -1656,7 +1664,7 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
return days;
}
@@ -77,7 +77,7 @@
@@ -77,7 +78,7 @@
return days;
}
@@ -1665,9 +1673,27 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
* Return the 0...11 month number.
*/
static int
@@ -152,7 +153,7 @@
#endif
#ifdef notyet
struct tm tm;
- if (gmtime_r(&ts->ts_sec, &tm) == NULL) {
+ if (php_gmtime_r(&ts->ts_sec, &tm) == NULL) {
errno = EINVAL;
return -1;
}
@@ -168,7 +169,7 @@
char *
cdf_ctime(const time_t *sec, char *buf)
{
- char *ptr = ctime_r(sec, buf);
+ char *ptr = php_ctime_r(sec, buf);
if (ptr != NULL)
return buf;
(void)snprintf(buf, 26, "*Bad* %#16.16" INT64_T_FORMAT "x\n",
diff -u libmagic.orig/compress.c libmagic/compress.c
--- libmagic.orig/compress.c 2017-11-02 21:25:39.000000000 +0100
+++ libmagic/compress.c 2018-08-10 11:51:05.111276714 +0200
+++ libmagic/compress.c 2018-08-10 11:46:29.214671395 +0200
@@ -2,7 +2,7 @@
* Copyright (c) Ian F. Darwin 1986-1995.
* Software written by Ian F. Darwin and others;
@@ -1968,7 +1994,7 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
+#endif /* if PHP_FILEINFO_UNCOMPRESS */
diff -u libmagic.orig/der.c libmagic/der.c
--- libmagic.orig/der.c 2017-02-10 19:14:01.000000000 +0100
+++ libmagic/der.c 2018-08-10 11:51:05.111276714 +0200
+++ libmagic/der.c 2018-08-10 11:46:29.214671395 +0200
@@ -51,7 +51,9 @@
#include "magic.h"
#include "der.h"
@@ -2025,7 +2051,7 @@ diff -u libmagic.orig/der.c libmagic/der.c
der_tag(buf, sizeof(buf), tag), len);
diff -u libmagic.orig/elfclass.h libmagic/elfclass.h
--- libmagic.orig/elfclass.h 2014-12-17 00:18:40.000000000 +0100
+++ libmagic/elfclass.h 2018-08-10 11:51:05.111276714 +0200
+++ libmagic/elfclass.h 2018-08-10 11:46:29.214671395 +0200
@@ -1,7 +1,7 @@
/*
* Copyright (c) Christos Zoulas 2008.
@@ -2073,7 +2099,7 @@ diff -u libmagic.orig/elfclass.h libmagic/elfclass.h
(int)elf_getu16(swap, elfhdr.e_shstrndx),
diff -u libmagic.orig/encoding.c libmagic/encoding.c
--- libmagic.orig/encoding.c 2017-11-02 21:25:39.000000000 +0100
+++ libmagic/encoding.c 2018-08-10 11:51:05.111276714 +0200
+++ libmagic/encoding.c 2018-08-10 11:46:29.214671395 +0200
@@ -88,12 +88,12 @@
*code_mime = "binary";
@@ -2103,7 +2129,7 @@ diff -u libmagic.orig/encoding.c libmagic/encoding.c
}
diff -u libmagic.orig/file.h libmagic/file.h
--- libmagic.orig/file.h 2018-03-11 01:46:42.000000000 +0100
+++ libmagic/file.h 2018-11-05 21:33:14.919371593 +0100
+++ libmagic/file.h 2018-11-05 21:31:59.339653700 +0100
@@ -27,21 +27,15 @@
*/
/*
@@ -2390,7 +2416,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#endif
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
--- libmagic.orig/fsmagic.c 2017-05-24 21:17:50.000000000 +0200
+++ libmagic/fsmagic.c 2018-08-10 11:51:05.111276714 +0200
+++ libmagic/fsmagic.c 2018-08-10 11:46:29.214671395 +0200
@@ -2,7 +2,7 @@
* Copyright (c) Ian F. Darwin 1986-1995.
* Software written by Ian F. Darwin and others;
@@ -2751,7 +2777,7 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
case S_IFSOCK:
diff -u libmagic.orig/funcs.c libmagic/funcs.c
--- libmagic.orig/funcs.c 2017-11-02 21:25:39.000000000 +0100
+++ libmagic/funcs.c 2018-11-05 21:33:14.919371593 +0100
+++ libmagic/funcs.c 2018-11-05 21:31:59.339653700 +0100
@@ -31,7 +31,6 @@
#endif /* lint */
@@ -3136,7 +3162,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
diff -u libmagic.orig/magic.c libmagic/magic.c
--- libmagic.orig/magic.c 2017-08-28 15:39:18.000000000 +0200
+++ libmagic/magic.c 2018-08-10 11:51:05.111276714 +0200
+++ libmagic/magic.c 2018-08-10 11:46:29.214671395 +0200
@@ -25,11 +25,6 @@
* SUCH DAMAGE.
*/
@@ -3612,8 +3638,8 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
public const char *
magic_error(struct magic_set *ms)
diff -u libmagic.orig/magic.h libmagic/magic.h
--- libmagic.orig/magic.h 2018-04-23 20:45:58.824428000 +0200
+++ libmagic/magic.h 2018-08-10 11:51:05.111276714 +0200
--- libmagic.orig/magic.h 2018-11-13 21:40:06.272616270 +0100
+++ libmagic/magic.h 2018-08-10 11:46:29.214671395 +0200
@@ -122,6 +122,7 @@
const char *magic_getpath(const char *, int);
@@ -3624,7 +3650,7 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
diff -u libmagic.orig/print.c libmagic/print.c
--- libmagic.orig/print.c 2017-02-10 19:14:01.000000000 +0100
+++ libmagic/print.c 2018-08-10 11:51:05.111276714 +0200
+++ libmagic/print.c 2019-03-08 21:00:46.636733574 +0100
@@ -2,7 +2,7 @@
* Copyright (c) Ian F. Darwin 1986-1995.
* Software written by Ian F. Darwin and others;
@@ -3643,28 +3669,15 @@ diff -u libmagic.orig/print.c libmagic/print.c
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -28,6 +28,8 @@
@@ -28,6 +28,7 @@
/*
* print.c - debugging printout routines
*/
+#define _GNU_SOURCE
+#include "php.h"
#include "file.h"
@@ -43,6 +45,11 @@
#endif
#include <time.h>
+#ifdef PHP_WIN32
+# define asctime_r php_asctime_r
+# define ctime_r php_ctime_r
+#endif
+
#define SZOF(a) (sizeof(a) / sizeof(a[0]))
#include "cdf.h"
@@ -75,7 +82,7 @@
@@ -75,7 +76,7 @@
if (m->mask_op & FILE_OPINVERSE)
(void) fputc('~', stderr);
@@ -3673,7 +3686,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
if (m->str_flags) {
(void) fputc('/', stderr);
if (m->str_flags & STRING_COMPACT_WHITESPACE)
@@ -215,26 +222,26 @@
@@ -215,18 +216,18 @@
file_magwarn(struct magic_set *ms, const char *f, ...)
{
va_list va;
@@ -3701,51 +3714,26 @@ diff -u libmagic.orig/print.c libmagic/print.c
}
protected const char *
file_fmttime(uint64_t v, int flags, char *buf)
{
char *pp;
- time_t t;
- struct tm *tm, tmz;
+ time_t t = (time_t)v;
+ struct tm *tm = NULL;
if (flags & FILE_T_WINDOWS) {
struct timespec ts;
@@ -247,9 +254,29 @@
@@ -247,13 +248,13 @@
}
if (flags & FILE_T_LOCAL) {
- tm = localtime_r(&t, &tmz);
+ pp = ctime_r(&t, buf);
+ tm = php_localtime_r(&t, &tmz);
} else {
- tm = gmtime_r(&t, &tmz);
+#ifndef HAVE_DAYLIGHT
+ private int daylight = 0;
+#ifdef HAVE_TM_ISDST
+ private time_t now = (time_t)0;
+
+ if (now == (time_t)0) {
+ struct tm *tm1;
+ (void)time(&now);
+ tm1 = localtime(&now);
+ if (tm1 == NULL)
+ goto out;
+ daylight = tm1->tm_isdst;
+ }
+#endif /* HAVE_TM_ISDST */
+#endif /* HAVE_DAYLIGHT */
+ if (daylight)
+ t += 3600;
+ tm = gmtime(&t);
+ if (tm == NULL)
+ goto out;
+ pp = asctime_r(tm, buf);
+ tm = php_gmtime_r(&t, &tmz);
}
if (tm == NULL)
goto out;
- pp = asctime_r(tm, buf);
+ pp = php_asctime_r(tm, buf);
if (pp == NULL)
goto out;
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
--- libmagic.orig/readcdf.c 2017-11-02 21:25:39.000000000 +0100
+++ libmagic/readcdf.c 2018-08-10 11:51:05.111276714 +0200
+++ libmagic/readcdf.c 2018-08-10 11:46:29.214671395 +0200
@@ -31,7 +31,11 @@
#include <assert.h>
@@ -3882,7 +3870,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
if (NOTMIME(ms)) {
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
--- libmagic.orig/softmagic.c 2018-04-15 20:49:15.000000000 +0200
+++ libmagic/softmagic.c 2018-11-10 12:18:21.864916065 +0100
+++ libmagic/softmagic.c 2018-11-11 21:42:27.860274508 +0100
@@ -43,6 +43,10 @@
#include <time.h>
#include "der.h"
@@ -4241,7 +4229,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
case FILE_INDIRECT:
diff -u libmagic.orig/strcasestr.c libmagic/strcasestr.c
--- libmagic.orig/strcasestr.c 2014-05-13 18:48:12.000000000 +0200
+++ libmagic/strcasestr.c 2018-08-10 11:51:05.111276714 +0200
+++ libmagic/strcasestr.c 2018-08-10 11:46:29.214671395 +0200
@@ -39,6 +39,8 @@
#include "file.h"
+3 -2
View File
@@ -23,6 +23,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "php.h"
#include "file.h"
@@ -152,7 +153,7 @@ cdf_timespec_to_timestamp(cdf_timestamp_t *t, const struct timespec *ts)
#endif
#ifdef notyet
struct tm tm;
if (gmtime_r(&ts->ts_sec, &tm) == NULL) {
if (php_gmtime_r(&ts->ts_sec, &tm) == NULL) {
errno = EINVAL;
return -1;
}
@@ -168,7 +169,7 @@ cdf_timespec_to_timestamp(cdf_timestamp_t *t, const struct timespec *ts)
char *
cdf_ctime(const time_t *sec, char *buf)
{
char *ptr = ctime_r(sec, buf);
char *ptr = php_ctime_r(sec, buf);
if (ptr != NULL)
return buf;
(void)snprintf(buf, 26, "*Bad* %#16.16" INT64_T_FORMAT "x\n",
+1 -1
View File
@@ -7,7 +7,7 @@
*
* $Log$
* Revision 2.1 2018/04/26 22:27:12 ab
* Update libmagic to 5.31
* Update libmagic to 5.33
*
* $Log$
* Revision 2.0 2017/10/11 22:27:12 ab
+5 -31
View File
@@ -28,7 +28,6 @@
/*
* print.c - debugging printout routines
*/
#define _GNU_SOURCE
#include "php.h"
#include "file.h"
@@ -45,11 +44,6 @@ FILE_RCSID("@(#)$File: print.c,v 1.82 2017/02/10 18:14:01 christos Exp $")
#endif
#include <time.h>
#ifdef PHP_WIN32
# define asctime_r php_asctime_r
# define ctime_r php_ctime_r
#endif
#define SZOF(a) (sizeof(a) / sizeof(a[0]))
#include "cdf.h"
@@ -240,8 +234,8 @@ protected const char *
file_fmttime(uint64_t v, int flags, char *buf)
{
char *pp;
time_t t = (time_t)v;
struct tm *tm = NULL;
time_t t;
struct tm *tm, tmz;
if (flags & FILE_T_WINDOWS) {
struct timespec ts;
@@ -254,33 +248,13 @@ file_fmttime(uint64_t v, int flags, char *buf)
}
if (flags & FILE_T_LOCAL) {
pp = ctime_r(&t, buf);
tm = php_localtime_r(&t, &tmz);
} else {
#ifndef HAVE_DAYLIGHT
private int daylight = 0;
#ifdef HAVE_TM_ISDST
private time_t now = (time_t)0;
if (now == (time_t)0) {
struct tm *tm1;
(void)time(&now);
tm1 = localtime(&now);
if (tm1 == NULL)
goto out;
daylight = tm1->tm_isdst;
}
#endif /* HAVE_TM_ISDST */
#endif /* HAVE_DAYLIGHT */
if (daylight)
t += 3600;
tm = gmtime(&t);
if (tm == NULL)
goto out;
pp = asctime_r(tm, buf);
tm = php_gmtime_r(&t, &tmz);
}
if (tm == NULL)
goto out;
pp = asctime_r(tm, buf);
pp = php_asctime_r(tm, buf);
if (pp == NULL)
goto out;
-70
View File
@@ -84,76 +84,6 @@ diff -u a/magic/Magdir/c-lang b/magic/Magdir/c-lang
!:strength + 30
!:mime text/x-c++
diff -u a/magic/Magdir/elf b/magic/Magdir/elf
--- a/magic/Magdir/elf 2018-03-11 01:46:42.000000000 +0100
+++ b/magic/Magdir/elf 2018-11-10 12:27:29.858619326 +0100
@@ -48,9 +48,8 @@
!:mime application/x-object
>16 leshort 2 executable,
!:mime application/x-executable
->16 leshort 3 ${x?pie executable:shared object}
-
-!:mime application/x-${x?pie-executable:sharedlib}
+>16 leshort 3 shared object,
+!:mime application/x-sharedlib
>16 leshort 4 core file
!:mime application/x-coredump
# Core file detection is not reliable.
diff -u a/magic/Magdir/fsav b/magic/Magdir/fsav
--- a/magic/Magdir/fsav 2017-03-17 22:35:28.000000000 +0100
+++ b/magic/Magdir/fsav 2018-11-10 12:27:29.858619326 +0100
@@ -48,13 +48,15 @@
>11 string >\0 Clam AntiVirus database %-.23s
>>34 string :
>>>35 string !: \b, version
->>>>35 string x \b%-.1s
->>>>>36 string !:
+>>>>35 string x \b %-.1s
+>>>>>36 string !:
>>>>>>36 string x \b%-.1s
>>>>>>>37 string !:
>>>>>>>>37 string x \b%-.1s
>>>>>>>>>38 string !:
>>>>>>>>>>38 string x \b%-.1s
+>>>>>>>>>>>39 string !:
+>>>>>>>>>>>>39 string x \b%-.1s
>512 string \037\213 \b, gzipped
>769 string ustar\0 \b, tarred
diff -u a/magic/Magdir/images b/magic/Magdir/images
--- a/magic/Magdir/images 2018-03-11 01:46:42.000000000 +0100
+++ b/magic/Magdir/images 2018-11-10 12:27:29.858619326 +0100
@@ -464,7 +464,9 @@
!:mime image/x-unknown
# GIF
+# Strength set up to beat 0x55AA DOS/MBR signature word lookups (+65)
0 string GIF8 GIF image data
+!:strength +80
!:mime image/gif
!:apple 8BIMGIFf
>4 string 7a \b, version 8%s,
Only in b/magic/Magdir/: images.orig
diff -u a/magic/Magdir/linux b/magic/Magdir/linux
--- a/magic/Magdir/linux 2017-03-17 22:35:28.000000000 +0100
+++ b/magic/Magdir/linux 2018-11-10 12:27:29.862619309 +0100
@@ -94,6 +94,16 @@
# From Daniel Novotny <dnovotny@redhat.com>
# swap file for PowerPC
65526 string SWAPSPACE2 Linux/ppc swap file
+>0x400 long x version %d,
+>0x404 long x size %d pages,
+>1052 string \0 no label,
+>1052 string >\0 LABEL=%s,
+>0x40c belong x UUID=%08x
+>0x410 beshort x \b-%04x
+>0x412 beshort x \b-%04x
+>0x414 beshort x \b-%04x
+>0x416 belong x \b-%08x
+>0x41a beshort x \b%04x
16374 string SWAPSPACE2 Linux/ia64 swap file
#
# Linux kernel boot images, from Albert Cahalan <acahalan@cs.uml.edu>
diff -u a/magic/Magdir/python b/magic/Magdir/python
--- a/magic/Magdir/python 2017-08-14 09:40:38.000000000 +0200
+++ b/magic/Magdir/python 2018-11-10 13:06:36.799268528 +0100
+3 -1
View File
@@ -18,7 +18,7 @@ ksort($results);
var_dump($results);
?>
--EXPECTF--
array(9) {
array(%d) {
["%s/resources/dir.zip"]=>
string(15) "application/zip"
["%s/resources/test.awk"]=>
@@ -37,4 +37,6 @@ array(9) {
string(9) "image/png"
["%s/resources/test.ppt"]=>
string(29) "application/vnd.ms-powerpoint"
["%s/resources/test.webm"]=>
string(10) "video/webm"
}
+786 -89
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
Binary file not shown.
+1 -1
View File
@@ -1857,7 +1857,7 @@ data_accepted:
php_pollfd p;
int i;
p.fd = ftp->fd;
p.fd = data->fd;
p.events = (err == SSL_ERROR_WANT_READ) ? (POLLIN|POLLPRI) : POLLOUT;
p.revents = 0;
+23 -5
View File
@@ -1593,7 +1593,7 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
int i, pti;
int lx = 0, ly = 0;
int fx = 0, fy = 0;
int startx, starty, endx, endy;
if ((s % 360) == (e % 360)) {
s = 0; e = 360;
@@ -1620,8 +1620,8 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
for (i = s, pti = 1; i <= e; i++, pti++) {
int x, y;
x = ((long) gdCosT[i % 360] * (long) w / (2 * 1024)) + cx;
y = ((long) gdSinT[i % 360] * (long) h / (2 * 1024)) + cy;
x = endx = ((long) gdCosT[i % 360] * (long) w / (2 * 1024)) + cx;
y = endy = ((long) gdSinT[i % 360] * (long) h / (2 * 1024)) + cy;
if (i != s) {
if (!(style & gdChord)) {
if (style & gdNoFill) {
@@ -1646,8 +1646,8 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
if (!(style & (gdChord | gdNoFill))) {
pts[0].x = cx;
pts[0].y = cy;
pts[pti].x = x;
pts[pti].y = y;
pts[pti].x = startx = x;
pts[pti].y = starty = y;
}
}
lx = x;
@@ -1676,6 +1676,24 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
gdImageLine(im, cx, cy, fx, fy, color);
}
} else {
if (e - s < 360) {
if (pts[1].x != startx && pts[1].y == starty) {
/* start point has been removed due to y-coord fix => insert it */
for (i = pti; i > 1; i--) {
pts[i].x = pts[i-1].x;
pts[i].y = pts[i-1].y;
}
pts[1].x = startx;
pts[1].y = starty;
pti++;
}
if (pts[pti-1].x != endx && pts[pti-1].y == endy) {
/* end point has been removed due to y-coord fix => insert it */
pts[pti].x = endx;
pts[pti].y = endy;
pti++;
}
}
pts[pti].x = cx;
pts[pti].y = cy;
gdImageFilledPolygon(im, pts, pti+1, color);
+2 -2
View File
@@ -813,8 +813,8 @@ static int bmp_read_1bit(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp
}
}
/* The line must be divisible by 4, else its padded with NULLs */
padding = ((int)ceil(0.1 * info->width)) % 4;
/* The line must be aligned on a 32 bits word, else it is padded with zeros */
padding = (info->width + 7) / 8 % 4;
if (padding) {
padding = 4 - padding;
}
+2 -2
View File
@@ -33,8 +33,8 @@ int gdImageColorMatch (gdImagePtr im1, gdImagePtr im2)
return -4; /* At least 1 color must be allocated */
}
buf = (unsigned long *)safe_emalloc(sizeof(unsigned long), 5 * im2->colorsTotal, 0);
memset( buf, 0, sizeof(unsigned long) * 5 * im2->colorsTotal );
buf = (unsigned long *)safe_emalloc(sizeof(unsigned long), 5 * gdMaxColors, 0);
memset( buf, 0, sizeof(unsigned long) * 5 * gdMaxColors );
for (x=0; x<im1->sx; x++) {
for( y=0; y<im1->sy; y++ ) {
Loaded 100 of 327 files, more files were not shown because too many files have changed in this diff. Show more