Compare commits

..
233 Commits
Author SHA1 Message Date
Anatol Belski 249a8fd9ae Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix dir separator in test
2016-03-29 15:50:21 +02:00
Anatol Belski 2b7c1bed1d fix item order 2016-03-29 12:03:01 +02:00
Anatol Belski 8197532f68 fix credit 2016-03-29 12:00:38 +02:00
Anatol Belski a380163014 set versions 2016-03-29 11:56:50 +02:00
Anatol Belski 8b6cf164b8 update NEWS 2016-03-29 11:54:36 +02:00
Stanislav Malyshev 67fbb06311 Merge branch 'PHP-5.5' into PHP-7.0.5
* PHP-5.5:
  Fixed bug #71704 php_snmp_error() Format String Vulnerability
  Fixed bug #71906: AddressSanitizer: negative-size-param (-1) in mbfl_strcut
  Fixed bug #71906: AddressSanitizer: negative-size-param (-1) in mbfl_strcut
  Fix bug #71798 - Integer Overflow in php_raw_url_encode
  Fix bug #71860: Require valid paths for phar filenames
  Going for 5.5.34

Conflicts:
	configure.in
	ext/phar/phar_object.c
	ext/phar/tests/badparameters.phpt
	ext/phar/tests/create_path_error.phpt
	ext/phar/tests/pharfileinfo_construct.phpt
	ext/snmp/snmp.c
	ext/standard/url.c
	main/php_version.h
2016-03-28 23:55:05 -07:00
Stanislav Malyshev 57d170aae0 Merge remote-tracking branch 'security/PHP-7.0.5' into PHP-7.0.5
* security/PHP-7.0.5:
  Fixed bug #71527 Buffer over-write in finfo_open with malformed magic file
  Fix bug #71860: Require valid paths for phar filenames
  update NEWS
  Fixed bug #71704 php_snmp_error() Format String Vulnerability
2016-03-28 23:49:03 -07:00
Anatol Belski 9c19a08b9d Fixed bug #71704 php_snmp_error() Format String Vulnerability
Conflicts:
	ext/snmp/snmp.c
2016-03-28 23:42:19 -07:00
Stanislav Malyshev 3dd82caf57 Merge branch 'PHP-5.5.34' into PHP-5.5
* PHP-5.5.34:
  Fixed bug #71906: AddressSanitizer: negative-size-param (-1) in mbfl_strcut
2016-03-28 23:29:45 -07:00
Stanislav Malyshev f8dd10508b Fixed bug #71906: AddressSanitizer: negative-size-param (-1) in mbfl_strcut 2016-03-28 23:15:16 -07:00
Derick Rethans 2d112e1378 Updated to version 2016.3 (2016c) 2016-03-28 15:31:51 +02:00
Stanislav Malyshev 64f42c73ef Fixed bug #71906: AddressSanitizer: negative-size-param (-1) in mbfl_strcut 2016-03-28 01:22:37 -07:00
Anatol Belski e93c6910fc Fixed bug #71527 Buffer over-write in finfo_open with malformed magic file
The actual fix is applying the upstream patch from
https://github.com/file/file/commit/6713ca45e7757297381f4b4cdb9cf5e624a9ad36
2016-03-28 00:45:19 +02:00
Stanislav Malyshev 95433e8e33 Fix bug #71798 - Integer Overflow in php_raw_url_encode 2016-03-27 14:22:19 -07:00
Anatol Belski 4bbc811ff4 update NEWS 2016-03-23 12:28:48 +01:00
Rasmus Lerdorf 06c2b31866 Disable huge pages in the Zend allocator by default
As per the discussion on internals, this is an expert feature
that needs special system-level configuration and care.
2016-03-23 12:23:35 +01:00
Dmitry Stogov 75dd4a7a50 Added ability to disable huge pages in Zend Memeory Manager through the environment variable USE_ZEND_ALLOC_HUGE_PAGES=0. 2016-03-23 12:23:03 +01:00
Stanislav Malyshev 72281f29dd Fix bug #71860: Require valid paths for phar filenames 2016-03-20 21:33:11 -07:00
Stanislav Malyshev 1e9b175204 Fix bug #71860: Require valid paths for phar filenames 2016-03-20 21:24:12 -07:00
Anatol Belski 884c7d181f update NEWS 2016-03-16 09:50:51 +01:00
Anatol Belski 6e25966544 Fixed bug #71704 php_snmp_error() Format String Vulnerability 2016-03-16 09:48:40 +01:00
Remi Collet ffe82dd775 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix #ifdef usage
2016-03-16 08:11:50 +01:00
Derick Rethans 89919b5ec5 Updated to version 2016.2 (2016b) 2016-03-15 11:17:57 +01:00
Anatol Belski 68a29ccb84 update libs versions 2016-03-15 09:51:47 +01:00
Anatol Belski 7fead8e8f5 set RC1 versions 2016-03-15 08:32:03 +01:00
Anatol Belski 0ce801a587 update NEWS 2016-03-15 07:11:21 +01:00
Sean DuBois 68ebfc87ad Fix bug #71624, PHP_MODE_PROCESS_STDIN (CLI SAPI called with '-R') did not properly set $argi and $argn 2016-03-15 07:02:40 +01:00
Anatol Belski 84651b32eb fix uninitialized value 2016-03-15 06:43:29 +01:00
Anatol Belski 704a9aeea7 fix pointer truncation on 64 bit 2016-03-14 16:44:27 +01:00
Anatol Belski ab7764d99b Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix test
2016-03-14 15:58:05 +01:00
Anatol Belski beda05269c fix test
Many warnings won't appear with libxml2 >= 2.9.3 because in many
cases libxml2 2.9.3 will just abort processing.
2016-03-14 15:53:02 +01:00
Yasuo Ohgaki ec12385f04 Update NEWS
Fixed Bug #71754 Regression in PHP7.0: trivial script segfaults php-cgi
    Fixed Bug #71683 Null pointer dereference in zend_hash_str_find_bucket
    Fixed Bug #71599 trans sid handling rework broke interaction with cookies

    All of these bugs are caused by git global change in PHP-7.0.
2016-03-12 08:52:16 +09:00
Yasuo Ohgaki ca61f5954b Fixed Bug #71754 Regression in PHP7.0: trivial script segfaults php-cgi
Fixed Bug #71683 Null pointer dereference in zend_hash_str_find_bucket
Fixed Bug #71599 trans sid handling rework broke interaction with cookies

All of these bug is caused by git global change in PHP-7.0.
2016-03-12 08:40:37 +09:00
Yasuo Ohgaki 50fca7a02a Fixed Bug #71683 Null pointer dereference in zend_hash_str_find_bucket 2016-03-12 08:15:47 +09:00
Nikita Popov 02743f43c2 Fixed bug #71806 2016-03-11 22:45:38 +01:00
Grigorii Sokolik ccc5150f15 Fix bug #71767 2016-03-11 22:27:48 +01:00
Anatol Belski fca831e8ad update NEWS 2016-03-11 14:23:34 +01:00
Anatol Belski 884f3f0afd Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  update NEWS
2016-03-11 14:23:07 +01:00
Anatol Belski 9d02e3b97e update NEWS 2016-03-11 14:22:11 +01:00
Anatol Belski d26d80ab75 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fix DatePeriod::getEndDate() segfault
2016-03-11 14:12:54 +01:00
Thomas Punt f3f5a07aa5 Fix DatePeriod::getEndDate() segfault 2016-03-11 14:08:48 +01:00
Anatol Belski 741bfe3932 fix build with clang on Winodws 2016-03-10 15:30:20 +01:00
Anatol Belski 8b5d09a195 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix error condition, part of bug #71753
2016-03-10 11:39:16 +01:00
Anatol Belski 8cd903ea68 fix error condition, part of bug #71753 2016-03-10 11:35:50 +01:00
Dmitry Stogov 99c44458da Merge branch 'PHP-7.0' of git.php.net:php-src into PHP-7.0
* 'PHP-7.0' of git.php.net:php-src:
  tsrm_win32_get_path_sid_key might returns NULL (Partially fix bug #71752)
2016-03-10 13:34:41 +03:00
Dmitry Stogov f8506c062f More effecient fix for bug #71756 2016-03-10 13:33:36 +03:00
Anatol Belski 4d4c6cf14e Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  tsrm_win32_get_path_sid_key might returns NULL (Partially fix bug #71752)
2016-03-10 09:35:55 +01:00
Xinchen Hui 67f0770036 tsrm_win32_get_path_sid_key might returns NULL (Partially fix bug #71752)
cherry-picked from 7d5f71b0b1
2016-03-10 09:33:39 +01:00
Anatol Belski 3edd33083c fix invalid pointer on 64-bit 2016-03-10 08:45:29 +01:00
Xinchen Hui 753bbad535 Useless check (part of #71753) 2016-03-10 15:43:22 +08:00
Xinchen Hui a0fac47364 object->ce should not be NULL 2016-03-10 15:26:15 +08:00
Xinchen Hui 351201bc7b Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fixed typo (partially fix for #71753)

Conflicts:
	ext/standard/uuencode.c
2016-03-10 15:23:40 +08:00
Xinchen Hui 915a3762ef Fixed typo (partially fix for #71753) 2016-03-10 15:22:34 +08:00
Xinchen Hui c3cf6f2a68 emalloc never returns NULL (partially fix for #71753) 2016-03-10 15:15:26 +08:00
Xinchen Hui 675c295722 Improve the codes (FETCH_DIM_R/IS is read context, we should not expose IS_REFERENCE) 2016-03-10 15:09:51 +08:00
Xinchen Hui 98c625a31c Fixed bug #71754 (Regression in PHP7.0: trivial script segfaults php-cgi) 2016-03-10 15:02:10 +08:00
Xinchen Hui 9833c76d3f Bug #71756 (Call-by-reference widens scope to uninvolved functions when used in switch) 2016-03-10 14:58:10 +08:00
Xinchen Hui 7d5f71b0b1 tsrm_win32_get_path_sid_key might returns NULL (Partially fix bug #71752) 2016-03-10 14:24:13 +08:00
Nikita Popov 5a6da79fd0 Fix bug #71659 2016-03-09 23:00:53 +01:00
Anatol Belski 86229f9943 fix SKIPIF sections 2016-03-09 14:28:38 +01:00
Anatol Belski a2022fd82a Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix directory separator
2016-03-09 14:17:30 +01:00
Anatol Belski a1d1f54b42 fix directory separator 2016-03-09 14:16:29 +01:00
Xinchen Hui 9aa73d3800 Fixed bug #71729 (Possible crash in zend_bin_strtod, zend_oct_strtod, zend_hex_strtod) 2016-03-09 12:16:24 +08:00
Anatol Belski 7a4c2fa829 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix regression introduced in 5683b6fa39
2016-03-08 13:16:08 +01:00
Anatol Belski 8ca02bb233 fix regression introduced in 5683b6fa39
Test extended. Basically, both iterator type and next node have
to be checked.
2016-03-08 12:59:59 +01:00
Anatol Belski 89a4342507 fix incompatible pointers on 64-bit 2016-03-07 22:01:44 +01:00
Anatol Belski f7e81fd9f1 fix double free and move temps into local scope 2016-03-07 16:38:47 +01:00
Anatol Belski 0fccddba75 add error check 2016-03-07 16:26:01 +01:00
Nikita Popov 860dc17ab7 Fixed bug #71724 2016-03-06 21:38:21 +01:00
Anatol Belski be5bbe7068 fix ibase connection routine
followup on a7028d96
2016-03-04 12:26:25 +01:00
Tjerk Meesters a7028d9671 Fix one zpp usage in interbase
Also small tweak to zpp REAME
2016-03-03 23:50:02 +01:00
Nikita Popov 5602f64213 Eliminate usages of _PP macros
These are either in debug code (fix them), commented out (drop
them) or in dead compatibility macros (drop them).

One usage was in php_stream_get_from_zval(), which we have not used
since at least PHP 5.2 and, judging from the fact that nobody
complained about it causing compile errors in PHP 7, nobody else
uses it either, so drop it.

There are still remaining uses in mysqli embedded and odbc birdstep.
These probably need to be dropped outright.
2016-03-03 23:20:12 +01:00
Nikita Popov 3240dd93b3 Merge branch 'PHP-5.6' into PHP-7.0 2016-03-03 19:27:35 +01:00
Christoph M. Becker 2d4ad66ff2 Fixed bug #69953
Added support for MKCALENDAR request method in CLI web server.
2016-03-03 19:22:38 +01:00
Nikita Popov 159602bd86 Merge branch 'PHP-5.6' into PHP-7.0 2016-03-03 17:29:58 +01:00
Anton Blanchard ccd215a517 Additional improvements to crypt() detection code
Reformat to normalize tabs vs spaces, return 1 if crypt.h not
defined, fix C99 compliance.
2016-03-03 17:28:34 +01:00
Nikita Popov 5a01605b4b Merge branch 'PHP-5.6' into PHP-7.0 2016-03-03 17:14:18 +01:00
Michael Orlitzky 08fce8e2c5 ext/standard/config.m4: fix crypt() test segfaults in >=glibc-2.17.
Starting with glibc-2.17, the crypt() function will report an EINVAL
and return NULL when the format of the "salt" parameter is
invalid. The current tests for crypt() pass its result to strcmp(),
causing segfaults when the value returned from crypt() is NULL.

This commit modifies the test programs to exit with failure when
crypt() returns NULL.

Reference: https://bugs.gentoo.org/show_bug.cgi?id=518964
2016-03-03 17:12:57 +01:00
Nikita Popov 1ac152938c Move semicolon into TSRMLS_CACHE_EXTERN/DEFINE
Also re bug #71575.
2016-03-03 16:50:01 +01:00
James Titcumb c4b188871e Fix bug #71575 removing extra semicolons outside macros 2016-03-03 16:41:03 +01:00
Nikita Popov 5527c5b083 Merge branch 'PHP-5.6' into PHP-7.0 2016-03-03 16:38:13 +01:00
Nikita Popov a4e56194d7 Fix intermixed SKIPIF and XFAIL sections in test 2016-03-03 16:38:05 +01:00
Nikita Popov bdd578fcbb Disable upload_2G test on travis 2016-03-03 16:35:45 +01:00
Anatol Belski 4f0042bead Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  show correct MINFO with libpq >= 9.5.x
2016-03-02 17:05:05 +01:00
Anatol Belski 2399c64eaf show correct MINFO with libpq >= 9.5.x 2016-03-02 17:03:20 +01:00
Dmitry Stogov 908b662f7f PHP-7 zend_call_function() doesn't support symbol_table substitution 2016-03-02 16:56:39 +03:00
Dmitry Stogov b6bbe33f05 Better fix for IS_INDIRECT support in zend_hash_merge() 2016-03-02 15:09:04 +03:00
Julien Pauli 914d33c40e Going for 5.5.34 2016-03-02 11:02:42 +01:00
Dmitry Stogov afedd4fd59 Fixed test (sizeof(zend_string) is different on 32 and 64-bit systems) 2016-03-02 13:01:42 +03:00
Dmitry Stogov ab800642df Introduce zend_symtable_exists_ind() for API consistency 2016-03-02 11:53:47 +03:00
Stanislav Malyshev 1ce0ea7396 fix wddx merge 2016-03-02 00:02:33 -08:00
Stanislav Malyshev 6823ee923d Update NEWS 2016-03-01 23:09:47 -08:00
Stanislav Malyshev 22d8e9aced Merge branch 'PHP-7.0.4' into PHP-7.0
* PHP-7.0.4: (21 commits)
  update NEWS
  fix test file
  Fix version
  update NEWS
  Update NEWS
  Fix bug #71610: Type Confusion Vulnerability - SOAP / make_http_soap_request()
  Fix bug #71637: Multiple Heap Overflow due to integer overflows
  extend check for add_flag
  Fixed another segfault with file_cache_only now
  set version
  fix nmake clean in phpize mode
  Fixed segfault with file_cache_only
  Fixed possible crash at PCRE on MSHUTDOWN
  Fixed more synchronisation issues during SHM reload
  Set proper type flags (REFCOUNTED and COPYABLE) according to interned or regular string
  sync with improvements in NEWS
  Fixed process synchronisation problem, that may cause crashes after opcache restart
  Fix bug #71498: Out-of-Bound Read in phar_parse_zipfile()
  fix ts buld
  prep for 5.6.19RC1
  ...

Conflicts:
	configure.in
	main/php_version.h
2016-03-01 23:08:19 -08:00
Stanislav Malyshev 499c1e81a1 Merge branch 'PHP-7.0' of git.php.net:php-src into PHP-7.0
* 'PHP-7.0' of git.php.net:php-src:
  limit size of result set so unit test runs reliably
2016-03-01 23:07:49 -08:00
Stanislav Malyshev c69d80d701 update NEWS 2016-03-01 23:07:32 -08:00
Stanislav Malyshev 90a0cbd594 Merge branch 'PHP-5.6.19' into PHP-7.0.4
* PHP-5.6.19:
  fix test file
  Fix version
  update NEWS
  Update NEWS
  Fix bug #71498: Out-of-Bound Read in phar_parse_zipfile()
  fix ts buld
  prep for 5.6.19RC1
  5.6.20 is next
  Fixed bug #71587 - Use-After-Free / Double-Free in WDDX Deserialize

Conflicts:
	configure.in
	ext/wddx/wddx.c
	main/php_version.h
2016-03-01 23:01:48 -08:00
Stanislav Malyshev b3bb1aacfe Merge branch 'PHP-5.6.19' into PHP-5.6
* PHP-5.6.19:
  fix test file
  Fix version
  Update NEWS
2016-03-01 22:56:08 -08:00
Stanislav Malyshev 6e6a556b8c Merge branch 'PHP-5.5' into PHP-5.6.19
* PHP-5.5:
  fix test file
  Fix version
  Update NEWS
2016-03-01 22:55:49 -08:00
Stanislav Malyshev 3c8ccdd9d3 fix test file 2016-03-01 22:55:02 -08:00
Stanislav Malyshev 54df59b729 Fix version 2016-03-01 22:47:27 -08:00
Stanislav Malyshev ae3f132be1 Merge branch 'PHP-5.6.19' into PHP-5.6
* PHP-5.6.19:
  update NEWS
  Fix bug #71498: Out-of-Bound Read in phar_parse_zipfile()
  fix ts buld
  prep for 5.6.19RC1
  Fixed bug #71587 - Use-After-Free / Double-Free in WDDX Deserialize
2016-03-01 22:42:16 -08:00
Stanislav Malyshev a0bbac550e update NEWS 2016-03-01 22:41:10 -08:00
Stanislav Malyshev 91990bbde0 Merge branch 'PHP-5.5.33' into PHP-5.6.19
* PHP-5.5.33:
  Fix bug #71498: Out-of-Bound Read in phar_parse_zipfile()
  Fixed bug #71587 - Use-After-Free / Double-Free in WDDX Deserialize
2016-03-01 22:40:00 -08:00
Stanislav Malyshev 153a44d6bb Update NEWS 2016-03-01 22:37:23 -08:00
Stanislav Malyshev 07b6fc93b1 Fix bug #71610: Type Confusion Vulnerability - SOAP / make_http_soap_request() 2016-03-01 22:32:38 -08:00
Stanislav Malyshev 9cabc99fce Fix bug #71637: Multiple Heap Overflow due to integer overflows 2016-03-01 22:32:38 -08:00
Xinchen Hui db68b8ea54 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  limit size of result set so unit test runs reliably
2016-03-02 14:27:09 +08:00
Xinchen Hui 20add1e530 Merge branch 'PHP-5.6-bug_69757' of https://github.com/wayfair/php-src into PHP-5.6
* 'PHP-5.6-bug_69757' of https://github.com/wayfair/php-src:
  limit size of result set so unit test runs reliably
2016-03-02 14:26:34 +08:00
Stanislav Malyshev 6f8585fc7d Merge branch 'PHP-7.0.4' into PHP-7.0
* PHP-7.0.4:
  Fix bug #71610: Type Confusion Vulnerability - SOAP / make_http_soap_request()
  Fix bug #71637: Multiple Heap Overflow due to integer overflows
  set versions

Conflicts:
	configure.in
	main/php_version.h
2016-03-01 22:22:47 -08:00
Xinchen Hui 3fb566f475 Fixed test ext/readline/tests/readline_read_history_error_001.phpt
This only pass with libedit
2016-03-02 12:29:15 +08:00
Xinchen Hui 2d4186dde7 Use hash_exists_ind in symbol table 2016-03-02 12:11:13 +08:00
Nikita Popov 726e87e142 Merge branch 'PHP-5.6' into PHP-7.0 2016-03-02 00:37:40 +01:00
Nikita Popov 471540d285 Fix intermittent failure of bug_68819_002.phpt
The test used rand(32, 127) to select the character, however
chr(127) results in "data" instead of the expected result, so this
test would fail in something like 1% of the runs.

Replace rand() with fixed character "a".
2016-03-02 00:34:36 +01:00
Nikita Popov dea2e1bc64 Merge branch 'PHP-5.6' into PHP-7.0 2016-03-01 23:32:47 +01:00
mpyw 0bbea60524 Fix bug #71694
Exports contants CURLM_ADDED_ALREADY.
2016-03-01 23:31:58 +01:00
Adam Baratz 2e18d438b0 limit size of result set so unit test runs reliably 2016-03-01 17:15:36 -05:00
Xinchen Hui 961c8d568d Maybe we should introduce a symtable_exists_ind 2016-03-01 20:01:02 +08:00
Xinchen Hui 996760f104 Merge branch 'PHP-7.0' of git.php.net:/php-src into PHP-7.0
* 'PHP-7.0' of git.php.net:/php-src:
  remove unused vars
  fix possible pointer truncation on win64
  Updated NEWS
  extend check for add_flag
  LDAP - Added support to change the certificates verification
2016-03-01 19:20:57 +08:00
Xinchen Hui 186844be92 Fixed bug #71695 (Global variables are reserved before execution).
Instead of slow down hash_merge, we may also check the array(whether it
contains INDIRECT) outside of the loop, however, consisdering hash_merge
is not widly used, I prefer fix this in the current way to keep the
codes simple
2016-03-01 19:19:07 +08:00
Anatol Belski 655e5dd99d remove unused vars 2016-03-01 10:52:49 +01:00
Anatol Belski acbbe76d7b fix possible pointer truncation on win64 2016-03-01 10:51:55 +01:00
Côme Bernigaud afcce5ceca Updated NEWS 2016-03-01 09:56:19 +01:00
Anatol Belski bb80c00a00 extend check for add_flag 2016-03-01 09:37:50 +01:00
Anatol Belski 0df2575e9f extend check for add_flag 2016-03-01 09:36:07 +01:00
Xinchen Hui 08af2f9a11 Fixed another segfault with file_cache_only now 2016-03-01 08:21:14 +01:00
Edwin Hoksberg ba96506676 LDAP - Added support to change the certificates verification 2016-03-01 04:59:30 +01:00
Xinchen Hui 9fc0517328 Fixed another segfault with file_cache_only now 2016-03-01 10:50:56 +08:00
Nikita Popov a6afaa9a85 Merge branch 'PHP-5.6' into PHP-7.0
Conflicts:
	ext/phar/tar.c
2016-02-29 22:44:46 +01:00
Jos Elstgeest 50b4cafd28 Fixed bugs #71317 and #71504
If there are duplicate filenames in tar, the last one wins.
2016-02-29 22:34:35 +01:00
Anatol Belski 4a66b01639 set version 2016-02-29 20:44:00 +01:00
Anatol Belski 31dc08a904 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  add test for bug #68957
2016-02-29 18:44:15 +01:00
Anatol Belski d78220fb2c add test for bug #68957 2016-02-29 18:43:03 +01:00
Anatol Belski 7a14a286bd update NEWS 2016-02-29 18:26:48 +01:00
Anatol Belski 128cc4bc9d Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  update NEWS
2016-02-29 18:26:08 +01:00
Anatol Belski c49d9f0684 update NEWS 2016-02-29 18:25:16 +01:00
Anatol Belski 56ab4a6096 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fixed #54648 PDO::MSSQL forces format of datetime fields
2016-02-29 17:07:05 +01:00
Anatol Belski 53c036b30b Fixed #54648 PDO::MSSQL forces format of datetime fields
adopted patch by steven dot lambeth at gmx dot de
2016-02-29 17:04:49 +01:00
Anatol Belski 44c3f1492f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  remove unneeded free parts
2016-02-29 16:30:33 +01:00
Anatol Belski 7816698580 remove unneeded free parts
See bug #71667, free_statement already does the job
2016-02-29 16:26:46 +01:00
Anatol Belski f806fedd80 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix leaks and add one more NULL check
  add NULL check
  fix C89 compat
  fix arg type
2016-02-29 15:48:51 +01:00
Anatol Belski d7fd614cc6 fix leaks and add one more NULL check 2016-02-29 15:38:42 +01:00
Anatol Belski a310c3b484 add NULL check 2016-02-29 15:26:57 +01:00
Anatol Belski efaafd45b4 fix C89 compat 2016-02-29 15:24:31 +01:00
Anatol Belski 35be4398d1 fix arg type 2016-02-29 15:23:53 +01:00
Anatol Belski 273bb7e9c0 fix nmake clean in phpize mode 2016-02-29 14:58:49 +01:00
Anatol Belski 9ccf3a0292 fix nmake clean in phpize mode 2016-02-29 11:00:09 +01:00
Xinchen Hui b79b036a31 The test self should be fixed(maybe relates to env?)
Revert "Fixed test ext/readline/tests/readline_read_history_error_001.phpt"

This reverts commit 69e26f9f8f.
2016-02-29 15:19:18 +08:00
Xinchen Hui d0b3a72cea Merge branch 'PHP-7.0' of git.php.net:/php-src into PHP-7.0
* 'PHP-7.0' of git.php.net:/php-src:
  test fixes
  update NEWS
  Fix bug #71536 Access Violation crashes php-cgi.exe
2016-02-29 15:07:38 +08:00
Xinchen Hui 69e26f9f8f Fixed test ext/readline/tests/readline_read_history_error_001.phpt 2016-02-29 15:07:19 +08:00
Xinchen Hui 6adfc20f04 Fixed segfault with file_cache_only 2016-02-28 15:54:01 +01:00
Anatol Belski f738abab85 test fixes 2016-02-28 11:53:21 +01:00
Anatol Belski 0ac0604b30 update NEWS 2016-02-28 11:06:55 +01:00
Anatol Belski 93592a9c08 Fix bug #71536 Access Violation crashes php-cgi.exe 2016-02-28 11:02:01 +01:00
Xinchen Hui 8c053d44e4 Fixed segfault with file_cache_only 2016-02-28 11:50:06 +08:00
Dmitry Stogov e2bf86fbfd Fixed possible crash at PCRE on MSHUTDOWN 2016-02-26 15:14:20 +01:00
Dmitry Stogov ecea7d3d35 Fixed more synchronisation issues during SHM reload 2016-02-26 15:14:01 +01:00
Dmitry Stogov e65cc72cb6 Set proper type flags (REFCOUNTED and COPYABLE) according to interned or regular string 2016-02-26 15:13:48 +01:00
Xinchen Hui c299b272c7 Fixed bug #71660 (array_column behaves incorrectly after foreach by reference) 2016-02-25 16:07:22 +08:00
Nikita Popov fd561505f4 Fix construction of AO with overloaded object error
a) Fix uses of zend_string in error message
b) Don't assign the overloaded object as the backing storage, that
   sort of defeats the point. Instead leave the previous value.
2016-02-24 22:34:50 +01:00
Nikita Popov 0aa7163816 Fix AO object properties separation 2016-02-24 22:34:50 +01:00
Nikita Popov 079f2f7eb3 Forbid exchangeArray() during sorting
Previously this would leak.
2016-02-24 22:34:50 +01:00
Nikita Popov b657554585 Fix typo in foreach_017.phpt 2016-02-24 22:34:50 +01:00
Dmitry Stogov 6842a3674d Fixed possible crash at PCRE on MSHUTDOWN 2016-02-24 23:46:11 +03:00
Dmitry Stogov 43366f8ba8 Fixed more synchronisation issues during SHM reload 2016-02-24 21:15:53 +03:00
Nikita Popov eb885e9d6e Fix leak on assignment to illegal AO offset 2016-02-24 17:39:16 +01:00
Nikita Popov ea02f57656 Don't use ht applyCount for AO sorting protection
Instead use the AOs own applyCount that just got freed up. Using the
apply count of the HashTable has various side effects, e.g. preventing
the ArrayObject from being dumped.
2016-02-24 17:18:07 +01:00
Nikita Popov 38db6ff306 Remove recursion checks from AO get_properties
These are pointless, there is no recursion (of that kind) happening
there.
2016-02-24 17:10:28 +01:00
Nikita Popov 3ea877ca15 Fix "Call to member function on unknown"
Should be "on null".
2016-02-24 17:00:25 +01:00
Nikita Popov d1057cc139 Fixed bug #71470
Don't report hashtable iterator leaks on unclean shutdown, those
are expected.
2016-02-24 14:09:03 +01:00
Anatol Belski bb2856b28c fix NEWS 2016-02-24 12:29:23 +01:00
Remi Collet 17967ecda1 fix NEWS 2016-02-24 12:26:25 +01:00
Anatol Belski f14c0cc43a sync with improvements in NEWS 2016-02-24 12:23:26 +01:00
Anatol Belski f463297c51 update NEWS 2016-02-24 12:06:35 +01:00
Anatol Belski c9778d3eb9 Port patch and test for bug #47803 to 7.0
See ff115e285a
2016-02-24 12:03:21 +01:00
Anatol Belski 6e1862d0a8 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  update NEWS
  add test for bug #47803
  Fixed bug #47803
2016-02-24 11:57:15 +01:00
Anatol Belski 7d7325246c update NEWS 2016-02-24 11:56:12 +01:00
Anatol Belski 90ad6e3c6c add test for bug #47803 2016-02-24 11:49:02 +01:00
Anatol Belski ff115e285a Fixed bug #47803
Executing prepared statements is succesfull only for the first two statements

The reworked patch descends to the bug #69526 which is fixed by
this as well. The broken logic in the current code was, that
SQLDescribeParam was executed in odbc_execute every time. This piece
is now moved into odbc_prepare and the results are carried on in an
additional structure.

Since the ext/odbc headers are not being currently installed and the
corresponding structs like odbc_result are not used outside ext/odbc,
the binary compatibility persists. Executing SQLDescribeParam only once
in odbc_prepare is also an optimization as the filds usually won't
change that fast and thus requestind the descriptions on every
execution is not required.
2016-02-24 11:40:35 +01:00
Dmitry Stogov ca779add4d Fixed process synchronisation problem, that may cause crashes after opcache restart 2016-02-24 10:54:37 +01:00
Dmitry Stogov 0b9c87a02b Fixed bug #71535 (Integer overflow in zend_mm_alloc_heap()) 2016-02-24 11:04:48 +03:00
Anatol Belski 01e85f3fdc add test for bug #71171 2016-02-23 14:39:17 +01:00
Anatol Belski cd75429ad8 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  make ext/odbc test credentials configurable
2016-02-23 14:22:06 +01:00
Anatol Belski 9623d2dd83 make ext/odbc test credentials configurable 2016-02-23 14:21:04 +01:00
Remi Collet 18e3b11d62 missing include 2016-02-22 18:45:18 +01:00
Remi Collet 0d57c06b2c update bundled libzip to 1.1.2 2016-02-22 18:18:30 +01:00
Nikita Popov 78b29310bc Remove check_std_props arg from get_hash_table
get_properties() is the only place using it, so handle it only
there.
2016-02-22 13:09:54 +01:00
Nikita Popov 3f5c80e8c2 Don't recurse into USE_OTHER checking STD_PROP_LIST
If STD_PROP_LIST is explicitly disabled in the constructor, it
should really be disabled.
2016-02-22 13:04:19 +01:00
Nikita Popov 6c2ca18fe0 Fix typo in previous commit
Happened to be correct because array is the first member, but
definitely not what I wanted...
2016-02-22 12:39:07 +01:00
Nikita Popov fd6ac61064 Fix ArrayObject clone for certain USE_OTHER cases
We can't simply use HASH_OF, need to use the usual hash table
getter.
2016-02-22 12:35:00 +01:00
Nikita Popov 32e2801ff9 Use USE_OTHER for ArrayIterator cloning
intern->array should never be an array with refcount 2.
2016-02-22 12:35:00 +01:00
Remi Collet e8385a60b3 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  cleanup $Id
2016-02-22 09:26:14 +01:00
Remi Collet d20f1d8f1f cleanup $Id 2016-02-22 09:26:00 +01:00
Stanislav Malyshev eaf4e77190 Fix bug #71610: Type Confusion Vulnerability - SOAP / make_http_soap_request() 2016-02-21 23:45:57 -08:00
Stanislav Malyshev 57b997ebf9 Fix bug #71637: Multiple Heap Overflow due to integer overflows 2016-02-21 23:14:29 -08:00
Stanislav Malyshev d25e67eee6 Fix bug #71629: sync php_url_decode definition 2016-02-21 17:11:34 -08:00
Stanislav Malyshev a6fdc5bb27 Fix bug #71498: Out-of-Bound Read in phar_parse_zipfile() 2016-02-21 16:51:05 -08:00
Nikita Popov 0bd64b50b8 Fixed bug #71617 2016-02-21 13:00:37 +01:00
Remi Collet 2ecc0c1085 cleanup, ext/json is simple PHP now 2016-02-20 17:42:53 +01:00
Andrea Faulds a50c31da19 Test that mt_rand() consistently produces the wrong results
See 6f6bd8ce53 and its revert,
a0724d3081.
2016-02-18 22:35:44 +00:00
Dmitry Stogov 796e1629b0 Set proper type flags (REFCOUNTED and COPYABLE) according to interned or regular string 2016-02-18 23:15:38 +03:00
Dmitry Stogov 25fbb06e2d Better fix for bug #71622 (Strings used in pass-as-reference cannot be used to invoke C::$callable()) 2016-02-18 23:14:46 +03:00
Anatol Belski 830b2bd368 refix broken 20ca0b89bd 2016-02-18 19:51:18 +01:00
Anatol Belski 9ac01060f9 Merge branch 'PHP-7.0' of git.php.net:php-src into PHP-7.0 2016-02-18 19:44:58 +01:00
Anatol Belski 7f7dce3cd6 update NEWS 2016-02-18 19:43:27 +01:00
Anatol Belski bbaece44ee Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  update NEWS
2016-02-18 19:43:03 +01:00
Anatol Belski bbce94ed78 update NEWS 2016-02-18 19:42:18 +01:00
Anatol Belski b3df715f50 add test for bug #71625, 7 variant 2016-02-18 19:40:17 +01:00
Anatol Belski 4564b4c8f6 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  add test for bug #71625
2016-02-18 19:39:30 +01:00
Anatol Belski 688b914217 add test for bug #71625 2016-02-18 19:38:39 +01:00
Rasmus Lerdorf 20ca0b89bd Fix typo 2016-02-18 10:35:53 -08:00
Anatol Belski 9a5797976a Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fixed bug #71625 Crash in php7.dll with bad phar filename
2016-02-18 19:33:27 +01:00
Anatol Belski 0445abd547 Fixed bug #71625 Crash in php7.dll with bad phar filename 2016-02-18 19:32:08 +01:00
Anatol Belski 150e3804b9 update NEWS 2016-02-18 19:17:54 +01:00
Anatol Belski 148eba2afd Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  update NEWS
2016-02-18 19:17:22 +01:00
Anatol Belski f613d89501 update NEWS 2016-02-18 19:16:39 +01:00
Anatol Belski 4b5cce269b Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Bug #71596 Segmentation fault on ZTS with date function (setlocale)
2016-02-18 19:14:22 +01:00
Anatol Belski 632fc51d98 Bug #71596 Segmentation fault on ZTS with date function (setlocale) 2016-02-18 19:13:07 +01:00
Bob Weinand 3ce6ad9d13 Fixed bug #71622 (Strings used in pass-as-reference cannot be used to invoke C::$callable()) 2016-02-18 13:53:15 +01:00
Leigh a0724d3081 Revert "Fix #71152: mt_rand() returns the different values from original mt19937ar.c"
This reverts commit 6f6bd8ce53.

`mt_rand()` is seedable with `mt_srand()` which means it can be used to (re)produce specific streams of numbers. All code (no matter how few instances that may be) that previously depended on this behaviour will no longer produce the same results.

This kind of change needs to be discussed before being committed.
2016-02-18 11:09:01 +00:00
Anatol Belski 68a51ae953 fix ts buld 2016-02-18 10:31:24 +01:00
Lior Kaplan aa383d633e Sort 7.0.4 extensions by name, merge FPM entries 2016-02-18 11:24:03 +02:00
Stanislav Malyshev 9afb29aa68 Remove TSRMLS_* from code, they are not used anymore 2016-02-17 22:44:05 -08:00
Stanislav Malyshev cf842f1064 Remove TSRMLS_* from docs as it's not used anymore 2016-02-17 22:36:01 -08:00
Anatol Belski 491925bc53 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix ts buld
2016-02-18 07:12:42 +01:00
Anatol Belski a329dc70e9 fix ts buld 2016-02-18 07:11:36 +01:00
Ferenc Kovacs c3eeb8092a prep for 5.6.19RC1 2016-02-18 01:26:18 +01:00
Ferenc Kovacs e87ac6de31 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  5.6.20 is next
2016-02-18 00:32:15 +01:00
Ferenc Kovacs 4762ed4d27 5.6.20 is next 2016-02-18 00:31:18 +01:00
Bob Weinand 055b411218 Fix crash when advancing inside an internal function
This just happened in the "double ctrl+c" mode, when we halted inside an internal function; there was some code assuming a proper op_array
2016-02-17 20:27:46 +01:00
Dmitry Stogov d228752939 Fixed process synchronisation problem, that may cause crashes after opcache restart 2016-02-17 13:58:05 +03:00
kusano 6f6bd8ce53 Fix #71152: mt_rand() returns the different values from original mt19937ar.c 2016-02-17 11:32:59 +08:00
Anatol Belski 837e2a912d prepare next 2016-02-16 09:14:05 +01:00
Stanislav Malyshev b1bd4119bc Fixed bug #71587 - Use-After-Free / Double-Free in WDDX Deserialize 2016-02-14 22:34:39 -08:00
281 changed files with 5513 additions and 3028 deletions

No files matched your search

+1 -1
View File
@@ -178,7 +178,7 @@ Internal Function Naming Convensions
Unexposed module function should be static and should not be defined in
'php_modulename.h'.
static int php_session_destroy(TSRMLS_D)
static int php_session_destroy()
2. Main module source file must be named 'modulename.c'.
+119 -22
View File
@@ -1,33 +1,138 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
18 Feb 2016 PHP 7.0.4RC1
31 Mar 2016 PHP 7.0.5
- Core:
. Huge pages disabled by default. (Rasmus)
. Added ability to enable huge pages in Zend Memory Manager through
the environment variable USE_ZEND_ALLOC_HUGE_PAGES=1. (Dmitry)
. Fixed bug #71756 (Call-by-reference widens scope to uninvolved functions
when used in switch). (Laruence)
. Fixed bug #71729 (Possible crash in zend_bin_strtod, zend_oct_strtod,
zend_hex_strtod). (Laruence)
. Fixed bug #71695 (Global variables are reserved before execution).
(Laruence)
. Fixed bug #71629 (Out-of-bounds access in php_url_decode in context
php_stream_url_wrap_rfc2397). (mt at debian dot org)
. Fixed bug #71622 (Strings used in pass-as-reference cannot be used to
invoke C::$callable()). (Bob)
. Fixed bug #71596 (Segmentation fault on ZTS with date function
(setlocale)). (Anatol)
. Fixed bug #71535 (Integer overflow in zend_mm_alloc_heap()). (Dmitry)
. Fixed bug #71470 (Leaked 1 hashtable iterators). (Nikita)
. Fixed bug #71575 (ISO C does not allow extra ‘;’ outside of a function).
(asgrim)
. Fixed bug #71724 (yield from does not count EOLs). (Nikita)
. Fixed bug #71767 (ReflectionMethod::getDocComment returns the wrong
comment). (Grigorii Sokolik)
. Fixed bug #71806 (php_strip_whitespace() fails on some numerical values).
(Nikita)
. Fixed bug #71624 (`php -R` (PHP_MODE_PROCESS_STDIN) is broken).
(Sean DuBois)
- CLI Server:
. Fixed bug #69953 (Support MKCALENDAR request method). (Christoph)
- Curl:
. Fixed bug #71694 (Support constant CURLM_ADDED_ALREADY). (mpyw)
- Date:
. Fixed bug #71635 (DatePeriod::getEndDate segfault). (Thomas Punt)
- Fileinfo:
. Fixed bug #71527 (Buffer over-write in finfo_open with malformed magic
file). (Anatol)
- libxml:
. Fixed bug #71536 (Access Violation crashes php-cgi.exe). (Anatol)
- mbstring:
. Fixed bug #71906 (AddressSanitizer: negative-size-param (-1) in
mbfl_strcut). (Stas)
- ODBC:
. Fixed bug #47803, #69526 (Executing prepared statements is succesfull only
for the first two statements). (einavitamar at gmail dot com, Anatol)
- PCRE:
. Fixed bug #71659 (segmentation fault in pcre running twig tests).
(nish dot aravamudan at canonical dot com)
- PDO_DBlib:
. Bug #54648 (PDO::MSSQL forces format of datetime fields).
(steven dot lambeth at gmx dot de, Anatol)
- Phar:
. Fixed bug #71625 (Crash in php7.dll with bad phar filename).
(Anatol)
. Fixed bug #71317 (PharData fails to open specific file). (Jos Elstgeest)
. Fixed bug #71860 (Invalid memory write in phar on filename with \0 in
name). (Stas)
- phpdbg:
. Fixed crash when advancing (except step) inside an internal function. (Bob)
- Session:
. Fixed Bug #71683 (Null pointer dereference in zend_hash_str_find_bucket).
(Yasuo)
- SNMP:
. Fixed bug #71704 (php_snmp_error() Format String Vulnerability).
(andrew at jmpesp dot org)
- SPL:
. Fixed bug #71617 (private properties lost when unserializing ArrayObject).
(Nikita)
- Standard:
. Fixed bug #71660 (array_column behaves incorrectly after foreach by
reference). (Laruence)
. Fixed bug #71798 (Integer Overflow in php_raw_url_encode).
(taoguangchen at icloud dot com, Stas)
- Zip:
. Update bundled libzip to 1.1.2. (Remi, Anatol)
03 Mar 2016 PHP 7.0.4
- Core:
. Fixed bug (Low probability segfault in zend_arena). (Laruence)
. Fixed bug #71485 (Return typehint on interanal func causes Fatal error
when it throws exception). (Laruence)
. Fixed bug #71474 (Crash because of VM stack corruption on Magento2).
(Dmitry)
. Fixed bug #71450 (An integer overflow bug in php_str_to_str_ex()). (Stas)
. Fixed bug #71449 (An integer overflow bug in php_implode()). (Stas)
. Fixed bug #71443 (Segfault using built-in webserver with intl using
symfony). (Laruence)
. Fixed bug #71442 (forward_static_call crash). (Laruence)
. Fixed bug #71441 (Typehinted Generator with return in try/finally crashes).
(Bob)
. Fixed bug #71442 (forward_static_call crash). (Laruence)
. Fixed bug #71443 (Segfault using built-in webserver with intl using
symfony). (Laruence)
. Fixed bug #71449 (An integer overflow bug in php_implode()). (Stas)
. Fixed bug #71450 (An integer overflow bug in php_str_to_str_ex()). (Stas)
. Fixed bug #71474 (Crash because of VM stack corruption on Magento2).
(Dmitry)
. Fixed bug #71485 (Return typehint on internal func causes Fatal error
when it throws exception). (Laruence)
. Fixed bug #71529 (Variable references on array elements don't work when
using count). (Nikita)
. Fixed bug #71601 (finally block not executed after yield from). (Bob)
. Fixed bug #71637 (Multiple Heap Overflow due to integer overflows in
xml/filter_url/addcslashes). (Stas)
- CLI server:
. Fixed bug #71559 (Built-in HTTP server, we can download file in web by bug).
(Johannes, Anatol)
- CURL:
. Fixed bug #71523 (Copied handle with new option CURLOPT_HTTPHEADER crashes
while curl_multi_exec). (Laruence)
. Fixed memory leak in curl_getinfo(). (Leigh)
- Date:
. Fixed bug #71525 (Calls to date_modify will mutate timelib_rel_time,
causing date_date_set issues). (Sean DuBois)
- Fileinfo:
. Fixed bug #71434 (finfo throws notice for specific python file). (Laruence)
- FPM:
. Fixed bug #62172 (FPM not working with Apache httpd 2.4 balancer/fcgi
setup). (Matt Haught, Remi)
. Fixed bug #71269 (php-fpm dumped core). (Mickaël)
- Opcache:
@@ -37,22 +142,14 @@ PHP NEWS
- PCRE:
. Fixed bug #71537 (PCRE segfault from Opcache). (Laruence)
- CURL:
. Fixed bug #71523 (Copied handle with new option CURLOPT_HTTPHEADER crashes
while curl_multi_exec). (Laruence)
. Fixed memory leak in curl_getinfo(). (Leigh)
- Fileinfo:
. Fixed bug #71434 (finfo throws notice for specific python file). (Laruence)
- FPM:
. Fixed bug #62172 (FPM not working with Apache httpd 2.4 balancer/fcgi
setup). (Matt Haught, Remi)
- phpdbg:
. Fixed inherited functions from unspecified files being included in
phpdbg_get_executable(). (Bob)
- SOAP:
. Fixed bug #71610 (Type Confusion Vulnerability - SOAP /
make_http_soap_request()). (Stas)
- Standard:
. Fixed bug #71603 (compact() maintains references in php7). (Laruence)
. Fixed bug #70720 (strip_tags improper php code parsing). (Julien)
+1 -1
View File
@@ -172,7 +172,7 @@ PHP_FUNCTION(module_name_drawtext)
zval *image = NULL;
zval *font = NULL;
if (zend_parse_parameters(argc TSRMLS_CC, "rsrll|l", &image, &text, &text_len, &font, &x, &y, &color) == FAILURE)
if (zend_parse_parameters(argc, "rsrll|l", &image, &text, &text_len, &font, &x, &y, &color) == FAILURE)
return;
if (image) {
+37 -37
View File
@@ -8,98 +8,98 @@ API adjustment to the old output control code:
Checking output control layers status:
// Using OG()
php_output_get_status(TSRMLS_C);
php_output_get_status();
Starting the default output handler:
// php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC);
php_output_start_default(TSRMLS_C);
// php_start_ob_buffer(NULL, 0, 1);
php_output_start_default();
Starting an user handler by zval:
// php_start_ob_buffer(zhandler, chunk_size, erase TSRMLS_CC);
php_output_start_user(zhandler, chunk_size, flags TSRMLS_CC);
// php_start_ob_buffer(zhandler, chunk_size, erase);
php_output_start_user(zhandler, chunk_size, flags);
Starting an internal handler whithout context:
// php_ob_set_internal_handler(my_php_output_handler_func_t, buffer_size, "output handler name", erase TSRMLS_CC);
php_output_start_internal(handler_name, handler_name_len, my_php_output_handler_func_t, chunk_size, flags TSRMLS_CC);
// php_ob_set_internal_handler(my_php_output_handler_func_t, buffer_size, "output handler name", erase);
php_output_start_internal(handler_name, handler_name_len, my_php_output_handler_func_t, chunk_size, flags);
Starting an internal handler with context:
// not possible with old API
php_output_handler *h;
h = php_output_handler_create_internal(handler_name, handler_name_len, my_php_output_handler_context_func_t, chunk_size, flags TSRMLS_CC);
h = php_output_handler_create_internal(handler_name, handler_name_len, my_php_output_handler_context_func_t, chunk_size, flags);
php_output_handler_set_context(h, my_context, my_context_dtor);
php_output_handler_start(h TSRMLS_CC);
php_output_handler_start(h);
Testing whether a certain output handler has already been started:
// php_ob_handler_used("output handler name" TSRMLS_CC);
php_output_handler_started(handler_name, handler_name_len TSRMLS_CC);
// php_ob_handler_used("output handler name");
php_output_handler_started(handler_name, handler_name_len);
Flushing one output buffer:
// php_end_ob_buffer(1, 1 TSRMLS_CC);
php_output_flush(TSRMLS_C);
// php_end_ob_buffer(1, 1);
php_output_flush();
Flushing all output buffers:
// not possible with old API
php_output_flush_all(TSRMLS_C);
php_output_flush_all();
Cleaning one output buffer:
// php_ob_end_buffer(0, 1 TSRMLS_CC);
php_output_clean(TSRMLS_C);
// php_ob_end_buffer(0, 1);
php_output_clean();
Cleaning all output buffers:
// not possible with old API
php_output_clean_all(TSRMLS_C);
php_output_clean_all();
Discarding one output buffer:
// php_ob_end_buffer(0, 0 TSRMLS_CC);
php_output_discard(TSRMLS_C);
// php_ob_end_buffer(0, 0);
php_output_discard();
Discarding all output buffers:
// php_ob_end_buffers(0 TSRMLS_CC);
php_output_discard_all(TSRMLS_C);
// php_ob_end_buffers(0);
php_output_discard_all();
Stopping (and dropping) one output buffer:
// php_ob_end_buffer(1, 0 TSRMLS_CC)
php_output_end(TSRMLS_C);
// php_ob_end_buffer(1, 0)
php_output_end();
Stopping (and dropping) all output buffers:
// php_ob_end_buffers(1, 0 TSRMLS_CC);
php_output_end_all(TSRMLS_C);
// php_ob_end_buffers(1, 0);
php_output_end_all();
Retrieving output buffers contents:
// php_ob_get_buffer(zstring TSRMLS_CC);
php_output_get_contents(zstring TSRMLS_CC);
// php_ob_get_buffer(zstring);
php_output_get_contents(zstring);
Retrieving output buffers length:
// php_ob_get_length(zlength TSRMLS_CC);
php_output_get_length(zlength TSRMLS_CC);
// php_ob_get_length(zlength);
php_output_get_length(zlength);
Retrieving output buffering level:
// OG(nesting_level);
php_output_get_level(TSRMLS_C);
php_output_get_level();
Issue a warning because of an output handler conflict:
// php_ob_init_conflict("to be started handler name", "to be tested if already started handler name" TSRMLS_CC);
php_output_handler_conflict(new_handler_name, new_handler_name_len, set_handler_name, set_handler_name_len TSRMLS_CC);
// php_ob_init_conflict("to be started handler name", "to be tested if already started handler name");
php_output_handler_conflict(new_handler_name, new_handler_name_len, set_handler_name, set_handler_name_len);
Registering a conflict checking function, which will be checked prior starting the handler:
// not possible with old API, unless hardcoding into output.c
php_output_handler_conflict_register(handler_name, handler_name_len, my_php_output_handler_conflict_check_t TSRMLS_CC);
php_output_handler_conflict_register(handler_name, handler_name_len, my_php_output_handler_conflict_check_t);
Registering a reverse conflict checking function, which will be checked prior starting the specified foreign handler:
// not possible with old API
php_output_handler_reverse_conflict_register(foreign_handler_name, foreign_handler_name_len, my_php_output_handler_conflict_check_t TSRMLS_CC);
php_output_handler_reverse_conflict_register(foreign_handler_name, foreign_handler_name_len, my_php_output_handler_conflict_check_t);
Facilitating a context from within an output handler callable with ob_start():
// not possible with old API
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_OPAQ, (void *) &custom_ctx_ptr_ptr TSRMLS_CC);
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_OPAQ, (void *) &custom_ctx_ptr_ptr);
Disabling of the output handler by itself:
//not possible with old API
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL TSRMLS_CC);
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL);
Marking an output handler immutable by itself because of irreversibility of its operation:
// not possible with old API
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC);
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL);
Restarting the output handler because of a CLEAN operation:
// not possible with old API
+16 -16
View File
@@ -13,8 +13,8 @@ meaningful error messages.
Prototypes
----------
/* Implemented. */
int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...);
int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...);
int zend_parse_parameters(int num_args, char *type_spec, ...);
int zend_parse_parameters_ex(int flags, int num_args, char *type_spec, ...);
The zend_parse_parameters() function takes the number of parameters
passed to the extension function, the type specifier string, and the
@@ -30,7 +30,7 @@ resources cannot be auto-converted.
PHP 5.5 includes a new function:
int zend_parse_parameter(int flags, int arg_num TSRMLS_DC, zval **arg, const char *spec, ...);
int zend_parse_parameter(int flags, int arg_num, zval **arg, const char *spec, ...);
This function behaves like zend_parse_parameters_ex() except that instead of
reading the arguments from the stack, it receives a single zval to convert
@@ -63,10 +63,10 @@ Type specifiers
o - object of any type (zval*)
O - object of specific type given by class entry (zval*, zend_class_entry)
p - valid path (string without null bytes in the middle) and its length (char*, size_t)
P - valid path (string without null bytes in the middle) as zend_string (zend_string)
P - valid path (string without null bytes in the middle) as zend_string (zend_string*)
r - resource (zval*)
s - string (with possible null bytes) and its length (char*, size_t)
S - string (with possible null bytes) as zend_string (zend_string)
S - string (with possible null bytes) as zend_string (zend_string*)
z - the actual zval (zval*)
* - variable arguments list (0 or more)
+ - variable arguments list (1 or more)
@@ -97,11 +97,11 @@ Both mistakes might cause memory corruptions and segfaults:
1)
char *str;
long str_len; /* XXX THIS IS WRONG!! Use size_t instead. */
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len)
zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &str_len)
2)
int num; /* XXX THIS IS WRONG!! Use zend_long instead. */
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num)
zend_parse_parameters(ZEND_NUM_ARGS(), "l", &num)
If you're in doubt, use check_parameters.php script to the parameters
and their types (it can be found in ./scripts/dev/ directory of PHP sources):
@@ -116,7 +116,7 @@ zend_long l;
char *s;
size_t s_len;
zval *param;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsz",
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lsz",
&l, &s, &s_len, &param) == FAILURE) {
return;
}
@@ -126,7 +126,7 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsz",
zval *obj;
double d = 0.5;
zend_class_entry *my_ce;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|d",
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|d",
&obj, my_ce, &d) == FAILURE) {
return;
}
@@ -136,7 +136,7 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|d",
If null is passed for object, obj will be set to NULL. */
zval *obj;
zval *arr;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o!a",
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o!a",
&obj, &arr) == FAILURE) {
return;
}
@@ -144,7 +144,7 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o!a",
/* Gets a separated array which can also be null. */
zval *arr;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!",
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/!",
&arr) == FAILURE) {
return;
}
@@ -161,10 +161,10 @@ char *s;
*/
size_t length;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(),
"lll", &l1, &l2, &l3) == SUCCESS) {
/* manipulate longs */
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(),
"s", &s, &length) == SUCCESS) {
/* manipulate string */
} else {
@@ -180,7 +180,7 @@ int i, num_varargs;
zval *varargs = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "*", &varargs, &num_varargs) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &varargs, &num_varargs) == FAILURE) {
return;
}
@@ -200,7 +200,7 @@ size_t str_len;
int i, num_varargs;
zval *varargs = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s+", &str, &str_len, &varargs, &num_varargs) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s+", &str, &str_len, &varargs, &num_varargs) == FAILURE) {
return;
}
@@ -214,7 +214,7 @@ zval *array;
int i, num_varargs;
zval *varargs = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a*l", &array, &varargs, &num_varargs, &num) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a*l", &array, &varargs, &num_varargs, &num) == FAILURE) {
return;
}
+19 -44
View File
@@ -5,17 +5,16 @@
5. ext/standard crypt
6. ext/standard crypt's blowfish implementation
7. Sqlite/Sqlite3 ext/sqlite3 ext/sqlite
8. ext/json/json_parser
9. ext/standard/rand
10. ext/standard/scanf
11. ext/standard/strnatcmp.c
12. ext/standard/uuencode
13. libxmlrpc ext/xmlrpc
14. libzip ext/zip
15. main/snprintf.c
16. main/strlcat
17. main/strlcpy
18. libgd see ext/gd/libgd/COPYING
8. ext/standard/rand
9. ext/standard/scanf
10. ext/standard/strnatcmp.c
11. ext/standard/uuencode
12. libxmlrpc ext/xmlrpc
13. libzip ext/zip
14. main/snprintf.c
15. main/strlcat
16. main/strlcpy
17. libgd see ext/gd/libgd/COPYING
5. ext/standard crypt
@@ -104,31 +103,7 @@ a legal notice, here is a blessing:
May you share freely, never taking more than you give.
8. ext/json/json_parser
Copyright (c) 2005 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
9. ext/standard/rand
8. ext/standard/rand
The following php_mt_...() functions are based on a C++ class MTRand by
Richard J. Wagner. For more information see the web page at
http://www-personal.engin.umich.edu/~wagnerr/MersenneTwister.html
@@ -181,7 +156,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10. ext/standard/scanf
9. ext/standard/scanf
scanf.c --
This file contains the base code which implements sscanf and by extension
@@ -227,7 +202,7 @@ authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.
11. ext/standard/strnatcmp.c
10. ext/standard/strnatcmp.c
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
@@ -248,7 +223,7 @@ freely, subject to the following restrictions:
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
12. ext/standard/uuencode
11. ext/standard/uuencode
Portions of this code are based on Berkeley's uuencode/uudecode
implementation.
@@ -284,7 +259,7 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
13. libxmlrpc ext/xmlrpc
12. libxmlrpc ext/xmlrpc
Copyright 2000 Epinions, Inc.
@@ -308,7 +283,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
DAMAGES.
14. libzip ext/zip
13. libzip ext/zip
zip.h -- exported declarations.
Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner
@@ -340,7 +315,7 @@ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15. main/snprintf.c
14. main/snprintf.c
Copyright (c) 2002, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
Permission to use, copy, modify, and distribute this software for any
@@ -413,8 +388,8 @@ This code is based on, and used with the permission of, the
SIO stdio-replacement strx_* functions by Panos Tsirigotis
<panos@alumni.cs.colorado.edu> for xinetd.
16. main/strlcat
17. main/strlcpy
15. main/strlcat
16. main/strlcpy
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
All rights reserved.
+3 -3
View File
@@ -28,7 +28,7 @@ The main functions are:
PHPAPI size_t php_stream_read(php_stream * stream, char * buf, size_t count);
PHPAPI size_t php_stream_write(php_stream * stream, const char * buf, size_t
count);
PHPAPI size_t php_stream_printf(php_stream * stream TSRMLS_DC,
PHPAPI size_t php_stream_printf(php_stream * stream,
const char * fmt, ...);
PHPAPI int php_stream_eof(php_stream * stream);
PHPAPI int php_stream_getc(php_stream * stream);
@@ -47,7 +47,7 @@ Opening Streams
In most cases, you should use this API:
PHPAPI php_stream *php_stream_open_wrapper(const char *path, const char *mode,
int options, char **opened_path TSRMLS_DC);
int options, char **opened_path);
Where:
path is the file or resource to open.
@@ -80,7 +80,7 @@ PHPAPI php_stream *php_stream_fopen_tmpfile(void);
Open a FILE * with tmpfile() and convert into a stream.
PHPAPI php_stream *php_stream_fopen_temporary_file(const char *dir,
const char *pfx, char **opened_path TSRMLS_DC);
const char *pfx, char **opened_path);
Generate a temporary file name and open it.
There are some network enabled relatives in php_network.h:
+2 -2
View File
@@ -138,7 +138,7 @@ SAPI_INPUT_FILTER_FUNC(my_sapi_input_filter)
strcpy(raw_var, "RAW_");
strlcat(raw_var,var,var_len+5);
php_register_variable_ex(raw_var, &new_var, array_ptr TSRMLS_DC);
php_register_variable_ex(raw_var, &new_var, array_ptr);
php_strip_tags(*val, val_len, NULL, NULL, 0);
@@ -154,7 +154,7 @@ PHP_FUNCTION(my_get_raw)
zval **tmp;
zval *array_ptr = NULL;
if(zend_parse_parameters(2 TSRMLS_CC, "ls", &arg, &var, &var_len) == FAILURE) {
if(zend_parse_parameters(2, "ls", &arg, &var, &var_len) == FAILURE) {
return;
}
+2 -2
View File
@@ -170,8 +170,8 @@ TSRM_API void *tsrm_get_ls_cache(void);
#define TSRMG_STATIC(id, type, element) (TSRMG_BULK_STATIC(id, type)->element)
#define TSRMG_BULK_STATIC(id, type) ((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)])
#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE
#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE = NULL
#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE;
#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE = NULL;
#if ZEND_DEBUG
#define TSRMLS_CACHE_UPDATE() TSRMLS_CACHE = tsrm_get_ls_cache()
#else
+1 -1
View File
@@ -72,7 +72,7 @@ typedef struct {
#ifdef ZTS
# define TWG(v) TSRMG_STATIC(win32_globals_id, tsrm_win32_globals *, v)
TSRMLS_CACHE_EXTERN();
TSRMLS_CACHE_EXTERN()
#else
# define TWG(v) (win32_globals.v)
#endif
+13
View File
@@ -0,0 +1,13 @@
--TEST--
Bug #71470: Leaked 1 hashtable iterators
--FILE--
<?php
$array = [1, 2, 3];
foreach ($array as &$v) {
die("foo\n");
}
?>
--EXPECT--
foo
+30
View File
@@ -0,0 +1,30 @@
--TEST--
Bug #71622 (Strings used in pass-as-reference cannot be used to invoke C::$callable())
--FILE--
<?php
function getMethodName(&$methodName) {
$methodName = Abc::METHOD_NAME;
}
class Abc {
const METHOD_NAME = "goal";
private static function goal() {
echo "success\n";
}
public static function run() {
$method = "foobar";
getMethodName($method);
var_dump(is_callable("self::$method"));
self::$method();
}
}
Abc::run();
?>
--EXPECT--
bool(true)
success
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #71695 (Global variables are reserved before execution)
--FILE--
<?php
function provideGlobals() {
var_dump(array_key_exists("foo", $GLOBALS));
var_dump(isset($GLOBALS["foo"]));
$GLOBALS += array("foo" => "foo");
}
provideGlobals();
echo $foo;
?>
--EXPECT--
bool(false)
bool(false)
foo
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Bug #71724: yield from does not count EOLs
--FILE--
<?php
function test()
{
yield
from [__LINE__];
}
var_dump(test()->current());
?>
--EXPECT--
int(10)
+27
View File
@@ -0,0 +1,27 @@
--TEST--
Bug #71756 (Call-by-reference widens scope to uninvolved functions when used in switch)
--FILE--
<?php
function a ($option) {
b($option['bla']);
c($option);
var_dump($option);
}
function b (&$string) {
$string = 'changed';
}
function c ($option) {
switch ($option['bla']) {
case 'changed':
$copy = $option;
$copy['bla'] = 'copy';
break;
}
}
a(array('bla' => 'false'));
?>
--EXPECTF--
array(1) {
["bla"]=>
string(7) "changed"
}
+1 -1
View File
@@ -45,7 +45,7 @@ $done = 0;
$a = [0,1,2,3,4];
foreach($a as &$v) {
echo "$v\n";
if ($done && $v == 3) {
if (!$done && $v == 3) {
$done = 1;
array_splice($a, 1, 2, $replacement);
}
+1 -1
View File
@@ -12,4 +12,4 @@ class Obj
function echo(){} // not valid
--EXPECTF--
Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting identifier (T_STRING) or '(' in %s on line 9
Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting %s in %s on line 9
+1 -1
View File
@@ -148,7 +148,7 @@ static HashTable *global_class_table = NULL;
static HashTable *global_constants_table = NULL;
static HashTable *global_auto_globals_table = NULL;
static HashTable *global_persistent_list = NULL;
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_API zend_utility_values zend_uv;
+1 -1
View File
@@ -77,7 +77,7 @@
#define ZEND_TSRMLS_CACHE
#endif
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
#ifdef HAVE_NORETURN
# ifdef ZEND_NORETURN_ALIAS
+7
View File
@@ -1226,8 +1226,15 @@ ZEND_API void object_properties_load(zend_object *object, HashTable *properties)
size_t prop_name_len;
if (zend_unmangle_property_name_ex(key, &class_name, &prop_name, &prop_name_len) == SUCCESS) {
zend_string *pname = zend_string_init(prop_name, prop_name_len, 0);
zend_class_entry *prev_scope = EG(scope);
if (class_name && class_name[0] != '*') {
zend_string *cname = zend_string_init(class_name, strlen(class_name), 0);
EG(scope) = zend_lookup_class(cname);
zend_string_release(cname);
}
property_info = zend_get_property_info(object->ce, pname, 1);
zend_string_release(pname);
EG(scope) = prev_scope;
} else {
property_info = ZEND_WRONG_PROPERTY_INFO;
}
+16 -2
View File
@@ -200,6 +200,10 @@ typedef struct _zend_mm_huge_list zend_mm_huge_list;
# define PTR_FMT "0x%0.8lx"
#endif
#ifdef MAP_HUGETLB
int zend_mm_use_huge_pages = 0;
#endif
/*
* Memory is retrived from OS by chunks of fixed size 2MB.
* Inside chunk it's managed by pages of fixed size 4096B.
@@ -462,7 +466,7 @@ static void *zend_mm_mmap(size_t size)
void *ptr;
#ifdef MAP_HUGETLB
if (size == ZEND_MM_CHUNK_SIZE) {
if (zend_mm_use_huge_pages && size == ZEND_MM_CHUNK_SIZE) {
ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_HUGETLB, -1, 0);
if (ptr != MAP_FAILED) {
return ptr;
@@ -1353,6 +1357,10 @@ static zend_always_inline void *zend_mm_alloc_heap(zend_mm_heap *heap, size_t si
/* special handling for zero-size allocation */
size = MAX(size, 1);
size = ZEND_MM_ALIGNED_SIZE(size) + ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info));
if (UNEXPECTED(size < real_size)) {
zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu + %zu)", ZEND_MM_ALIGNED_SIZE(real_size), ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info)));
return NULL;
}
#endif
if (size <= ZEND_MM_MAX_SMALL_SIZE) {
ptr = zend_mm_alloc_small(heap, size, ZEND_MM_SMALL_SIZE_TO_BIN(size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
@@ -2324,7 +2332,7 @@ ZEND_API int is_zend_mm(void)
#endif
}
#if !ZEND_DEBUG && !defined(_WIN32)
#if !ZEND_DEBUG && (!defined(_WIN32) || defined(__clang__))
#undef _emalloc
#if ZEND_MM_CUSTOM
@@ -2643,6 +2651,12 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
alloc_globals->mm_heap->custom_heap.std._realloc = realloc;
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();
+1 -1
View File
@@ -1827,7 +1827,7 @@ try_array:
try_string_offset:
if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
switch(Z_TYPE_P(dim)) {
switch (Z_TYPE_P(dim)) {
/* case IS_LONG: */
case IS_STRING:
if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
+4 -1
View File
@@ -398,7 +398,7 @@ void shutdown_executor(void) /* {{{ */
zend_shutdown_fpu();
#ifdef ZEND_DEBUG
if (EG(ht_iterators_used)) {
if (EG(ht_iterators_used) && !CG(unclean_shutdown)) {
zend_error(E_WARNING, "Leaked %" PRIu32 " hashtable iterators", EG(ht_iterators_used));
}
#endif
@@ -851,6 +851,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
ZEND_ADD_CALL_FLAG(call, ZEND_CALL_CLOSURE);
}
/* PHP-7 doesn't support symbol_table substitution for functions */
ZEND_ASSERT(fci->symbol_table == NULL);
if (func->type == ZEND_USER_FUNCTION) {
int call_via_handler = (func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) != 0;
EG(scope) = func->common.scope;
+54 -18
View File
@@ -571,12 +571,25 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s
zval *data;
if (flag & HASH_ADD) {
return NULL;
}
ZEND_ASSERT(&p->val != pData);
data = &p->val;
if ((flag & HASH_UPDATE_INDIRECT) && Z_TYPE_P(data) == IS_INDIRECT) {
data = Z_INDIRECT_P(data);
if (!(flag & HASH_UPDATE_INDIRECT)) {
return NULL;
}
ZEND_ASSERT(&p->val != pData);
data = &p->val;
if (Z_TYPE_P(data) == IS_INDIRECT) {
data = Z_INDIRECT_P(data);
if (Z_TYPE_P(data) != IS_UNDEF) {
return NULL;
}
} else {
return NULL;
}
} else {
ZEND_ASSERT(&p->val != pData);
data = &p->val;
if ((flag & HASH_UPDATE_INDIRECT) && Z_TYPE_P(data) == IS_INDIRECT) {
data = Z_INDIRECT_P(data);
}
}
HANDLE_BLOCK_INTERRUPTIONS();
if (ht->pDestructor) {
@@ -1864,24 +1877,47 @@ ZEND_API void ZEND_FASTCALL _zend_hash_merge(HashTable *target, HashTable *sourc
uint32_t idx;
Bucket *p;
zval *t;
uint32_t mode = (overwrite?HASH_UPDATE:HASH_ADD);
IS_CONSISTENT(source);
IS_CONSISTENT(target);
HT_ASSERT(GC_REFCOUNT(target) == 1);
for (idx = 0; idx < source->nNumUsed; idx++) {
p = source->arData + idx;
if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue;
if (p->key) {
t = _zend_hash_add_or_update(target, p->key, &p->val, mode ZEND_FILE_LINE_RELAY_CC);
if (t && pCopyConstructor) {
pCopyConstructor(t);
if (overwrite) {
for (idx = 0; idx < source->nNumUsed; idx++) {
p = source->arData + idx;
if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue;
if (UNEXPECTED(Z_TYPE(p->val) == IS_INDIRECT) &&
UNEXPECTED(Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF)) {
continue;
}
} else {
if ((mode==HASH_UPDATE || !zend_hash_index_exists(target, p->h))) {
t = zend_hash_index_update(target, p->h, &p->val);
if (t && pCopyConstructor) {
if (p->key) {
t = _zend_hash_add_or_update_i(target, p->key, &p->val, HASH_UPDATE | HASH_UPDATE_INDIRECT ZEND_FILE_LINE_RELAY_CC);
if (t && pCopyConstructor) {
pCopyConstructor(t);
}
} else {
t = zend_hash_index_update(target, p->h, &p->val);
if (t && pCopyConstructor) {
pCopyConstructor(t);
}
}
}
} else {
for (idx = 0; idx < source->nNumUsed; idx++) {
p = source->arData + idx;
if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue;
if (UNEXPECTED(Z_TYPE(p->val) == IS_INDIRECT) &&
UNEXPECTED(Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF)) {
continue;
}
if (p->key) {
t = _zend_hash_add_or_update_i(target, p->key, &p->val, HASH_ADD | HASH_UPDATE_INDIRECT ZEND_FILE_LINE_RELAY_CC);
if (t && pCopyConstructor) {
pCopyConstructor(t);
}
} else {
t = zend_hash_index_add(target, p->h, &p->val);
if (t && pCopyConstructor) {
pCopyConstructor(t);
}
}
+12
View File
@@ -385,6 +385,18 @@ static zend_always_inline int zend_symtable_exists(HashTable *ht, zend_string *k
}
static zend_always_inline int zend_symtable_exists_ind(HashTable *ht, zend_string *key)
{
zend_ulong idx;
if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_exists(ht, idx);
} else {
return zend_hash_exists_ind(ht, key);
}
}
static zend_always_inline zval *zend_symtable_str_update(HashTable *ht, const char *str, size_t len, zval *pData)
{
zend_ulong idx;
+3
View File
@@ -228,6 +228,9 @@ ZEND_API void zend_strip(void)
prev_space = 0;
ZVAL_UNDEF(&token);
}
/* Discard parse errors thrown during tokenization */
zend_clear_exception();
}
/*
+16 -16
View File
@@ -473,10 +473,10 @@ unset_variable:
;
function_declaration_statement:
function returns_ref T_STRING '(' parameter_list ')' return_type
backup_doc_comment '{' inner_statement_list '}'
{ $$ = zend_ast_create_decl(ZEND_AST_FUNC_DECL, $2, $1, $8,
zend_ast_get_str($3), $5, NULL, $10, $7); }
function returns_ref T_STRING backup_doc_comment '(' parameter_list ')' return_type
'{' inner_statement_list '}'
{ $$ = zend_ast_create_decl(ZEND_AST_FUNC_DECL, $2, $1, $4,
zend_ast_get_str($3), $6, NULL, $10, $8); }
;
is_reference:
@@ -705,10 +705,10 @@ class_statement:
{ $$ = $2; RESET_DOC_COMMENT(); }
| T_USE name_list trait_adaptations
{ $$ = zend_ast_create(ZEND_AST_USE_TRAIT, $2, $3); }
| method_modifiers function returns_ref identifier '(' parameter_list ')'
return_type backup_doc_comment method_body
{ $$ = zend_ast_create_decl(ZEND_AST_METHOD, $3 | $1, $2, $9,
zend_ast_get_str($4), $6, NULL, $10, $8); }
| method_modifiers function returns_ref identifier backup_doc_comment '(' parameter_list ')'
return_type method_body
{ $$ = zend_ast_create_decl(ZEND_AST_METHOD, $3 | $1, $2, $5,
zend_ast_get_str($4), $7, NULL, $10, $9); }
;
name_list:
@@ -959,16 +959,16 @@ expr_without_variable:
| T_YIELD expr { $$ = zend_ast_create(ZEND_AST_YIELD, $2, NULL); }
| T_YIELD expr T_DOUBLE_ARROW expr { $$ = zend_ast_create(ZEND_AST_YIELD, $4, $2); }
| T_YIELD_FROM expr { $$ = zend_ast_create(ZEND_AST_YIELD_FROM, $2); }
| function returns_ref '(' parameter_list ')' lexical_vars return_type
backup_doc_comment '{' inner_statement_list '}'
{ $$ = zend_ast_create_decl(ZEND_AST_CLOSURE, $2, $1, $8,
| function returns_ref backup_doc_comment '(' parameter_list ')' lexical_vars return_type
'{' inner_statement_list '}'
{ $$ = zend_ast_create_decl(ZEND_AST_CLOSURE, $2, $1, $3,
zend_string_init("{closure}", sizeof("{closure}") - 1, 0),
$4, $6, $10, $7); }
| T_STATIC function returns_ref '(' parameter_list ')' lexical_vars
return_type backup_doc_comment '{' inner_statement_list '}'
{ $$ = zend_ast_create_decl(ZEND_AST_CLOSURE, $3 | ZEND_ACC_STATIC, $2, $9,
$5, $7, $10, $8); }
| T_STATIC function returns_ref backup_doc_comment '(' parameter_list ')' lexical_vars
return_type '{' inner_statement_list '}'
{ $$ = zend_ast_create_decl(ZEND_AST_CLOSURE, $3 | ZEND_ACC_STATIC, $2, $4,
zend_string_init("{closure}", sizeof("{closure}") - 1, 0),
$5, $7, $11, $8); }
$6, $8, $11, $9); }
;
function:
File diff suppressed because it is too large. Load diff
+1
View File
@@ -1152,6 +1152,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_IN_SCRIPTING>"yield"{WHITESPACE}"from" {
HANDLE_NEWLINES(yytext, yyleng);
RETURN_TOKEN(T_YIELD_FROM);
}
+9 -3
View File
@@ -4417,7 +4417,9 @@ ZEND_API double zend_hex_strtod(const char *str, const char **endptr)
double value = 0;
if (strlen(str) < 2) {
*endptr = str;
if (endptr != NULL) {
*endptr = str;
}
return 0.0;
}
@@ -4455,7 +4457,9 @@ ZEND_API double zend_oct_strtod(const char *str, const char **endptr)
int any = 0;
if (strlen(str) < 1) {
*endptr = str;
if (endptr != NULL) {
*endptr = str;
}
return 0.0;
}
@@ -4488,7 +4492,9 @@ ZEND_API double zend_bin_strtod(const char *str, const char **endptr)
int any = 0;
if (strlen(str) < 2) {
*endptr = str;
if (endptr != NULL) {
*endptr = str;
}
return 0.0;
}
+2 -1
View File
@@ -597,12 +597,13 @@ static inline zend_ulong realpath_cache_key(const char *path, int path_len) /* {
register zend_ulong h;
char *bucket_key_start = tsrm_win32_get_path_sid_key(path);
char *bucket_key = (char *)bucket_key_start;
const char *e = bucket_key + strlen(bucket_key);
const char *e;
if (!bucket_key) {
return 0;
}
e = bucket_key + strlen(bucket_key);
for (h = Z_UL(2166136261); bucket_key < e;) {
h *= Z_UL(16777619);
h ^= *bucket_key++;
+24 -9
View File
@@ -2944,7 +2944,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR
}
}
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
GET_OP1_UNDEF_CV(object, BP_VAR_R);
object = GET_OP1_UNDEF_CV(object, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
FREE_OP2();
HANDLE_EXCEPTION();
@@ -3053,15 +3053,22 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMPVAR|UNUSE
function_name = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
if (OP2_TYPE != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (OP2_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
do {
if (OP2_TYPE & (IS_VAR|IS_CV) && Z_ISREF_P(function_name)) {
function_name = Z_REFVAL_P(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
break;
}
} else if (OP2_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
}
zend_throw_error(NULL, "Function name must be a string");
FREE_OP2();
HANDLE_EXCEPTION();
zend_throw_error(NULL, "Function name must be a string");
FREE_OP2();
HANDLE_EXCEPTION();
} while (0);
}
}
@@ -4884,6 +4891,14 @@ ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
SAVE_OPLINE();
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if ((OP1_TYPE & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if (OP2_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
+198 -70
View File
@@ -5540,7 +5540,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CO
}
}
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
GET_OP1_UNDEF_CV(object, BP_VAR_R);
object = GET_OP1_UNDEF_CV(object, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -5647,15 +5647,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
function_name = EX_CONSTANT(opline->op2);
if (IS_CONST != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
do {
if (IS_CONST & (IS_VAR|IS_CV) && Z_ISREF_P(function_name)) {
function_name = Z_REFVAL_P(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
break;
}
} else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
}
zend_throw_error(NULL, "Function name must be a string");
zend_throw_error(NULL, "Function name must be a string");
HANDLE_EXCEPTION();
HANDLE_EXCEPTION();
} while (0);
}
}
@@ -5851,6 +5858,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CONST_HANDLER(
SAVE_OPLINE();
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if ((IS_CONST & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@@ -7628,15 +7643,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
function_name = NULL;
if (IS_UNUSED != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (IS_UNUSED == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
do {
if (IS_UNUSED & (IS_VAR|IS_CV) && Z_ISREF_P(function_name)) {
function_name = Z_REFVAL_P(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
break;
}
} else if (IS_UNUSED == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
}
zend_throw_error(NULL, "Function name must be a string");
zend_throw_error(NULL, "Function name must be a string");
HANDLE_EXCEPTION();
HANDLE_EXCEPTION();
} while (0);
}
}
@@ -9264,7 +9286,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CV
}
}
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
GET_OP1_UNDEF_CV(object, BP_VAR_R);
object = GET_OP1_UNDEF_CV(object, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -9371,15 +9393,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
function_name = _get_zval_ptr_cv_undef(execute_data, opline->op2.var);
if (IS_CV != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
do {
if (IS_CV & (IS_VAR|IS_CV) && Z_ISREF_P(function_name)) {
function_name = Z_REFVAL_P(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
break;
}
} else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
}
zend_throw_error(NULL, "Function name must be a string");
zend_throw_error(NULL, "Function name must be a string");
HANDLE_EXCEPTION();
HANDLE_EXCEPTION();
} while (0);
}
}
@@ -9625,6 +9654,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CV_HANDLER(ZEN
SAVE_OPLINE();
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if ((IS_CONST & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@@ -11071,7 +11108,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_TM
}
}
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
GET_OP1_UNDEF_CV(object, BP_VAR_R);
object = GET_OP1_UNDEF_CV(object, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor_nogc(free_op2);
HANDLE_EXCEPTION();
@@ -11179,15 +11216,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
do {
if ((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV) && Z_ISREF_P(function_name)) {
function_name = Z_REFVAL_P(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
break;
}
} else if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
}
zend_throw_error(NULL, "Function name must be a string");
zval_ptr_dtor_nogc(free_op2);
HANDLE_EXCEPTION();
zend_throw_error(NULL, "Function name must be a string");
zval_ptr_dtor_nogc(free_op2);
HANDLE_EXCEPTION();
} while (0);
}
}
@@ -11384,6 +11428,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CONST_TMPVAR_HANDLER
SAVE_OPLINE();
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if ((IS_CONST & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@@ -17516,15 +17568,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
function_name = EX_CONSTANT(opline->op2);
if (IS_CONST != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
do {
if (IS_CONST & (IS_VAR|IS_CV) && Z_ISREF_P(function_name)) {
function_name = Z_REFVAL_P(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
break;
}
} else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
}
zend_throw_error(NULL, "Function name must be a string");
zend_throw_error(NULL, "Function name must be a string");
HANDLE_EXCEPTION();
HANDLE_EXCEPTION();
} while (0);
}
}
@@ -19144,15 +19203,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
function_name = NULL;
if (IS_UNUSED != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (IS_UNUSED == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
do {
if (IS_UNUSED & (IS_VAR|IS_CV) && Z_ISREF_P(function_name)) {
function_name = Z_REFVAL_P(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
break;
}
} else if (IS_UNUSED == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
}
zend_throw_error(NULL, "Function name must be a string");
zend_throw_error(NULL, "Function name must be a string");
HANDLE_EXCEPTION();
HANDLE_EXCEPTION();
} while (0);
}
}
@@ -20765,15 +20831,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
function_name = _get_zval_ptr_cv_undef(execute_data, opline->op2.var);
if (IS_CV != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
do {
if (IS_CV & (IS_VAR|IS_CV) && Z_ISREF_P(function_name)) {
function_name = Z_REFVAL_P(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
break;
}
} else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
}
zend_throw_error(NULL, "Function name must be a string");
zend_throw_error(NULL, "Function name must be a string");
HANDLE_EXCEPTION();
HANDLE_EXCEPTION();
} while (0);
}
}
@@ -22335,15 +22408,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
do {
if ((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV) && Z_ISREF_P(function_name)) {
function_name = Z_REFVAL_P(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
break;
}
} else if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
}
zend_throw_error(NULL, "Function name must be a string");
zval_ptr_dtor_nogc(free_op2);
HANDLE_EXCEPTION();
zend_throw_error(NULL, "Function name must be a string");
zval_ptr_dtor_nogc(free_op2);
HANDLE_EXCEPTION();
} while (0);
}
}
@@ -23736,7 +23816,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
}
}
if (IS_UNUSED == IS_CV && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
GET_OP1_UNDEF_CV(object, BP_VAR_R);
object = GET_OP1_UNDEF_CV(object, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -26151,7 +26231,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
}
}
if (IS_UNUSED == IS_CV && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
GET_OP1_UNDEF_CV(object, BP_VAR_R);
object = GET_OP1_UNDEF_CV(object, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -27643,7 +27723,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
}
}
if (IS_UNUSED == IS_CV && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
GET_OP1_UNDEF_CV(object, BP_VAR_R);
object = GET_OP1_UNDEF_CV(object, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor_nogc(free_op2);
HANDLE_EXCEPTION();
@@ -31901,7 +31981,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST
}
}
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
GET_OP1_UNDEF_CV(object, BP_VAR_R);
object = GET_OP1_UNDEF_CV(object, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -32020,6 +32100,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CV_CONST_HANDLER(ZEN
SAVE_OPLINE();
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if ((IS_CV & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@@ -36977,7 +37065,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
}
}
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
GET_OP1_UNDEF_CV(object, BP_VAR_R);
object = GET_OP1_UNDEF_CV(object, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -37096,6 +37184,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CV_CV_HANDLER(ZEND_O
SAVE_OPLINE();
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if ((IS_CV & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@@ -39549,7 +39645,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
}
}
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
GET_OP1_UNDEF_CV(object, BP_VAR_R);
object = GET_OP1_UNDEF_CV(object, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor_nogc(free_op2);
HANDLE_EXCEPTION();
@@ -39669,6 +39765,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CV_TMPVAR_HANDLER(ZE
SAVE_OPLINE();
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if ((IS_CV & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@@ -41776,7 +41880,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
GET_OP1_UNDEF_CV(object, BP_VAR_R);
object = GET_OP1_UNDEF_CV(object, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -41896,6 +42000,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_CONST_HANDLER
SAVE_OPLINE();
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@@ -43916,7 +44028,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
GET_OP1_UNDEF_CV(object, BP_VAR_R);
object = GET_OP1_UNDEF_CV(object, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -44036,6 +44148,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_CV_HANDLER(ZE
SAVE_OPLINE();
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@@ -45054,7 +45174,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
GET_OP1_UNDEF_CV(object, BP_VAR_R);
object = GET_OP1_UNDEF_CV(object, BP_VAR_R);
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor_nogc(free_op2);
HANDLE_EXCEPTION();
@@ -45175,6 +45295,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_TMPVAR_HANDLE
SAVE_OPLINE();
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
+2 -2
View File
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=7
PHP_MINOR_VERSION=0
PHP_RELEASE_VERSION=4
PHP_EXTRA_VERSION="RC1"
PHP_RELEASE_VERSION=5
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`
+1 -1
View File
@@ -128,7 +128,7 @@ zend_module_entry bcmath_module_entry = {
#ifdef COMPILE_DL_BCMATH
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(bcmath)
#endif
+1 -1
View File
@@ -52,7 +52,7 @@ ZEND_BEGIN_MODULE_GLOBALS(bcmath)
ZEND_END_MODULE_GLOBALS(bcmath)
#if defined(ZTS) && defined(COMPILE_DL_BCMATH)
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
#endif
ZEND_EXTERN_MODULE_GLOBALS(bcmath)
+1 -1
View File
@@ -255,7 +255,7 @@ zend_module_entry com_dotnet_module_entry = {
#ifdef COMPILE_DL_COM_DOTNET
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(com_dotnet)
#endif
+1 -1
View File
@@ -56,7 +56,7 @@ ZEND_BEGIN_MODULE_GLOBALS(com_dotnet)
ZEND_END_MODULE_GLOBALS(com_dotnet)
#if defined(ZTS) && defined(COMPILE_DL_COM_DOTNET)
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
#endif
extern ZEND_DECLARE_MODULE_GLOBALS(com_dotnet);
+4 -1
View File
@@ -838,6 +838,9 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLM_INTERNAL_ERROR);
REGISTER_CURL_CONSTANT(CURLM_OK);
REGISTER_CURL_CONSTANT(CURLM_OUT_OF_MEMORY);
#if LIBCURL_VERSION_NUM >= 0x072001 /* Available since 7.32.1 */
REGISTER_CURL_CONSTANT(CURLM_ADDED_ALREADY);
#endif
/* Curl proxy constants */
REGISTER_CURL_CONSTANT(CURLPROXY_HTTP);
@@ -2189,7 +2192,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
#endif
# if defined(ZTS)
if (option == CURLOPT_DNS_USE_GLOBAL_CACHE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_DNS_USE_GLOBAL_CACHE cannot be activated when thread safety is enabled");
php_error_docref(NULL, E_WARNING, "CURLOPT_DNS_USE_GLOBAL_CACHE cannot be activated when thread safety is enabled");
return 1;
}
# endif
+1938 -1641
View File
File diff suppressed because it is too large. Load diff
+4
View File
@@ -4447,6 +4447,10 @@ PHP_METHOD(DatePeriod, getEndDate)
dpobj = Z_PHPPERIOD_P(getThis());
if (!dpobj->end) {
return;
}
php_date_instantiate(dpobj->start_ce, return_value);
dateobj = Z_PHPDATE_P(return_value);
dateobj->time = timelib_time_ctor();
+11
View File
@@ -0,0 +1,11 @@
--TEST--
Bug #71635 (segfault in DatePeriod::getEndDate() when no end date has been set)
--FILE--
<?php
date_default_timezone_set('UTC');
$period = new DatePeriod(new DateTimeImmutable("now"), new DateInterval("P2Y4DT6H8M"), 2);
var_dump($period->getEndDate());
?>
--EXPECT--
NULL
-2
View File
@@ -129,8 +129,6 @@ typedef struct dba_handler {
DBA_SYNC_FUNC(x); \
DBA_INFO_FUNC(x)
#define VALLEN(p) Z_STRVAL_PP(p), Z_STRLEN_PP(p)
PHP_FUNCTION(dba_open);
PHP_FUNCTION(dba_popen);
PHP_FUNCTION(dba_close);
+2 -2
View File
@@ -155,7 +155,7 @@ ZEND_DECLARE_MODULE_GLOBALS(exif)
#define EXIF_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(exif, v)
#if defined(ZTS) && defined(COMPILE_DL_EXIF)
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
/* {{{ PHP_INI
@@ -4074,7 +4074,7 @@ PHP_FUNCTION(exif_read_data)
exif_discard_imageinfo(&ImageInfo);
#ifdef EXIF_DEBUG
php_error_docref1(NULL, Z_STRVAL_PP(p_name), E_NOTICE, "done");
php_error_docref1(NULL, p_name, E_NOTICE, "done");
#endif
}
/* }}} */
+1 -1
View File
@@ -403,7 +403,7 @@ file_check_mem(struct magic_set *ms, unsigned int level)
size_t len;
if (level >= ms->c.len) {
len = (ms->c.len += 20) * sizeof(*ms->c.li);
len = (ms->c.len += 20 + level) * sizeof(*ms->c.li);
ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ?
emalloc(len) :
erealloc(ms->c.li, len));
+1 -1
View File
@@ -12,7 +12,7 @@ $string .= "\r\n";
$string .= "''''";
// Total string length > 8192
$string .= str_repeat(chr(rand(32, 127)), 8184);
$string .= str_repeat("a", 8184);
// Ending in this string
$string .= "say";
+3 -6
View File
@@ -1,14 +1,11 @@
--TEST--
Bug #68996 (Invalid free of CG(interned_empty_string))
--SKIPIF--
<?php
if (getenv("USE_ZEND_ALLOC") !== "0") {
print "skip Need Zend MM disabled";
}
?>
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
html_errors=1
--ENV--
USE_ZEND_ALLOC=0
--FILE--
<?php
finfo_open(FILEINFO_MIME_TYPE, "\xfc\x63");
@@ -19,4 +16,4 @@ finfo_open(FILEINFO_MIME_TYPE, "\xfc\x63");
<br />
<b>Warning</b>: : failed to open stream: No such file or directory in <b>%sbug68996.php</b> on line <b>%d</b><br />
<br />
<b>Warning</b>: finfo_open(): in <b>%sbug68996.php</b> on line <b>%d</b><br />
<b>Warning</b>: finfo_open(): Failed to load magic database at '%s�c'. in <b>%sbug68996.php</b> on line <b>%d</b><br />
+1
View File
@@ -0,0 +1 @@
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Bug #71527 Buffer over-write in finfo_open with malformed magic file
--SKIPIF--
<?php
if (!class_exists('finfo'))
die('skip no fileinfo extension');
--ENV--
USE_ZEND_ALLOC=0
--FILE--
<?php
$finfo = finfo_open(FILEINFO_NONE, dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug71527.magic");
$info = finfo_file($finfo, __FILE__);
var_dump($info);
?>
--EXPECTF--
Warning: finfo_open(): Failed to load magic database at '%sbug71527.magic'. in %sbug71527.php on line %d
Warning: finfo_file() expects parameter 1 to be resource, boolean given in %sbug71527.php on line %d
bool(false)
+1 -1
View File
@@ -152,7 +152,7 @@ zend_module_entry filter_module_entry = {
#ifdef COMPILE_DL_FILTER
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(filter)
#endif
+1 -1
View File
@@ -66,7 +66,7 @@ ZEND_BEGIN_MODULE_GLOBALS(filter)
ZEND_END_MODULE_GLOBALS(filter)
#if defined(COMPILE_DL_FILTER) && defined(ZTS)
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
#endif
#define IF_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(filter, v)
+1 -1
View File
@@ -87,7 +87,7 @@ static void php_filter_encode_url(zval *value, const unsigned char* chars, const
memset(tmp, 1, 32);
}
*/
str = zend_string_alloc(3 * Z_STRLEN_P(value), 0);
str = zend_string_safe_alloc(Z_STRLEN_P(value), 3, 0, 0);
p = (unsigned char *) ZSTR_VAL(str);
s = (unsigned char *) Z_STRVAL_P(value);
e = s + Z_STRLEN_P(value);
+7 -5
View File
@@ -14,6 +14,8 @@ gdImagePtr gdImageCreateFromWebp (FILE * inFile)
{
gdImagePtr im;
gdIOCtx *in = gdNewFileCtx(inFile);
if (!in)
return 0;
im = gdImageCreateFromWebpCtx(in);
in->gd_free(in);
@@ -37,13 +39,14 @@ gdImagePtr gdImageCreateFromWebpCtx (gdIOCtx * infile)
int width, height;
uint8_t *filedata = NULL;
uint8_t *argb = NULL;
unsigned char *read, *temp;
size_t size = 0, n;
gdImagePtr im;
int x, y;
uint8_t *p;
do {
unsigned char *read, *temp;
temp = gdRealloc(filedata, size+GD_WEBP_ALLOC_STEP);
if (temp) {
filedata = temp;
@@ -64,19 +67,19 @@ gdImagePtr gdImageCreateFromWebpCtx (gdIOCtx * infile)
if (WebPGetInfo(filedata,size, &width, &height) == 0) {
zend_error(E_ERROR, "gd-webp cannot get webp info");
gdFree(temp);
gdFree(filedata);
return NULL;
}
im = gdImageCreateTrueColor(width, height);
if (!im) {
gdFree(temp);
gdFree(filedata);
return NULL;
}
argb = WebPDecodeARGB(filedata, size, &width, &height);
if (!argb) {
zend_error(E_ERROR, "gd-webp cannot allocate temporary buffer");
gdFree(temp);
gdFree(filedata);
gdImageDestroy(im);
return NULL;
}
@@ -92,7 +95,6 @@ gdImagePtr gdImageCreateFromWebpCtx (gdIOCtx * infile)
gdFree(filedata);
/* do not use gdFree here, in case gdFree/alloc is mapped to something else than libc */
free(argb);
gdFree(temp);
im->saveAlphaFlag = 1;
return im;
}
+1 -1
View File
@@ -215,7 +215,7 @@ zend_module_entry gmp_module_entry = {
#ifdef COMPILE_DL_GMP
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(gmp)
#endif
+1 -1
View File
@@ -98,7 +98,7 @@ ZEND_END_MODULE_GLOBALS(gmp)
#define GMPG(v) ZEND_MODULE_GLOBALS_ACCESSOR(gmp, v)
#if defined(ZTS) && defined(COMPILE_DL_GMP)
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
#endif
#else
+1 -1
View File
@@ -165,7 +165,7 @@ zend_module_entry iconv_module_entry = {
#ifdef COMPILE_DL_ICONV
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(iconv)
#endif
+1 -1
View File
@@ -78,7 +78,7 @@ ZEND_END_MODULE_GLOBALS(iconv)
#define ICONVG(v) ZEND_MODULE_GLOBALS_ACCESSOR(iconv, v)
#if defined(ZTS) && defined(COMPILE_DL_ICONV)
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
#endif
#ifdef HAVE_IBM_ICONV
+10 -12
View File
@@ -1315,8 +1315,6 @@ PHP_FUNCTION(imap_append)
zend_string* regex;
pcre_cache_entry *pce; /* Compiled regex */
zval *subpats = NULL; /* Parts (not used) */
long regex_flags = 0; /* Flags (not used) */
long start_offset = 0; /* Start offset (not used) */
int global = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSS|SS", &streamind, &folder, &message, &flags, &internal_date) == FAILURE) {
@@ -1334,7 +1332,7 @@ PHP_FUNCTION(imap_append)
zend_string_free(regex);
php_pcre_match_impl(pce, ZSTR_VAL(internal_date), ZSTR_LEN(internal_date), return_value, subpats, global,
0, regex_flags, start_offset);
0, Z_L(0), Z_L(0));
if (!Z_LVAL_P(return_value)) {
php_error_docref(NULL, E_WARNING, "internal date not correctly formatted");
@@ -4259,7 +4257,7 @@ PHP_FUNCTION(imap_mime_header_decode)
zval myobject;
zend_string *str;
char *string, *charset, encoding, *text, *decode;
long charset_token, encoding_token, end_token, end, offset=0, i;
zend_long charset_token, encoding_token, end_token, end, offset=0, i;
unsigned long newlength;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
@@ -4274,8 +4272,8 @@ PHP_FUNCTION(imap_mime_header_decode)
charset = (char *) safe_emalloc((end + 1), 2, 0);
text = &charset[end + 1];
while (offset < end) { /* Reached end of the string? */
if ((charset_token = (long)php_memnstr(&string[offset], "=?", 2, string + end))) { /* Is there anything encoded in the string? */
charset_token -= (long)string;
if ((charset_token = (zend_long)php_memnstr(&string[offset], "=?", 2, string + end))) { /* Is there anything encoded in the string? */
charset_token -= (zend_long)string;
if (offset != charset_token) { /* Is there anything before the encoded data? */
/* Retrieve unencoded data that is found before encoded data */
memcpy(text, &string[offset], charset_token-offset);
@@ -4285,10 +4283,10 @@ PHP_FUNCTION(imap_mime_header_decode)
add_property_string(&myobject, "text", text);
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &myobject);
}
if ((encoding_token = (long)php_memnstr(&string[charset_token+2], "?", 1, string+end))) { /* Find token for encoding */
encoding_token -= (long)string;
if ((end_token = (long)php_memnstr(&string[encoding_token+3], "?=", 2, string+end))) { /* Find token for end of encoded data */
end_token -= (long)string;
if ((encoding_token = (zend_long)php_memnstr(&string[charset_token+2], "?", 1, string+end))) { /* Find token for encoding */
encoding_token -= (zend_long)string;
if ((end_token = (zend_long)php_memnstr(&string[encoding_token+3], "?=", 2, string+end))) { /* Find token for end of encoded data */
end_token -= (zend_long)string;
memcpy(charset, &string[charset_token + 2], encoding_token - (charset_token + 2)); /* Extract charset encoding */
charset[encoding_token-(charset_token + 2)] = 0x00;
encoding=string[encoding_token + 1]; /* Extract encoding from string */
@@ -4797,7 +4795,7 @@ PHP_FUNCTION(imap_timeout)
break;
}
timeout = (long) mail_parameters(NIL, timeout_type, NIL);
timeout = (zend_long) mail_parameters(NIL, timeout_type, NIL);
RETURN_LONG(timeout);
} else if (timeout >= 0) {
switch (ttype) {
@@ -4818,7 +4816,7 @@ PHP_FUNCTION(imap_timeout)
break;
}
timeout = (long) mail_parameters(NIL, timeout_type, (void *) timeout);
timeout = (zend_long) mail_parameters(NIL, timeout_type, (void *) timeout);
RETURN_TRUE;
} else {
RETURN_FALSE;
+4 -3
View File
@@ -461,7 +461,7 @@ zend_module_entry ibase_module_entry = {
#ifdef COMPILE_DL_INTERBASE
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(ibase)
#endif
@@ -848,7 +848,7 @@ static char const dpb_args[] = {
0, isc_dpb_user_name, isc_dpb_password, isc_dpb_lc_ctype, isc_dpb_sql_role_name, 0
};
int _php_ibase_attach_db(char **args, int *len, zend_long *largs, isc_db_handle *db) /* {{{ */
int _php_ibase_attach_db(char **args, size_t *len, zend_long *largs, isc_db_handle *db) /* {{{ */
{
short i, dpb_len, buf_len = 257-2; /* version byte at the front, and a null at the end */
char dpb_buffer[257] = { isc_dpb_version1, 0 }, *dpb;
@@ -884,7 +884,8 @@ int _php_ibase_attach_db(char **args, int *len, zend_long *largs, isc_db_handle
static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /* {{{ */
{
char *c, hash[16], *args[] = { NULL, NULL, NULL, NULL, NULL };
int i, len[] = { 0, 0, 0, 0, 0 };
int i;
size_t len[] = { 0, 0, 0, 0, 0 };
zend_long largs[] = { 0, 0, 0 };
PHP_MD5_CTX hash_context;
zend_resource new_index_ptr, *le;
+1 -1
View File
@@ -130,7 +130,7 @@ enum php_interbase_option {
#define IBG(v) ZEND_MODULE_GLOBALS_ACCESSOR(ibase, v)
#if defined(ZTS) && defined(COMPILE_DL_INTERBASE)
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
#endif
#define BLOB_ID_LEN 18
+10 -10
View File
@@ -21,9 +21,9 @@ intl.use_exceptions you get more fine-grained information about where the
error occurred).
The internal PHP code can set the global last error with:
void intl_error_set_code(intl_error* err, UErrorCode err_code TSRMLS_DC);
void intl_error_set_custom_msg(intl_error* err, char* msg, int copyMsg TSRMLS_DC);
void intl_error_set(intl_error* err, UErrorCode code, char* msg, int copyMsg TSRMLS_DC);
void intl_error_set_code(intl_error* err, UErrorCode err_code);
void intl_error_set_custom_msg(intl_error* err, char* msg, int copyMsg);
void intl_error_set(intl_error* err, UErrorCode code, char* msg, int copyMsg);
and by passing NULL as the first parameter. The last function is a combination
of the first two. If the message is not a static buffer, copyMsg should be 1.
@@ -44,9 +44,9 @@ typedef struct {
The global error and the object error can be SIMULTANEOUSLY set with these
functions:
void intl_errors_set_custom_msg(intl_error* err, char* msg, int copyMsg TSRMLS_DC);
void intl_errors_set_code(intl_error* err, UErrorCode err_code TSRMLS_DC);
void intl_errors_set(intl_error* err, UErrorCode code, char* msg, int copyMsg TSRMLS_DC);
void intl_errors_set_custom_msg(intl_error* err, char* msg, int copyMsg);
void intl_errors_set_code(intl_error* err, UErrorCode err_code);
void intl_errors_set(intl_error* err, UErrorCode code, char* msg, int copyMsg);
by passing a pointer to the object's intl_error structed as the first parameter.
Node the extra 's' in the functions' names ('errors', not 'error').
@@ -79,8 +79,8 @@ Errors should be lost after a function call. This is different from the way
ICU operates, where functions return immediately if an error is set.
Error resetting can be done with:
void intl_error_reset(NULL TSRMLS_DC); /* reset global error */
void intl_errors_reset(intl_error* err TSRMLS_DC ); /* reset global and object error */
void intl_error_reset(NULL); /* reset global error */
void intl_errors_reset(intl_error* err ); /* reset global and object error */
In practice, intl_errors_reset() is not used because most classes have also
plain functions mapped to the same internal functions as their instance methods.
@@ -97,10 +97,10 @@ U_CFUNC PHP_FUNCTION(breakiter_set_text)
BREAKITER_METHOD_INIT_VARS; /* macro also resets global error */
object = getThis();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&text, &text_len) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"breakiter_set_text: bad arguments", 0 TSRMLS_CC);
"breakiter_set_text: bad arguments", 0);
RETURN_FALSE;
}
+1 -1
View File
@@ -892,7 +892,7 @@ zend_module_entry intl_module_entry = {
#ifdef COMPILE_DL_INTL
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE( intl )
#endif
+1 -1
View File
@@ -56,7 +56,7 @@ ZEND_BEGIN_MODULE_GLOBALS(intl)
ZEND_END_MODULE_GLOBALS(intl)
#if defined(ZTS) && defined(COMPILE_DL_INTL)
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
#endif
ZEND_EXTERN_MODULE_GLOBALS(intl)
+1 -1
View File
@@ -175,7 +175,7 @@ zend_module_entry json_module_entry = {
#ifdef COMPILE_DL_JSON
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(json)
#endif
+2 -2
View File
@@ -85,11 +85,11 @@ ZEND_BEGIN_MODULE_GLOBALS(json)
php_json_error_code error_code;
ZEND_END_MODULE_GLOBALS(json)
PHP_JSON_API ZEND_EXTERN_MODULE_GLOBALS(json);
PHP_JSON_API ZEND_EXTERN_MODULE_GLOBALS(json)
#define JSON_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(json, v)
#if defined(ZTS) && defined(COMPILE_DL_JSON)
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
#endif
PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options);
+16
View File
@@ -227,6 +227,16 @@ PHP_MINIT_FUNCTION(ldap)
REGISTER_LONG_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS);
#endif
#if (LDAP_API_VERSION > 2000)
REGISTER_LONG_CONSTANT("LDAP_OPT_X_TLS_REQUIRE_CERT", LDAP_OPT_X_TLS_REQUIRE_CERT, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("LDAP_OPT_X_TLS_NEVER", LDAP_OPT_X_TLS_NEVER, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("LDAP_OPT_X_TLS_HARD", LDAP_OPT_X_TLS_HARD, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("LDAP_OPT_X_TLS_DEMAND", LDAP_OPT_X_TLS_DEMAND, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("LDAP_OPT_X_TLS_ALLOW", LDAP_OPT_X_TLS_ALLOW, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("LDAP_OPT_X_TLS_TRY", LDAP_OPT_X_TLS_TRY, CONST_PERSISTENT | CONST_CS);
#endif
REGISTER_LONG_CONSTANT("LDAP_ESCAPE_FILTER", PHP_LDAP_ESCAPE_FILTER, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("LDAP_ESCAPE_DN", PHP_LDAP_ESCAPE_DN, CONST_PERSISTENT | CONST_CS);
@@ -2082,6 +2092,9 @@ PHP_FUNCTION(ldap_get_option)
case LDAP_OPT_REFERRALS:
#ifdef LDAP_OPT_RESTART
case LDAP_OPT_RESTART:
#endif
#ifdef LDAP_OPT_X_TLS_REQUIRE_CERT
case LDAP_OPT_X_TLS_REQUIRE_CERT:
#endif
{
int val;
@@ -2212,6 +2225,9 @@ PHP_FUNCTION(ldap_set_option)
case LDAP_OPT_ERROR_NUMBER:
#ifdef LDAP_OPT_DEBUG_LEVEL
case LDAP_OPT_DEBUG_LEVEL:
#endif
#ifdef LDAP_OPT_X_TLS_REQUIRE_CERT
case LDAP_OPT_X_TLS_REQUIRE_CERT:
#endif
{
int val;
@@ -0,0 +1,24 @@
--TEST--
ldap_option_reqcert_basic() - Basic test to check if PHP can connect to a LDAP server with an invalid certificate with certificate checking disabled
--CREDITS--
Edwin Hoksberg <edwin@edwinhoksberg.nl>
--SKIPIF--
<?php
require_once dirname(__FILE__) .'/skipif.inc';
require_once dirname(__FILE__) .'/skipifbindfailure.inc';
?>
--FILE--
<?php
require "connect.inc";
ldap_set_option(null, LDAP_OPT_X_TLS_REQUIRE_CERT, LDAP_OPT_X_TLS_NEVER);
$link = ldap_connect($host, $port);
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
var_dump(@ldap_bind($link, $user, $passwd));
?>
===DONE===
--EXPECT--
bool(true)
===DONE===
@@ -0,0 +1,24 @@
--TEST--
ldap_option_reqcert_error() - A test to check if ldap cant connect to a LDAP server with a invalid certificate with certificate checking enabled
--CREDITS--
Edwin Hoksberg <edwin@edwinhoksberg.nl>
--SKIPIF--
<?php
require_once dirname(__FILE__) .'/skipif.inc';
require_once dirname(__FILE__) .'/skipifbindfailure.inc';
?>
--FILE--
<?php
require "connect.inc";
ldap_set_option(null, LDAP_OPT_X_TLS_REQUIRE_CERT, LDAP_OPT_X_TLS_HARD);
$link = ldap_connect($host, $port);
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
var_dump(@ldap_bind($link, $user, $passwd));
?>
===DONE===
--EXPECT--
bool(true)
===DONE===
@@ -0,0 +1,36 @@
--TEST--
ldap_option_reqcert_basic() - Error test for TLS require cert ldap option
--CREDITS--
Edwin Hoksberg <edwin@edwinhoksberg.nl>
--FILE--
<?php
require "connect.inc";
$link = ldap_connect($host, $port);
foreach([
LDAP_OPT_X_TLS_NEVER,
LDAP_OPT_X_TLS_HARD,
LDAP_OPT_X_TLS_DEMAND,
LDAP_OPT_X_TLS_ALLOW,
LDAP_OPT_X_TLS_TRY,
] as $option) {
$result = ldap_set_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, $option);
var_dump($result);
ldap_get_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, $optionval);
var_dump($optionval);
}
?>
===DONE===
--EXPECT--
bool(true)
int(0)
bool(true)
int(1)
bool(true)
int(2)
bool(true)
int(3)
bool(true)
int(4)
===DONE===
@@ -0,0 +1,17 @@
--TEST--
ldap_option_reqcert_basic() - Error test for TLS require cert ldap option
--CREDITS--
Edwin Hoksberg <edwin@edwinhoksberg.nl>
--SKIPIF--
<?php require_once dirname(__FILE__) .'/skipif.inc'; ?>
--FILE--
<?php
require "connect.inc";
$link = ldap_connect($host, $port);
$result = ldap_set_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, 9001);
var_dump($result);
?>
===DONE===
--EXPECT--
bool(false)
===DONE===
+4 -1
View File
@@ -80,7 +80,7 @@ static zend_class_entry *libxmlerror_class_entry;
/* {{{ dynamically loadable module stuff */
#ifdef COMPILE_DL_LIBXML
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(libxml)
#endif /* COMPILE_DL_LIBXML */
@@ -383,6 +383,9 @@ static int php_libxml_streams_IO_read(void *context, char *buffer, int len)
static int php_libxml_streams_IO_write(void *context, const char *buffer, int len)
{
if (CG(unclean_shutdown)) {
return -1;
}
return php_stream_write((php_stream*)context, buffer, len);
}
+1 -1
View File
@@ -118,7 +118,7 @@ PHP_LIBXML_API void php_libxml_shutdown(void);
#define LIBXML(v) ZEND_MODULE_GLOBALS_ACCESSOR(libxml, v)
#if defined(ZTS) && defined(COMPILE_DL_LIBXML)
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
#endif
#else /* HAVE_LIBXML */
+4 -4
View File
@@ -1501,7 +1501,7 @@ mbfl_strcut(
if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) {
from &= -2;
if (from + length >= string->len) {
if (length >= string->len - from) {
length = string->len - from;
}
@@ -1510,14 +1510,14 @@ mbfl_strcut(
} else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) {
from &= -4;
if (from + length >= string->len) {
if (length >= string->len - from) {
length = string->len - from;
}
start = string->val + from;
end = start + (length & -4);
} else if ((encoding->flag & MBFL_ENCTYPE_SBCS)) {
if (from + length >= string->len) {
if (length >= string->len - from) {
length = string->len - from;
}
@@ -1539,7 +1539,7 @@ mbfl_strcut(
start = p;
/* search end position */
if ((start - string->val) + length >= (int)string->len) {
if (length >= (int)string->len - (start - string->val)) {
end = string->val + string->len;
} else {
for (q = p + length; p < q; p += (m = mbtab[*p]));
+173 -30
View File
@@ -591,7 +591,7 @@ static sapi_post_entry php_post_entries[] = {
#ifdef COMPILE_DL_MBSTRING
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(mbstring)
#endif
@@ -2222,14 +2222,21 @@ PHP_FUNCTION(mb_strlen)
int n;
mbfl_string string;
char *enc_name = NULL;
size_t enc_name_len;
size_t enc_name_len, string_len;
mbfl_string_init(&string);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", (char **)&string.val, &string.len, &enc_name, &enc_name_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", (char **)&string.val, &string_len, &enc_name, &enc_name_len) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(string_len)) {
php_error_docref(NULL, E_WARNING, "String overflows the max allowed length of %u", UINT_MAX);
return;
}
string.len = (uint32_t)string_len;
string.no_language = MBSTRG(language);
if (enc_name == NULL) {
string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
@@ -2258,7 +2265,7 @@ PHP_FUNCTION(mb_strpos)
zend_long offset = 0;
mbfl_string haystack, needle;
char *enc_name = NULL;
size_t enc_name_len;
size_t enc_name_len, haystack_len, needle_len;
mbfl_string_init(&haystack);
mbfl_string_init(&needle);
@@ -2267,10 +2274,21 @@ PHP_FUNCTION(mb_strpos)
needle.no_language = MBSTRG(language);
needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ls", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &enc_name, &enc_name_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ls", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &offset, &enc_name, &enc_name_len) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) {
php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX);
return;
} else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) {
php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX);
return;
}
haystack.len = (uint32_t)haystack_len;
needle.len = (uint32_t)needle_len;
if (enc_name != NULL) {
haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(enc_name);
if (haystack.no_encoding == mbfl_no_encoding_invalid) {
@@ -2320,7 +2338,7 @@ PHP_FUNCTION(mb_strrpos)
int n;
mbfl_string haystack, needle;
char *enc_name = NULL;
size_t enc_name_len;
size_t enc_name_len, haystack_len, needle_len;
zval *zoffset = NULL;
long offset = 0, str_flg;
char *enc_name2 = NULL;
@@ -2333,10 +2351,21 @@ PHP_FUNCTION(mb_strrpos)
needle.no_language = MBSTRG(language);
needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|zs", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &zoffset, &enc_name, &enc_name_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|zs", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &zoffset, &enc_name, &enc_name_len) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) {
php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX);
return;
} else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) {
php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX);
return;
}
haystack.len = (uint32_t)haystack_len;
needle.len = (uint32_t)needle_len;
if (zoffset) {
if (Z_TYPE_P(zoffset) == IS_STRING) {
enc_name2 = Z_STRVAL_P(zoffset);
@@ -2419,11 +2448,23 @@ PHP_FUNCTION(mb_stripos)
zend_long offset = 0;
mbfl_string haystack, needle;
const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name;
size_t from_encoding_len;
size_t from_encoding_len, haystack_len, needle_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ls", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ls", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &offset, &from_encoding, &from_encoding_len) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) {
php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX);
return;
} else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) {
php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX);
return;
}
haystack.len = (uint32_t)haystack_len;
needle.len = (uint32_t)needle_len;
if (needle.len == 0) {
php_error_docref(NULL, E_WARNING, "Empty delimiter");
RETURN_FALSE;
@@ -2446,12 +2487,23 @@ PHP_FUNCTION(mb_strripos)
zend_long offset = 0;
mbfl_string haystack, needle;
const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name;
size_t from_encoding_len;
size_t from_encoding_len, haystack_len, needle_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ls", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ls", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &offset, &from_encoding, &from_encoding_len) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) {
php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX);
return;
} else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) {
php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX);
return;
}
haystack.len = (uint32_t)haystack_len;
needle.len = (uint32_t)needle_len;
n = php_mb_stripos(1, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding);
if (n >= 0) {
@@ -2469,7 +2521,7 @@ PHP_FUNCTION(mb_strstr)
int n, len, mblen;
mbfl_string haystack, needle, result, *ret = NULL;
char *enc_name = NULL;
size_t enc_name_len;
size_t enc_name_len, haystack_len, needle_len;
zend_bool part = 0;
mbfl_string_init(&haystack);
@@ -2479,10 +2531,21 @@ PHP_FUNCTION(mb_strstr)
needle.no_language = MBSTRG(language);
needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &part, &enc_name, &enc_name_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &part, &enc_name, &enc_name_len) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) {
php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX);
return;
} else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) {
php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX);
return;
}
haystack.len = (uint32_t)haystack_len;
needle.len = (uint32_t)needle_len;
if (enc_name != NULL) {
haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(enc_name);
if (haystack.no_encoding == mbfl_no_encoding_invalid) {
@@ -2531,7 +2594,7 @@ PHP_FUNCTION(mb_strrchr)
int n, len, mblen;
mbfl_string haystack, needle, result, *ret = NULL;
char *enc_name = NULL;
size_t enc_name_len;
size_t enc_name_len, haystack_len, needle_len;
zend_bool part = 0;
mbfl_string_init(&haystack);
@@ -2541,10 +2604,21 @@ PHP_FUNCTION(mb_strrchr)
needle.no_language = MBSTRG(language);
needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &part, &enc_name, &enc_name_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &part, &enc_name, &enc_name_len) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) {
php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX);
return;
} else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) {
php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX);
return;
}
haystack.len = (uint32_t)haystack_len;
needle.len = (uint32_t)needle_len;
if (enc_name != NULL) {
haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(enc_name);
if (haystack.no_encoding == mbfl_no_encoding_invalid) {
@@ -2593,7 +2667,7 @@ PHP_FUNCTION(mb_strrchr)
PHP_FUNCTION(mb_stristr)
{
zend_bool part = 0;
size_t from_encoding_len, len, mblen;
size_t from_encoding_len, len, mblen, haystack_len, needle_len;
int n;
mbfl_string haystack, needle, result, *ret = NULL;
const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name;
@@ -2605,10 +2679,21 @@ PHP_FUNCTION(mb_stristr)
needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &part, &from_encoding, &from_encoding_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &part, &from_encoding, &from_encoding_len) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) {
php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX);
return;
} else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) {
php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX);
return;
}
haystack.len = (uint32_t)haystack_len;
needle.len = (uint32_t)needle_len;
if (!needle.len) {
php_error_docref(NULL, E_WARNING, "Empty delimiter");
RETURN_FALSE;
@@ -2657,7 +2742,7 @@ PHP_FUNCTION(mb_strrichr)
{
zend_bool part = 0;
int n, len, mblen;
size_t from_encoding_len;
size_t from_encoding_len, haystack_len, needle_len;
mbfl_string haystack, needle, result, *ret = NULL;
const char *from_encoding = MBSTRG(current_internal_encoding)->name;
mbfl_string_init(&haystack);
@@ -2668,10 +2753,21 @@ PHP_FUNCTION(mb_strrichr)
needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &part, &from_encoding, &from_encoding_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &part, &from_encoding, &from_encoding_len) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) {
php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX);
return;
} else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) {
php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX);
return;
}
haystack.len = (uint32_t)haystack_len;
needle.len = (uint32_t)needle_len;
haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(from_encoding);
if (haystack.no_encoding == mbfl_no_encoding_invalid) {
php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", from_encoding);
@@ -2716,7 +2812,7 @@ PHP_FUNCTION(mb_substr_count)
int n;
mbfl_string haystack, needle;
char *enc_name = NULL;
size_t enc_name_len;
size_t enc_name_len, haystack_len, needle_len;
mbfl_string_init(&haystack);
mbfl_string_init(&needle);
@@ -2725,10 +2821,21 @@ PHP_FUNCTION(mb_substr_count)
needle.no_language = MBSTRG(language);
needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|s", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &enc_name, &enc_name_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|s", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &enc_name, &enc_name_len) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) {
php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX);
return;
} else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) {
php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX);
return;
}
haystack.len = (uint32_t)haystack_len;
needle.len = (uint32_t)needle_len;
if (enc_name != NULL) {
haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(enc_name);
if (haystack.no_encoding == mbfl_no_encoding_invalid) {
@@ -2833,7 +2940,7 @@ PHP_FUNCTION(mb_strcut)
{
char *encoding = NULL;
zend_long from, len;
size_t encoding_len;
size_t encoding_len, string_len;
zend_bool len_is_null = 1;
mbfl_string string, result, *ret;
@@ -2841,10 +2948,17 @@ PHP_FUNCTION(mb_strcut)
string.no_language = MBSTRG(language);
string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l!s", (char **)&string.val, (int **)&string.len, &from, &len, &len_is_null, &encoding, &encoding_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l!s", (char **)&string.val, &string_len, &from, &len, &len_is_null, &encoding, &encoding_len) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(string_len)) {
php_error_docref(NULL, E_WARNING, "String length overflows the max allowed length of %u", UINT_MAX);
return;
}
string.len = (uint32_t)string_len;
if (encoding) {
string.no_encoding = mbfl_name2no_encoding(encoding);
if (string.no_encoding == mbfl_no_encoding_invalid) {
@@ -2899,17 +3013,24 @@ PHP_FUNCTION(mb_strwidth)
int n;
mbfl_string string;
char *enc_name = NULL;
size_t enc_name_len;
size_t enc_name_len, string_len;
mbfl_string_init(&string);
string.no_language = MBSTRG(language);
string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", (char **)&string.val, &string.len, &enc_name, &enc_name_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", (char **)&string.val, &string_len, &enc_name, &enc_name_len) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(string_len)) {
php_error_docref(NULL, E_WARNING, "String length overflows the max allowed length of %u", UINT_MAX);
return;
}
string.len = (uint32_t)string_len;
if (enc_name != NULL) {
string.no_encoding = mbfl_name2no_encoding(enc_name);
if (string.no_encoding == mbfl_no_encoding_invalid) {
@@ -3354,17 +3475,24 @@ PHP_FUNCTION(mb_encode_mimeheader)
char *trans_enc_name = NULL;
size_t trans_enc_name_len;
char *linefeed = "\r\n";
size_t linefeed_len;
size_t linefeed_len, string_len;
zend_long indent = 0;
mbfl_string_init(&string);
string.no_language = MBSTRG(language);
string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|sssl", (char **)&string.val, &string.len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len, &indent) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|sssl", (char **)&string.val, &string_len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len, &indent) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(string_len)) {
php_error_docref(NULL, E_WARNING, "String length overflows the max allowed length of %u", UINT_MAX);
return;
}
string.len = (uint32_t)string_len;
charset = mbfl_no_encoding_pass;
transenc = mbfl_no_encoding_base64;
@@ -3407,15 +3535,23 @@ PHP_FUNCTION(mb_encode_mimeheader)
PHP_FUNCTION(mb_decode_mimeheader)
{
mbfl_string string, result, *ret;
size_t string_len;
mbfl_string_init(&string);
string.no_language = MBSTRG(language);
string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", (char **)&string.val, &string.len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", (char **)&string.val, &string_len) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(string_len)) {
php_error_docref(NULL, E_WARNING, "String length overflows the max allowed length of %u", UINT_MAX);
return;
}
string.len = (uint32_t)string_len;
mbfl_string_init(&result);
ret = mbfl_mime_header_decode(&string, &result, MBSTRG(current_internal_encoding)->no_encoding);
if (ret != NULL) {
@@ -3437,16 +3573,23 @@ PHP_FUNCTION(mb_convert_kana)
char *optstr = NULL;
size_t optstr_len;
char *encname = NULL;
size_t encname_len;
size_t encname_len, string_len;
mbfl_string_init(&string);
string.no_language = MBSTRG(language);
string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ss", (char **)&string.val, &string.len, &optstr, &optstr_len, &encname, &encname_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ss", (char **)&string.val, &string_len, &optstr, &optstr_len, &encname, &encname_len) == FAILURE) {
return;
}
if (ZEND_SIZE_T_UINT_OVFL(string_len)) {
php_error_docref(NULL, E_WARNING, "String length overflows the max allowed length of %u", UINT_MAX);
return;
}
string.len = (uint32_t)string_len;
/* option */
if (optstr != NULL) {
char *p = optstr;
+1 -1
View File
@@ -205,7 +205,7 @@ struct mb_overload_def {
#define MBSTRG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mbstring, v)
#if defined(ZTS) && defined(COMPILE_DL_MBSTRING)
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
#endif
#else /* HAVE_MBSTRING */
+1 -1
View File
@@ -273,7 +273,7 @@ zend_module_entry mcrypt_module_entry = {
#ifdef COMPILE_DL_MCRYPT
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(mcrypt)
#endif
+1 -1
View File
@@ -1031,7 +1031,7 @@ zend_module_entry mysqli_module_entry = {
#ifdef COMPILE_DL_MYSQLI
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(mysqli)
#endif
+1 -1
View File
@@ -345,7 +345,7 @@ ZEND_END_MODULE_GLOBALS(mysqli)
#define MyG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mysqli, v)
#if defined(ZTS) && defined(COMPILE_DL_MYSQLI)
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
#endif
#define my_estrdup(x) (x) ? estrdup(x) : NULL
+1 -1
View File
@@ -284,7 +284,7 @@ PHPAPI ZEND_EXTERN_MODULE_GLOBALS(mysqlnd)
#define MYSQLND_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(mysqlnd, v)
#if defined(ZTS) && defined(COMPILE_DL_MYSQLND)
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
#endif
-14
View File
@@ -23,24 +23,10 @@
#ifndef MYSQLND_PRIV_H
#define MYSQLND_PRIV_H
#ifndef Z_ADDREF_P
/* PHP 5.2, old GC */
#define Z_ADDREF_P(pz) (++(pz)->refcount)
#define Z_DELREF_P(pz) (--(pz)->refcount)
#define Z_REFCOUNT_P(pz) ((pz)->refcount)
#define Z_SET_REFCOUNT_P(pz, rc) ((pz)->refcount = rc)
#define Z_REFCOUNT_PP(ppz) Z_REFCOUNT_P(*(ppz))
#define Z_DELREF_PP(ppz) Z_DELREF_P(*(ppz))
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
#ifndef pestrndup
#define pestrndup(s, length, persistent) ((persistent)?zend_strndup((s),(length)):estrndup((s),(length)))
#endif
#define MYSQLND_STR_W_LEN(str) str, (sizeof(str) - 1)
#define MYSQLND_DEBUG_DUMP_TIME 1
+1 -1
View File
@@ -361,7 +361,7 @@ zend_module_entry mysqlnd_module_entry = {
/* {{{ COMPILE_DL_MYSQLND */
#ifdef COMPILE_DL_MYSQLND
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(mysqlnd)
#endif
+25 -20
View File
@@ -412,7 +412,7 @@ zend_module_entry odbc_module_entry = {
#ifdef COMPILE_DL_ODBC
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(odbc)
#endif
@@ -445,6 +445,9 @@ static void _free_odbc_result(zend_resource *rsrc)
* zend_list_delete(res->conn_ptr->id);
*/
}
if (res->param_info) {
efree(res->param_info);
}
efree(res);
}
}
@@ -1184,6 +1187,7 @@ PHP_FUNCTION(odbc_prepare)
odbc_result *result = NULL;
odbc_connection *conn;
RETCODE rc;
int i;
#ifdef HAVE_SQL_EXTENDED_FETCH
SQLUINTEGER scrollopts;
#endif
@@ -1199,6 +1203,7 @@ PHP_FUNCTION(odbc_prepare)
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
result->numparams = 0;
result->param_info = NULL;
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
@@ -1255,6 +1260,20 @@ PHP_FUNCTION(odbc_prepare)
Z_ADDREF_P(pv_conn);
result->conn_ptr = conn;
result->fetched = 0;
result->param_info = (odbc_param_info *) safe_emalloc(sizeof(odbc_param_info), result->numparams, 0);
for (i=0;i<result->numparams;i++) {
rc = SQLDescribeParam(result->stmt, (SQLUSMALLINT)(i+1), &result->param_info[i].sqltype, &result->param_info[i].precision,
&result->param_info[i].scale, &result->param_info[i].nullable);
if (rc == SQL_ERROR) {
odbc_sql_error(result->conn_ptr, result->stmt, "SQLDescribeParameter");
SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
efree(result->param_info);
efree(result);
RETURN_FALSE;
}
}
RETURN_RES(zend_register_resource(result, le_result));
}
/* }}} */
@@ -1275,9 +1294,7 @@ PHP_FUNCTION(odbc_execute)
params_t *params = NULL;
char *filename;
unsigned char otype;
SQLSMALLINT sqltype, ctype, scale;
SQLSMALLINT nullable;
SQLULEN precision;
SQLSMALLINT ctype;
odbc_result *result;
int numArgs, i, ne;
RETCODE rc;
@@ -1337,22 +1354,10 @@ PHP_FUNCTION(odbc_execute)
RETURN_FALSE;
}
rc = SQLDescribeParam(result->stmt, (SQLUSMALLINT)i, &sqltype, &precision, &scale, &nullable);
params[i-1].vallen = Z_STRLEN_P(tmp);
params[i-1].fp = -1;
if (rc == SQL_ERROR) {
odbc_sql_error(result->conn_ptr, result->stmt, "SQLDescribeParam");
SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
for (i = 0; i < result->numparams; i++) {
if (params[i].fp != -1) {
close(params[i].fp);
}
}
efree(params);
RETURN_FALSE;
}
if (IS_SQL_BINARY(sqltype)) {
if (IS_SQL_BINARY(result->param_info[i-1].sqltype)) {
ctype = SQL_C_BINARY;
} else {
ctype = SQL_C_CHAR;
@@ -1399,7 +1404,7 @@ PHP_FUNCTION(odbc_execute)
params[i-1].vallen = SQL_LEN_DATA_AT_EXEC(0);
rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT,
ctype, sqltype, precision, scale,
ctype, result->param_info[i-1].sqltype, result->param_info[i-1].precision, result->param_info[i-1].scale,
(void *)(intptr_t)params[i-1].fp, 0,
&params[i-1].vallen);
} else {
@@ -1411,7 +1416,7 @@ PHP_FUNCTION(odbc_execute)
}
rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT,
ctype, sqltype, precision, scale,
ctype, result->param_info[i-1].sqltype, result->param_info[i-1].precision, result->param_info[i-1].scale,
Z_STRVAL_P(tmp), 0,
&params[i-1].vallen);
}
@@ -1530,7 +1535,7 @@ PHP_FUNCTION(odbc_cursor)
result->stmt, state, &error, errormsg,
sizeof(errormsg)-1, &errormsgsize);
if (!strncmp(state,"S1015",5)) {
snprintf(cursorname, max_len+1, "php_curs_%d", (int)result->stmt);
snprintf(cursorname, max_len+1, "php_curs_" ZEND_ULONG_FMT, (zend_ulong)result->stmt);
if (SQLSetCursorName(result->stmt,cursorname,SQL_NTS) != SQL_SUCCESS) {
odbc_sql_error(result->conn_ptr, result->stmt, "SQLSetCursorName");
RETVAL_FALSE;
+9 -1
View File
@@ -233,6 +233,13 @@ typedef struct odbc_result_value {
SQLLEN coltype;
} odbc_result_value;
typedef struct odbc_param_info {
SQLSMALLINT sqltype;
SQLSMALLINT scale;
SQLSMALLINT nullable;
SQLULEN precision;
} odbc_param_info;
typedef struct odbc_result {
ODBC_SQL_STMT_T stmt;
odbc_result_value *values;
@@ -244,6 +251,7 @@ typedef struct odbc_result {
zend_long longreadlen;
int binmode;
int fetched;
odbc_param_info * param_info;
odbc_connection *conn_ptr;
} odbc_result;
@@ -300,7 +308,7 @@ PHP_ODBC_API ZEND_EXTERN_MODULE_GLOBALS(odbc)
#define ODBCG(v) ZEND_MODULE_GLOBALS_ACCESSOR(odbc, v)
#if defined(ZTS) && defined(COMPILE_DL_ODBC)
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
#endif
#endif /* HAVE_UODBC */
+185
View File
@@ -0,0 +1,185 @@
--TEST--
Bug #47803 Executing prepared statements is succesfull only for the first two statements
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
include dirname(__FILE__) . "/config.inc";
$create_table = "CREATE TABLE FOO(
[PAR_ID] [int] NOT NULL,
[PAR_INT] [int] NULL,
[PAR_CHR] [varchar](500) NULL
)";
$inserts = "INSERT INTO FOO
([PAR_ID]
,[PAR_INT]
,[PAR_CHR])
VALUES
(1,14,''),
(2,30,''),
(3,7,''),
(4,7,''),
(5,0,''),
(6,0,''),
(7,20130901,''),
(8,20140201,''),
(9,20140201,''),
(10,20140620,''),
(11,221,'')";
date_default_timezone_set('Europe/Warsaw');
$link = odbc_connect($dsn, $user, $pass);
odbc_exec($link, 'CREATE DATABASE odbcTEST');
odbc_exec($link, $create_table);
odbc_exec($link, $inserts);
$upd_params = array(
array('id'=>1, 'name'=>'test 1'),
array('id'=>2, 'name'=>'test 2'),
array('id'=>3, 'name'=>'test 3'),
array('id'=>4, 'name'=>'test 4'),
array('id'=>5, 'name'=>'test 5'),
array('id'=>10, 'name'=>'test 10'),
array('id'=>9, 'name'=>'test 9'),
array('id'=>8, 'name'=>'test 8'),
array('id'=>7, 'name'=>'test 7'),
array('id'=>6, 'name'=>'test 6'),
);
$sql = "UPDATE FOO
SET [PAR_CHR] = ?
WHERE [PAR_ID] = ?";
$result = odbc_prepare($link, $sql);
if (!$result) {
print ('[sql] prep: '.$sql);
goto out;
}
foreach ($upd_params as &$k) {
if(!odbc_execute($result, array($k['name'], $k['id']))) {
print ('[sql] exec: '."array({$k['name']}, {$k['id']})");
goto out;
}
}
odbc_free_result($result);
$sql = "SELECT * FROM FOO WHERE [PAR_ID] = ?";
$result = odbc_prepare($link, $sql);
if (!$result) {
print ('[sql] prep: '.$sql);
goto out;
}
foreach ($upd_params as $k) {
if(!odbc_execute($result, array($k['id']))) {
print ('[sql] exec: '."array({$k['id']})");
goto out;
}
while (($r = odbc_fetch_array($result)) !== false) {
var_dump($r);
}
}
out:
if ($result) odbc_free_result($result);
odbc_close($link);
?>
==DONE==
--EXPECT--
array(3) {
["PAR_ID"]=>
string(1) "1"
["PAR_INT"]=>
string(2) "14"
["PAR_CHR"]=>
string(6) "test 1"
}
array(3) {
["PAR_ID"]=>
string(1) "2"
["PAR_INT"]=>
string(2) "30"
["PAR_CHR"]=>
string(6) "test 2"
}
array(3) {
["PAR_ID"]=>
string(1) "3"
["PAR_INT"]=>
string(1) "7"
["PAR_CHR"]=>
string(6) "test 3"
}
array(3) {
["PAR_ID"]=>
string(1) "4"
["PAR_INT"]=>
string(1) "7"
["PAR_CHR"]=>
string(6) "test 4"
}
array(3) {
["PAR_ID"]=>
string(1) "5"
["PAR_INT"]=>
string(1) "0"
["PAR_CHR"]=>
string(6) "test 5"
}
array(3) {
["PAR_ID"]=>
string(2) "10"
["PAR_INT"]=>
string(8) "20140620"
["PAR_CHR"]=>
string(7) "test 10"
}
array(3) {
["PAR_ID"]=>
string(1) "9"
["PAR_INT"]=>
string(8) "20140201"
["PAR_CHR"]=>
string(6) "test 9"
}
array(3) {
["PAR_ID"]=>
string(1) "8"
["PAR_INT"]=>
string(8) "20140201"
["PAR_CHR"]=>
string(6) "test 8"
}
array(3) {
["PAR_ID"]=>
string(1) "7"
["PAR_INT"]=>
string(8) "20130901"
["PAR_CHR"]=>
string(6) "test 7"
}
array(3) {
["PAR_ID"]=>
string(1) "7"
["PAR_INT"]=>
string(8) "20130901"
["PAR_CHR"]=>
string(6) "test 7"
}
==DONE==
--CLEAN--
<?php
include 'config.inc';
$conn = odbc_connect($dsn, $user, $pass);
odbc_exec($conn, 'DROP TABLE FOO');
odbc_exec($conn, 'DROP DATABASE odbcTEST');
odbc_close($conn);
?>
+43
View File
@@ -0,0 +1,43 @@
--TEST--
Bug #71171 odbc_fetch_array generates SIGFAULT, variant 0
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
include 'config.inc';
$conn = odbc_connect($dsn, $user, $pass);
@odbc_exec($conn, 'CREATE DATABASE odbcTEST');
odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL NVARCHAR(40))');
odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL) VALUES (1, '" . chr(0x81) . "')");
$res = odbc_exec($conn,"SELECT ID FROM FOO WHERE VARCHAR_COL = '" . chr(0x81) . "'");
if ($res) {
while($record = odbc_fetch_array($res)) var_dump($record);
}
odbc_close($conn);
?>
==DONE==
--EXPECT--
array(1) {
["ID"]=>
string(1) "1"
}
==DONE==
--CLEAN--
<?php
include 'config.inc';
$conn = odbc_connect($dsn, $user, $pass);
odbc_exec($conn, 'DROP TABLE FOO');
odbc_exec($conn, 'DROP DATABASE odbcTEST');
odbc_close($conn);
?>
+14 -3
View File
@@ -3,6 +3,17 @@
putenv('ODBCINI=/etc/odbc.ini');
putenv('ODBCSYSINI=/etc');
$dsn = 'myodbc3';
$user = 'root';
$pass = '';
$dsn = getenv("ODBC_TEST_DSN");
$user = getenv("ODBC_TEST_USER");
$pass = getenv("ODBC_TEST_PASS");
if (false === $dsn) {
$dsn = 'myodbc3';
}
if (false === $user) {
$user = 'root';
}
if (false == $pass) {
$pass = '';
}
+2 -8
View File
@@ -925,10 +925,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)));
Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0';
zval_dtor(&ZEND_OP1_LITERAL(opline));
Z_STR(ZEND_OP1_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op)));
if (!Z_REFCOUNTED(ZEND_OP1_LITERAL(opline))) {
Z_TYPE_FLAGS(ZEND_OP1_LITERAL(opline)) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
}
ZVAL_STR(&ZEND_OP1_LITERAL(opline), zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op))));
ZVAL_NULL(&ZEND_OP1_LITERAL(last_op));
MAKE_NOP(last_op);
} else if ((opline->opcode == ZEND_CONCAT) &&
@@ -965,10 +962,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src)) + old_len, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)));
Z_STRVAL(ZEND_OP2_LITERAL(src))[l] = '\0';
zend_string_release(Z_STR(ZEND_OP2_LITERAL(opline)));
Z_STR(ZEND_OP2_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP2_LITERAL(src)));
if (!Z_REFCOUNTED(ZEND_OP2_LITERAL(opline))) {
Z_TYPE_FLAGS(ZEND_OP2_LITERAL(opline)) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
}
ZVAL_STR(&ZEND_OP2_LITERAL(opline), zend_new_interned_string(Z_STR(ZEND_OP2_LITERAL(src))));
ZVAL_NULL(&ZEND_OP2_LITERAL(src));
MAKE_NOP(src);
} else if ((opline->opcode == ZEND_ADD ||
+133 -106
View File
@@ -97,7 +97,7 @@ zend_accel_globals accel_globals;
#else
int accel_globals_id;
#if defined(COMPILE_DL_OPCACHE)
ZEND_TSRMLS_CACHE_DEFINE();
ZEND_TSRMLS_CACHE_DEFINE()
#endif
#endif
@@ -220,6 +220,104 @@ static ZEND_INI_MH(accel_include_path_on_modify)
return ret;
}
static inline void accel_restart_enter(void)
{
#ifdef ZEND_WIN32
INCREMENT(restart_in);
#else
static const FLOCK_STRUCTURE(restart_in_progress, F_WRLCK, SEEK_SET, 2, 1);
if (fcntl(lock_file, F_SETLK, &restart_in_progress) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "RestartC(+1): %s (%d)", strerror(errno), errno);
}
#endif
ZCSG(restart_in_progress) = 1;
}
static inline void accel_restart_leave(void)
{
#ifdef ZEND_WIN32
ZCSG(restart_in_progress) = 0;
DECREMENT(restart_in);
#else
static const FLOCK_STRUCTURE(restart_finished, F_UNLCK, SEEK_SET, 2, 1);
ZCSG(restart_in_progress) = 0;
if (fcntl(lock_file, F_SETLK, &restart_finished) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "RestartC(-1): %s (%d)", strerror(errno), errno);
}
#endif
}
static inline int accel_restart_is_active(void)
{
if (ZCSG(restart_in_progress)) {
#ifndef ZEND_WIN32
FLOCK_STRUCTURE(restart_check, F_WRLCK, SEEK_SET, 2, 1);
if (fcntl(lock_file, F_GETLK, &restart_check) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "RestartC: %s (%d)", strerror(errno), errno);
return FAILURE;
}
if (restart_check.l_type == F_UNLCK) {
ZCSG(restart_in_progress) = 0;
return 0;
} else {
return 1;
}
#else
return LOCKVAL(restart_in) != 0;
#endif
}
return 0;
}
/* Creates a read lock for SHM access */
static inline int accel_activate_add(void)
{
#ifdef ZEND_WIN32
INCREMENT(mem_usage);
#else
static const FLOCK_STRUCTURE(mem_usage_lock, F_RDLCK, SEEK_SET, 1, 1);
if (fcntl(lock_file, F_SETLK, &mem_usage_lock) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "UpdateC(+1): %s (%d)", strerror(errno), errno);
return FAILURE;
}
#endif
return SUCCESS;
}
/* Releases a lock for SHM access */
static inline void accel_deactivate_sub(void)
{
#ifdef ZEND_WIN32
if (ZCG(counted)) {
DECREMENT(mem_usage);
ZCG(counted) = 0;
}
#else
static const FLOCK_STRUCTURE(mem_usage_unlock, F_UNLCK, SEEK_SET, 1, 1);
if (fcntl(lock_file, F_SETLK, &mem_usage_unlock) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "UpdateC(-1): %s (%d)", strerror(errno), errno);
}
#endif
}
static inline void accel_unlock_all(void)
{
#ifdef ZEND_WIN32
accel_deactivate_sub();
#else
static const FLOCK_STRUCTURE(mem_usage_unlock_all, F_UNLCK, SEEK_SET, 0, 0);
if (fcntl(lock_file, F_SETLK, &mem_usage_unlock_all) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "UnlockAll: %s (%d)", strerror(errno), errno);
}
#endif
}
/* Interned strings support */
static zend_string *(*orig_new_interned_string)(zend_string *str);
static void (*orig_interned_strings_snapshot)(void);
@@ -291,6 +389,12 @@ static zend_string *accel_find_interned_string(zend_string *str)
/* this is already an interned string */
return str;
}
if (!ZCG(counted)) {
if (accel_activate_add() == FAILURE) {
return str;
}
ZCG(counted) = 1;
}
h = zend_string_hash_val(str);
nIndex = h | ZCSG(interned_strings).nTableMask;
@@ -492,102 +596,6 @@ static void accel_use_shm_interned_strings(void)
}
#endif
static inline void accel_restart_enter(void)
{
#ifdef ZEND_WIN32
INCREMENT(restart_in);
#else
static const FLOCK_STRUCTURE(restart_in_progress, F_WRLCK, SEEK_SET, 2, 1);
if (fcntl(lock_file, F_SETLK, &restart_in_progress) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "RestartC(+1): %s (%d)", strerror(errno), errno);
}
#endif
ZCSG(restart_in_progress) = 1;
}
static inline void accel_restart_leave(void)
{
#ifdef ZEND_WIN32
ZCSG(restart_in_progress) = 0;
DECREMENT(restart_in);
#else
static const FLOCK_STRUCTURE(restart_finished, F_UNLCK, SEEK_SET, 2, 1);
ZCSG(restart_in_progress) = 0;
if (fcntl(lock_file, F_SETLK, &restart_finished) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "RestartC(-1): %s (%d)", strerror(errno), errno);
}
#endif
}
static inline int accel_restart_is_active(void)
{
if (ZCSG(restart_in_progress)) {
#ifndef ZEND_WIN32
FLOCK_STRUCTURE(restart_check, F_WRLCK, SEEK_SET, 2, 1);
if (fcntl(lock_file, F_GETLK, &restart_check) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "RestartC: %s (%d)", strerror(errno), errno);
return FAILURE;
}
if (restart_check.l_type == F_UNLCK) {
ZCSG(restart_in_progress) = 0;
return 0;
} else {
return 1;
}
#else
return LOCKVAL(restart_in) != 0;
#endif
}
return 0;
}
/* Creates a read lock for SHM access */
static inline void accel_activate_add(void)
{
#ifdef ZEND_WIN32
INCREMENT(mem_usage);
#else
static const FLOCK_STRUCTURE(mem_usage_lock, F_RDLCK, SEEK_SET, 1, 1);
if (fcntl(lock_file, F_SETLK, &mem_usage_lock) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "UpdateC(+1): %s (%d)", strerror(errno), errno);
}
#endif
}
/* Releases a lock for SHM access */
static inline void accel_deactivate_sub(void)
{
#ifdef ZEND_WIN32
if (ZCG(counted)) {
DECREMENT(mem_usage);
ZCG(counted) = 0;
}
#else
static const FLOCK_STRUCTURE(mem_usage_unlock, F_UNLCK, SEEK_SET, 1, 1);
if (fcntl(lock_file, F_SETLK, &mem_usage_unlock) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "UpdateC(-1): %s (%d)", strerror(errno), errno);
}
#endif
}
static inline void accel_unlock_all(void)
{
#ifdef ZEND_WIN32
accel_deactivate_sub();
#else
static const FLOCK_STRUCTURE(mem_usage_unlock_all, F_UNLCK, SEEK_SET, 0, 0);
if (fcntl(lock_file, F_SETLK, &mem_usage_unlock_all) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "UnlockAll: %s (%d)", strerror(errno), errno);
}
#endif
}
#ifndef ZEND_WIN32
static inline void kill_all_lockers(struct flock *mem_usage_check)
{
@@ -1563,7 +1571,9 @@ zend_op_array *file_cache_compile_file(zend_file_handle *file_handle, int type)
}
}
SHM_UNPROTECT();
persistent_script = zend_file_cache_script_load(file_handle);
SHM_PROTECT();
if (persistent_script) {
/* see bug #15471 (old BTS) */
if (persistent_script->full_path) {
@@ -1589,8 +1599,6 @@ zend_op_array *file_cache_compile_file(zend_file_handle *file_handle, int type)
}
zend_file_handle_dtor(file_handle);
persistent_script->dynamic_members.last_used = ZCG(request_time);
if (persistent_script->ping_auto_globals_mask) {
zend_accel_set_auto_globals(persistent_script->ping_auto_globals_mask);
}
@@ -1709,8 +1717,15 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
* each execution)
*/
if (!ZCG(counted)) {
if (accel_activate_add() == FAILURE) {
#ifdef HAVE_OPCACHE_FILE_CACHE
if (ZCG(accel_directives).file_cache) {
return file_cache_compile_file(file_handle, type);
}
#endif
return accelerator_orig_compile_file(file_handle, type);
}
ZCG(counted) = 1;
accel_activate_add();
}
SHM_UNPROTECT();
@@ -1977,7 +1992,7 @@ static void accel_reset_pcre_cache(void)
ZEND_HASH_FOREACH_BUCKET(&PCRE_G(pcre_cache), p) {
/* Remove PCRE cache entries with inconsistent keys */
if (ZSTR_IS_INTERNED(p->key)) {
if (zend_accel_in_shm(p->key)) {
p->key = NULL;
zend_hash_del_bucket(&PCRE_G(pcre_cache), p);
}
@@ -2278,6 +2293,19 @@ static void zend_accel_fast_shutdown(void)
}
#endif
int accel_post_deactivate(void)
{
if (!ZCG(enabled) || !accel_startup_ok) {
return SUCCESS;
}
zend_shared_alloc_safe_unlock(); /* be sure we didn't leave cache locked */
accel_unlock_all();
ZCG(counted) = 0;
return SUCCESS;
}
static void accel_deactivate(void)
{
/* ensure that we restore function_table and class_table
@@ -2294,10 +2322,6 @@ static void accel_deactivate(void)
return;
}
zend_shared_alloc_safe_unlock(); /* be sure we didn't leave cache locked */
accel_unlock_all();
ZCG(counted) = 0;
#if !ZEND_DEBUG
if (ZCG(accel_directives).fast_shutdown && is_zend_mm()) {
zend_accel_fast_shutdown();
@@ -2865,13 +2889,16 @@ int accelerator_shm_read_lock(void)
} else {
/* here accelerator is active but we do not hold SHM lock. This means restart was scheduled
or is in progress now */
accel_activate_add(); /* acquire usage lock */
if (accel_activate_add() == FAILURE) { /* acquire usage lock */
return FAILURE;
}
/* Now if we weren't inside restart, restart would not begin until we remove usage lock */
if (ZCSG(restart_in_progress)) {
/* we already were inside restart this means it's not safe to touch shm */
accel_deactivate_now(); /* drop usage lock */
return FAILURE;
}
ZCG(counted) = 1;
}
return SUCCESS;
}
+2 -1
View File
@@ -308,7 +308,7 @@ extern zend_accel_shared_globals *accel_shared_globals;
# define ZCG(v) ZEND_TSRMG(accel_globals_id, zend_accel_globals *, v)
extern int accel_globals_id;
# ifdef COMPILE_DL_OPCACHE
ZEND_TSRMLS_CACHE_EXTERN();
ZEND_TSRMLS_CACHE_EXTERN()
# endif
#else
# define ZCG(v) (accel_globals.v)
@@ -318,6 +318,7 @@ extern zend_accel_globals accel_globals;
extern char *zps_api_failure_reason;
void accel_shutdown(void);
int accel_post_deactivate(void);
void zend_accel_schedule_restart(zend_accel_restart_reason reason);
void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason);
accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size);
+2 -2
View File
@@ -15,13 +15,13 @@ file_put_contents( "$root-Officials.inc", '<?php
file_put_contents( "$root-clientUS.php", '<?php
class LocalTerms { const GOV_LEADER = "Barack Hussein Obama II"; }
require "'.$root.'-Officials.inc";
require \''.$root.'-Officials.inc\';
printf( "The President of the USA is %s\n", Officials::getLeader() );
' );
file_put_contents( "$root-clientUK.php", '<?php
class LocalTerms { const GOV_LEADER = "David William Donald Cameron"; }
require "'.$root.'-Officials.inc";
require \''.$root.'-Officials.inc\';
printf( "The Prime Minister of the UK is %s\n", Officials::getLeader() );
' );
+1 -1
View File
@@ -11,7 +11,7 @@ opcache.file_update_protection=0
$file_c = __DIR__ . "/bug67215.c.php";
$file_p = __DIR__ . "/bug67215.p.php";
file_put_contents($file_c, "<?php require \"$file_p\"; class c extends p {} ?>");
file_put_contents($file_c, "<?php require '$file_p'; class c extends p {} ?>");
file_put_contents($file_p, '<?php class p { protected $var = ""; } ?>');
require $file_c;
$a = new c();
+23 -5
View File
@@ -25,16 +25,30 @@ while (filemtime($file1) != filemtime($file2)) {
touch($file1);
touch($file2);
}
@unlink($link);
@symlink($dir1, $link);
if (substr(PHP_OS, 0, 3) == 'WIN') {
@rmdir($link);
$ln = str_replace('/', '\\', $link);
$d1 = realpath($dir1);
`mklink /j $ln $d1`;
} else {
@unlink($link);
@symlink($dir1, $link);
}
include "php_cli_server.inc";
//php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.revalidate_path=1');
php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.revalidate_path=1 -d opcache.file_update_protection=0 -d realpath_cache_size=0');
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
@unlink($link);
@symlink($dir2, $link);
if (substr(PHP_OS, 0, 3) == 'WIN') {
@rmdir($link);
$ln = str_replace('/', '\\', $link);
$d2 = realpath($dir2);
`mklink /j $ln $d2`;
} else {
@unlink($link);
@symlink($dir2, $link);
}
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
?>
@@ -48,7 +62,11 @@ $file1 = "$dir1/index.php";
$file2 = "$dir2/index.php";
$main = "$dir/main.php";
@unlink($main);
@unlink($link);
if (substr(PHP_OS, 0, 3) == 'WIN') {
@rmdir($link);
} else {
@unlink($link);
}
@unlink($file1);
@unlink($file2);
@rmdir($dir1);
+3 -1
View File
@@ -516,7 +516,9 @@ static zend_module_entry accel_module_entry = {
NULL,
zend_accel_info,
ACCELERATOR_VERSION "FE",
STANDARD_MODULE_PROPERTIES
NO_MODULE_GLOBALS,
accel_post_deactivate,
STANDARD_MODULE_PROPERTIES_EX
};
int start_accel_module(void)
+12 -8
View File
@@ -224,15 +224,16 @@ static void *zend_file_cache_unserialize_interned(zend_string *str, int in_shm)
zend_string *ret;
str = (zend_string*)((char*)ZCG(mem) + ((size_t)(str) & ~Z_UL(1)));
ret = accel_new_interned_string(str);
if (ret == str) {
/* String wasn't interned but we will use it as interned anyway */
if (in_shm) {
if (in_shm) {
ret = accel_new_interned_string(str);
if (ret == str) {
/* String wasn't interned but we will use it as interned anyway */
GC_FLAGS(ret) |= IS_STR_INTERNED | IS_STR_PERMANENT;
} else {
GC_FLAGS(ret) |= IS_STR_INTERNED;
GC_FLAGS(ret) &= ~IS_STR_PERMANENT;
}
} else {
ret = str;
GC_FLAGS(ret) |= IS_STR_INTERNED;
GC_FLAGS(ret) &= ~IS_STR_PERMANENT;
}
return ret;
}
@@ -1303,7 +1304,9 @@ zend_persistent_script *zend_file_cache_script_load(zend_file_handle *file_handl
return NULL;
}
if (!ZCG(accel_directives).file_cache_only) {
if (!ZCG(accel_directives).file_cache_only &&
!ZCSG(restart_in_progress) &&
accelerator_shm_read_lock() == SUCCESS) {
/* exclusive lock */
zend_shared_alloc_lock();
@@ -1357,6 +1360,7 @@ use_process_mem:
if (cache_it) {
script->dynamic_members.checksum = zend_accel_script_checksum(script);
script->dynamic_members.last_used = ZCG(request_time);
zend_accel_hash_update(&ZCSG(hash), ZSTR_VAL(script->full_path), ZSTR_LEN(script->full_path), 0, script);
+9 -2
View File
@@ -34,7 +34,9 @@
# define ADD_STRING(str) ADD_DUP_SIZE((str), _ZSTR_STRUCT_SIZE(ZSTR_LEN(str)))
# define ADD_INTERNED_STRING(str, do_free) do { \
if (!IS_ACCEL_INTERNED(str)) { \
if (ZCG(current_persistent_script)->corrupted) { \
ADD_STRING(str); \
} else if (!IS_ACCEL_INTERNED(str)) { \
zend_string *tmp = accel_new_interned_string(str); \
if (tmp != (str)) { \
if (do_free) { \
@@ -126,7 +128,7 @@ static void zend_persist_zval_calc(zval *z)
case IS_CONSTANT:
flags = Z_GC_FLAGS_P(z) & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT);
ADD_INTERNED_STRING(Z_STR_P(z), 0);
if (!Z_REFCOUNTED_P(z)) {
if (ZSTR_IS_INTERNED(Z_STR_P(z))) {
Z_TYPE_FLAGS_P(z) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
}
Z_GC_FLAGS_P(z) |= flags;
@@ -385,11 +387,15 @@ uint zend_accel_script_persist_calc(zend_persistent_script *new_persistent_scrip
new_persistent_script->size = 0;
new_persistent_script->arena_mem = NULL;
new_persistent_script->arena_size = 0;
new_persistent_script->corrupted = 0;
ZCG(current_persistent_script) = new_persistent_script;
ADD_DUP_SIZE(new_persistent_script, sizeof(zend_persistent_script));
if (key) {
ADD_DUP_SIZE(key, key_length + 1);
} else {
/* script is not going to be saved in SHM */
new_persistent_script->corrupted = 1;
}
ADD_STRING(new_persistent_script->full_path);
@@ -408,6 +414,7 @@ uint zend_accel_script_persist_calc(zend_persistent_script *new_persistent_scrip
#endif
new_persistent_script->size += new_persistent_script->arena_size;
new_persistent_script->corrupted = 0;
ZCG(current_persistent_script) = NULL;
+21
View File
@@ -496,6 +496,10 @@ void zend_accel_shared_protect(int mode)
#ifdef HAVE_MPROTECT
int i;
if (!smm_shared_globals) {
return;
}
if (mode) {
mode = PROT_READ;
} else {
@@ -507,3 +511,20 @@ void zend_accel_shared_protect(int mode)
}
#endif
}
int zend_accel_in_shm(void *ptr)
{
int i;
if (!smm_shared_globals) {
return 0;
}
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
if ((char*)ptr >= (char*)ZSMMG(shared_segments)[i]->p &&
(char*)ptr < (char*)ZSMMG(shared_segments)[i]->p + ZSMMG(shared_segments)[i]->size) {
return 1;
}
}
return 0;
}
+2
View File
@@ -128,6 +128,8 @@ void *zend_shared_alloc(size_t size);
void *_zend_shared_memdup(void *p, size_t size, zend_bool free_source);
int zend_shared_memdup_size(void *p, size_t size);
int zend_accel_in_shm(void *ptr);
typedef union _align_test {
void *ptr;
double dbl;
+1 -1
View File
@@ -4931,7 +4931,7 @@ PHP_FUNCTION(openssl_seal)
iv_len = EVP_CIPHER_iv_length(cipher);
if (!iv && iv_len > 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
php_error_docref(NULL, E_WARNING,
"Cipher algorithm requires an IV to be supplied as a sixth parameter");
RETURN_FALSE;
}
+4 -24
View File
@@ -1731,8 +1731,6 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
zend_long limit_val, zend_long flags)
{
pcre_extra *extra = pce->extra;/* Holds results of studying */
pcre *re_bump = NULL; /* Regex instance for empty matches */
pcre_extra *extra_bump = NULL; /* Almost dummy */
pcre_extra extra_data; /* Used locally for exec options */
int *offsets; /* Array of subpattern offsets */
int size_offsets; /* Size of the offsets array */
@@ -1840,29 +1838,11 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
the start offset, and continue. Fudge the offset values
to achieve this, unless we're already at the end of the string. */
if (g_notempty != 0 && start_offset < subject_len) {
if (pce->compile_options & PCRE_UTF8) {
if (re_bump == NULL) {
int dummy;
zend_string *regex = zend_string_init("/./us", sizeof("/./us")-1, 0);
re_bump = pcre_get_compiled_regex(regex, &extra_bump, &dummy);
zend_string_release(regex);
if (re_bump == NULL) {
RETURN_FALSE;
}
}
count = pcre_exec(re_bump, extra_bump, subject,
subject_len, start_offset,
exoptions, offsets, size_offsets);
if (count < 1) {
php_error_docref(NULL, E_WARNING, "Unknown error");
RETURN_FALSE;
}
} else {
offsets[0] = start_offset;
offsets[1] = start_offset + 1;
}
} else
offsets[0] = start_offset;
offsets[1] = start_offset + calculate_unit_length(pce, subject + start_offset);
} else {
break;
}
} else {
pcre_handle_exec_error(count);
break;
+1 -1
View File
@@ -81,7 +81,7 @@ ZEND_BEGIN_MODULE_GLOBALS(pcre)
int error_code;
ZEND_END_MODULE_GLOBALS(pcre)
PHPAPI ZEND_EXTERN_MODULE_GLOBALS(pcre);
PHPAPI ZEND_EXTERN_MODULE_GLOBALS(pcre)
#define PCRE_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(pcre, v)
#else
Loaded 100 of 281 files, more files were not shown because too many files have changed in this diff. Show more