mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-21 16:06:37 +00:00
Compare commits
67
Commits
php-7.4.11
...
php-7.3.24
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8737373e1 | ||
|
|
302d15a9a9 | ||
|
|
4e6e1f42be | ||
|
|
8488c34fc6 | ||
|
|
73e43b6e19 | ||
|
|
c1962e900a | ||
|
|
0d022ddf03 | ||
|
|
3c4dd73c02 | ||
|
|
e304468e57 | ||
|
|
1ed5a2a54d | ||
|
|
62a2387a8d | ||
|
|
8bee0fbd37 | ||
|
|
07a4185df1 | ||
|
|
5018581410 | ||
|
|
14d231bd16 | ||
|
|
90a5d7c2ad | ||
|
|
1895bf7b94 | ||
|
|
e68acd031d | ||
|
|
e857dfa7cc | ||
|
|
69ba81d183 | ||
|
|
aa405b7da2 | ||
|
|
bf6873a18e | ||
|
|
1666cfcca0 | ||
|
|
773f980e00 | ||
|
|
5733f11ee9 | ||
|
|
1616363850 | ||
|
|
662083fc4f | ||
|
|
3f5c47af3b | ||
|
|
ae95d06f68 | ||
|
|
b5cb999e7f | ||
|
|
bf5f07cc8b | ||
|
|
df5efa2fcd | ||
|
|
f5afd0a827 | ||
|
|
2899137391 | ||
|
|
035ad0aed5 | ||
|
|
af500b8685 | ||
|
|
95e1a415a5 | ||
|
|
2f5cb702ff | ||
|
|
311922ddbe | ||
|
|
7bc112a142 | ||
|
|
6acfb79276 | ||
|
|
6559fe9126 | ||
|
|
0216630ea2 | ||
|
|
4dfbf07644 | ||
|
|
a49555a9e1 | ||
|
|
e74f89d95a | ||
|
|
610e7d2c77 | ||
|
|
2576c57a51 | ||
|
|
9439d65f0d | ||
|
|
5ed0602ec6 | ||
|
|
4000780b3d | ||
|
|
730fdc77a7 | ||
|
|
81b2f3e5d9 | ||
|
|
a7544411df | ||
|
|
740f0f6165 | ||
|
|
70cba36fc9 | ||
|
|
77f43e48ff | ||
|
|
ecd9c42f9e | ||
|
|
c7ceebc42c | ||
|
|
c3944c4c4f | ||
|
|
efdbc3688b | ||
|
|
1aab7db6c8 | ||
|
|
c9abb0c0ac | ||
|
|
202a0697f3 | ||
|
|
efc52f1754 | ||
|
|
a4f806aa79 | ||
|
|
edddddcea8 |
No files matched your search
@@ -1,11 +1,61 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? ????, PHP 7.3.23
|
||||
29 Oct 2020, PHP 7.3.24
|
||||
|
||||
- Core:
|
||||
. Fixed bug #79423 (copy command is limited to size of file it can copy).
|
||||
(cmb)
|
||||
|
||||
- Calendar:
|
||||
. Fixed bug #80185 (jdtounix() fails after 2037). (cmb)
|
||||
|
||||
- IMAP:
|
||||
. Fixed bug #80213 (imap_mail_compose() segfaults on certain $bodies). (cmb)
|
||||
. Fixed bug #80215 (imap_mail_compose() may modify by-val parameters). (cmb)
|
||||
. Fixed bug #80220 (imap_mail_compose() may leak memory). (cmb)
|
||||
. Fixed bug #80223 (imap_mail_compose() leaks envelope on malformed bodies).
|
||||
(cmb)
|
||||
. Fixed bug #80216 (imap_mail_compose() does not validate types/encodings).
|
||||
(cmb)
|
||||
. Fixed bug #80226 (imap_sort() leaks sortpgm memory). (cmb)
|
||||
|
||||
- MySQLnd:
|
||||
. Fixed bug #80115 (mysqlnd.debug doesn't recognize absolute paths with
|
||||
slashes). (cmb)
|
||||
. Fixed bug #80107 (mysqli_query() fails for ~16 MB long query when
|
||||
compression is enabled). (Nikita)
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #78470 (odbc_specialcolumns() no longer accepts $nullable). (cmb)
|
||||
. Fixed bug #80147 (BINARY strings may not be properly zero-terminated).
|
||||
(cmb)
|
||||
. Fixed bug #80150 (Failure to fetch error message). (cmb)
|
||||
. Fixed bug #80152 (odbc_execute() moves internal pointer of $params). (cmb)
|
||||
. Fixed bug #46050 (odbc_next_result corrupts prepared resource). (cmb)
|
||||
|
||||
- OPcache:
|
||||
. Fixed bug #80083 (Optimizer pass 6 removes variables used for ibm_db2 data
|
||||
binding). (Nikita)
|
||||
|
||||
- PDO_ODBC:
|
||||
. Fixed bug #67465 (NULL Pointer dereference in odbc_handle_preparer). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #80114 (parse_url does not accept URLs with port 0). (cmb, twosee)
|
||||
. Fixed bug #76943 (Inconsistent stream_wrapper_restore() errors). (cmb)
|
||||
. Fixed bug #76735 (Incorrect message in fopen on invalid mode). (cmb)
|
||||
|
||||
- Tidy:
|
||||
. Fixed bug #77040 (tidyNode::isHtml() is completely broken). (cmb)
|
||||
|
||||
01 Oct 2020, PHP 7.3.23
|
||||
|
||||
- Core:
|
||||
. Fixed bug #80048 (Bug #69100 has not been fixed for Windows). (cmb)
|
||||
. Fixed bug #80049 (Memleak when coercing integers to string via variadic
|
||||
argument). (Nikita)
|
||||
. Fixed bug #79699 (PHP parses encoded cookie names so malicious `__Host-`
|
||||
cookies can be sent). (CVE-2020-7070) (Stas)
|
||||
|
||||
- Calendar:
|
||||
. Fixed bug #80007 (Potential type confusion in unixtojd() parameter parsing).
|
||||
@@ -21,9 +71,17 @@ PHP NEWS
|
||||
. Fixed bug #79825 (opcache.file_cache causes SIGSEGV when custom opcode
|
||||
handlers changed). (SammyK)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #79601 (Wrong ciphertext/tag in AES-CCM encryption for a 12
|
||||
bytes IV). (CVE-2020-7069) (Jakub Zelenka)
|
||||
|
||||
- PDO:
|
||||
. Fixed bug #80027 (Terrible performance using $query->fetch on queries with
|
||||
many bind parameters (Matteo)
|
||||
many bind parameters). (Matteo)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #47021 (SoapClient stumbles over WSDL delivered with
|
||||
"Transfer-Encoding: chunked"). (Matteo)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #79986 (str_ireplace bug with diacritics characters). (cmb)
|
||||
@@ -67,10 +125,6 @@ PHP NEWS
|
||||
. Fixed bug #64705 (errorInfo property of PDOException is null when
|
||||
PDO::__construct() fails). (Ahmed Abdou)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #47021 (SoapClient stumbles over WSDL delivered with
|
||||
"Transfer-Encoding: chunked"). (Matteo)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #79930 (array_merge_recursive() crashes when called with array
|
||||
with single reference). (Nikita)
|
||||
|
||||
@@ -151,6 +151,11 @@ Reflection:
|
||||
. Reflection export to string now uses `int` and `bool` instead of `integer`
|
||||
and `boolean`.
|
||||
|
||||
- SAPI:
|
||||
. Starting with 7.3.23, incoming cookie names are not url-decoded. This was never
|
||||
required by the standard, outgoing cookie names aren't encoded and this leads
|
||||
to security issues (CVE-2020-7070).
|
||||
|
||||
SPL:
|
||||
. If an SPL autoloader throws an exception, following autoloaders will not be
|
||||
executed. Previously all autoloaders were executed and exceptions were
|
||||
|
||||
+5
-4
@@ -116,16 +116,16 @@ int main()
|
||||
double d = (double) LONG_MIN * LONG_MIN + 2e9;
|
||||
|
||||
if ((long) d == 2e9 && (long) -d == -2e9) {
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
} else if (sizeof(long) == 8) {
|
||||
double correct = 18e18 - ((double) LONG_MIN * -2); /* Subtract ULONG_MAX + 1 */
|
||||
|
||||
if ((long) 18e18 == correct) { /* On 64-bit, only check between LONG_MAX and ULONG_MAX */
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
]])], [
|
||||
AC_DEFINE([ZEND_DVAL_TO_LVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits])
|
||||
@@ -249,7 +249,7 @@ int main()
|
||||
fprintf(fp, "%d %d\n", ZEND_MM_ALIGNMENT, zeros);
|
||||
fclose(fp);
|
||||
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
]])], [
|
||||
LIBZEND_MM_ALIGN=`cat conftest.zend | cut -d ' ' -f 1`
|
||||
@@ -318,6 +318,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <sys/mman.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#ifndef MAP_ANON
|
||||
# ifdef MAP_ANONYMOUS
|
||||
# define MAP_ANON MAP_ANONYMOUS
|
||||
|
||||
+4
-1
@@ -63,7 +63,10 @@ dnl Check for broken sprintf()
|
||||
dnl
|
||||
AC_DEFUN([AC_ZEND_BROKEN_SPRINTF],[
|
||||
AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }]])],[
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
int main() {char buf[20]; return sprintf(buf,"testing 123")!=11; }
|
||||
]])],[
|
||||
ac_cv_broken_sprintf=no
|
||||
],[
|
||||
ac_cv_broken_sprintf=yes
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Array addition should not add INDIRECT elements
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$x = 1;
|
||||
$ary = ['y' => 1];
|
||||
$ary += $GLOBALS;
|
||||
var_dump($ary['x']);
|
||||
$x = 2;
|
||||
var_dump($ary['x']);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(1)
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Add $GLOBALS to itself
|
||||
--FILE--
|
||||
<?php
|
||||
$GLOBALS += $GLOBALS;
|
||||
$x = $GLOBALS + $GLOBALS;
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "3.3.23-dev"
|
||||
#define ZEND_VERSION "3.3.24"
|
||||
|
||||
#define ZEND_ENGINE_3
|
||||
|
||||
|
||||
@@ -666,6 +666,7 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
|
||||
if (func->type == ZEND_USER_FUNCTION) {
|
||||
memcpy(&closure->func, func, sizeof(zend_op_array));
|
||||
closure->func.common.fn_flags |= ZEND_ACC_CLOSURE;
|
||||
closure->func.common.fn_flags &= ~ZEND_ACC_IMMUTABLE;
|
||||
if (closure->func.op_array.static_variables) {
|
||||
closure->func.op_array.static_variables =
|
||||
zend_array_dup(closure->func.op_array.static_variables);
|
||||
@@ -676,7 +677,9 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
|
||||
|| func->common.scope != scope
|
||||
|| (func->common.fn_flags & ZEND_ACC_NO_RT_ARENA)
|
||||
) {
|
||||
if (!func->op_array.run_time_cache && (func->common.fn_flags & ZEND_ACC_CLOSURE)) {
|
||||
if (!func->op_array.run_time_cache
|
||||
&& (func->common.fn_flags & ZEND_ACC_CLOSURE)
|
||||
&& !(func->common.fn_flags & ZEND_ACC_IMMUTABLE)) {
|
||||
/* If a real closure is used for the first time, we create a shared runtime cache
|
||||
* and remember which scope it is for. */
|
||||
func->common.scope = scope;
|
||||
|
||||
+17
-13
@@ -1999,7 +1999,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_merge(HashTable *target, HashTable *source
|
||||
{
|
||||
uint32_t idx;
|
||||
Bucket *p;
|
||||
zval *t;
|
||||
zval *t, *s;
|
||||
|
||||
IS_CONSISTENT(source);
|
||||
IS_CONSISTENT(target);
|
||||
@@ -2008,18 +2008,20 @@ ZEND_API void ZEND_FASTCALL zend_hash_merge(HashTable *target, HashTable *source
|
||||
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;
|
||||
s = &p->val;
|
||||
if (UNEXPECTED(Z_TYPE_P(s) == IS_INDIRECT)) {
|
||||
s = Z_INDIRECT_P(s);
|
||||
}
|
||||
if (UNEXPECTED(Z_TYPE_P(s) == IS_UNDEF)) {
|
||||
continue;
|
||||
}
|
||||
if (p->key) {
|
||||
t = _zend_hash_add_or_update_i(target, p->key, &p->val, HASH_UPDATE | HASH_UPDATE_INDIRECT);
|
||||
t = _zend_hash_add_or_update_i(target, p->key, s, HASH_UPDATE | HASH_UPDATE_INDIRECT);
|
||||
if (pCopyConstructor) {
|
||||
pCopyConstructor(t);
|
||||
}
|
||||
} else {
|
||||
t = zend_hash_index_update(target, p->h, &p->val);
|
||||
t = zend_hash_index_update(target, p->h, s);
|
||||
if (pCopyConstructor) {
|
||||
pCopyConstructor(t);
|
||||
}
|
||||
@@ -2028,18 +2030,20 @@ ZEND_API void ZEND_FASTCALL zend_hash_merge(HashTable *target, HashTable *source
|
||||
} 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;
|
||||
s = &p->val;
|
||||
if (UNEXPECTED(Z_TYPE_P(s) == IS_INDIRECT)) {
|
||||
s = Z_INDIRECT_P(s);
|
||||
}
|
||||
if (UNEXPECTED(Z_TYPE_P(s) == IS_UNDEF)) {
|
||||
continue;
|
||||
}
|
||||
if (p->key) {
|
||||
t = _zend_hash_add_or_update_i(target, p->key, &p->val, HASH_ADD | HASH_UPDATE_INDIRECT);
|
||||
t = _zend_hash_add_or_update_i(target, p->key, s, HASH_ADD | HASH_UPDATE_INDIRECT);
|
||||
if (t && pCopyConstructor) {
|
||||
pCopyConstructor(t);
|
||||
}
|
||||
} else {
|
||||
t = zend_hash_index_add(target, p->h, &p->val);
|
||||
t = zend_hash_index_add(target, p->h, s);
|
||||
if (t && pCopyConstructor) {
|
||||
pCopyConstructor(t);
|
||||
}
|
||||
|
||||
@@ -903,7 +903,7 @@ try_again:
|
||||
|
||||
static zend_never_inline void ZEND_FASTCALL add_function_array(zval *result, zval *op1, zval *op2) /* {{{ */
|
||||
{
|
||||
if ((result == op1) && (result == op2)) {
|
||||
if (result == op1 && Z_ARR_P(op1) == Z_ARR_P(op2)) {
|
||||
/* $a += $a */
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7097,15 +7097,6 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
|
||||
zfunc = zend_hash_find_ex(EG(function_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1);
|
||||
ZEND_ASSERT(zfunc != NULL && Z_FUNC_P(zfunc)->type == ZEND_USER_FUNCTION);
|
||||
|
||||
fbc = Z_PTR_P(zfunc);
|
||||
if (fbc->common.fn_flags & ZEND_ACC_IMMUTABLE) {
|
||||
zend_function *new_func = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
|
||||
|
||||
memcpy(new_func, fbc, sizeof(zend_op_array));
|
||||
new_func->common.fn_flags &= ~ZEND_ACC_IMMUTABLE;
|
||||
Z_PTR_P(zfunc) = fbc = new_func;
|
||||
}
|
||||
|
||||
if (Z_TYPE(EX(This)) == IS_OBJECT) {
|
||||
called_scope = Z_OBJCE(EX(This));
|
||||
if (UNEXPECTED((Z_FUNC_P(zfunc)->common.fn_flags & ZEND_ACC_STATIC) ||
|
||||
|
||||
@@ -9209,15 +9209,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_C
|
||||
zfunc = zend_hash_find_ex(EG(function_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1);
|
||||
ZEND_ASSERT(zfunc != NULL && Z_FUNC_P(zfunc)->type == ZEND_USER_FUNCTION);
|
||||
|
||||
fbc = Z_PTR_P(zfunc);
|
||||
if (fbc->common.fn_flags & ZEND_ACC_IMMUTABLE) {
|
||||
zend_function *new_func = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
|
||||
|
||||
memcpy(new_func, fbc, sizeof(zend_op_array));
|
||||
new_func->common.fn_flags &= ~ZEND_ACC_IMMUTABLE;
|
||||
Z_PTR_P(zfunc) = fbc = new_func;
|
||||
}
|
||||
|
||||
if (Z_TYPE(EX(This)) == IS_OBJECT) {
|
||||
called_scope = Z_OBJCE(EX(This));
|
||||
if (UNEXPECTED((Z_FUNC_P(zfunc)->common.fn_flags & ZEND_ACC_STATIC) ||
|
||||
|
||||
+20
-18
@@ -1209,14 +1209,14 @@ AC_DEFUN([PHP_DOES_PWRITE_WORK],[
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
$1
|
||||
main() {
|
||||
int main() {
|
||||
int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600);
|
||||
|
||||
if (fd < 0) exit(1);
|
||||
if (pwrite(fd, "text", 4, 0) != 4) exit(1);
|
||||
if (fd < 0) return 1;
|
||||
if (pwrite(fd, "text", 4, 0) != 4) return 1;
|
||||
/* Linux glibc breakage until 2.2.5 */
|
||||
if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1);
|
||||
exit(0);
|
||||
if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
]])],[
|
||||
@@ -1239,14 +1239,14 @@ AC_DEFUN([PHP_DOES_PREAD_WORK],[
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
$1
|
||||
main() {
|
||||
int main() {
|
||||
char buf[3];
|
||||
int fd = open("conftest_in", O_RDONLY);
|
||||
if (fd < 0) exit(1);
|
||||
if (pread(fd, buf, 2, 0) != 2) exit(1);
|
||||
if (fd < 0) return 1;
|
||||
if (pread(fd, buf, 2, 0) != 2) return 1;
|
||||
/* Linux glibc breakage until 2.2.5 */
|
||||
if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1);
|
||||
exit(0);
|
||||
if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) return 1;
|
||||
return 0;
|
||||
}
|
||||
]])],[
|
||||
ac_cv_pread=yes
|
||||
@@ -1347,25 +1347,26 @@ AC_DEFUN([PHP_READDIR_R_TYPE],[
|
||||
#define _REENTRANT
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 1024
|
||||
#endif
|
||||
|
||||
main() {
|
||||
int main() {
|
||||
DIR *dir;
|
||||
char entry[sizeof(struct dirent)+PATH_MAX];
|
||||
struct dirent *pentry = (struct dirent *) &entry;
|
||||
|
||||
dir = opendir("/");
|
||||
if (!dir)
|
||||
exit(1);
|
||||
return 1;
|
||||
if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0) {
|
||||
close(dir);
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
close(dir);
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
]])],[
|
||||
ac_cv_what_readdir_r=POSIX
|
||||
@@ -1693,6 +1694,7 @@ AC_DEFUN([PHP_BROKEN_GLIBC_FOPEN_APPEND], [
|
||||
AC_CACHE_VAL(_cv_have_broken_glibc_fopen_append,[
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
FILE *fp;
|
||||
@@ -1702,7 +1704,7 @@ int main(int argc, char *argv[])
|
||||
fp = fopen(filename, "w");
|
||||
if (fp == NULL) {
|
||||
perror("fopen");
|
||||
exit(2);
|
||||
return 2;
|
||||
}
|
||||
fputs("foobar", fp);
|
||||
fclose(fp);
|
||||
@@ -1812,13 +1814,13 @@ int seeker(void *cookie, __off64_t *position, int whence)
|
||||
|
||||
cookie_io_functions_t funcs = {reader, writer, seeker, closer};
|
||||
|
||||
main() {
|
||||
int main() {
|
||||
struct cookiedata g = { 0 };
|
||||
FILE *fp = fopencookie(&g, "r", funcs);
|
||||
|
||||
if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192)
|
||||
exit(0);
|
||||
exit(1);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
]])], [
|
||||
|
||||
+8
-7
@@ -107,8 +107,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=7
|
||||
PHP_MINOR_VERSION=3
|
||||
PHP_RELEASE_VERSION=23
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=24
|
||||
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`
|
||||
|
||||
@@ -716,6 +716,7 @@ dnl Also check for working getaddrinfo
|
||||
AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
|
||||
[[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);]])],[AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef AF_INET
|
||||
@@ -728,11 +729,11 @@ int main(void) {
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
|
||||
if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) {
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ai == 0) {
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
pai = ai;
|
||||
@@ -740,16 +741,16 @@ int main(void) {
|
||||
while (pai) {
|
||||
if (pai->ai_family != AF_INET) {
|
||||
/* 127.0.0.1/NUMERICHOST should only resolve ONE way */
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
if (pai->ai_addr->sa_family != AF_INET) {
|
||||
/* 127.0.0.1/NUMERICHOST should only resolve ONE way */
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
pai = pai->ai_next;
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
]])],[ac_cv_func_getaddrinfo=yes], [ac_cv_func_getaddrinfo=no], [ac_cv_func_getaddrinfo=no])],
|
||||
[ac_cv_func_getaddrinfo=no])])
|
||||
|
||||
@@ -83,12 +83,12 @@ bool(false)
|
||||
resource(%d) of type (stream)
|
||||
resource(%d) of type (stream)
|
||||
|
||||
Warning: fopen(bz_open_002.txt): failed to open stream: Bad file %s in %s on line %d
|
||||
Warning: fopen(bz_open_002.txt): failed to open stream: `br' is not a valid mode for fopen in %s on line %d
|
||||
|
||||
Warning: bzopen(): first parameter has to be string or file-resource in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fopen(bz_open_002.txt): failed to open stream: Bad file %s in %s on line %d
|
||||
Warning: fopen(bz_open_002.txt): failed to open stream: `br' is not a valid mode for fopen in %s on line %d
|
||||
|
||||
Warning: bzopen(): first parameter has to be string or file-resource in %s on line %d
|
||||
bool(false)
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "sdncal.h"
|
||||
#include <time.h>
|
||||
|
||||
#define SECS_PER_DAY (24 * 3600)
|
||||
|
||||
/* {{{ proto int unixtojd([int timestamp])
|
||||
Convert UNIX timestamp to Julian Day */
|
||||
PHP_FUNCTION(unixtojd)
|
||||
@@ -62,11 +64,11 @@ PHP_FUNCTION(jdtounix)
|
||||
}
|
||||
uday -= 2440588 /* J.D. of 1.1.1970 */;
|
||||
|
||||
if (uday < 0 || uday > 24755) { /* before beginning of unix epoch or behind end of unix epoch */
|
||||
if (uday < 0 || uday > ZEND_LONG_MAX / SECS_PER_DAY) { /* before beginning of unix epoch or greater than representable */
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(uday * 24 * 3600);
|
||||
RETURN_LONG(uday * SECS_PER_DAY);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #80185 (jdtounix() fails after 2037)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('calendar')) die('skip ext/calendar required');
|
||||
if (PHP_INT_SIZE != 8) die("skip for 64bit platforms only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(jdtounix(2465712));
|
||||
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440588));
|
||||
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440589));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2170713600)
|
||||
int(9223372036854720000)
|
||||
bool(false)
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #80185 (jdtounix() fails after 2037)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('calendar')) die('skip ext/calendar required');
|
||||
if (PHP_INT_SIZE != 4) die("skip for 32bit platforms only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(jdtounix(2465712));
|
||||
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440588));
|
||||
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440589));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
int(2147472000)
|
||||
bool(false)
|
||||
@@ -7,7 +7,7 @@ TestFest 2009 - AFUP - Perrick Penet <perrick@noparking.net>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = uniqid()."://www.".uniqid().".".uniqid();
|
||||
$url = substr(uniqid(),0,7)."://www.".uniqid().".".uniqid();
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
|
||||
@@ -18,6 +18,6 @@ curl_close($ch);
|
||||
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
string\(\d+\) "([^\r\n]*rotocol[^\r\n]+|Could not resolve host: .+)"
|
||||
int\(\d\)
|
||||
--EXPECTF--
|
||||
string(%d) "%Srotocol%s"
|
||||
int(1)
|
||||
+724
-853
File diff suppressed because it is too large.
Load diff
@@ -4,7 +4,7 @@ Bug #48097 (date_timezone_set function produces wrong datetime result)
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
$d = date_create( "Mon, 23 May 1955 00:00:00 +0200" );
|
||||
$d = date_create( "Sun, 22 May 1955 02:00:00 +0200" );
|
||||
var_dump( $d );
|
||||
echo $d->format( DATE_ISO8601 ), "\n";
|
||||
echo $d->format( 'U' ), "\n\n";
|
||||
@@ -16,23 +16,23 @@ echo $d->format( 'U' ), "\n\n";
|
||||
--EXPECT--
|
||||
object(DateTime)#1 (3) {
|
||||
["date"]=>
|
||||
string(26) "1955-05-23 00:00:00.000000"
|
||||
string(26) "1955-05-22 02:00:00.000000"
|
||||
["timezone_type"]=>
|
||||
int(1)
|
||||
["timezone"]=>
|
||||
string(6) "+02:00"
|
||||
}
|
||||
1955-05-23T00:00:00+0200
|
||||
-461124000
|
||||
1955-05-22T02:00:00+0200
|
||||
-461203200
|
||||
|
||||
object(DateTime)#1 (3) {
|
||||
["date"]=>
|
||||
string(26) "1955-05-22 23:00:00.000000"
|
||||
string(26) "1955-05-22 01:00:00.000000"
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
string(15) "Europe/Budapest"
|
||||
}
|
||||
1955-05-22T23:00:00+0100
|
||||
1955-05-22T01:00:00+0100
|
||||
|
||||
-461124000
|
||||
-461203200
|
||||
+1
-1
@@ -129,7 +129,7 @@ int main() {
|
||||
|
||||
int main() {
|
||||
iconv_t cd;
|
||||
cd = iconv_open( "*blahblah*", "*blahblah*" );
|
||||
cd = iconv_open( "*blahblah*", "*blahblahblah*" );
|
||||
if (cd == (iconv_t)(-1)) {
|
||||
if (errno == EINVAL) {
|
||||
return 0;
|
||||
|
||||
+38
-14
@@ -3074,7 +3074,8 @@ static void php_imap_mutf7(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
if (out == NIL) {
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
RETURN_STRING((char *)out);
|
||||
RETVAL_STRING((char *)out);
|
||||
fs_give((void**) &out);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -3188,6 +3189,7 @@ PHP_FUNCTION(imap_sort)
|
||||
|
||||
slst = mail_sort(imap_le_struct->imap_stream, (argc == 6 ? ZSTR_VAL(charset) : NIL), spg, mypgm, (argc >= 4 ? flags : NIL));
|
||||
|
||||
mail_free_sortpgm(&mypgm);
|
||||
if (spg && !(flags & SE_FREE)) {
|
||||
mail_free_searchpgm(&spg);
|
||||
}
|
||||
@@ -3543,7 +3545,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
int toppart = 0;
|
||||
int first;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "aa", &envelope, &body) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/a/", &envelope, &body) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3601,6 +3603,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(envelope), "custom_headers", sizeof("custom_headers") - 1)) != NULL) {
|
||||
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
|
||||
custom_headers_param = tmp_param = NULL;
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pvalue), env_data) {
|
||||
custom_headers_param = mail_newbody_parameter();
|
||||
convert_to_string_ex(env_data);
|
||||
@@ -3620,17 +3623,25 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
|
||||
if (Z_TYPE_P(data) != IS_ARRAY) {
|
||||
php_error_docref(NULL, E_WARNING, "body parameter must be a non-empty array");
|
||||
RETURN_FALSE;
|
||||
RETVAL_FALSE;
|
||||
goto done;
|
||||
}
|
||||
SEPARATE_ARRAY(data);
|
||||
|
||||
bod = mail_newbody();
|
||||
topbod = bod;
|
||||
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) {
|
||||
bod->type = (short) zval_get_long(pvalue);
|
||||
zend_long type = zval_get_long(pvalue);
|
||||
if (type >= 0 && type <= TYPEMAX && body_types[type] != NULL) {
|
||||
bod->type = (short) type;
|
||||
}
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) {
|
||||
bod->encoding = (short) zval_get_long(pvalue);
|
||||
zend_long encoding = zval_get_long(pvalue);
|
||||
if (encoding >= 0 && encoding <= ENCMAX && body_encodings[encoding] != NULL) {
|
||||
bod->encoding = (short) encoding;
|
||||
}
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
@@ -3643,7 +3654,9 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type.parameters", sizeof("type.parameters") - 1)) != NULL) {
|
||||
if(Z_TYPE_P(pvalue) == IS_ARRAY) {
|
||||
disp_param = tmp_param = NULL;
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
@@ -3675,7 +3688,9 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition", sizeof("disposition") - 1)) != NULL) {
|
||||
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
|
||||
disp_param = tmp_param = NULL;
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
@@ -3707,10 +3722,14 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
convert_to_string_ex(pvalue);
|
||||
bod->md5 = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
} else if (Z_TYPE_P(data) == IS_ARRAY) {
|
||||
short type = -1;
|
||||
} else if (Z_TYPE_P(data) == IS_ARRAY && topbod->type == TYPEMULTIPART) {
|
||||
short type = 0;
|
||||
SEPARATE_ARRAY(data);
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) {
|
||||
type = (short) zval_get_long(pvalue);
|
||||
zend_long tmp_type = zval_get_long(pvalue);
|
||||
if (tmp_type >= 0 && tmp_type <= TYPEMAX && tmp_type != TYPEMULTIPART && body_types[tmp_type] != NULL) {
|
||||
type = (short) tmp_type;
|
||||
}
|
||||
}
|
||||
|
||||
if (!toppart) {
|
||||
@@ -3723,13 +3742,13 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
|
||||
bod = &mypart->body;
|
||||
|
||||
if (type != TYPEMULTIPART) {
|
||||
bod->type = type;
|
||||
}
|
||||
bod->type = type;
|
||||
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) {
|
||||
bod->encoding = (short) zval_get_long(pvalue);
|
||||
zend_long encoding = zval_get_long(pvalue);
|
||||
if (encoding >= 0 && encoding <= ENCMAX && body_encodings[encoding] != NULL) {
|
||||
bod->encoding = (short) encoding;
|
||||
}
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
@@ -3743,7 +3762,9 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type.parameters", sizeof("type.parameters") - 1)) != NULL) {
|
||||
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
|
||||
disp_param = tmp_param = NULL;
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
@@ -3775,7 +3796,9 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition", sizeof("disposition") - 1)) != NULL) {
|
||||
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
|
||||
disp_param = tmp_param = NULL;
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
@@ -3812,7 +3835,8 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
|
||||
if (first) {
|
||||
php_error_docref(NULL, E_WARNING, "body parameter must be a non-empty array");
|
||||
RETURN_FALSE;
|
||||
RETVAL_FALSE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (bod && bod->type == TYPEMULTIPART && (!bod->nested.part || !bod->nested.part->next)) {
|
||||
|
||||
@@ -11,5 +11,5 @@ imap_mail('1', 1, NULL);
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imap_mail(): No message string in mail command in %s on line %d
|
||||
%s
|
||||
%A
|
||||
===DONE===
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #80213 (imap_mail_compose() segfaults on certain $bodies)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('imap')) die('skip imap extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$envelope = [];
|
||||
$body = [[
|
||||
'type.parameters' => ['param'],
|
||||
'disposition' => ['disp'],
|
||||
], [
|
||||
'type.parameters' => ['param'],
|
||||
'disposition' => ['disp'],
|
||||
]];
|
||||
imap_mail_compose($envelope, $body);
|
||||
echo "done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
||||
@@ -0,0 +1,69 @@
|
||||
--TEST--
|
||||
Bug #80215 (imap_mail_compose() may modify by-val parameters)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('imap')) die('skip imap extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$envelope = [
|
||||
"from" => 1,
|
||||
"to" => 2,
|
||||
"custom_headers" => [3],
|
||||
];
|
||||
$body = [[
|
||||
"contents.data" => 4,
|
||||
"type.parameters" => ['foo' => 5],
|
||||
"disposition" => ['bar' => 6],
|
||||
], [
|
||||
"contents.data" => 7,
|
||||
"type.parameters" => ['foo' => 8],
|
||||
"disposition" => ['bar' => 9],
|
||||
]];
|
||||
imap_mail_compose($envelope, $body);
|
||||
var_dump($envelope, $body);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
["from"]=>
|
||||
int(1)
|
||||
["to"]=>
|
||||
int(2)
|
||||
["custom_headers"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(3)
|
||||
}
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(3) {
|
||||
["contents.data"]=>
|
||||
int(4)
|
||||
["type.parameters"]=>
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
int(5)
|
||||
}
|
||||
["disposition"]=>
|
||||
array(1) {
|
||||
["bar"]=>
|
||||
int(6)
|
||||
}
|
||||
}
|
||||
[1]=>
|
||||
array(3) {
|
||||
["contents.data"]=>
|
||||
int(7)
|
||||
["type.parameters"]=>
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
int(8)
|
||||
}
|
||||
["disposition"]=>
|
||||
array(1) {
|
||||
["bar"]=>
|
||||
int(9)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #80216 (imap_mail_compose() does not validate types/encodings)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('imap')) die('skip imap extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
imap_mail_compose([], [['type' => TYPEMULTIPART], []]);
|
||||
imap_mail_compose([], [['type' => 12]]);
|
||||
imap_mail_compose([], [['type' => TYPEMULTIPART], ['type' => 12]]);
|
||||
imap_mail_compose([], [['encoding' => 8]]);
|
||||
imap_mail_compose([], [['type' => TYPEMULTIPART], ['encoding' => 8]]);
|
||||
echo "done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #80223 (imap_mail_compose() leaks envelope on malformed bodies)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('imap')) die('skip imap extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
imap_mail_compose([], []);
|
||||
imap_mail_compose([], [1]);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imap_mail_compose(): body parameter must be a non-empty array in %s on line %d
|
||||
|
||||
Warning: imap_mail_compose(): body parameter must be a non-empty array in %s on line %d
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #80226 (imap_sort() leaks sortpgm memory)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(__DIR__.'/skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(__DIR__.'/imap_include.inc');
|
||||
$stream = imap_open($default_mailbox, $username, $password);
|
||||
imap_sort($stream, SORTFROM, 0);
|
||||
?>
|
||||
--EXPECT--
|
||||
@@ -106,7 +106,7 @@ Create a temporary mailbox and add 1 msgs
|
||||
.. mailbox '%s.phpttest' created
|
||||
|
||||
-- Iteration 1 --
|
||||
string(71) "From: %s
|
||||
string(%d) "From: %s
|
||||
To: %s
|
||||
Subject: test1
|
||||
|
||||
|
||||
@@ -57,9 +57,6 @@ elif test "$PHP_MYSQLI" != "no"; then
|
||||
MYSQL_LIB_CFG='--libmysqld-libs'
|
||||
dnl mysqlnd doesn't support embedded, so we have to add some extra stuff
|
||||
mysqli_extra_sources="mysqli_embedded.c"
|
||||
elif test "$enable_maintainer_zts" = "yes"; then
|
||||
MYSQL_LIB_CFG='--libs_r'
|
||||
MYSQL_LIB_NAME='mysqlclient_r'
|
||||
else
|
||||
MYSQL_LIB_CFG='--libs'
|
||||
fi
|
||||
|
||||
+1
-1
@@ -686,7 +686,7 @@ PHP_MINIT_FUNCTION(mysqli)
|
||||
#ifdef MYSQLND_STRING_TO_INT_CONVERSION
|
||||
REGISTER_LONG_CONSTANT("MYSQLI_OPT_INT_AND_FLOAT_NATIVE", MYSQLND_OPT_INT_AND_FLOAT_NATIVE, CONST_CS | CONST_PERSISTENT);
|
||||
#endif
|
||||
#if MYSQL_VERSION_ID > 50110 || defined(MYSQLI_USE_MYSQLND)
|
||||
#if (MYSQL_VERSION_ID > 50110 && MYSQL_VERSION_ID < 80000) || (MYSQL_VERSION_ID >= 100000) || defined(MYSQLI_USE_MYSQLND)
|
||||
REGISTER_LONG_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT);
|
||||
#endif
|
||||
|
||||
|
||||
+11
-4
@@ -614,7 +614,7 @@ PHP_FUNCTION(mysqli_change_user)
|
||||
size_t user_len, password_len, dbname_len;
|
||||
zend_ulong rc;
|
||||
#if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET)
|
||||
const CHARSET_INFO * old_charset;
|
||||
MY_CHARSET_INFO old_charset;
|
||||
#endif
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osss!", &mysql_link, mysqli_link_class_entry, &user, &user_len, &password, &password_len, &dbname, &dbname_len) == FAILURE) {
|
||||
@@ -623,7 +623,7 @@ PHP_FUNCTION(mysqli_change_user)
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
|
||||
|
||||
#if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET)
|
||||
old_charset = mysql->mysql->charset;
|
||||
mysql_get_character_set_info(mysql->mysql, &old_charset);
|
||||
#endif
|
||||
|
||||
#if defined(MYSQLI_USE_MYSQLND)
|
||||
@@ -643,7 +643,7 @@ PHP_FUNCTION(mysqli_change_user)
|
||||
5.0 doesn't support it. Support added in 5.1.23 by fixing the following bug :
|
||||
Bug #30472 libmysql doesn't reset charset, insert_id after succ. mysql_change_user() call
|
||||
*/
|
||||
rc = mysql_set_character_set(mysql->mysql, old_charset->csname);
|
||||
rc = mysql_set_character_set(mysql->mysql, old_charset.csname);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1716,10 +1716,12 @@ static int mysqli_options_get_option_zval_type(int option)
|
||||
#endif /* MySQL 4.1.0 */
|
||||
case MYSQL_OPT_READ_TIMEOUT:
|
||||
case MYSQL_OPT_WRITE_TIMEOUT:
|
||||
#ifdef MYSQL_OPT_GUESS_CONNECTION /* removed in MySQL-8.0 */
|
||||
case MYSQL_OPT_GUESS_CONNECTION:
|
||||
case MYSQL_OPT_USE_EMBEDDED_CONNECTION:
|
||||
case MYSQL_OPT_USE_REMOTE_CONNECTION:
|
||||
case MYSQL_SECURE_AUTH:
|
||||
#endif
|
||||
#ifdef MYSQL_OPT_RECONNECT
|
||||
case MYSQL_OPT_RECONNECT:
|
||||
#endif /* MySQL 5.0.13 */
|
||||
@@ -1952,6 +1954,11 @@ PHP_FUNCTION(mysqli_real_query)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if defined(MYSQLI_USE_MYSQLND) || MYSQL_VERSION_ID < 50707 || defined(MARIADB_BASE_VERSION)
|
||||
# define mysql_real_escape_string_quote(mysql, to, from, length, quote) \
|
||||
mysql_real_escape_string(mysql, to, from, length)
|
||||
#endif
|
||||
|
||||
/* {{{ proto string mysqli_real_escape_string(object link, string escapestr)
|
||||
Escapes special characters in a string for use in a SQL statement, taking into account the current charset of the connection */
|
||||
PHP_FUNCTION(mysqli_real_escape_string) {
|
||||
@@ -1967,7 +1974,7 @@ PHP_FUNCTION(mysqli_real_escape_string) {
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
|
||||
|
||||
newstr = zend_string_alloc(2 * escapestr_len, 0);
|
||||
ZSTR_LEN(newstr) = mysql_real_escape_string(mysql->mysql, ZSTR_VAL(newstr), escapestr, escapestr_len);
|
||||
ZSTR_LEN(newstr) = mysql_real_escape_string_quote(mysql->mysql, ZSTR_VAL(newstr), escapestr, escapestr_len, '\'');
|
||||
newstr = zend_string_truncate(newstr, ZSTR_LEN(newstr), 0);
|
||||
|
||||
RETURN_NEW_STR(newstr);
|
||||
|
||||
+27
-28
@@ -303,7 +303,8 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
|
||||
php_mysqli_set_error(mysql_errno(mysql->mysql), (char *) mysql_error(mysql->mysql));
|
||||
|
||||
#if !defined(MYSQLI_USE_MYSQLND)
|
||||
mysql->mysql->reconnect = MyG(reconnect);
|
||||
char reconnect = MyG(reconnect);
|
||||
mysql_options(mysql->mysql, MYSQL_OPT_RECONNECT, (char *)&reconnect);
|
||||
#endif
|
||||
unsigned int allow_local_infile = MyG(allow_local_infile);
|
||||
mysql_options(mysql->mysql, MYSQL_OPT_LOCAL_INFILE, (char *)&allow_local_infile);
|
||||
@@ -1085,45 +1086,43 @@ extern char * mysqli_escape_string_for_tx_name_in_comment(const char * const nam
|
||||
static int mysqli_begin_transaction_libmysql(MYSQL * conn, const unsigned int mode, const char * const name)
|
||||
{
|
||||
int ret;
|
||||
zend_bool err = FALSE;
|
||||
smart_str tmp_str = {0};
|
||||
char * name_esc;
|
||||
char * query;
|
||||
unsigned int query_len;
|
||||
if (mode & TRANS_START_WITH_CONSISTENT_SNAPSHOT) {
|
||||
if (tmp_str.s) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "WITH CONSISTENT SNAPSHOT", sizeof("WITH CONSISTENT SNAPSHOT") - 1);
|
||||
}
|
||||
if (mode & (TRANS_START_READ_WRITE | TRANS_START_READ_ONLY)) {
|
||||
if (mysql_get_server_version(conn) < 50605L) {
|
||||
php_error_docref(NULL, E_WARNING, "This server version doesn't support 'READ WRITE' and 'READ ONLY'. Minimum 5.6.5 is required");
|
||||
err = TRUE;
|
||||
} else if (mode & TRANS_START_READ_WRITE) {
|
||||
if (tmp_str.s) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ WRITE", sizeof("READ WRITE") - 1);
|
||||
} else if (mode & TRANS_START_READ_ONLY) {
|
||||
if (tmp_str.s) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ ONLY", sizeof("READ ONLY") - 1);
|
||||
if (mode & TRANS_START_READ_WRITE) {
|
||||
if (tmp_str.s) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ WRITE", sizeof("READ WRITE") - 1);
|
||||
} else if (mode & TRANS_START_READ_ONLY) {
|
||||
if (tmp_str.s) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ ONLY", sizeof("READ ONLY") - 1);
|
||||
}
|
||||
smart_str_0(&tmp_str);
|
||||
|
||||
if (err == FALSE){
|
||||
char * name_esc = mysqli_escape_string_for_tx_name_in_comment(name);
|
||||
char * query;
|
||||
unsigned int query_len = spprintf(&query, 0, "START TRANSACTION%s %s",
|
||||
name_esc? name_esc:"", tmp_str.s? ZSTR_VAL(tmp_str.s):"");
|
||||
name_esc = mysqli_escape_string_for_tx_name_in_comment(name);
|
||||
query_len = spprintf(&query, 0, "START TRANSACTION%s %s",
|
||||
name_esc? name_esc:"", tmp_str.s? ZSTR_VAL(tmp_str.s):"");
|
||||
|
||||
smart_str_free(&tmp_str);
|
||||
if (name_esc) {
|
||||
efree(name_esc);
|
||||
}
|
||||
smart_str_free(&tmp_str);
|
||||
if (name_esc) {
|
||||
efree(name_esc);
|
||||
}
|
||||
|
||||
ret = mysql_real_query(conn, query, query_len);
|
||||
efree(query);
|
||||
ret = mysql_real_query(conn, query, query_len);
|
||||
efree(query);
|
||||
|
||||
if (ret && mode & (TRANS_START_READ_WRITE | TRANS_START_READ_ONLY) && mysql_errno(conn) == 1064) {
|
||||
php_error_docref(NULL, E_WARNING, "This server version doesn't support 'READ WRITE' and 'READ ONLY'. Minimum 5.6.5 is required");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -1233,7 +1232,7 @@ PHP_FUNCTION(mysqli_release_savepoint)
|
||||
#if !defined(MYSQLI_USE_MYSQLND)
|
||||
if (mysqli_savepoint_libmysql(mysql->mysql, name, TRUE)) {
|
||||
#else
|
||||
if (FAIL == mysqlnd_savepoint(mysql->mysql, name)) {
|
||||
if (FAIL == mysqlnd_release_savepoint(mysql->mysql, name)) {
|
||||
#endif
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -58,8 +58,6 @@
|
||||
#define HAVE_ULONG
|
||||
#endif
|
||||
|
||||
#include <my_global.h>
|
||||
|
||||
#if !defined(HAVE_MBRLEN) && defined(WE_HAD_MBRLEN)
|
||||
#define HAVE_MBRLEN 1
|
||||
#endif
|
||||
@@ -68,20 +66,12 @@
|
||||
#define HAVE_MBSTATE_T 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
We need more than mysql.h because we need CHARSET_INFO in one place.
|
||||
This order has been borrowed from the ODBC driver. Nothing can be removed
|
||||
from the list of headers :(
|
||||
*/
|
||||
|
||||
#include <my_sys.h>
|
||||
#include <mysql.h>
|
||||
#if MYSQL_VERSION_ID >= 80000 && MYSQL_VERSION_ID < 100000
|
||||
typedef _Bool my_bool;
|
||||
#endif
|
||||
#include <errmsg.h>
|
||||
#include <my_list.h>
|
||||
#include <m_string.h>
|
||||
#include <mysqld_error.h>
|
||||
#include <my_list.h>
|
||||
#include <m_ctype.h>
|
||||
#include "mysqli_libmysql.h"
|
||||
#endif /* MYSQLI_USE_MYSQLND */
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
--TEST--
|
||||
Bug #80107 mysqli_query() fails for ~16 MB long query when compression is enabled
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifemb.inc');
|
||||
require_once("connect.inc");
|
||||
$link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||
if (!$link) {
|
||||
die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
|
||||
}
|
||||
$result = $link->query("SHOW VARIABLES LIKE 'max_allowed_packet'");
|
||||
if ($result->fetch_assoc()['Value'] < 0xffffff) {
|
||||
die('skip max_allowed_packet is less than 0xffffff');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once("connect.inc");
|
||||
|
||||
$data_size = 16777174;
|
||||
|
||||
// Insert with compression disabled:
|
||||
|
||||
$mysqli = mysqli_init();
|
||||
$result = my_mysqli_real_connect($mysqli, $host, $user, $passwd, $db, $port, $socket);
|
||||
$mysqli->query("DROP TABLE IF EXISTS test");
|
||||
$mysqli->query("CREATE TABLE test (`blob` LONGBLOB NOT NULL) ENGINE=MyISAM");
|
||||
|
||||
$data = str_repeat("x", $data_size);
|
||||
$mysqli->query("INSERT INTO $db.test(`blob`) VALUE ('$data')");
|
||||
|
||||
var_dump(mysqli_error_list($mysqli));
|
||||
$mysqli->close();
|
||||
|
||||
// Insert with compression enabled:
|
||||
|
||||
$mysqli = mysqli_init();
|
||||
$result = my_mysqli_real_connect($mysqli, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS);
|
||||
|
||||
$data = str_repeat("x", $data_size);
|
||||
$mysqli->query("INSERT INTO $db.test(`blob`) VALUE ('$data')");
|
||||
|
||||
var_dump(mysqli_error_list($mysqli));
|
||||
$mysqli->close();
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once("clean_table.inc");
|
||||
?>
|
||||
--EXPECT--
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
@@ -50,7 +50,7 @@ if (!have_innodb($link))
|
||||
printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
/* note that there is no savepoint my... */
|
||||
if (true !== ($tmp = mysqli_release_savepoint($link, 'my')))
|
||||
if (false !== ($tmp = mysqli_release_savepoint($link, 'my')))
|
||||
printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
|
||||
|
||||
@@ -2131,23 +2131,16 @@ MYSQLND_METHOD(mysqlnd_conn_data, tx_begin)(MYSQLND_CONN_DATA * conn, const unsi
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "WITH CONSISTENT SNAPSHOT", sizeof("WITH CONSISTENT SNAPSHOT") - 1);
|
||||
}
|
||||
if (mode & (TRANS_START_READ_WRITE | TRANS_START_READ_ONLY)) {
|
||||
zend_ulong server_version = conn->m->get_server_version(conn);
|
||||
if (server_version < 50605L) {
|
||||
php_error_docref(NULL, E_WARNING, "This server version doesn't support 'READ WRITE' and 'READ ONLY'. Minimum 5.6.5 is required");
|
||||
smart_str_free(&tmp_str);
|
||||
break;
|
||||
} else if (mode & TRANS_START_READ_WRITE) {
|
||||
if (tmp_str.s && ZSTR_LEN(tmp_str.s)) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ WRITE", sizeof("READ WRITE") - 1);
|
||||
} else if (mode & TRANS_START_READ_ONLY) {
|
||||
if (tmp_str.s && ZSTR_LEN(tmp_str.s)) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ ONLY", sizeof("READ ONLY") - 1);
|
||||
if (mode & TRANS_START_READ_WRITE) {
|
||||
if (tmp_str.s && ZSTR_LEN(tmp_str.s)) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ WRITE", sizeof("READ WRITE") - 1);
|
||||
} else if (mode & TRANS_START_READ_ONLY) {
|
||||
if (tmp_str.s && ZSTR_LEN(tmp_str.s)) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ ONLY", sizeof("READ ONLY") - 1);
|
||||
}
|
||||
smart_str_0(&tmp_str);
|
||||
|
||||
@@ -2166,6 +2159,11 @@ MYSQLND_METHOD(mysqlnd_conn_data, tx_begin)(MYSQLND_CONN_DATA * conn, const unsi
|
||||
}
|
||||
ret = conn->m->query(conn, query, query_len);
|
||||
mnd_sprintf_free(query);
|
||||
if (ret && mode & (TRANS_START_READ_WRITE | TRANS_START_READ_ONLY) &&
|
||||
mysqlnd_stmt_errno(conn) == 1064) {
|
||||
php_error_docref(NULL, E_WARNING, "This server version doesn't support 'READ WRITE' and 'READ ONLY'. Minimum 5.6.5 is required");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
conn->m->local_tx_end(conn, this_func, ret);
|
||||
|
||||
@@ -524,7 +524,7 @@ MYSQLND_METHOD(mysqlnd_debug, set_mode)(MYSQLND_DEBUG * self, const char * const
|
||||
if (i + 1 < mode_len && mode[i+1] == ',') {
|
||||
unsigned int j = i + 2;
|
||||
#ifdef PHP_WIN32
|
||||
if (i+4 < mode_len && mode[i+3] == ':' && (mode[i+4] == '\\' || mode[i+5] == '/')) {
|
||||
if (i+4 < mode_len && mode[i+3] == ':' && (mode[i+4] == '\\' || mode[i+4] == '/')) {
|
||||
j = i + 5;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -50,6 +50,57 @@ MYSQLND_METHOD(mysqlnd_pfc, reset)(MYSQLND_PFC * const pfc, MYSQLND_STATS * cons
|
||||
#define STORE_HEADER_SIZE(safe_storage, buffer) COPY_HEADER((safe_storage), (buffer))
|
||||
#define RESTORE_HEADER_SIZE(buffer, safe_storage) STORE_HEADER_SIZE((safe_storage), (buffer))
|
||||
|
||||
#ifdef MYSQLND_COMPRESSION_ENABLED
|
||||
static size_t write_compressed_packet(
|
||||
const MYSQLND_PFC *pfc, MYSQLND_VIO *vio,
|
||||
MYSQLND_STATS *conn_stats, MYSQLND_ERROR_INFO *error_info,
|
||||
zend_uchar *uncompressed_payload, size_t to_be_sent, zend_uchar *compress_buf) {
|
||||
DBG_ENTER("write_compressed_packet");
|
||||
/* here we need to compress the data and then write it, first comes the compressed header */
|
||||
size_t tmp_complen = to_be_sent;
|
||||
size_t payload_size;
|
||||
if (PASS == pfc->data->m.encode((compress_buf + COMPRESSED_HEADER_SIZE + MYSQLND_HEADER_SIZE), &tmp_complen,
|
||||
uncompressed_payload, to_be_sent))
|
||||
{
|
||||
int3store(compress_buf + MYSQLND_HEADER_SIZE, to_be_sent);
|
||||
payload_size = tmp_complen;
|
||||
} else {
|
||||
int3store(compress_buf + MYSQLND_HEADER_SIZE, 0);
|
||||
memcpy(compress_buf + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE, uncompressed_payload, to_be_sent);
|
||||
payload_size = to_be_sent;
|
||||
}
|
||||
|
||||
int3store(compress_buf, payload_size);
|
||||
int1store(compress_buf + 3, pfc->data->compressed_envelope_packet_no);
|
||||
DBG_INF_FMT("writing "MYSQLND_SZ_T_SPEC" bytes to the network", payload_size + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE);
|
||||
|
||||
size_t bytes_sent = vio->data->m.network_write(vio, compress_buf, payload_size + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE, conn_stats, error_info);
|
||||
pfc->data->compressed_envelope_packet_no++;
|
||||
#ifdef WHEN_WE_NEED_TO_CHECK_WHETHER_COMPRESSION_WORKS_CORRECTLY
|
||||
if (res == Z_OK) {
|
||||
size_t decompressed_size = left + MYSQLND_HEADER_SIZE;
|
||||
zend_uchar * decompressed_data = mnd_malloc(decompressed_size);
|
||||
int error = pfc->data->m.decode(decompressed_data, decompressed_size,
|
||||
compress_buf + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE, payload_size);
|
||||
if (error == Z_OK) {
|
||||
int i;
|
||||
DBG_INF("success decompressing");
|
||||
for (i = 0 ; i < decompressed_size; i++) {
|
||||
if (i && (i % 30 == 0)) {
|
||||
printf("\n\t\t");
|
||||
}
|
||||
printf("%.2X ", (int)*((char*)&(decompressed_data[i])));
|
||||
DBG_INF_FMT("%.2X ", (int)*((char*)&(decompressed_data[i])));
|
||||
}
|
||||
} else {
|
||||
DBG_INF("error decompressing");
|
||||
}
|
||||
mnd_free(decompressed_data);
|
||||
}
|
||||
#endif /* WHEN_WE_NEED_TO_CHECK_WHETHER_COMPRESSION_WORKS_CORRECTLY */
|
||||
DBG_RETURN(bytes_sent);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* {{{ mysqlnd_pfc::send */
|
||||
/*
|
||||
@@ -91,53 +142,27 @@ MYSQLND_METHOD(mysqlnd_pfc, send)(MYSQLND_PFC * const pfc, MYSQLND_VIO * const v
|
||||
DBG_INF_FMT("packet_no=%u", pfc->data->packet_no);
|
||||
#ifdef MYSQLND_COMPRESSION_ENABLED
|
||||
if (pfc->data->compressed == TRUE) {
|
||||
/* here we need to compress the data and then write it, first comes the compressed header */
|
||||
size_t tmp_complen = to_be_sent;
|
||||
size_t payload_size;
|
||||
zend_uchar * uncompressed_payload = p; /* should include the header */
|
||||
|
||||
STORE_HEADER_SIZE(safe_storage, uncompressed_payload);
|
||||
int3store(uncompressed_payload, to_be_sent);
|
||||
int1store(uncompressed_payload + 3, pfc->data->packet_no);
|
||||
if (PASS == pfc->data->m.encode((compress_buf + COMPRESSED_HEADER_SIZE + MYSQLND_HEADER_SIZE), &tmp_complen,
|
||||
uncompressed_payload, to_be_sent + MYSQLND_HEADER_SIZE))
|
||||
{
|
||||
int3store(compress_buf + MYSQLND_HEADER_SIZE, to_be_sent + MYSQLND_HEADER_SIZE);
|
||||
payload_size = tmp_complen;
|
||||
if (to_be_sent <= MYSQLND_MAX_PACKET_SIZE - MYSQLND_HEADER_SIZE) {
|
||||
bytes_sent = write_compressed_packet(
|
||||
pfc, vio, conn_stats, error_info,
|
||||
uncompressed_payload, to_be_sent + MYSQLND_HEADER_SIZE, compress_buf);
|
||||
} else {
|
||||
int3store(compress_buf + MYSQLND_HEADER_SIZE, 0);
|
||||
memcpy(compress_buf + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE, uncompressed_payload, to_be_sent + MYSQLND_HEADER_SIZE);
|
||||
payload_size = to_be_sent + MYSQLND_HEADER_SIZE;
|
||||
/* The uncompressed size including the header would overflow. Split into two
|
||||
* compressed packets. The size of the first one is relatively arbitrary here. */
|
||||
const size_t split_off_bytes = 8192;
|
||||
bytes_sent = write_compressed_packet(
|
||||
pfc, vio, conn_stats, error_info,
|
||||
uncompressed_payload, split_off_bytes, compress_buf);
|
||||
bytes_sent = write_compressed_packet(
|
||||
pfc, vio, conn_stats, error_info,
|
||||
uncompressed_payload + split_off_bytes,
|
||||
to_be_sent + MYSQLND_HEADER_SIZE - split_off_bytes, compress_buf);
|
||||
}
|
||||
RESTORE_HEADER_SIZE(uncompressed_payload, safe_storage);
|
||||
|
||||
int3store(compress_buf, payload_size);
|
||||
int1store(compress_buf + 3, pfc->data->packet_no);
|
||||
DBG_INF_FMT("writing "MYSQLND_SZ_T_SPEC" bytes to the network", payload_size + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE);
|
||||
bytes_sent = vio->data->m.network_write(vio, compress_buf, payload_size + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE, conn_stats, error_info);
|
||||
pfc->data->compressed_envelope_packet_no++;
|
||||
#if WHEN_WE_NEED_TO_CHECK_WHETHER_COMPRESSION_WORKS_CORRECTLY
|
||||
if (res == Z_OK) {
|
||||
size_t decompressed_size = left + MYSQLND_HEADER_SIZE;
|
||||
zend_uchar * decompressed_data = mnd_malloc(decompressed_size);
|
||||
int error = pfc->data->m.decode(decompressed_data, decompressed_size,
|
||||
compress_buf + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE, payload_size);
|
||||
if (error == Z_OK) {
|
||||
int i;
|
||||
DBG_INF("success decompressing");
|
||||
for (i = 0 ; i < decompressed_size; i++) {
|
||||
if (i && (i % 30 == 0)) {
|
||||
printf("\n\t\t");
|
||||
}
|
||||
printf("%.2X ", (int)*((char*)&(decompressed_data[i])));
|
||||
DBG_INF_FMT("%.2X ", (int)*((char*)&(decompressed_data[i])));
|
||||
}
|
||||
} else {
|
||||
DBG_INF("error decompressing");
|
||||
}
|
||||
mnd_free(decompressed_data);
|
||||
}
|
||||
#endif /* WHEN_WE_NEED_TO_CHECK_WHETHER_COMPRESSION_WORKS_CORRECTLY */
|
||||
} else
|
||||
#endif /* MYSQLND_COMPRESSION_ENABLED */
|
||||
{
|
||||
|
||||
+15
-13
@@ -1309,7 +1309,7 @@ PHP_FUNCTION(odbc_execute)
|
||||
int numArgs = ZEND_NUM_ARGS(), i, ne;
|
||||
RETCODE rc;
|
||||
|
||||
if (zend_parse_parameters(numArgs, "r|a", &pv_res, &pv_param_arr) == FAILURE) {
|
||||
if (zend_parse_parameters(numArgs, "r|a/", &pv_res, &pv_param_arr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2221,6 +2221,7 @@ PHP_FUNCTION(odbc_result)
|
||||
if (rc != SQL_SUCCESS_WITH_INFO) {
|
||||
field_str = zend_string_truncate(field_str, result->values[field_ind].vallen, 0);
|
||||
}
|
||||
ZSTR_VAL(field_str)[ZSTR_LEN(field_str)] = '\0';
|
||||
RETURN_NEW_STR(field_str);
|
||||
break;
|
||||
|
||||
@@ -2772,6 +2773,7 @@ PHP_FUNCTION(odbc_next_result)
|
||||
}
|
||||
efree(result->values);
|
||||
result->values = NULL;
|
||||
result->numcols = 0;
|
||||
}
|
||||
|
||||
result->fetched = 0;
|
||||
@@ -3155,7 +3157,7 @@ PHP_FUNCTION(odbc_tables)
|
||||
type, SAFE_SQL_NTS(type));
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLTables");
|
||||
odbc_sql_error(conn, result->stmt, "SQLTables");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3226,7 +3228,7 @@ PHP_FUNCTION(odbc_columns)
|
||||
column, (SQLSMALLINT) column_len);
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLColumns");
|
||||
odbc_sql_error(conn, result->stmt, "SQLColumns");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3291,7 +3293,7 @@ PHP_FUNCTION(odbc_columnprivileges)
|
||||
column, SAFE_SQL_NTS(column));
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLColumnPrivileges");
|
||||
odbc_sql_error(conn, result->stmt, "SQLColumnPrivileges");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3371,7 +3373,7 @@ PHP_FUNCTION(odbc_foreignkeys)
|
||||
ftable, SAFE_SQL_NTS(ftable) );
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLForeignKeys");
|
||||
odbc_sql_error(conn, result->stmt, "SQLForeignKeys");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3433,7 +3435,7 @@ PHP_FUNCTION(odbc_gettypeinfo)
|
||||
rc = SQLGetTypeInfo(result->stmt, data_type );
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLGetTypeInfo");
|
||||
odbc_sql_error(conn, result->stmt, "SQLGetTypeInfo");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3495,7 +3497,7 @@ PHP_FUNCTION(odbc_primarykeys)
|
||||
table, SAFE_SQL_NTS(table) );
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLPrimaryKeys");
|
||||
odbc_sql_error(conn, result->stmt, "SQLPrimaryKeys");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3564,7 +3566,7 @@ PHP_FUNCTION(odbc_procedurecolumns)
|
||||
col, SAFE_SQL_NTS(col) );
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLProcedureColumns");
|
||||
odbc_sql_error(conn, result->stmt, "SQLProcedureColumns");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3632,7 +3634,7 @@ PHP_FUNCTION(odbc_procedures)
|
||||
proc, SAFE_SQL_NTS(proc) );
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLProcedures");
|
||||
odbc_sql_error(conn, result->stmt, "SQLProcedures");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3668,7 +3670,7 @@ PHP_FUNCTION(odbc_specialcolumns)
|
||||
SQLUSMALLINT type, scope, nullable;
|
||||
RETCODE rc;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rls!ssl", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len,
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rls!ssll", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len,
|
||||
&name, &name_len, &vscope, &vnullable) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3705,7 +3707,7 @@ PHP_FUNCTION(odbc_specialcolumns)
|
||||
nullable);
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLSpecialColumns");
|
||||
odbc_sql_error(conn, result->stmt, "SQLSpecialColumns");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3775,7 +3777,7 @@ PHP_FUNCTION(odbc_statistics)
|
||||
reserved);
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLStatistics");
|
||||
odbc_sql_error(conn, result->stmt, "SQLStatistics");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3838,7 +3840,7 @@ PHP_FUNCTION(odbc_tableprivileges)
|
||||
table, SAFE_SQL_NTS(table));
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLTablePrivileges");
|
||||
odbc_sql_error(conn, result->stmt, "SQLTablePrivileges");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #46050 (odbc_next_result corrupts prepared resource)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include __DIR__ . "/config.inc";
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
$stmt = odbc_prepare($conn, "SELECT 1");
|
||||
var_dump(odbc_execute($stmt));
|
||||
var_dump(odbc_fetch_array($stmt));
|
||||
var_dump(odbc_next_result($stmt));
|
||||
var_dump(odbc_execute($stmt));
|
||||
var_dump(odbc_fetch_array($stmt));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
array(1) {
|
||||
["1"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
bool(false)
|
||||
bool(true)
|
||||
array(1) {
|
||||
["1"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #78470 (odbc_specialcolumns() no longer accepts $nullable)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
var_dump(odbc_specialcolumns($conn, SQL_BEST_ROWID, '', '', '', SQL_SCOPE_CURROW, SQL_NO_NULLS));
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (odbc result)
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #80147 (BINARY strings may not be properly zero-terminated)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, "CREATE TABLE bug80147 (id INT, whatever VARBINARY(50))");
|
||||
odbc_exec($conn, "INSERT INTO bug80147 VALUES (1, CONVERT(VARBINARY(50), 'whatever'))");
|
||||
|
||||
$res = odbc_exec($conn, "SELECT * FROM bug80147");
|
||||
odbc_binmode($res, ODBC_BINMODE_RETURN);
|
||||
odbc_fetch_row($res);
|
||||
var_dump(odbc_result($res, 'whatever'));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
odbc_exec($conn, "DROP TABLE bug80147");
|
||||
?>
|
||||
--EXPECT--
|
||||
string(8) "whatever"
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #80152 (odbc_execute() moves internal pointer of $params)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
odbc_exec($conn,"CREATE TABLE bug80152 (id INT, name CHAR(24))");
|
||||
$stmt = odbc_prepare($conn,"INSERT INTO bug80152 (id, name) VALUES (?, ?)");
|
||||
$params = [1, "John", "Lim"];
|
||||
var_dump(key($params));
|
||||
odbc_execute($stmt, $params);
|
||||
var_dump(key($params));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
odbc_exec($conn, "DROP TABLE bug80152");
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
int(0)
|
||||
@@ -1079,6 +1079,8 @@ uint32_t zend_optimizer_classify_function(zend_string *name, uint32_t num_args)
|
||||
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
|
||||
} else if (zend_string_equals_literal(name, "assert")) {
|
||||
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
|
||||
} else if (zend_string_equals_literal(name, "db2_execute")) {
|
||||
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
|
||||
} else if (zend_string_equals_literal(name, "func_num_args")) {
|
||||
return ZEND_FUNC_VARARG;
|
||||
} else if (zend_string_equals_literal(name, "func_get_arg")) {
|
||||
|
||||
@@ -6441,11 +6441,6 @@ static int php_openssl_validate_iv(char **piv, size_t *piv_len, size_t iv_requir
|
||||
{
|
||||
char *iv_new;
|
||||
|
||||
/* Best case scenario, user behaved */
|
||||
if (*piv_len == iv_required_len) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (mode->is_aead) {
|
||||
if (EVP_CIPHER_CTX_ctrl(cipher_ctx, mode->aead_ivlen_flag, *piv_len, NULL) != 1) {
|
||||
php_error_docref(NULL, E_WARNING, "Setting of IV length for AEAD mode failed");
|
||||
@@ -6454,6 +6449,11 @@ static int php_openssl_validate_iv(char **piv, size_t *piv_len, size_t iv_requir
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* Best case scenario, user behaved */
|
||||
if (*piv_len == iv_required_len) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
iv_new = ecalloc(1, iv_required_len + 1);
|
||||
|
||||
if (*piv_len == 0) {
|
||||
|
||||
@@ -1,5 +1,26 @@
|
||||
<?php
|
||||
$php_openssl_cipher_tests = array(
|
||||
'aes-128-ccm' => array(
|
||||
array(
|
||||
'key' => '404142434445464748494a4b4c4d4e4f',
|
||||
'iv' => '1011121314151617',
|
||||
'aad' => '000102030405060708090a0b0c0d0e0f',
|
||||
'tag' => '1fc64fbfaccd',
|
||||
'pt' => '202122232425262728292a2b2c2d2e2f',
|
||||
'ct' => 'd2a1f0e051ea5f62081a7792073d593d',
|
||||
),
|
||||
array(
|
||||
'key' => '404142434445464748494a4b4c4d4e4f',
|
||||
'iv' => '101112131415161718191a1b',
|
||||
'aad' => '000102030405060708090a0b0c0d0e0f' .
|
||||
'10111213',
|
||||
'tag' => '484392fbc1b09951',
|
||||
'pt' => '202122232425262728292a2b2c2d2e2f' .
|
||||
'3031323334353637',
|
||||
'ct' => 'e3b201a9f5b71a7a9b1ceaeccd97e70b' .
|
||||
'6176aad9a4428aa5',
|
||||
),
|
||||
),
|
||||
'aes-256-ccm' => array(
|
||||
array(
|
||||
'key' => '1bde3251d41a8b5ea013c195ae128b21' .
|
||||
|
||||
@@ -10,14 +10,16 @@ if (!in_array('aes-256-ccm', openssl_get_cipher_methods()))
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . "/cipher_tests.inc";
|
||||
$method = 'aes-256-ccm';
|
||||
$tests = openssl_get_cipher_tests($method);
|
||||
$methods = ['aes-128-ccm', 'aes-256-ccm'];
|
||||
|
||||
foreach ($tests as $idx => $test) {
|
||||
echo "TEST $idx\n";
|
||||
$pt = openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
|
||||
$test['iv'], $test['tag'], $test['aad']);
|
||||
var_dump($test['pt'] === $pt);
|
||||
foreach ($methods as $method) {
|
||||
$tests = openssl_get_cipher_tests($method);
|
||||
foreach ($tests as $idx => $test) {
|
||||
echo "$method - TEST $idx\n";
|
||||
$pt = openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
|
||||
$test['iv'], $test['tag'], $test['aad']);
|
||||
var_dump($test['pt'] === $pt);
|
||||
}
|
||||
}
|
||||
|
||||
// no IV
|
||||
@@ -32,7 +34,11 @@ var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
TEST 0
|
||||
aes-128-ccm - TEST 0
|
||||
bool(true)
|
||||
aes-128-ccm - TEST 1
|
||||
bool(true)
|
||||
aes-256-ccm - TEST 0
|
||||
bool(true)
|
||||
|
||||
Warning: openssl_decrypt(): Setting of IV length for AEAD mode failed in %s on line %d
|
||||
|
||||
@@ -10,15 +10,17 @@ if (!in_array('aes-256-ccm', openssl_get_cipher_methods()))
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . "/cipher_tests.inc";
|
||||
$method = 'aes-256-ccm';
|
||||
$tests = openssl_get_cipher_tests($method);
|
||||
$methods = ['aes-128-ccm', 'aes-256-ccm'];
|
||||
|
||||
foreach ($tests as $idx => $test) {
|
||||
echo "TEST $idx\n";
|
||||
$ct = openssl_encrypt($test['pt'], $method, $test['key'], OPENSSL_RAW_DATA,
|
||||
$test['iv'], $tag, $test['aad'], strlen($test['tag']));
|
||||
var_dump($test['ct'] === $ct);
|
||||
var_dump($test['tag'] === $tag);
|
||||
foreach ($methods as $method) {
|
||||
$tests = openssl_get_cipher_tests($method);
|
||||
foreach ($tests as $idx => $test) {
|
||||
echo "$method - TEST $idx\n";
|
||||
$ct = openssl_encrypt($test['pt'], $method, $test['key'], OPENSSL_RAW_DATA,
|
||||
$test['iv'], $tag, $test['aad'], strlen($test['tag']));
|
||||
var_dump($test['ct'] === $ct);
|
||||
var_dump($test['tag'] === $tag);
|
||||
}
|
||||
}
|
||||
|
||||
// Empty IV error
|
||||
@@ -32,7 +34,13 @@ var_dump(strlen($tag));
|
||||
var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 16), $tag, '', 1024));
|
||||
?>
|
||||
--EXPECTF--
|
||||
TEST 0
|
||||
aes-128-ccm - TEST 0
|
||||
bool(true)
|
||||
bool(true)
|
||||
aes-128-ccm - TEST 1
|
||||
bool(true)
|
||||
bool(true)
|
||||
aes-256-ccm - TEST 0
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
|
||||
+2
-1
@@ -1873,7 +1873,8 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in
|
||||
mode = Z_LVAL(args[skip]);
|
||||
flags = mode & PDO_FETCH_FLAGS;
|
||||
|
||||
retval = pdo_stmt_verify_mode(stmt, mode, 0);
|
||||
/* pdo_stmt_verify_mode() returns a boolean value */
|
||||
retval = pdo_stmt_verify_mode(stmt, mode, 0) ? SUCCESS : FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,13 +66,8 @@ if test "$PHP_PDO_MYSQL" != "no"; then
|
||||
if test "x$SED" = "x"; then
|
||||
AC_PATH_PROG(SED, sed)
|
||||
fi
|
||||
if test "$enable_maintainer_zts" = "yes"; then
|
||||
PDO_MYSQL_LIBNAME=mysqlclient_r
|
||||
PDO_MYSQL_LIBS=`$PDO_MYSQL_CONFIG --libs_r | $SED -e "s/'//g"`
|
||||
else
|
||||
PDO_MYSQL_LIBNAME=mysqlclient
|
||||
PDO_MYSQL_LIBS=`$PDO_MYSQL_CONFIG --libs | $SED -e "s/'//g"`
|
||||
fi
|
||||
PDO_MYSQL_LIBNAME=mysqlclient
|
||||
PDO_MYSQL_LIBS=`$PDO_MYSQL_CONFIG --libs | $SED -e "s/'//g"`
|
||||
PDO_MYSQL_INCLUDE=`$PDO_MYSQL_CONFIG --cflags | $SED -e "s/'//g"`
|
||||
elif test -n "$PDO_MYSQL_DIR"; then
|
||||
AC_MSG_RESULT([not found])
|
||||
|
||||
@@ -293,6 +293,11 @@ static char *pdo_mysql_last_insert_id(pdo_dbh_t *dbh, const char *name, size_t *
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if defined(PDO_USE_MYSQLND) || MYSQL_VERSION_ID < 50707 || defined(MARIADB_BASE_VERSION)
|
||||
# define mysql_real_escape_string_quote(mysql, to, from, length, quote) \
|
||||
mysql_real_escape_string(mysql, to, from, length)
|
||||
#endif
|
||||
|
||||
/* {{{ mysql_handle_quoter */
|
||||
static int mysql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unquotedlen, char **quoted, size_t *quotedlen, enum pdo_param_type paramtype )
|
||||
{
|
||||
@@ -315,13 +320,13 @@ static int mysql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unqu
|
||||
*quoted = safe_emalloc(2, unquotedlen, 3 + (use_national_character_set ? 1 : 0));
|
||||
|
||||
if (use_national_character_set) {
|
||||
*quotedlen = mysql_real_escape_string(H->server, *quoted + 2, unquoted, unquotedlen);
|
||||
*quotedlen = mysql_real_escape_string_quote(H->server, *quoted + 2, unquoted, unquotedlen, '\'');
|
||||
(*quoted)[0] = 'N';
|
||||
(*quoted)[1] = '\'';
|
||||
|
||||
++*quotedlen; /* N prefix */
|
||||
} else {
|
||||
*quotedlen = mysql_real_escape_string(H->server, *quoted + 1, unquoted, unquotedlen);
|
||||
*quotedlen = mysql_real_escape_string_quote(H->server, *quoted + 1, unquoted, unquotedlen, '\'');
|
||||
(*quoted)[0] = '\'';
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
# define PDO_MYSQL_PARAM_BIND MYSQLND_PARAM_BIND
|
||||
#else
|
||||
# include <mysql.h>
|
||||
#if MYSQL_VERSION_ID >= 80000 && MYSQL_VERSION_ID < 100000
|
||||
typedef _Bool my_bool;
|
||||
#endif
|
||||
# define PDO_MYSQL_PARAM_BIND MYSQL_BIND
|
||||
#endif
|
||||
|
||||
|
||||
@@ -179,6 +179,8 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len,
|
||||
return 0;
|
||||
}
|
||||
|
||||
stmt->driver_data = S;
|
||||
|
||||
cursor_type = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY);
|
||||
if (cursor_type != PDO_CURSOR_FWDONLY) {
|
||||
rc = SQLSetStmtAttr(S->stmt, SQL_ATTR_CURSOR_SCROLLABLE, (void*)SQL_SCROLLABLE, 0);
|
||||
@@ -197,7 +199,6 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len,
|
||||
efree(nsql);
|
||||
}
|
||||
|
||||
stmt->driver_data = S;
|
||||
stmt->methods = &odbc_stmt_methods;
|
||||
|
||||
if (rc != SQL_SUCCESS) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #67465 (NULL Pointer dereference in odbc_handle_preparer)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo_odbc')) die('skip pdo_odbc extension not available');
|
||||
require 'ext/pdo/tests/pdo_test.inc';
|
||||
PDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
||||
$db->prepare("SELECT 1", [PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL]);
|
||||
echo "done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
||||
+25
-6
@@ -23,6 +23,7 @@
|
||||
#include "ext/standard/md5.h"
|
||||
#include "ext/standard/php_random.h"
|
||||
|
||||
static char *get_http_header_value_nodup(char *headers, char *type, size_t *len);
|
||||
static char *get_http_header_value(char *headers, char *type);
|
||||
static zend_string *get_http_body(php_stream *socketd, int close, char *headers);
|
||||
static zend_string *get_http_headers(php_stream *socketd);
|
||||
@@ -350,6 +351,7 @@ int make_http_soap_request(zval *this_ptr,
|
||||
int use_ssl;
|
||||
zend_string *http_body;
|
||||
char *content_type, *http_version, *cookie_itt;
|
||||
size_t cookie_len;
|
||||
int http_close;
|
||||
zend_string *http_headers;
|
||||
char *connection;
|
||||
@@ -968,8 +970,9 @@ try_again:
|
||||
we shouldn't be changing urls so path doesn't
|
||||
matter too much
|
||||
*/
|
||||
cookie_itt = strstr(ZSTR_VAL(http_headers), "Set-Cookie: ");
|
||||
while (cookie_itt) {
|
||||
cookie_itt = ZSTR_VAL(http_headers);
|
||||
|
||||
while ((cookie_itt = get_http_header_value_nodup(cookie_itt, "Set-Cookie: ", &cookie_len))) {
|
||||
char *cookie;
|
||||
char *eqpos, *sempos;
|
||||
zval *cookies;
|
||||
@@ -981,7 +984,7 @@ try_again:
|
||||
cookies = zend_hash_str_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1, &tmp_cookies);
|
||||
}
|
||||
|
||||
cookie = get_http_header_value(cookie_itt,"Set-Cookie: ");
|
||||
cookie = estrndup(cookie_itt, cookie_len);
|
||||
|
||||
eqpos = strstr(cookie, "=");
|
||||
sempos = strstr(cookie, ";");
|
||||
@@ -1039,7 +1042,7 @@ try_again:
|
||||
smart_str_free(&name);
|
||||
}
|
||||
|
||||
cookie_itt = strstr(cookie_itt + sizeof("Set-Cookie: "), "Set-Cookie: ");
|
||||
cookie_itt = cookie_itt + cookie_len;
|
||||
efree(cookie);
|
||||
}
|
||||
|
||||
@@ -1357,7 +1360,7 @@ try_again:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static char *get_http_header_value(char *headers, char *type)
|
||||
static char *get_http_header_value_nodup(char *headers, char *type, size_t *len)
|
||||
{
|
||||
char *pos, *tmp = NULL;
|
||||
int typelen, headerslen;
|
||||
@@ -1394,7 +1397,9 @@ static char *get_http_header_value(char *headers, char *type)
|
||||
eol--;
|
||||
}
|
||||
}
|
||||
return estrndup(tmp, eol - tmp);
|
||||
|
||||
*len = eol - tmp;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/* find next line */
|
||||
@@ -1408,6 +1413,20 @@ static char *get_http_header_value(char *headers, char *type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *get_http_header_value(char *headers, char *type)
|
||||
{
|
||||
size_t len;
|
||||
char *value;
|
||||
|
||||
value = get_http_header_value_nodup(headers, type, &len);
|
||||
|
||||
if (value) {
|
||||
return estrndup(value, len);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static zend_string* get_http_body(php_stream *stream, int close, char *headers)
|
||||
{
|
||||
zend_string *http_buf = NULL;
|
||||
|
||||
@@ -1614,8 +1614,6 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp
|
||||
attr = get_attribute(attrs, "default");
|
||||
if (attr) {
|
||||
if (ref != NULL) {
|
||||
soap_error0(E_ERROR, "Parsing Schema: element has both 'ref' and 'fixed' attributes");
|
||||
} else if (ref != NULL) {
|
||||
soap_error0(E_ERROR, "Parsing Schema: element has both 'default' and 'fixed' attributes");
|
||||
}
|
||||
cur_type->def = estrdup((char*)attr->children->content);
|
||||
|
||||
+2
-2
@@ -2325,8 +2325,8 @@ PHP_METHOD(SoapClient, SoapClient)
|
||||
}
|
||||
|
||||
if ((tmp = zend_hash_str_find(ht, "soap_version", sizeof("soap_version")-1)) != NULL) {
|
||||
if (Z_TYPE_P(tmp) == IS_LONG ||
|
||||
(Z_LVAL_P(tmp) == SOAP_1_1 && Z_LVAL_P(tmp) == SOAP_1_2)) {
|
||||
if (Z_TYPE_P(tmp) == IS_LONG &&
|
||||
(Z_LVAL_P(tmp) == SOAP_1_1 || Z_LVAL_P(tmp) == SOAP_1_2)) {
|
||||
soap_version = Z_LVAL_P(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
+26
-12
@@ -7,6 +7,8 @@ AC_CACHE_CHECK([whether flush should be called explicitly after a buffered io],
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@@ -61,6 +63,8 @@ fi
|
||||
|
||||
AC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <string.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@@ -72,9 +76,9 @@ AC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[
|
||||
int main() {
|
||||
#if HAVE_CRYPT
|
||||
char *encrypted = crypt("rasmuslerdorf","rl");
|
||||
exit(!encrypted || strcmp(encrypted,"rl.3StKT.4T8M"));
|
||||
return !encrypted || strcmp(encrypted,"rl.3StKT.4T8M");
|
||||
#else
|
||||
exit(1);
|
||||
return 1;
|
||||
#endif
|
||||
}]])],[
|
||||
ac_cv_crypt_des=yes
|
||||
@@ -86,6 +90,8 @@ int main() {
|
||||
|
||||
AC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <string.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@@ -97,9 +103,9 @@ AC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[
|
||||
int main() {
|
||||
#if HAVE_CRYPT
|
||||
char *encrypted = crypt("rasmuslerdorf","_J9..rasm");
|
||||
exit(!encrypted || strcmp(encrypted,"_J9..rasmBYk8r9AiWNc"));
|
||||
return !encrypted || strcmp(encrypted,"_J9..rasmBYk8r9AiWNc");
|
||||
#else
|
||||
exit(1);
|
||||
return 1;
|
||||
#endif
|
||||
}]])],[
|
||||
ac_cv_crypt_ext_des=yes
|
||||
@@ -111,6 +117,8 @@ int main() {
|
||||
|
||||
AC_CACHE_CHECK(for MD5 crypt, ac_cv_crypt_md5,[
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <string.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@@ -132,9 +140,9 @@ int main() {
|
||||
strcpy(answer,salt);
|
||||
strcat(answer,"rISCgZzpwk3UhDidwXvin0");
|
||||
encrypted = crypt("rasmuslerdorf",salt);
|
||||
exit(!encrypted || strcmp(encrypted,answer));
|
||||
return !encrypted || strcmp(encrypted,answer);
|
||||
#else
|
||||
exit(1);
|
||||
return 1;
|
||||
#endif
|
||||
}]])],[
|
||||
ac_cv_crypt_md5=yes
|
||||
@@ -146,6 +154,8 @@ int main() {
|
||||
|
||||
AC_CACHE_CHECK(for Blowfish crypt, ac_cv_crypt_blowfish,[
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <string.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@@ -164,9 +174,9 @@ int main() {
|
||||
strcpy(answer,salt);
|
||||
strcpy(&answer[29],"nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra");
|
||||
encrypted = crypt("rasmuslerdorf",salt);
|
||||
exit(!encrypted || strcmp(encrypted,answer));
|
||||
return !encrypted || strcmp(encrypted,answer);
|
||||
#else
|
||||
exit(1);
|
||||
return 1;
|
||||
#endif
|
||||
}]])],[
|
||||
ac_cv_crypt_blowfish=yes
|
||||
@@ -178,6 +188,8 @@ int main() {
|
||||
|
||||
AC_CACHE_CHECK(for SHA512 crypt, ac_cv_crypt_sha512,[
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <string.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@@ -195,9 +207,9 @@ int main() {
|
||||
strcpy(answer, salt);
|
||||
strcat(answer, "EeHCRjm0bljalWuALHSTs1NB9ipEiLEXLhYeXdOpx22gmlmVejnVXFhd84cEKbYxCo.XuUTrW.RLraeEnsvWs/");
|
||||
encrypted = crypt("rasmuslerdorf",salt);
|
||||
exit(!encrypted || strcmp(encrypted,answer));
|
||||
return !encrypted || strcmp(encrypted,answer);
|
||||
#else
|
||||
exit(1);
|
||||
return 1;
|
||||
#endif
|
||||
}]])],[
|
||||
ac_cv_crypt_sha512=yes
|
||||
@@ -209,6 +221,8 @@ int main() {
|
||||
|
||||
AC_CACHE_CHECK(for SHA256 crypt, ac_cv_crypt_sha256,[
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <string.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@@ -226,9 +240,9 @@ int main() {
|
||||
strcpy(answer, salt);
|
||||
strcat(answer, "cFAm2puLCujQ9t.0CxiFIIvFi4JyQx5UncCt/xRIX23");
|
||||
encrypted = crypt("rasmuslerdorf",salt);
|
||||
exit(!encrypted || strcmp(encrypted,answer));
|
||||
return !encrypted || strcmp(encrypted,answer);
|
||||
#else
|
||||
exit(1);
|
||||
return 1;
|
||||
#endif
|
||||
}]])],[
|
||||
ac_cv_crypt_sha256=yes
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
Bug #76735 (Incorrect message in fopen on invalid mode)
|
||||
--FILE--
|
||||
<?php
|
||||
fopen(__FILE__, 'Q');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: fopen(%s): failed to open stream: `Q' is not a valid mode for fopen in %s on line %d
|
||||
@@ -5,6 +5,12 @@ Italian PHP TestFest 2009 Cesena 19-20-21 june
|
||||
Fabio Fabbrucci (fabbrucci@grupporetina.com)
|
||||
Michele Orselli (mo@ideato.it)
|
||||
Simone Gentili (sensorario@gmail.com)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(in_array(PHP_OS_FAMILY, ['BSD', 'Darwin', 'Solaris', 'Linux'])){
|
||||
if (!file_exists("/etc/services")) die("skip reason: missing /etc/services");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -5,6 +5,12 @@ Italian PHP TestFest 2009 Cesena 19-20-21 june
|
||||
Fabio Fabbrucci (fabbrucci@grupporetina.com)
|
||||
Michele Orselli (mo@ideato.it)
|
||||
Simone Gentili (sensorario@gmail.com)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(in_array(PHP_OS_FAMILY, ['BSD', 'Darwin', 'Solaris', 'Linux'])){
|
||||
if (!file_exists("/etc/services")) die("skip reason: missing /etc/services");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
if (file_exists("/etc/services")) {
|
||||
|
||||
@@ -7,6 +7,12 @@ Italian PHP TestFest 2009 Cesena 19-20-21 june
|
||||
Fabio Fabbrucci (fabbrucci@grupporetina.com)
|
||||
Michele Orselli (mo@ideato.it)
|
||||
Simone Gentili (sensorario@gmail.com)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(in_array(PHP_OS_FAMILY, ['BSD', 'Darwin', 'Solaris', 'Linux'])){
|
||||
if (!file_exists("/etc/services")) die("skip reason: missing /etc/services");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(getservbyport( -1, "tcp" ));
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
getprotobyname function basic test
|
||||
--CREDITS--
|
||||
edgarsandi - <edgar.r.sandi@gmail.com>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(in_array(PHP_OS_FAMILY, ['BSD', 'Darwin', 'Solaris', 'Linux'])){
|
||||
if (!file_exists("/etc/protocols")) die("skip reason: missing /etc/protocols");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(getprotobyname('tcp'));
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
getprotobynumber function basic test
|
||||
--CREDITS--
|
||||
edgarsandi - <edgar.r.sandi@gmail.com>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(in_array(PHP_OS_FAMILY, ['BSD', 'Darwin', 'Solaris', 'Linux'])){
|
||||
if (!file_exists("/etc/protocols")) die("skip reason: missing /etc/protocols");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(getprotobynumber(6));
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #76943 (Inconsistent stream_wrapper_restore() errors)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!in_array('phar', stream_get_wrappers())) die('skip phar wrapper not registered');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(stream_wrapper_restore('foo'));
|
||||
var_dump(stream_wrapper_restore('phar'));
|
||||
|
||||
stream_wrapper_register('bar', 'stdClass');
|
||||
|
||||
var_dump(stream_wrapper_restore('foo'));
|
||||
var_dump(stream_wrapper_restore('phar'));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: stream_wrapper_restore(): foo:// never existed, nothing to restore in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Notice: stream_wrapper_restore(): phar:// was never changed, nothing to restore in %s on line %d
|
||||
bool(true)
|
||||
|
||||
Warning: stream_wrapper_restore(): foo:// never existed, nothing to restore in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Notice: stream_wrapper_restore(): phar:// was never changed, nothing to restore in %s on line %d
|
||||
bool(true)
|
||||
@@ -859,6 +859,15 @@ echo "Done";
|
||||
string(3) "%:x"
|
||||
}
|
||||
|
||||
--> https://example.com:0/: array(3) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
}
|
||||
|
||||
--> http:///blah.com: bool(false)
|
||||
|
||||
--> http://:80: bool(false)
|
||||
|
||||
@@ -113,6 +113,7 @@ echo "Done";
|
||||
--> / : NULL
|
||||
--> /rest/Users?filter={"id":"123"} : NULL
|
||||
--> %:x : NULL
|
||||
--> https://example.com:0/ : string(5) "https"
|
||||
--> http:///blah.com : bool(false)
|
||||
--> http://:80 : bool(false)
|
||||
--> http://user@:80 : bool(false)
|
||||
|
||||
@@ -112,6 +112,7 @@ echo "Done";
|
||||
--> / : NULL
|
||||
--> /rest/Users?filter={"id":"123"} : NULL
|
||||
--> %:x : NULL
|
||||
--> https://example.com:0/ : string(11) "example.com"
|
||||
--> http:///blah.com : bool(false)
|
||||
--> http://:80 : bool(false)
|
||||
--> http://user@:80 : bool(false)
|
||||
|
||||
@@ -112,6 +112,7 @@ echo "Done";
|
||||
--> / : NULL
|
||||
--> /rest/Users?filter={"id":"123"} : NULL
|
||||
--> %:x : NULL
|
||||
--> https://example.com:0/ : NULL
|
||||
--> http:///blah.com : bool(false)
|
||||
--> http://:80 : bool(false)
|
||||
--> http://user@:80 : bool(false)
|
||||
|
||||
@@ -112,6 +112,7 @@ echo "Done";
|
||||
--> / : NULL
|
||||
--> /rest/Users?filter={"id":"123"} : NULL
|
||||
--> %:x : NULL
|
||||
--> https://example.com:0/ : NULL
|
||||
--> http:///blah.com : bool(false)
|
||||
--> http://:80 : bool(false)
|
||||
--> http://user@:80 : bool(false)
|
||||
|
||||
@@ -112,6 +112,7 @@ echo "Done";
|
||||
--> / : NULL
|
||||
--> /rest/Users?filter={"id":"123"} : NULL
|
||||
--> %:x : NULL
|
||||
--> https://example.com:0/ : NULL
|
||||
--> http:///blah.com : bool(false)
|
||||
--> http://:80 : bool(false)
|
||||
--> http://user@:80 : bool(false)
|
||||
|
||||
@@ -112,6 +112,7 @@ echo "Done";
|
||||
--> / : string(1) "/"
|
||||
--> /rest/Users?filter={"id":"123"} : string(11) "/rest/Users"
|
||||
--> %:x : string(3) "%:x"
|
||||
--> https://example.com:0/ : string(1) "/"
|
||||
--> http:///blah.com : bool(false)
|
||||
--> http://:80 : bool(false)
|
||||
--> http://user@:80 : bool(false)
|
||||
|
||||
@@ -112,6 +112,7 @@ echo "Done";
|
||||
--> / : NULL
|
||||
--> /rest/Users?filter={"id":"123"} : string(19) "filter={"id":"123"}"
|
||||
--> %:x : NULL
|
||||
--> https://example.com:0/ : NULL
|
||||
--> http:///blah.com : bool(false)
|
||||
--> http://:80 : bool(false)
|
||||
--> http://user@:80 : bool(false)
|
||||
|
||||
@@ -112,6 +112,7 @@ echo "Done";
|
||||
--> / : NULL
|
||||
--> /rest/Users?filter={"id":"123"} : NULL
|
||||
--> %:x : NULL
|
||||
--> https://example.com:0/ : NULL
|
||||
--> http:///blah.com : bool(false)
|
||||
--> http://:80 : bool(false)
|
||||
--> http://user@:80 : bool(false)
|
||||
|
||||
@@ -861,6 +861,15 @@ echo "Done";
|
||||
string(3) "%:x"
|
||||
}
|
||||
|
||||
--> https://example.com:0/: array(3) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
}
|
||||
|
||||
--> http:///blah.com: bool(false)
|
||||
|
||||
--> http://:80: bool(false)
|
||||
|
||||
@@ -92,6 +92,7 @@ $urls = array(
|
||||
'/',
|
||||
'/rest/Users?filter={"id":"123"}',
|
||||
'%:x',
|
||||
'https://example.com:0/',
|
||||
|
||||
// Severely malformed URLs that do not parse:
|
||||
'http:///blah.com',
|
||||
|
||||
+6
-4
@@ -194,10 +194,11 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length)
|
||||
|
||||
if (pp - p > 0 && pp - p < 6 && (pp == ue || *pp == '/')) {
|
||||
zend_long port;
|
||||
char *end;
|
||||
memcpy(port_buf, p, (pp - p));
|
||||
port_buf[pp - p] = '\0';
|
||||
port = ZEND_STRTOL(port_buf, NULL, 10);
|
||||
if (port > 0 && port <= 65535) {
|
||||
port = ZEND_STRTOL(port_buf, &end, 10);
|
||||
if (port >= 0 && port <= 65535 && end != port_buf) {
|
||||
ret->port = (unsigned short) port;
|
||||
if (s + 1 < ue && *s == '/' && *(s + 1) == '/') { /* relative-scheme URL */
|
||||
s += 2;
|
||||
@@ -258,10 +259,11 @@ parse_host:
|
||||
return NULL;
|
||||
} else if (e - p > 0) {
|
||||
zend_long port;
|
||||
char *end;
|
||||
memcpy(port_buf, p, (e - p));
|
||||
port_buf[e - p] = '\0';
|
||||
port = ZEND_STRTOL(port_buf, NULL, 10);
|
||||
if (port > 0 && port <= 65535) {
|
||||
port = ZEND_STRTOL(port_buf, &end, 10);
|
||||
if (port >= 0 && port <= 65535 && end != port_buf) {
|
||||
ret->port = (unsigned short)port;
|
||||
} else {
|
||||
php_url_free(ret);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #77040 (tidyNode::isHtml() is completely broken)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('tidy')) die('skip tidy extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$tidy = new tidy;
|
||||
$tidy->parseString("<p>text</p><p><![CDATA[cdata]]></p>");
|
||||
$p = $tidy->body()->child[0];
|
||||
var_dump($p->type === TIDY_NODETYPE_START);
|
||||
var_dump($p->isHtml());
|
||||
$text = $p->child[0];
|
||||
var_dump($text->type === TIDY_NODETYPE_TEXT);
|
||||
var_dump($text->isHtml());
|
||||
$cdata = $tidy->body()->child[1]->child[0];
|
||||
var_dump($cdata->type === TIDY_NODETYPE_CDATA);
|
||||
var_dump($cdata->isHtml());
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
+7
-4
@@ -1786,11 +1786,14 @@ static TIDY_NODE_METHOD(isHtml)
|
||||
{
|
||||
TIDY_FETCH_ONLY_OBJECT;
|
||||
|
||||
if (tidyNodeGetType(obj->node) & (TidyNode_Start | TidyNode_End | TidyNode_StartEnd)) {
|
||||
RETURN_TRUE;
|
||||
switch (tidyNodeGetType(obj->node)) {
|
||||
case TidyNode_Start:
|
||||
case TidyNode_End:
|
||||
case TidyNode_StartEnd:
|
||||
RETURN_TRUE;
|
||||
default:
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -501,7 +501,9 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
|
||||
size_t new_val_len;
|
||||
|
||||
*val++ = '\0';
|
||||
php_url_decode(var, strlen(var));
|
||||
if (arg != PARSE_COOKIE) {
|
||||
php_url_decode(var, strlen(var));
|
||||
}
|
||||
val_len = php_url_decode(val, strlen(val));
|
||||
val = estrndup(val, val_len);
|
||||
if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len)) {
|
||||
@@ -512,7 +514,9 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
|
||||
size_t val_len;
|
||||
size_t new_val_len;
|
||||
|
||||
php_url_decode(var, strlen(var));
|
||||
if (arg != PARSE_COOKIE) {
|
||||
php_url_decode(var, strlen(var));
|
||||
}
|
||||
val_len = 0;
|
||||
val = estrndup("", val_len);
|
||||
if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len)) {
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
/* edit configure.ac to change version number */
|
||||
#define PHP_MAJOR_VERSION 7
|
||||
#define PHP_MINOR_VERSION 3
|
||||
#define PHP_RELEASE_VERSION 23
|
||||
#define PHP_EXTRA_VERSION "-dev"
|
||||
#define PHP_VERSION "7.3.23-dev"
|
||||
#define PHP_VERSION_ID 70323
|
||||
#define PHP_RELEASE_VERSION 24
|
||||
#define PHP_EXTRA_VERSION ""
|
||||
#define PHP_VERSION "7.3.24"
|
||||
#define PHP_VERSION_ID 70324
|
||||
@@ -749,6 +749,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
|
||||
php_stream_mmap_range *range = (php_stream_mmap_range*)ptrparam;
|
||||
HANDLE hfile = (HANDLE)_get_osfhandle(fd);
|
||||
DWORD prot, acc, loffs = 0, delta = 0;
|
||||
LARGE_INTEGER file_size;
|
||||
|
||||
switch (value) {
|
||||
case PHP_STREAM_MMAP_SUPPORTED:
|
||||
@@ -785,7 +786,22 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
|
||||
return PHP_STREAM_OPTION_RETURN_ERR;
|
||||
}
|
||||
|
||||
size = GetFileSize(hfile, NULL);
|
||||
if (!GetFileSizeEx(hfile, &file_size)) {
|
||||
CloseHandle(data->file_mapping);
|
||||
data->file_mapping = NULL;
|
||||
return PHP_STREAM_OPTION_RETURN_ERR;
|
||||
}
|
||||
# if defined(_WIN64)
|
||||
size = file_size.QuadPart;
|
||||
# else
|
||||
if (file_size.HighPart) {
|
||||
CloseHandle(data->file_mapping);
|
||||
data->file_mapping = NULL;
|
||||
return PHP_STREAM_OPTION_RETURN_ERR;
|
||||
} else {
|
||||
size = file_size.LowPart;
|
||||
}
|
||||
# endif
|
||||
if (range->offset > size) {
|
||||
range->offset = size;
|
||||
}
|
||||
@@ -1005,9 +1021,7 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, zen
|
||||
char *persistent_id = NULL;
|
||||
|
||||
if (FAILURE == php_stream_parse_fopen_modes(mode, &open_flags)) {
|
||||
if (options & REPORT_ERRORS) {
|
||||
php_error_docref(NULL, E_WARNING, "`%s' is not a valid mode for fopen", mode);
|
||||
}
|
||||
php_stream_wrapper_log_error(&php_plain_files_wrapper, options, "`%s' is not a valid mode for fopen", mode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -559,23 +559,24 @@ PHP_FUNCTION(stream_wrapper_restore)
|
||||
{
|
||||
zend_string *protocol;
|
||||
php_stream_wrapper *wrapper;
|
||||
HashTable *global_wrapper_hash;
|
||||
HashTable *global_wrapper_hash, *wrapper_hash;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &protocol) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
global_wrapper_hash = php_stream_get_url_stream_wrappers_hash_global();
|
||||
if (php_stream_get_url_stream_wrappers_hash() == global_wrapper_hash) {
|
||||
php_error_docref(NULL, E_NOTICE, "%s:// was never changed, nothing to restore", ZSTR_VAL(protocol));
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
if ((wrapper = zend_hash_find_ptr(global_wrapper_hash, protocol)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "%s:// never existed, nothing to restore", ZSTR_VAL(protocol));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
wrapper_hash = php_stream_get_url_stream_wrappers_hash();
|
||||
if (wrapper_hash == global_wrapper_hash || zend_hash_find_ptr(wrapper_hash, protocol) == wrapper) {
|
||||
php_error_docref(NULL, E_NOTICE, "%s:// was never changed, nothing to restore", ZSTR_VAL(protocol));
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
/* A failure here could be okay given that the protocol might have been merely unregistered */
|
||||
php_unregister_url_stream_wrapper_volatile(protocol);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ cookie1=val1 ; cookie2=val2%20; cookie3=val 3.; cookie 4= value 4 %3B; cookie1=
|
||||
var_dump($_COOKIE);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(10) {
|
||||
array(12) {
|
||||
["cookie1"]=>
|
||||
string(6) "val1 "
|
||||
["cookie2"]=>
|
||||
@@ -19,11 +19,15 @@ array(10) {
|
||||
string(6) "val 3."
|
||||
["cookie_4"]=>
|
||||
string(10) " value 4 ;"
|
||||
["%20cookie1"]=>
|
||||
string(6) "ignore"
|
||||
["+cookie1"]=>
|
||||
string(6) "ignore"
|
||||
["cookie__5"]=>
|
||||
string(7) " value"
|
||||
["cookie_6"]=>
|
||||
["cookie%206"]=>
|
||||
string(3) "þæö"
|
||||
["cookie_7"]=>
|
||||
["cookie+7"]=>
|
||||
string(0) ""
|
||||
["$cookie_8"]=>
|
||||
string(0) ""
|
||||
|
||||
@@ -10,9 +10,11 @@ c o o k i e=value; c o o k i e= v a l u e ;;c%20o+o k+i%20e=v;name="value","valu
|
||||
var_dump($_COOKIE);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
array(4) {
|
||||
["c_o_o_k_i_e"]=>
|
||||
string(5) "value"
|
||||
["c%20o+o_k+i%20e"]=>
|
||||
string(1) "v"
|
||||
["name"]=>
|
||||
string(24) ""value","value",UEhQIQ=="
|
||||
["UEhQIQ"]=>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Cookies Security Bug
|
||||
--INI--
|
||||
max_input_vars=1000
|
||||
filter.default=unsafe_raw
|
||||
--COOKIE--
|
||||
__%48ost-evil=evil; __Host-evil=good; %66oo=baz;foo=bar
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_COOKIE);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(4) {
|
||||
["__%48ost-evil"]=>
|
||||
string(4) "evil"
|
||||
["__Host-evil"]=>
|
||||
string(4) "good"
|
||||
["%66oo"]=>
|
||||
string(3) "baz"
|
||||
["foo"]=>
|
||||
string(3) "bar"
|
||||
}
|
||||
Reference in new issue
Block a user