mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-25 18:05:42 +00:00
Compare commits
233
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
249a8fd9ae | ||
|
|
2b7c1bed1d | ||
|
|
8197532f68 | ||
|
|
a380163014 | ||
|
|
8b6cf164b8 | ||
|
|
67fbb06311 | ||
|
|
57d170aae0 | ||
|
|
9c19a08b9d | ||
|
|
3dd82caf57 | ||
|
|
f8dd10508b | ||
|
|
2d112e1378 | ||
|
|
64f42c73ef | ||
|
|
e93c6910fc | ||
|
|
95433e8e33 | ||
|
|
4bbc811ff4 | ||
|
|
06c2b31866 | ||
|
|
75dd4a7a50 | ||
|
|
72281f29dd | ||
|
|
1e9b175204 | ||
|
|
884c7d181f | ||
|
|
6e25966544 | ||
|
|
ffe82dd775 | ||
|
|
89919b5ec5 | ||
|
|
68a29ccb84 | ||
|
|
7fead8e8f5 | ||
|
|
0ce801a587 | ||
|
|
68ebfc87ad | ||
|
|
84651b32eb | ||
|
|
704a9aeea7 | ||
|
|
ab7764d99b | ||
|
|
beda05269c | ||
|
|
ec12385f04 | ||
|
|
ca61f5954b | ||
|
|
50fca7a02a | ||
|
|
02743f43c2 | ||
|
|
ccc5150f15 | ||
|
|
fca831e8ad | ||
|
|
884f3f0afd | ||
|
|
9d02e3b97e | ||
|
|
d26d80ab75 | ||
|
|
f3f5a07aa5 | ||
|
|
741bfe3932 | ||
|
|
8b5d09a195 | ||
|
|
8cd903ea68 | ||
|
|
99c44458da | ||
|
|
f8506c062f | ||
|
|
4d4c6cf14e | ||
|
|
67f0770036 | ||
|
|
3edd33083c | ||
|
|
753bbad535 | ||
|
|
a0fac47364 | ||
|
|
351201bc7b | ||
|
|
915a3762ef | ||
|
|
c3cf6f2a68 | ||
|
|
675c295722 | ||
|
|
98c625a31c | ||
|
|
9833c76d3f | ||
|
|
7d5f71b0b1 | ||
|
|
5a6da79fd0 | ||
|
|
86229f9943 | ||
|
|
a2022fd82a | ||
|
|
a1d1f54b42 | ||
|
|
9aa73d3800 | ||
|
|
7a4c2fa829 | ||
|
|
8ca02bb233 | ||
|
|
89a4342507 | ||
|
|
f7e81fd9f1 | ||
|
|
0fccddba75 | ||
|
|
860dc17ab7 | ||
|
|
be5bbe7068 | ||
|
|
a7028d9671 | ||
|
|
5602f64213 | ||
|
|
3240dd93b3 | ||
|
|
2d4ad66ff2 | ||
|
|
159602bd86 | ||
|
|
ccd215a517 | ||
|
|
5a01605b4b | ||
|
|
08fce8e2c5 | ||
|
|
1ac152938c | ||
|
|
c4b188871e | ||
|
|
5527c5b083 | ||
|
|
a4e56194d7 | ||
|
|
bdd578fcbb | ||
|
|
4f0042bead | ||
|
|
2399c64eaf | ||
|
|
908b662f7f | ||
|
|
b6bbe33f05 | ||
|
|
914d33c40e | ||
|
|
afedd4fd59 | ||
|
|
ab800642df | ||
|
|
1ce0ea7396 | ||
|
|
6823ee923d | ||
|
|
22d8e9aced | ||
|
|
499c1e81a1 | ||
|
|
c69d80d701 | ||
|
|
90a0cbd594 | ||
|
|
b3bb1aacfe | ||
|
|
6e6a556b8c | ||
|
|
3c8ccdd9d3 | ||
|
|
54df59b729 | ||
|
|
ae3f132be1 | ||
|
|
a0bbac550e | ||
|
|
91990bbde0 | ||
|
|
153a44d6bb | ||
|
|
07b6fc93b1 | ||
|
|
9cabc99fce | ||
|
|
db68b8ea54 | ||
|
|
20add1e530 | ||
|
|
6f8585fc7d | ||
|
|
3fb566f475 | ||
|
|
2d4186dde7 | ||
|
|
726e87e142 | ||
|
|
471540d285 | ||
|
|
dea2e1bc64 | ||
|
|
0bbea60524 | ||
|
|
2e18d438b0 | ||
|
|
961c8d568d | ||
|
|
996760f104 | ||
|
|
186844be92 | ||
|
|
655e5dd99d | ||
|
|
acbbe76d7b | ||
|
|
afcce5ceca | ||
|
|
bb80c00a00 | ||
|
|
0df2575e9f | ||
|
|
08af2f9a11 | ||
|
|
ba96506676 | ||
|
|
9fc0517328 | ||
|
|
a6afaa9a85 | ||
|
|
50b4cafd28 | ||
|
|
4a66b01639 | ||
|
|
31dc08a904 | ||
|
|
d78220fb2c | ||
|
|
7a14a286bd | ||
|
|
128cc4bc9d | ||
|
|
c49d9f0684 | ||
|
|
56ab4a6096 | ||
|
|
53c036b30b | ||
|
|
44c3f1492f | ||
|
|
7816698580 | ||
|
|
f806fedd80 | ||
|
|
d7fd614cc6 | ||
|
|
a310c3b484 | ||
|
|
efaafd45b4 | ||
|
|
35be4398d1 | ||
|
|
273bb7e9c0 | ||
|
|
9ccf3a0292 | ||
|
|
b79b036a31 | ||
|
|
d0b3a72cea | ||
|
|
69e26f9f8f | ||
|
|
6adfc20f04 | ||
|
|
f738abab85 | ||
|
|
0ac0604b30 | ||
|
|
93592a9c08 | ||
|
|
8c053d44e4 | ||
|
|
e2bf86fbfd | ||
|
|
ecea7d3d35 | ||
|
|
e65cc72cb6 | ||
|
|
c299b272c7 | ||
|
|
fd561505f4 | ||
|
|
0aa7163816 | ||
|
|
079f2f7eb3 | ||
|
|
b657554585 | ||
|
|
6842a3674d | ||
|
|
43366f8ba8 | ||
|
|
eb885e9d6e | ||
|
|
ea02f57656 | ||
|
|
38db6ff306 | ||
|
|
3ea877ca15 | ||
|
|
d1057cc139 | ||
|
|
bb2856b28c | ||
|
|
17967ecda1 | ||
|
|
f14c0cc43a | ||
|
|
f463297c51 | ||
|
|
c9778d3eb9 | ||
|
|
6e1862d0a8 | ||
|
|
7d7325246c | ||
|
|
90ad6e3c6c | ||
|
|
ff115e285a | ||
|
|
ca779add4d | ||
|
|
0b9c87a02b | ||
|
|
01e85f3fdc | ||
|
|
cd75429ad8 | ||
|
|
9623d2dd83 | ||
|
|
18e3b11d62 | ||
|
|
0d57c06b2c | ||
|
|
78b29310bc | ||
|
|
3f5c80e8c2 | ||
|
|
6c2ca18fe0 | ||
|
|
fd6ac61064 | ||
|
|
32e2801ff9 | ||
|
|
e8385a60b3 | ||
|
|
d20f1d8f1f | ||
|
|
eaf4e77190 | ||
|
|
57b997ebf9 | ||
|
|
d25e67eee6 | ||
|
|
a6fdc5bb27 | ||
|
|
0bd64b50b8 | ||
|
|
2ecc0c1085 | ||
|
|
a50c31da19 | ||
|
|
796e1629b0 | ||
|
|
25fbb06e2d | ||
|
|
830b2bd368 | ||
|
|
9ac01060f9 | ||
|
|
7f7dce3cd6 | ||
|
|
bbaece44ee | ||
|
|
bbce94ed78 | ||
|
|
b3df715f50 | ||
|
|
4564b4c8f6 | ||
|
|
688b914217 | ||
|
|
20ca0b89bd | ||
|
|
9a5797976a | ||
|
|
0445abd547 | ||
|
|
150e3804b9 | ||
|
|
148eba2afd | ||
|
|
f613d89501 | ||
|
|
4b5cce269b | ||
|
|
632fc51d98 | ||
|
|
3ce6ad9d13 | ||
|
|
a0724d3081 | ||
|
|
68a51ae953 | ||
|
|
aa383d633e | ||
|
|
9afb29aa68 | ||
|
|
cf842f1064 | ||
|
|
491925bc53 | ||
|
|
a329dc70e9 | ||
|
|
c3eeb8092a | ||
|
|
e87ac6de31 | ||
|
|
4762ed4d27 | ||
|
|
055b411218 | ||
|
|
d228752939 | ||
|
|
6f6bd8ce53 | ||
|
|
837e2a912d | ||
|
|
b1bd4119bc |
No files matched your search
+1
-1
@@ -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'.
|
||||
|
||||
|
||||
@@ -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
@@ -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
@@ -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
|
||||
|
||||
@@ -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, ¶m) == 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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)
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
@@ -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
@@ -77,7 +77,7 @@
|
||||
#define ZEND_TSRMLS_CACHE
|
||||
#endif
|
||||
|
||||
ZEND_TSRMLS_CACHE_EXTERN();
|
||||
ZEND_TSRMLS_CACHE_EXTERN()
|
||||
|
||||
#ifdef HAVE_NORETURN
|
||||
# ifdef ZEND_NORETURN_ALIAS
|
||||
|
||||
@@ -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
@@ -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
@@ -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)) {
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
@@ -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:
|
||||
|
||||
+217
-216
File diff suppressed because it is too large.
Load diff
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
File diff suppressed because it is too large.
Load diff
@@ -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();
|
||||
|
||||
@@ -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
|
||||
@@ -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
@@ -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
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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 />
|
||||
@@ -0,0 +1 @@
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
@@ -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
@@ -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
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
@@ -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,
|
||||
¶ms[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,
|
||||
¶ms[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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
?>
|
||||
@@ -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);
|
||||
|
||||
?>
|
||||
@@ -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 = '';
|
||||
}
|
||||
|
||||
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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() );
|
||||
' );
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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
@@ -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
@@ -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
Reference in new issue
Block a user