mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-24 01:15:41 +00:00
Compare commits
173
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45e4e84c90 | ||
|
|
2323e95df9 | ||
|
|
db5ad4c51f | ||
|
|
9dfa843a38 | ||
|
|
0ddcf2a919 | ||
|
|
7740edae36 | ||
|
|
c351b47ce8 | ||
|
|
1a2ec3fc60 | ||
|
|
4d54c4bdf0 | ||
|
|
de4fff0fb3 | ||
|
|
1803228597 | ||
|
|
287c91c1f0 | ||
|
|
ab0939e5e5 | ||
|
|
56754a7f9e | ||
|
|
88412772d2 | ||
|
|
82b07b62c0 | ||
|
|
26ff3a4c1e | ||
|
|
4e7b31a0db | ||
|
|
fcbe20d357 | ||
|
|
2711948d14 | ||
|
|
16e2d954fc | ||
|
|
28ed0119ac | ||
|
|
408b172017 | ||
|
|
e64da8c20d | ||
|
|
00525b824a | ||
|
|
2775dc2b44 | ||
|
|
372844918a | ||
|
|
f86b2193a4 | ||
|
|
99f0760bfb | ||
|
|
d2e1a04b10 | ||
|
|
582f42b8d4 | ||
|
|
592df89027 | ||
|
|
5e95b61639 | ||
|
|
fe551c089a | ||
|
|
53fa6c5b6b | ||
|
|
30aceaf1a7 | ||
|
|
197095c29e | ||
|
|
e665a07ab9 | ||
|
|
b206b0e29d | ||
|
|
ee275e34c8 | ||
|
|
32be79dcfa | ||
|
|
52f35b984c | ||
|
|
bda1cc6946 | ||
|
|
cb41a7bad1 | ||
|
|
437612f656 | ||
|
|
54fbbded37 | ||
|
|
9185cfd539 | ||
|
|
20941b71aa | ||
|
|
276bead9c4 | ||
|
|
359bc0ee2f | ||
|
|
cbe1597b74 | ||
|
|
5a7039035c | ||
|
|
eb2360602e | ||
|
|
88c48a4b95 | ||
|
|
2fefae4771 | ||
|
|
2b10db8e10 | ||
|
|
706aefb781 | ||
|
|
529da0f74c | ||
|
|
1504f7d630 | ||
|
|
3f42f2f5d1 | ||
|
|
0407bdf252 | ||
|
|
7bfe9bf951 | ||
|
|
7ba1409a1a | ||
|
|
35f32637b0 | ||
|
|
eab42649ab | ||
|
|
b7cd099ae0 | ||
|
|
ad492ca932 | ||
|
|
481c4715d4 | ||
|
|
4e2c01617f | ||
|
|
c044164a96 | ||
|
|
aeb633543b | ||
|
|
7311087cf0 | ||
|
|
1355ea60cc | ||
|
|
5e338836ff | ||
|
|
32314f6b67 | ||
|
|
babeca356b | ||
|
|
1847cf10c1 | ||
|
|
f6896e4395 | ||
|
|
8c247af1fc | ||
|
|
daa1fb8ba6 | ||
|
|
39dd715382 | ||
|
|
84a4041ba4 | ||
|
|
1ff30fd88c | ||
|
|
6569db8808 | ||
|
|
7189039d65 | ||
|
|
7df4087b98 | ||
|
|
d72b943262 | ||
|
|
9444bc7997 | ||
|
|
547451796c | ||
|
|
65cf73c931 | ||
|
|
fd28010e20 | ||
|
|
e4ff7f2ee3 | ||
|
|
f59506cd27 | ||
|
|
d3b5ed0787 | ||
|
|
cf4753691d | ||
|
|
ae74549239 | ||
|
|
61ec9b5b0f | ||
|
|
eeaec70758 | ||
|
|
990ecc12fc | ||
|
|
0fe07a0e74 | ||
|
|
bff84d7c18 | ||
|
|
358aedc454 | ||
|
|
0a29e4731e | ||
|
|
12b2127b72 | ||
|
|
8b9719d8b9 | ||
|
|
b3466f862f | ||
|
|
da3add26cf | ||
|
|
ab6c1d21f9 | ||
|
|
65364fe7d0 | ||
|
|
00546bc9b7 | ||
|
|
3e167ba990 | ||
|
|
b4a4db467b | ||
|
|
d0a244f1f3 | ||
|
|
51c38a0997 | ||
|
|
61e0f8599d | ||
|
|
d491b2f916 | ||
|
|
71d3a69425 | ||
|
|
dc3a5d783f | ||
|
|
0678dc8d91 | ||
|
|
ad744263ca | ||
|
|
e946de29d2 | ||
|
|
1ffb7fddc2 | ||
|
|
c74efe1b2e | ||
|
|
b5051ff939 | ||
|
|
e2ba5c7987 | ||
|
|
8e9777a1f1 | ||
|
|
e644aad3f9 | ||
|
|
8ab4e2e90d | ||
|
|
b512adf78d | ||
|
|
2fe5bcbeb5 | ||
|
|
892def5f12 | ||
|
|
8d1d038509 | ||
|
|
6bd5a06894 | ||
|
|
ec002bd837 | ||
|
|
52de149ebc | ||
|
|
2326401fc1 | ||
|
|
7f527897fe | ||
|
|
d4b67896ec | ||
|
|
84605098bc | ||
|
|
ee1ab62763 | ||
|
|
d77ea459bd | ||
|
|
44be7b7f27 | ||
|
|
0335d2ef3e | ||
|
|
a0bb3fd679 | ||
|
|
eca037a51d | ||
|
|
f3230e3522 | ||
|
|
c5ccaf1d04 | ||
|
|
35b077f53e | ||
|
|
8044d0680b | ||
|
|
a8e0a623ec | ||
|
|
2dff153b23 | ||
|
|
f0a1e410a3 | ||
|
|
b3c6089111 | ||
|
|
ce2ad0df18 | ||
|
|
04821a1ee6 | ||
|
|
f25ff02b54 | ||
|
|
4fc0d46ae7 | ||
|
|
0baaf9fade | ||
|
|
ae313b6037 | ||
|
|
9f5cf7d41a | ||
|
|
02b661ecfc | ||
|
|
1f90dd3359 | ||
|
|
e7f36ba693 | ||
|
|
01a1c3067c | ||
|
|
1f46bec9ce | ||
|
|
e3df0c5f60 | ||
|
|
e2b0d97950 | ||
|
|
a34288fa1a | ||
|
|
b93ea59665 | ||
|
|
3c328f0984 | ||
|
|
d780c2a673 | ||
|
|
d400b74296 | ||
|
|
08334293f8 |
No files matched your search
@@ -22,6 +22,10 @@ sapi/nsapi/nsapi.c ident
|
||||
sapi/continuity/capi.c ident
|
||||
Zend/RFCs/002.txt ident
|
||||
Zend/RFCs/003.txt ident
|
||||
ext/exif/exif.c ident
|
||||
ext/ldap/ldap.c ident
|
||||
ext/pdo_pgsql/pdo_pgsql.c ident
|
||||
ext/tidy/tidy.c ident
|
||||
NEWS merge=NEWS
|
||||
/ext/bz2/tests/with_strings.phpt -crlf
|
||||
/ext/dom/tests/bug40836.phpt -crlf
|
||||
|
||||
@@ -385,6 +385,12 @@ MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: hash
|
||||
PRIMARY MAINTAINER: Sara Golemon <pollita@php.net>, Mike Wallner <mike@php.net>, Anatol Belski <ab@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.1.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: iconv
|
||||
PRIMARY MAINTAINER: Moriyoshi Koizumi <moriyoshi@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
|
||||
@@ -1,5 +1,126 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
13 Nov 2014 PHP 5.4.35
|
||||
|
||||
- Core:
|
||||
. Fixed bug #68365 (zend_mm_heap corrupted after memory overflow in
|
||||
zend_hash_copy). (Dmitry)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #68283 (fileinfo: out-of-bounds read in elf note headers).
|
||||
(CVE-2014-3710) (Remi)
|
||||
|
||||
- GMP:
|
||||
. Fixed bug #63595 (GMP memory management conflicts with other libraries
|
||||
using GMP). (Remi)
|
||||
|
||||
- PDO_pgsql:
|
||||
. Fixed bug #66584 (Segmentation fault on statement deallocation) (Matteo)
|
||||
|
||||
16 Oct 2014, PHP 5.4.34
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #66242 (libmagic: don't assume char is signed). (ArdB)
|
||||
|
||||
- Core:
|
||||
. Fixed bug #67985 (Incorrect last used array index copied to new array after
|
||||
unset). (Tjerk)
|
||||
. Fixed bug #68044 (Integer overflow in unserialize() (32-bits only)).
|
||||
(CVE-2014-3669) (Stas)
|
||||
|
||||
- cURL:
|
||||
. Fixed bug #68089 (NULL byte injection - cURL lib). (Stas)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #68113 (Heap corruption in exif_thumbnail()). (CVE-2014-3670)
|
||||
(Stas)
|
||||
|
||||
- OpenSSL:
|
||||
. Reverted fixes for bug #41631, due to regressions. (Stas)
|
||||
|
||||
- XMLRPC:
|
||||
. Fixed bug #68027 (Global buffer overflow in mkgmtime() function).
|
||||
(CVE-2014-3668) (Stas)
|
||||
|
||||
18 Sep 2014, PHP 5.4.33
|
||||
|
||||
- Core:
|
||||
. Fixed bug #47358 (glob returns error, should be empty array()). (Pierre)
|
||||
. Fixed bug #65463 (SIGSEGV during zend_shutdown()). (Keyur Govande)
|
||||
. Fixed bug #66036 (Crash on SIGTERM in apache process). (Keyur Govande)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #41631 (socket timeouts not honored in blocking SSL reads).
|
||||
(Daniel Lowrey)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #66091 (memory leaks in DateTime constructor). (Tjerk)
|
||||
|
||||
- FPM:
|
||||
. Fixed #67606 (FPM with mod_fastcgi/apache2.4 is broken). (David Zuelke)
|
||||
|
||||
- GD:
|
||||
. Made fontFetch's path parser thread-safe. (Sara)
|
||||
|
||||
- Wddx:
|
||||
. Fixed bug #67873 (Segfaults in php_wddx_serialize_var). (Anatol, Remi)
|
||||
|
||||
- Zlib:
|
||||
. Fixed bug #67724 (chained zlib filters silently fail with large amounts of
|
||||
data). (Mike)
|
||||
. Fixed bug #67865 (internal corruption phar error). (Mike)
|
||||
|
||||
21 Aug 2014, PHP 5.4.32
|
||||
|
||||
- COM:
|
||||
. Fixed missing type checks in com_event_sink. (Yussuf Khalil, Stas)
|
||||
. Fixed bug #41577 (DOTNET is successful once per server run).
|
||||
(Aidas Kasparas)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #67705 (extensive backtracking in rule regular expression).
|
||||
(CVE-2014-3538) (Remi)
|
||||
. Fixed bug #67716 (Segfault in cdf.c). (CVE-2014-3587) (Remi)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #66901 (php-gd 'c_color' NULL pointer dereference).
|
||||
(CVE-2014-2497). (Remi)
|
||||
. Fixed bug #67730 (Null byte injection possible with imagexxx functions).
|
||||
(CVE-2014-5120) (Ryan Mauger)
|
||||
|
||||
- Network:
|
||||
. Fixed bug #67717 (segfault in dns_get_record). (CVE-2014-3597) (Remi)
|
||||
|
||||
- Milter:
|
||||
. Fixed bug #67715 (php-milter does not build and crashes randomly). (Mike)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed missing type checks in OpenSSL options (Yussuf Khalil, Stas).
|
||||
|
||||
- Readline:
|
||||
. Fixed bug #55496 (Interactive mode doesn't force a newline before the
|
||||
prompt). (Bob, Johannes)
|
||||
. Fixed bug #67496 (Save command history when exiting interactive shell
|
||||
with control-c). (Dmitry Saprykin, Johannes)
|
||||
|
||||
- Sessions:
|
||||
. Fixed missing type checks in php_session_create_id. (Yussuf Khalil, Stas).
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #67539 (ArrayIterator use-after-free due to object change during
|
||||
sorting). (CVE-2014-4698) (research at insighti dot org, Laruence)
|
||||
. Fixed bug #67538 (SPL Iterators use-after-free). (CVE-2014-4670) (Laruence)
|
||||
|
||||
- Core:
|
||||
. Fixed bug #67693 (incorrect push to the empty array) (Tjerk)
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #60616 (odbc_fetch_into returns junk data at end of multi-byte
|
||||
char fields). (Keyur)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #67839 (mysqli does not handle 4-byte floats correctly). (Keyur)
|
||||
|
||||
24 Jul 2014, PHP 5.4.31
|
||||
|
||||
- Core:
|
||||
@@ -12,6 +133,7 @@ PHP NEWS
|
||||
. Fixed bug #67151 (strtr with empty array crashes). (Nikita)
|
||||
. Fixed bug #67407 (Windows 8.1/Server 2012 R2 reported as Windows 8/Server
|
||||
2012). (Christian Wenz)
|
||||
. Implemented FR #34407 (ucwords and Title Case). (Tjerk)
|
||||
|
||||
- CLI server:
|
||||
. Implemented FR #67429 (CLI server is missing some new HTTP response codes).
|
||||
@@ -37,6 +159,10 @@ PHP NEWS
|
||||
- Streams:
|
||||
. Fixed bug #67430 (http:// wrapper doesn't follow 308 redirects). (Adam)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #66827 (Session raises E_NOTICE when session name variable is array).
|
||||
(Yasuo)
|
||||
|
||||
26 Jun 2014, PHP 5.4.30
|
||||
|
||||
- Core:
|
||||
|
||||
+8
-4
@@ -45,15 +45,16 @@ Currently we have the following branches in use::
|
||||
|
||||
master The active development branch.
|
||||
|
||||
PHP-5.6 Is used to release the PHP 5.6.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.5 Is used to release the PHP 5.5.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.4 Is used to release the PHP 5.4.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.3 Is used to release the PHP 5.3.x series. This is currently
|
||||
in extended support and open forsecurity fixes only. Triaged
|
||||
via security@php.net
|
||||
PHP-5.3 This branch is closed.
|
||||
|
||||
PHP-5.2 This branch is closed.
|
||||
|
||||
@@ -61,9 +62,12 @@ Currently we have the following branches in use::
|
||||
|
||||
PHP-4.4 This branch is closed.
|
||||
|
||||
PHP-X.Y.Z These branches are used for the release managers for tagging
|
||||
the releases, hence they are closed to the general public.
|
||||
|
||||
The next few rules are more of a technical nature::
|
||||
|
||||
1. All changes should first go to the lowest branch (i.e. 5.3) and then
|
||||
1. All changes should first go to the lowest branch (i.e. 5.4) and then
|
||||
get merged up to all other branches. If a change is not needed for
|
||||
later branches (i.e. fixes for features which where dropped from later
|
||||
branches) an empty merge should be done.
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #67985 - Last used array index not copied to new array at assignment
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = ['zero', 'one', 'two'];
|
||||
unset($a[2]);
|
||||
$b = $a;
|
||||
$a[] = 'three';
|
||||
$b[] = 'three';
|
||||
|
||||
var_dump($a === $b);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
+14
@@ -813,6 +813,20 @@ void zend_shutdown(TSRMLS_D) /* {{{ */
|
||||
zend_shutdown_timeout_thread();
|
||||
#endif
|
||||
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
|
||||
|
||||
if (EG(active))
|
||||
{
|
||||
/*
|
||||
* The order of destruction is important here.
|
||||
* See bugs #65463 and 66036.
|
||||
*/
|
||||
zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
|
||||
zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) zend_cleanup_user_class_data TSRMLS_CC);
|
||||
zend_cleanup_internal_classes(TSRMLS_C);
|
||||
zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) clean_non_persistent_function_full TSRMLS_CC);
|
||||
zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) clean_non_persistent_class_full TSRMLS_CC);
|
||||
}
|
||||
|
||||
zend_destroy_modules();
|
||||
|
||||
zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
|
||||
|
||||
@@ -639,6 +639,8 @@ ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce TSRMLS_DC);
|
||||
ZEND_API void zend_cleanup_internal_classes(TSRMLS_D);
|
||||
ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int clean_non_persistent_function_full(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC);
|
||||
|
||||
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
|
||||
ZEND_API void zend_function_dtor(zend_function *function);
|
||||
|
||||
@@ -108,7 +108,7 @@ static int clean_non_persistent_function(zend_function *function TSRMLS_DC) /* {
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ static int clean_non_persistent_class(zend_class_entry **ce TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return ((*ce)->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
|
||||
@@ -135,8 +135,9 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
}
|
||||
ALLOC_HASHTABLE_REL(tmp_ht);
|
||||
zend_hash_init(tmp_ht, zend_hash_num_elements(original_ht), NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_copy(tmp_ht, original_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
zvalue->value.ht = tmp_ht;
|
||||
zend_hash_copy(tmp_ht, original_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
tmp_ht->nNextFreeElement = original_ht->nNextFreeElement;
|
||||
}
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
|
||||
+1
-1
@@ -2800,7 +2800,7 @@ AC_DEFUN([PHP_DETECT_ICC],
|
||||
|
||||
dnl PHP_DETECT_SUNCC
|
||||
dnl Detect if the systems default compiler is suncc.
|
||||
dnl We also set some usefull CFLAGS if the user didn't set any
|
||||
dnl We also set some useful CFLAGS if the user didn't set any
|
||||
AC_DEFUN([PHP_DETECT_SUNCC],[
|
||||
SUNCC="no"
|
||||
AC_MSG_CHECKING([for suncc])
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=4
|
||||
PHP_RELEASE_VERSION=31
|
||||
PHP_RELEASE_VERSION=35
|
||||
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`
|
||||
|
||||
@@ -698,9 +698,9 @@ PHP_FUNCTION(com_event_sink)
|
||||
/* 0 => typelibname, 1 => dispname */
|
||||
zval **tmp;
|
||||
|
||||
if (zend_hash_index_find(Z_ARRVAL_P(sink), 0, (void**)&tmp) == SUCCESS)
|
||||
if (zend_hash_index_find(Z_ARRVAL_P(sink), 0, (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING)
|
||||
typelibname = Z_STRVAL_PP(tmp);
|
||||
if (zend_hash_index_find(Z_ARRVAL_P(sink), 1, (void**)&tmp) == SUCCESS)
|
||||
if (zend_hash_index_find(Z_ARRVAL_P(sink), 1, (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING)
|
||||
dispname = Z_STRVAL_PP(tmp);
|
||||
} else if (sink != NULL) {
|
||||
convert_to_string(sink);
|
||||
|
||||
@@ -198,7 +198,8 @@ PHP_FUNCTION(com_dotnet_create_instance)
|
||||
IUnknown *unk = NULL;
|
||||
|
||||
php_com_initialize(TSRMLS_C);
|
||||
if (COMG(dotnet_runtime_stuff) == NULL) {
|
||||
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
|
||||
if (stuff == NULL) {
|
||||
hr = dotnet_init(&where TSRMLS_CC);
|
||||
if (FAILED(hr)) {
|
||||
char buf[1024];
|
||||
@@ -210,9 +211,35 @@ PHP_FUNCTION(com_dotnet_create_instance)
|
||||
ZVAL_NULL(object);
|
||||
return;
|
||||
}
|
||||
}
|
||||
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
|
||||
|
||||
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
|
||||
} else if (stuff->dotnet_domain == NULL) {
|
||||
where = "ICorRuntimeHost_GetDefaultDomain";
|
||||
hr = ICorRuntimeHost_GetDefaultDomain(stuff->dotnet_host, &unk);
|
||||
if (FAILED(hr)) {
|
||||
char buf[1024];
|
||||
char *err = php_win32_error_to_msg(hr);
|
||||
snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] %s", where, err);
|
||||
if (err)
|
||||
LocalFree(err);
|
||||
php_com_throw_exception(hr, buf TSRMLS_CC);
|
||||
ZVAL_NULL(object);
|
||||
return;
|
||||
}
|
||||
|
||||
where = "QI: System._AppDomain";
|
||||
hr = IUnknown_QueryInterface(unk, &IID_mscorlib_System_AppDomain, (LPVOID*)&stuff->dotnet_domain);
|
||||
if (FAILED(hr)) {
|
||||
char buf[1024];
|
||||
char *err = php_win32_error_to_msg(hr);
|
||||
snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] %s", where, err);
|
||||
if (err)
|
||||
LocalFree(err);
|
||||
php_com_throw_exception(hr, buf TSRMLS_CC);
|
||||
ZVAL_NULL(object);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
obj = CDNO_FETCH(object);
|
||||
|
||||
|
||||
@@ -170,6 +170,12 @@ static int php_curl_option_url(php_curl *ch, const char *url, const int len TSRM
|
||||
#if LIBCURL_VERSION_NUM < 0x071100
|
||||
char *copystr = NULL;
|
||||
#endif
|
||||
|
||||
if (strlen(url) != len) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Curl option contains invalid characters (\\0)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Disable file:// if open_basedir are used */
|
||||
if (PG(open_basedir) && *PG(open_basedir)) {
|
||||
#if LIBCURL_VERSION_NUM >= 0x071304
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #68089 (NULL byte injection - cURL lib)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$url = "file:///etc/passwd\0http://google.com";
|
||||
$ch = curl_init();
|
||||
var_dump(curl_setopt($ch, CURLOPT_URL, $url));
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Warning: curl_setopt(): Curl option contains invalid characters (\0) in %s/bug68089.php on line 4
|
||||
bool(false)
|
||||
Done
|
||||
+12506
-12508
File diff suppressed because it is too large.
Load diff
@@ -966,8 +966,8 @@ mssqltime = hour12 ":" minutelz ":" secondlz [:.] [0-9]+ meridian;
|
||||
isoweekday = year4 "-"? "W" weekofyear "-"? [0-7];
|
||||
isoweek = year4 "-"? "W" weekofyear;
|
||||
exif = year4 ":" monthlz ":" daylz " " hour24lz ":" minutelz ":" secondlz;
|
||||
firstdayof = 'first day of'?;
|
||||
lastdayof = 'last day of'?;
|
||||
firstdayof = 'first day of';
|
||||
lastdayof = 'last day of';
|
||||
backof = 'back of ' hour24 space? meridian?;
|
||||
frontof = 'front of ' hour24 space? meridian?;
|
||||
|
||||
|
||||
+1500
-1439
File diff suppressed because it is too large.
Load diff
+21
-11
@@ -50,7 +50,11 @@ static inline long long php_date_llabs( long long i ) { return i >= 0 ? i : -i;
|
||||
int st = snprintf(s, len, "%lld", i); \
|
||||
s[st] = '\0'; \
|
||||
} while (0);
|
||||
#ifdef HAVE_ATOLL
|
||||
# define DATE_A64I(i, s) i = atoll(s)
|
||||
#else
|
||||
# define DATE_A64I(i, s) i = strtoll(s, NULL, 10)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* {{{ arginfo */
|
||||
@@ -2394,11 +2398,7 @@ static void date_object_free_storage_period(void *object TSRMLS_DC)
|
||||
/* Advanced Interface */
|
||||
PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC)
|
||||
{
|
||||
Z_TYPE_P(object) = IS_OBJECT;
|
||||
object_init_ex(object, pce);
|
||||
Z_SET_REFCOUNT_P(object, 1);
|
||||
Z_UNSET_ISREF_P(object);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -2506,14 +2506,19 @@ PHP_FUNCTION(date_create)
|
||||
zval *timezone_object = NULL;
|
||||
char *time_str = NULL;
|
||||
int time_str_len = 0;
|
||||
zval datetime_object;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
|
||||
if (!php_date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
|
||||
php_date_instantiate(date_ce_date, &datetime_object TSRMLS_CC);
|
||||
if (!php_date_initialize(zend_object_store_get_object(&datetime_object TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
|
||||
zval_dtor(&datetime_object);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
zval *datetime_object_ptr = &datetime_object;
|
||||
RETVAL_ZVAL(datetime_object_ptr, 0, 0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2526,14 +2531,19 @@ PHP_FUNCTION(date_create_from_format)
|
||||
zval *timezone_object = NULL;
|
||||
char *time_str = NULL, *format_str = NULL;
|
||||
int time_str_len = 0, format_str_len = 0;
|
||||
zval datetime_object;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
|
||||
if (!php_date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
|
||||
php_date_instantiate(date_ce_date, &datetime_object TSRMLS_CC);
|
||||
if (!php_date_initialize(zend_object_store_get_object(&datetime_object TSRMLS_CC), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
|
||||
zval_dtor(&datetime_object);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
zval *datetime_object_ptr = &datetime_object;
|
||||
RETVAL_ZVAL(datetime_object_ptr, 0, 0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2556,7 +2566,7 @@ PHP_METHOD(DateTime, __construct)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dateobj, HashTable *myht TSRMLS_DC)
|
||||
static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht TSRMLS_DC)
|
||||
{
|
||||
zval **z_date = NULL;
|
||||
zval **z_timezone = NULL;
|
||||
@@ -2626,7 +2636,7 @@ PHP_METHOD(DateTime, __set_state)
|
||||
|
||||
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
|
||||
dateobj = (php_date_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
if (!php_date_initialize_from_hash(&return_value, &dateobj, myht TSRMLS_CC)) {
|
||||
if (!php_date_initialize_from_hash(&dateobj, myht TSRMLS_CC)) {
|
||||
php_error(E_ERROR, "Invalid serialization data for DateTime object");
|
||||
}
|
||||
}
|
||||
@@ -2644,7 +2654,7 @@ PHP_METHOD(DateTime, __wakeup)
|
||||
|
||||
myht = Z_OBJPROP_P(object);
|
||||
|
||||
if (!php_date_initialize_from_hash(&return_value, &dateobj, myht TSRMLS_CC)) {
|
||||
if (!php_date_initialize_from_hash(&dateobj, myht TSRMLS_CC)) {
|
||||
php_error(E_ERROR, "Invalid serialization data for DateTime object");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,18 +95,18 @@ result = Monday 2037-10-05 00:00:00 NZDT
|
||||
wanted = Monday 00:00:00
|
||||
|
||||
Australia/Adelaide
|
||||
ts = Friday 1971-01-01 17:17:17 CST
|
||||
result = Monday 1971-01-04 00:00:00 CST
|
||||
ts = Friday 1971-01-01 17:17:17 ACST
|
||||
result = Monday 1971-01-04 00:00:00 ACST
|
||||
wanted = Monday 00:00:00
|
||||
|
||||
Australia/Darwin
|
||||
ts = Monday 1971-03-29 17:17:17 CST
|
||||
result = Monday 1971-04-05 00:00:00 CST
|
||||
ts = Monday 1971-03-29 17:17:17 ACST
|
||||
result = Monday 1971-04-05 00:00:00 ACST
|
||||
wanted = Monday 00:00:00
|
||||
|
||||
Australia/Perth
|
||||
ts = Friday 1971-01-01 17:17:17 WST
|
||||
result = Monday 1971-01-04 00:00:00 WST
|
||||
ts = Friday 1971-01-01 17:17:17 AWST
|
||||
result = Monday 1971-01-04 00:00:00 AWST
|
||||
wanted = Monday 00:00:00
|
||||
|
||||
America/Aruba
|
||||
|
||||
@@ -233,8 +233,8 @@ result=Saturday 1970-01-03 00:00:00 CAT 0
|
||||
wanted=Saturday 00:00:00
|
||||
|
||||
TZ=Asia/Kashgar - Is it OK for this to be 3 AM? yes
|
||||
tStamp=Thursday 1980-04-24 17:17:17 KAST 0
|
||||
result=Thursday 1980-05-01 03:00:00 CST 0
|
||||
tStamp=Thursday 1980-04-24 17:17:17 XJT 0
|
||||
result=Thursday 1980-05-01 00:00:00 XJT 0
|
||||
wanted=Thursday 03:00:00
|
||||
|
||||
TZ=Indian/Christmas - Is it OK for this to be 7 AM? Note: does
|
||||
|
||||
@@ -39,5 +39,5 @@ datestr 10:00:00 AM July 1 2005 UTC
|
||||
|
||||
Setting TZ
|
||||
input 10:00:00 AM July 1 2005
|
||||
strftime 10:00:00 AM July 1 2005 EST +1000
|
||||
datestr 10:00:00 AM July 1 2005 EST
|
||||
strftime 10:00:00 AM July 1 2005 AEST +1000
|
||||
datestr 10:00:00 AM July 1 2005 AEST
|
||||
@@ -44,7 +44,7 @@ array(4) {
|
||||
|
||||
string(6) "Y-m-d+"
|
||||
string(19) "2001-11-29 13:20:01"
|
||||
object(DateTime)#2 (3) {
|
||||
object(DateTime)#%d (3) {
|
||||
["date"]=>
|
||||
string(26) "2001-11-29 %d:%d:%d.%d"
|
||||
["timezone_type"]=>
|
||||
@@ -70,7 +70,7 @@ array(4) {
|
||||
|
||||
string(7) "Y-m-d +"
|
||||
string(19) "2001-11-29 13:20:01"
|
||||
object(DateTime)#3 (3) {
|
||||
object(DateTime)#%d (3) {
|
||||
["date"]=>
|
||||
string(26) "2001-11-29 %d:%d:%d.%d"
|
||||
["timezone_type"]=>
|
||||
@@ -96,7 +96,7 @@ array(4) {
|
||||
|
||||
string(6) "Y-m-d+"
|
||||
string(10) "2001-11-29"
|
||||
object(DateTime)#2 (3) {
|
||||
object(DateTime)#%d (3) {
|
||||
["date"]=>
|
||||
string(26) "2001-11-29 %d:%d:%d.%d"
|
||||
["timezone_type"]=>
|
||||
@@ -139,7 +139,7 @@ array(4) {
|
||||
|
||||
string(7) "Y-m-d +"
|
||||
string(11) "2001-11-29 "
|
||||
object(DateTime)#2 (3) {
|
||||
object(DateTime)#%d (3) {
|
||||
["date"]=>
|
||||
string(26) "2001-11-29 %d:%d:%d.%d"
|
||||
["timezone_type"]=>
|
||||
|
||||
+1
-1
@@ -518,7 +518,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp TSRMLS_DC
|
||||
value = null_value;
|
||||
} else if (Z_TYPE_P(value) == IS_OBJECT) {
|
||||
/* these are zvalues create on demand, with refcount and is_ref
|
||||
* status left in an uninitalized stated */
|
||||
* status left in an uninitialized stated */
|
||||
zval_dtor(value);
|
||||
efree(value);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Test eregi() function : basic functionality - confirm case insensitivity
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test basic funtionality of eregi()
|
||||
* Test basic functionality of eregi()
|
||||
*/
|
||||
|
||||
echo "*** Testing eregi() : basic functionality ***\n";
|
||||
|
||||
+2
-2
@@ -2426,11 +2426,11 @@ static void* exif_ifd_make_value(image_info_data *info_data, int motorola_intel
|
||||
data_ptr += 8;
|
||||
break;
|
||||
case TAG_FMT_SINGLE:
|
||||
memmove(data_ptr, &info_data->value.f, byte_count);
|
||||
memmove(data_ptr, &info_value->f, 4);
|
||||
data_ptr += 4;
|
||||
break;
|
||||
case TAG_FMT_DOUBLE:
|
||||
memmove(data_ptr, &info_data->value.d, byte_count);
|
||||
memmove(data_ptr, &info_value->d, 8);
|
||||
data_ptr += 8;
|
||||
break;
|
||||
}
|
||||
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 368 B |
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #68113 (Heap corruption in exif_thumbnail())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("exif") or die("skip need exif");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(exif_thumbnail(__DIR__."/bug68113.jpg"));
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Warning: exif_thumbnail(bug68113.jpg): File structure corrupted in %s/bug68113.php on line 2
|
||||
|
||||
Warning: exif_thumbnail(bug68113.jpg): Invalid JPEG file in %s/bug68113.php on line 2
|
||||
bool(false)
|
||||
Done
|
||||
@@ -115198,7 +115198,7 @@ const unsigned char php_magic_database[2606480] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x40, 0x00, 0x3D, 0x1B, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x5E, 0x5C, 0x73, 0x7B, 0x30, 0x2C, 0x31, 0x30, 0x30, 0x7D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x5C,
|
||||
0x73, 0x7B, 0x30, 0x2C, 0x31, 0x30, 0x30, 0x7D, 0x5B, 0x7B, 0x5D, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
@@ -1269,7 +1269,7 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
|
||||
* the sign extension must have happened.
|
||||
*/
|
||||
case FILE_BYTE:
|
||||
v = (char) v;
|
||||
v = (signed char) v;
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
case FILE_BESHORT:
|
||||
|
||||
@@ -820,7 +820,7 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
|
||||
q = (const uint8_t *)(const void *)
|
||||
((const char *)(const void *)p + ofs
|
||||
- 2 * sizeof(uint32_t));
|
||||
if (q > e) {
|
||||
if (q < p || q > e) {
|
||||
DPRINTF(("Ran of the end %p > %p\n", q, e));
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -372,6 +372,13 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
|
||||
uint32_t namesz, descsz;
|
||||
unsigned char *nbuf = CAST(unsigned char *, vbuf);
|
||||
|
||||
if (xnh_sizeof + offset > size) {
|
||||
/*
|
||||
* We're out of note headers.
|
||||
*/
|
||||
return xnh_sizeof + offset;
|
||||
}
|
||||
|
||||
(void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
|
||||
offset += xnh_sizeof;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ private int32_t mprint(struct magic_set *, struct magic *);
|
||||
private int32_t moffset(struct magic_set *, struct magic *);
|
||||
private void mdebug(uint32_t, const char *, size_t);
|
||||
private int mcopy(struct magic_set *, union VALUETYPE *, int, int,
|
||||
const unsigned char *, uint32_t, size_t, size_t);
|
||||
const unsigned char *, uint32_t, size_t, struct magic *);
|
||||
private int mconvert(struct magic_set *, struct magic *, int);
|
||||
private int print_sep(struct magic_set *, int);
|
||||
private int handle_annotation(struct magic_set *, struct magic *);
|
||||
@@ -1003,7 +1003,7 @@ mdebug(uint32_t offset, const char *str, size_t len)
|
||||
|
||||
private int
|
||||
mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
|
||||
const unsigned char *s, uint32_t offset, size_t nbytes, size_t linecnt)
|
||||
const unsigned char *s, uint32_t offset, size_t nbytes, struct magic *m)
|
||||
{
|
||||
/*
|
||||
* Note: FILE_SEARCH and FILE_REGEX do not actually copy
|
||||
@@ -1023,15 +1023,24 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
|
||||
const char *last; /* end of search region */
|
||||
const char *buf; /* start of search region */
|
||||
const char *end;
|
||||
size_t lines;
|
||||
size_t lines, linecnt, bytecnt;
|
||||
|
||||
linecnt = m->str_range;
|
||||
bytecnt = linecnt * 80;
|
||||
|
||||
if (bytecnt == 0) {
|
||||
bytecnt = 8192;
|
||||
}
|
||||
if (bytecnt > nbytes) {
|
||||
bytecnt = nbytes;
|
||||
}
|
||||
if (s == NULL) {
|
||||
ms->search.s_len = 0;
|
||||
ms->search.s = NULL;
|
||||
return 0;
|
||||
}
|
||||
buf = RCAST(const char *, s) + offset;
|
||||
end = last = RCAST(const char *, s) + nbytes;
|
||||
end = last = RCAST(const char *, s) + bytecnt;
|
||||
/* mget() guarantees buf <= last */
|
||||
for (lines = linecnt, b = buf; lines && b < end &&
|
||||
((b = CAST(const char *,
|
||||
@@ -1044,7 +1053,7 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
|
||||
b++;
|
||||
}
|
||||
if (lines)
|
||||
last = RCAST(const char *, s) + nbytes;
|
||||
last = RCAST(const char *, s) + bytecnt;
|
||||
|
||||
ms->search.s = buf;
|
||||
ms->search.s_len = last - buf;
|
||||
@@ -1118,7 +1127,6 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
int *need_separator, int *returnval)
|
||||
{
|
||||
uint32_t soffset, offset = ms->offset;
|
||||
uint32_t count = m->str_range;
|
||||
int rv, oneed_separator;
|
||||
char *sbuf, *rbuf;
|
||||
union VALUETYPE *p = &ms->ms_value;
|
||||
@@ -1130,13 +1138,12 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
}
|
||||
|
||||
if (mcopy(ms, p, m->type, m->flag & INDIR, s, (uint32_t)(offset + o),
|
||||
(uint32_t)nbytes, count) == -1)
|
||||
(uint32_t)nbytes, m) == -1)
|
||||
return -1;
|
||||
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0) {
|
||||
fprintf(stderr, "mget(type=%d, flag=%x, offset=%u, o=%zu, "
|
||||
"nbytes=%zu, count=%u)\n", m->type, m->flag, offset, o,
|
||||
nbytes, count);
|
||||
"nbytes=%zu)\n", m->type, m->flag, offset, o, nbytes);
|
||||
mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE));
|
||||
}
|
||||
|
||||
@@ -1627,7 +1634,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
fprintf(stderr, "indirect +offs=%u\n", offset);
|
||||
}
|
||||
if (mcopy(ms, p, m->type, 0, s, offset, nbytes, count) == -1)
|
||||
if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1)
|
||||
return -1;
|
||||
ms->offset = offset;
|
||||
|
||||
@@ -2057,7 +2064,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
|
||||
zval *retval;
|
||||
zval *subpats;
|
||||
char *haystack;
|
||||
|
||||
|
||||
MAKE_STD_ZVAL(retval);
|
||||
ALLOC_INIT_ZVAL(subpats);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Patches applied to file sources tree before generating magic.mgc
|
||||
Patches applied to file 5.14 sources tree before generating magic.mgc
|
||||
and before running create_data_file.php to create data_file.c.
|
||||
|
||||
|
||||
@@ -17,14 +17,6 @@ diff --git a/magic/Magdir/commands b/magic/Magdir/commands
|
||||
index 67c3eee..4a7d8dd 100644
|
||||
--- a/magic/Magdir/commands
|
||||
+++ b/magic/Magdir/commands
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
-# $File: commands,v 1.44 2013/02/05 15:20:47 christos Exp $
|
||||
+# $File: commands,v 1.45 2013/02/06 14:18:52 christos Exp $
|
||||
# commands: file(1) magic for various shells and interpreters
|
||||
#
|
||||
#0 string/w : shell archive or script for antique kernel text
|
||||
@@ -49,7 +49,7 @@
|
||||
!:mime text/x-awk
|
||||
0 string/wt #!\ /usr/bin/awk awk script text executable
|
||||
@@ -36,4 +28,56 @@ index 67c3eee..4a7d8dd 100644
|
||||
0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable
|
||||
--
|
||||
1.8.5.5
|
||||
From 0b478f445b6b7540b58af5d1fe583fa9e48fd745 Mon Sep 17 00:00:00 2001
|
||||
From: Christos Zoulas <christos@zoulas.com>
|
||||
Date: Wed, 28 May 2014 19:52:36 +0000
|
||||
Subject: [PATCH] further optimize awk by not looking for the BEGIN regex until
|
||||
we found the BEGIN (Jan Kaluza)
|
||||
|
||||
---
|
||||
magic/Magdir/commands | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/magic/Magdir/commands b/magic/Magdir/commands
|
||||
index bfffdef..26b2869 100644
|
||||
--- a/magic/Magdir/commands
|
||||
+++ b/magic/Magdir/commands
|
||||
@@ -49,7 +49,8 @@
|
||||
!:mime text/x-awk
|
||||
0 string/wt #!\ /usr/bin/awk awk script text executable
|
||||
!:mime text/x-awk
|
||||
-0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text
|
||||
+0 search/16384 BEGIN
|
||||
+>0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text
|
||||
|
||||
# AT&T Bell Labs' Plan 9 shell
|
||||
0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable
|
||||
--
|
||||
2.0.3
|
||||
|
||||
From 71a8b6c0d758acb0f73e2e51421a711b5e9d6668 Mon Sep 17 00:00:00 2001
|
||||
From: Christos Zoulas <christos@zoulas.com>
|
||||
Date: Fri, 30 May 2014 16:48:44 +0000
|
||||
Subject: [PATCH] Limit regex search for BEGIN to the first 4K of the file.
|
||||
|
||||
---
|
||||
magic/Magdir/commands | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/magic/Magdir/commands b/magic/Magdir/commands
|
||||
index 26b2869..bcd0f43 100644
|
||||
--- a/magic/Magdir/commands
|
||||
+++ b/magic/Magdir/commands
|
||||
@@ -49,8 +49,7 @@
|
||||
!:mime text/x-awk
|
||||
0 string/wt #!\ /usr/bin/awk awk script text executable
|
||||
!:mime text/x-awk
|
||||
-0 search/16384 BEGIN
|
||||
->0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text
|
||||
+0 regex/4096 =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text
|
||||
|
||||
# AT&T Bell Labs' Plan 9 shell
|
||||
0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable
|
||||
--
|
||||
2.0.3
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
Bug #66731: file: extensive backtraking
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!class_exists('finfo'))
|
||||
die('skip no fileinfo extension');
|
||||
--FILE--
|
||||
<?php
|
||||
$fd = __DIR__.'/cve-2014-3538.data';
|
||||
|
||||
file_put_contents($fd,
|
||||
'try:' .
|
||||
str_repeat("\n", 1000000));
|
||||
|
||||
$fi = finfo_open(FILEINFO_NONE);
|
||||
$t = microtime(true);
|
||||
var_dump(finfo_file($fi, $fd));
|
||||
$t = microtime(true) - $t;
|
||||
finfo_close($fi);
|
||||
if ($t < 1) {
|
||||
echo "Ok\n";
|
||||
} else {
|
||||
printf("Failed, time=%.2f\n", $t);
|
||||
}
|
||||
|
||||
?>
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__.'/cve-2014-3538.data');
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "%s"
|
||||
Ok
|
||||
Done
|
||||
@@ -124,6 +124,11 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else if (Z_TYPE_P(to_zval) == IS_STRING) {
|
||||
if (CHECK_ZVAL_NULL_PATH(to_zval)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 2nd parameter, filename must not contain null bytes");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
stream = php_stream_open_wrapper(Z_STRVAL_P(to_zval), "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
|
||||
if (stream == NULL) {
|
||||
RETURN_FALSE;
|
||||
|
||||
+4
-2
@@ -370,9 +370,10 @@ static void *fontFetch (char **error, void *key)
|
||||
fontlist = gdEstrdup(a->fontlist);
|
||||
|
||||
/*
|
||||
* Must use gd_strtok_r else pointer corrupted by strtok in nested loop.
|
||||
* Must use gd_strtok_r becasuse strtok() isn't thread safe
|
||||
*/
|
||||
for (name = gd_strtok_r (fontlist, LISTSEPARATOR, &strtok_ptr); name; name = gd_strtok_r (0, LISTSEPARATOR, &strtok_ptr)) {
|
||||
char *strtok_ptr_path;
|
||||
/* make a fresh copy each time - strtok corrupts it. */
|
||||
path = gdEstrdup (fontsearchpath);
|
||||
|
||||
@@ -388,7 +389,8 @@ static void *fontFetch (char **error, void *key)
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (dir = strtok (path, PATHSEPARATOR); dir; dir = strtok (0, PATHSEPARATOR)) {
|
||||
for (dir = gd_strtok_r (path, PATHSEPARATOR, &strtok_ptr_path); dir;
|
||||
dir = gd_strtok_r (0, PATHSEPARATOR, &strtok_ptr_path)) {
|
||||
if (!strcmp(dir, ".")) {
|
||||
TSRMLS_FETCH();
|
||||
#if HAVE_GETCWD
|
||||
|
||||
@@ -31,12 +31,17 @@ gdImagePtr gdImageCreateFromXpm (char *filename)
|
||||
if (ret != XpmSuccess) {
|
||||
return 0;
|
||||
}
|
||||
number = image.ncolors;
|
||||
for(i = 0; i < number; i++) {
|
||||
if (!image.colorTable[i].c_color) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(im = gdImageCreate(image.width, image.height))) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
number = image.ncolors;
|
||||
colors = (int *) safe_emalloc(number, sizeof(int), 0);
|
||||
for (i = 0; i < number; i++) {
|
||||
switch (strlen (image.colorTable[i].c_color)) {
|
||||
|
||||
@@ -20,6 +20,6 @@ echo '(' . $bbox[6] . ', ' . $bbox[7] . ")\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
(-1, 15)
|
||||
(156, 15)
|
||||
(156, -48)
|
||||
(15%d, 15)
|
||||
(15%d, -48)
|
||||
(-1, -48)
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagegd2
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagegd2 TEST\n";
|
||||
imagegd2($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagegd2 TEST
|
||||
|
||||
Warning: imagegd2() expects parameter 2 to be a valid path, string given in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagegd
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagegd TEST\n";
|
||||
imagegd($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagegd TEST
|
||||
|
||||
Warning: imagegd() expects parameter 2 to be a valid path, string given in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagegif
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['GIF Create Support']) || $support['GIF Create Support'] === false) {
|
||||
print 'skip gif support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagegif TEST\n";
|
||||
imagegif($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagegif TEST
|
||||
|
||||
Warning: imagegif(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagejpeg
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['JPEG Support']) || $support['JPEG Support'] === false) {
|
||||
print 'skip jpeg support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagejpeg TEST\n";
|
||||
imagejpeg($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagejpeg TEST
|
||||
|
||||
Warning: imagejpeg(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagepng
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['PNG Support']) || $support['PNG Support'] === false) {
|
||||
print 'skip png support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagepng TEST\n";
|
||||
imagepng($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagepng TEST
|
||||
|
||||
Warning: imagepng(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagewbmp
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['WBMP Support']) || $support['WBMP Support'] === false) {
|
||||
print 'skip wbmp support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagewbmp TEST\n";
|
||||
imagewbmp($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagewbmp TEST
|
||||
|
||||
Warning: imagewbmp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagewebp
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['WEBP Support']) || $support['WEBP Support'] === false) {
|
||||
print 'skip webp support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagewebp TEST\n";
|
||||
imagewebp($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagewbmp TEST
|
||||
|
||||
Warning: imagewebp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -324,30 +324,6 @@ static void _php_gmpnum_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
# define MAX_BASE 36
|
||||
#endif
|
||||
|
||||
/* {{{ gmp_emalloc
|
||||
*/
|
||||
static void *gmp_emalloc(size_t size)
|
||||
{
|
||||
return emalloc(size);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ gmp_erealloc
|
||||
*/
|
||||
static void *gmp_erealloc(void *ptr, size_t old_size, size_t new_size)
|
||||
{
|
||||
return erealloc(ptr, new_size);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ gmp_efree
|
||||
*/
|
||||
static void gmp_efree(void *ptr, size_t size)
|
||||
{
|
||||
efree(ptr);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ ZEND_GINIT_FUNCTION
|
||||
*/
|
||||
static ZEND_GINIT_FUNCTION(gmp)
|
||||
@@ -369,8 +345,6 @@ ZEND_MODULE_STARTUP_D(gmp)
|
||||
#endif
|
||||
REGISTER_STRING_CONSTANT("GMP_VERSION", (char *)gmp_version, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
mp_set_memory_functions(gmp_emalloc, gmp_erealloc, gmp_efree);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+1
-1
@@ -368,7 +368,7 @@ static int json_utf8_to_utf16(unsigned short *utf16, char utf8[], int len) /* {{
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Only check if utf8 string is valid, and compute utf16 lenght */
|
||||
/* Only check if utf8 string is valid, and compute utf16 length */
|
||||
for (j=0 ; pos < len ; j++) {
|
||||
us = php_next_utf8_char((const unsigned char *)utf8, len, &pos, &status);
|
||||
if (status != SUCCESS) {
|
||||
|
||||
+21
-2
@@ -385,6 +385,23 @@ static int _get_lderrno(LDAP *ldap)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ _set_lderrno
|
||||
*/
|
||||
static void _set_lderrno(LDAP *ldap, int lderr)
|
||||
{
|
||||
#if !HAVE_NSLDAP
|
||||
#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP
|
||||
/* New versions of OpenLDAP do it this way */
|
||||
ldap_set_option(ldap, LDAP_OPT_ERROR_NUMBER, &lderr);
|
||||
#else
|
||||
ldap->ld_errno = lderr;
|
||||
#endif
|
||||
#else
|
||||
ldap_set_lderrno(ldap, lderr, NULL, NULL);
|
||||
#endif
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool ldap_bind(resource link [, string dn [, string password]])
|
||||
Bind to LDAP directory */
|
||||
PHP_FUNCTION(ldap_bind)
|
||||
@@ -399,18 +416,20 @@ PHP_FUNCTION(ldap_bind)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
|
||||
|
||||
if (ldap_bind_dn != NULL && memchr(ldap_bind_dn, '\0', ldap_bind_dnlen) != NULL) {
|
||||
_set_lderrno(ld->link, LDAP_INVALID_CREDENTIALS);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "DN contains a null byte");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (ldap_bind_pw != NULL && memchr(ldap_bind_pw, '\0', ldap_bind_pwlen) != NULL) {
|
||||
_set_lderrno(ld->link, LDAP_INVALID_CREDENTIALS);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Password contains a null byte");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
|
||||
|
||||
if ((rc = ldap_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw, LDAP_AUTH_SIMPLE)) != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to bind to server: %s", ldap_err2string(rc));
|
||||
RETURN_FALSE;
|
||||
|
||||
@@ -260,7 +260,7 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i
|
||||
goto out;
|
||||
}
|
||||
|
||||
num = n; /* make sure to process initilized vars only */
|
||||
num = n; /* make sure to process initialized vars only */
|
||||
|
||||
/* initialize converter */
|
||||
if (info->num_from_encodings <= 0) {
|
||||
|
||||
@@ -62,18 +62,18 @@ mysqli_close($link);
|
||||
--EXPECT--
|
||||
array(7) {
|
||||
[0]=>
|
||||
float(3.14159274101)
|
||||
float(3.141593)
|
||||
[1]=>
|
||||
float(-9.99999997475E-7)
|
||||
float(-1.0E-6)
|
||||
[2]=>
|
||||
float(0)
|
||||
[3]=>
|
||||
float(999999995904)
|
||||
float(1.0E+12)
|
||||
[4]=>
|
||||
float(0.564642488956)
|
||||
float(0.5646425)
|
||||
[5]=>
|
||||
float(1)
|
||||
[6]=>
|
||||
float(8.88888914608E+14)
|
||||
float(8.888889E+14)
|
||||
}
|
||||
done!
|
||||
done!
|
||||
@@ -67,7 +67,7 @@ array(8) {
|
||||
[3]=>
|
||||
int(4999999)
|
||||
[4]=>
|
||||
float(2345.60009766)
|
||||
float(2345.6)
|
||||
[5]=>
|
||||
float(5678.89563)
|
||||
[6]=>
|
||||
@@ -75,4 +75,4 @@ array(8) {
|
||||
[7]=>
|
||||
%unicode|string%(11) "mysql rulez"
|
||||
}
|
||||
done!
|
||||
done!
|
||||
@@ -66,7 +66,7 @@ array(8) {
|
||||
[3]=>
|
||||
int(54)
|
||||
[4]=>
|
||||
float(2.59999990463)
|
||||
float(2.6)
|
||||
[5]=>
|
||||
float(58.89)
|
||||
[6]=>
|
||||
@@ -74,4 +74,4 @@ array(8) {
|
||||
[7]=>
|
||||
%unicode|string%(3) "6.7"
|
||||
}
|
||||
done!
|
||||
done!
|
||||
@@ -12,6 +12,9 @@ require_once('skipifconnectfailure.inc');
|
||||
/*** test mysqli_connect 127.0.0.1 ***/
|
||||
$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
|
||||
if (!mysqli_query($mysql, "SET sql_mode=''"))
|
||||
printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql));
|
||||
|
||||
$mysql->query("DROP TABLE IF EXISTS test_warnings");
|
||||
|
||||
$mysql->query("CREATE TABLE test_warnings (a int not null) ENGINE=myisam");
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
--TEST--
|
||||
mysqli_float_handling - ensure 4 byte float is handled correctly
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifemb.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require('connect.inc');
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
|
||||
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
die();
|
||||
}
|
||||
|
||||
if (!mysqli_query($link, "CREATE TABLE test(id INT PRIMARY KEY, fp4 FLOAT, fp8 DOUBLE) ENGINE = InnoDB")) {
|
||||
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
die();
|
||||
}
|
||||
|
||||
// Insert via string to make sure the real floating number gets to the DB
|
||||
if (!mysqli_query($link, "INSERT INTO test(id, fp4, fp8) VALUES (1, 9.9999, 9.9999)")) {
|
||||
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
die();
|
||||
}
|
||||
|
||||
if (!($stmt = mysqli_prepare($link, "SELECT id, fp4, fp8 FROM test"))) {
|
||||
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
die();
|
||||
}
|
||||
|
||||
if (!mysqli_stmt_execute($stmt)) {
|
||||
printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
if (!($result = mysqli_stmt_get_result($stmt))) {
|
||||
printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
die();
|
||||
}
|
||||
|
||||
$data = mysqli_fetch_assoc($result);
|
||||
print $data['id'] . ": " . $data['fp4'] . ": " . $data['fp8'] . "\n";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once("clean_table.inc");
|
||||
?>
|
||||
--EXPECTF--
|
||||
1: 9.9999: 9.9999
|
||||
@@ -41,6 +41,11 @@ require_once('skipifconnectfailure.inc');
|
||||
if (false !== ($tmp = mysqli_change_user($link, $user, $passwd, $db . '_unknown_really')))
|
||||
printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
// Reconnect because after 3 failed change_user attempts, the server blocks you off.
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
|
||||
if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
|
||||
printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
@@ -109,4 +114,4 @@ require_once('skipifconnectfailure.inc');
|
||||
print "done!";
|
||||
?>
|
||||
--EXPECTF--
|
||||
done!
|
||||
done!
|
||||
@@ -43,6 +43,11 @@ if (!$IS_MYSQLND && (mysqli_get_server_version($link) < 50118 && mysqli_get_serv
|
||||
if (false !== ($tmp = $mysqli->change_user($user, $passwd, $db . '_unknown_really')))
|
||||
printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
// Reconnect because after 3 failed change_user attempts, the server blocks you off.
|
||||
if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
|
||||
if (!$mysqli->query('SET @mysqli_change_user_test_var=1'))
|
||||
printf("[009] Failed to set test variable: [%d] %s\n", $mysqli->errno, $mysqli->error);
|
||||
|
||||
@@ -81,4 +86,4 @@ if (!$IS_MYSQLND && (mysqli_get_server_version($link) < 50118 && mysqli_get_serv
|
||||
print "done!";
|
||||
?>
|
||||
--EXPECTF--
|
||||
done!
|
||||
done!
|
||||
@@ -36,7 +36,7 @@ $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
|
||||
mysqli_error($link));
|
||||
}
|
||||
|
||||
if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
|
||||
if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(3), PRIMARY
|
||||
KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=gbk")) {
|
||||
printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
|
||||
mysqli_error($link));
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
--TEST--
|
||||
Multiple result set with PS
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once("connect.inc");
|
||||
if (!$IS_MYSQLND) {
|
||||
die("skip mysqlnd only test");
|
||||
}
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
require('table.inc');
|
||||
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
if (!$link->query('DROP PROCEDURE IF EXISTS p123')) {
|
||||
printf("[001] [%d] %s\n", $link->error, $link->errno);
|
||||
}
|
||||
|
||||
if (!$link->query("CREATE PROCEDURE p123() BEGIN SELECT id+12, CONCAT_WS('-',label,'ahoi') FROM test ORDER BY id LIMIT 1; SELECT id + 42, CONCAT_WS('---',label, label) FROM test ORDER BY id LIMIT 1; END")) {
|
||||
printf("[002] [%d] %s\n", $link->error, $link->errno);
|
||||
}
|
||||
|
||||
if (!($stmt = $link->prepare("CALL p123"))) {
|
||||
printf("[003] [%d] %s\n", $stmt->error, $stmt->errno);
|
||||
}
|
||||
|
||||
if (!$stmt->execute()) {
|
||||
printf("[005] [%d] %s\n", $stmt->error, $stmt->errno);
|
||||
}
|
||||
|
||||
$c_id = NULL;
|
||||
$c_label = NULL;
|
||||
if (!$stmt->bind_result($c_id, $c_label)) {
|
||||
printf("[004] [%d] %s\n", $stmt->error, $stmt->errno);
|
||||
}
|
||||
var_dump("pre:",$c_id, $c_label);
|
||||
|
||||
if (!$stmt->fetch()) {
|
||||
printf("[006] [%d] %s\n", $stmt->error, $stmt->errno);
|
||||
}
|
||||
|
||||
var_dump("post:",$c_id, $c_label);
|
||||
|
||||
if ($stmt->fetch()) {
|
||||
printf("[007] Shouldn't have fetched anything\n");
|
||||
var_dump($c_id, $c_label);
|
||||
}
|
||||
|
||||
if ($stmt->fetch()) {
|
||||
printf("[008] No more rows expected\n");
|
||||
}
|
||||
|
||||
if (!$stmt->more_results()) {
|
||||
printf("[009] Expected more results\n");
|
||||
} else {
|
||||
var_dump("[009] next_result:", $stmt->next_result());
|
||||
}
|
||||
|
||||
if (!$stmt->bind_result($c_id, $c_label)) {
|
||||
printf("[010] [%d] %s\n", $stmt->error, $stmt->errno);
|
||||
}
|
||||
var_dump("pre:",$c_id, $c_label);
|
||||
|
||||
if (!$stmt->fetch()) {
|
||||
printf("[011] [%d] %s\n", $stmt->error, $stmt->errno);
|
||||
}
|
||||
|
||||
var_dump("post:",$c_id, $c_label);
|
||||
|
||||
if ($stmt->fetch()) {
|
||||
printf("[012] No more rows expected\n");
|
||||
}
|
||||
|
||||
if (!$stmt->more_results()) {
|
||||
printf("[013] Expected more results\n");
|
||||
} else {
|
||||
var_dump("[013] next_result:", $stmt->next_result());
|
||||
}
|
||||
|
||||
if ($stmt->more_results()) {
|
||||
printf("[014] No more results expected\n");
|
||||
} else {
|
||||
printf("[014] No result, as expected\n");
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
$link->close();
|
||||
|
||||
|
||||
echo "done";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
if (!$link->query('DROP PROCEDURE IF EXISTS p123')) {
|
||||
printf("[001] [%d] %s\n", $link->error, $link->errno);
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(4) "pre:"
|
||||
NULL
|
||||
NULL
|
||||
string(5) "post:"
|
||||
int(13)
|
||||
string(6) "a-ahoi"
|
||||
string(18) "[009] next_result:"
|
||||
bool(true)
|
||||
string(4) "pre:"
|
||||
int(13)
|
||||
string(6) "a-ahoi"
|
||||
string(5) "post:"
|
||||
int(43)
|
||||
string(5) "a---a"
|
||||
string(18) "[013] next_result:"
|
||||
bool(true)
|
||||
[014] No result, as expected
|
||||
done
|
||||
@@ -12,6 +12,11 @@ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!mysqli_query($link, 'SET SESSION sql_mode=\'\'')) {
|
||||
printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) {
|
||||
printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
exit(1);
|
||||
@@ -20,4 +25,4 @@ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(i
|
||||
if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')")) {
|
||||
printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
?>
|
||||
?>
|
||||
@@ -51,3 +51,29 @@ if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes" || test "$
|
||||
#endif
|
||||
])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Check if the compiler supports Decimal32/64/128 types from the IEEE-754 2008 version
|
||||
dnl References: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1657.pdf
|
||||
dnl http://speleotrove.com/decimal/
|
||||
dnl
|
||||
AC_CACHE_CHECK([whether whether compiler supports Decimal32/64/128 types], ac_cv_decimal_fp_supported,[
|
||||
AC_TRY_RUN( [
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
typedef float dec32 __attribute__((mode(SD)));
|
||||
dec32 k = 99.49f;
|
||||
double d2 = (double)k;
|
||||
return 0;
|
||||
}
|
||||
],[
|
||||
ac_cv_decimal_fp_supported=yes
|
||||
],[
|
||||
ac_cv_decimal_fp_supported=no
|
||||
],[
|
||||
ac_cv_decimal_fp_supported=no
|
||||
])])
|
||||
if test "$ac_cv_decimal_fp_supported" = "yes"; then
|
||||
AC_DEFINE(HAVE_DECIMAL_FP_SUPPORT, 1, [Define if the compiler supports Decimal32/64/128 types.])
|
||||
fi
|
||||
+34
-17
@@ -50,6 +50,7 @@ enum_func_status mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES *result, void *param,
|
||||
static void mysqlnd_stmt_separate_result_bind(MYSQLND_STMT * const stmt TSRMLS_DC);
|
||||
static void mysqlnd_stmt_separate_one_result_bind(MYSQLND_STMT * const stmt, unsigned int param_no TSRMLS_DC);
|
||||
|
||||
static void MYSQLND_METHOD(mysqlnd_stmt, free_stmt_result)(MYSQLND_STMT * const s TSRMLS_DC);
|
||||
|
||||
/* {{{ mysqlnd_stmt::store_result */
|
||||
static MYSQLND_RES *
|
||||
@@ -226,7 +227,7 @@ MYSQLND_METHOD(mysqlnd_stmt, next_result)(MYSQLND_STMT * s TSRMLS_DC)
|
||||
DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status->server_status, stmt->upsert_status->server_status & SERVER_STATUS_CURSOR_EXISTS);
|
||||
|
||||
/* Free space for next result */
|
||||
s->m->free_stmt_content(s TSRMLS_CC);
|
||||
MYSQLND_METHOD(mysqlnd_stmt, free_stmt_result)(s TSRMLS_CC);
|
||||
{
|
||||
enum_func_status ret = s->m->parse_execute_response(s TSRMLS_CC);
|
||||
DBG_RETURN(ret);
|
||||
@@ -2076,6 +2077,37 @@ mysqlnd_stmt_separate_one_result_bind(MYSQLND_STMT * const s, unsigned int param
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_stmt::free_stmt_result */
|
||||
static void
|
||||
MYSQLND_METHOD(mysqlnd_stmt, free_stmt_result)(MYSQLND_STMT * const s TSRMLS_DC)
|
||||
{
|
||||
MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
|
||||
DBG_ENTER("mysqlnd_stmt::free_stmt_result");
|
||||
if (!stmt) {
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/*
|
||||
First separate the bound variables, which point to the result set, then
|
||||
destroy the set.
|
||||
*/
|
||||
mysqlnd_stmt_separate_result_bind(s TSRMLS_CC);
|
||||
/* Not every statement has a result set attached */
|
||||
if (stmt->result) {
|
||||
stmt->result->m.free_result_internal(stmt->result TSRMLS_CC);
|
||||
stmt->result = NULL;
|
||||
}
|
||||
if (stmt->error_info->error_list) {
|
||||
zend_llist_clean(stmt->error_info->error_list);
|
||||
mnd_pefree(stmt->error_info->error_list, s->persistent);
|
||||
stmt->error_info->error_list = NULL;
|
||||
}
|
||||
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_stmt::free_stmt_content */
|
||||
static void
|
||||
MYSQLND_METHOD(mysqlnd_stmt, free_stmt_content)(MYSQLND_STMT * const s TSRMLS_DC)
|
||||
@@ -2108,22 +2140,7 @@ MYSQLND_METHOD(mysqlnd_stmt, free_stmt_content)(MYSQLND_STMT * const s TSRMLS_DC
|
||||
stmt->param_bind = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
First separate the bound variables, which point to the result set, then
|
||||
destroy the set.
|
||||
*/
|
||||
mysqlnd_stmt_separate_result_bind(s TSRMLS_CC);
|
||||
/* Not every statement has a result set attached */
|
||||
if (stmt->result) {
|
||||
stmt->result->m.free_result_internal(stmt->result TSRMLS_CC);
|
||||
stmt->result = NULL;
|
||||
}
|
||||
if (stmt->error_info->error_list) {
|
||||
zend_llist_clean(stmt->error_info->error_list);
|
||||
mnd_pefree(stmt->error_info->error_list, s->persistent);
|
||||
stmt->error_info->error_list = NULL;
|
||||
}
|
||||
|
||||
MYSQLND_METHOD(mysqlnd_stmt, free_stmt_result)(s TSRMLS_CC);
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -195,12 +195,53 @@ void ps_fetch_float(zval *zv, const MYSQLND_FIELD * const field,
|
||||
unsigned int pack_len, zend_uchar **row,
|
||||
zend_bool as_unicode TSRMLS_DC)
|
||||
{
|
||||
float value;
|
||||
float fval;
|
||||
double dval;
|
||||
DBG_ENTER("ps_fetch_float");
|
||||
float4get(value, *row);
|
||||
ZVAL_DOUBLE(zv, value);
|
||||
float4get(fval, *row);
|
||||
(*row)+= 4;
|
||||
DBG_INF_FMT("value=%f", value);
|
||||
DBG_INF_FMT("value=%f", fval);
|
||||
|
||||
/*
|
||||
* The following is needed to correctly support 4-byte floats.
|
||||
* Otherwise, a value of 9.99 in a FLOAT column comes out of mysqli
|
||||
* as 9.9998998641968.
|
||||
*
|
||||
* For GCC, we use the built-in decimal support to "up-convert" a
|
||||
* 4-byte float to a 8-byte double.
|
||||
* When that is not available, we fall back to converting the float
|
||||
* to a string and then converting the string to a double. This mimics
|
||||
* what MySQL does.
|
||||
*/
|
||||
#ifdef HAVE_DECIMAL_FP_SUPPORT
|
||||
{
|
||||
typedef float dec32 __attribute__((mode(SD)));
|
||||
dec32 d32val = fval;
|
||||
|
||||
/* The following cast is guaranteed to do the right thing */
|
||||
dval = (double) d32val;
|
||||
}
|
||||
#else
|
||||
{
|
||||
char num_buf[2048]; /* Over allocated */
|
||||
char *s;
|
||||
|
||||
/* Convert to string. Ignoring localization, etc.
|
||||
* Following MySQL's rules. If precision is undefined (NOT_FIXED_DEC i.e. 31)
|
||||
* or larger than 31, the value is limited to 6 (FLT_DIG).
|
||||
*/
|
||||
s = php_gcvt(fval,
|
||||
field->decimals >= 31 ? 6 : field->decimals,
|
||||
'.',
|
||||
'e',
|
||||
num_buf);
|
||||
|
||||
/* And now convert back to double */
|
||||
dval = zend_strtod(s, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
ZVAL_DOUBLE(zv, dval);
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1182,7 +1182,7 @@ MYSQLND_METHOD(mysqlnd_res, store_result_fetch_data)(MYSQLND_CONN_DATA * const c
|
||||
No need to FREE_ALLOCA as we can reuse the
|
||||
'lengths' and 'fields' arrays. For lengths its absolutely safe.
|
||||
'fields' is reused because the ownership of the strings has been
|
||||
transfered above.
|
||||
transferred above.
|
||||
*/
|
||||
}
|
||||
/* Overflow ? */
|
||||
|
||||
+46
-7
@@ -780,6 +780,9 @@ PHP_MINIT_FUNCTION(odbc)
|
||||
REGISTER_LONG_CONSTANT("SQL_TYPE_DATE", SQL_TYPE_DATE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_LONG_CONSTANT("SQL_TYPE_TIME", SQL_TYPE_TIME, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_LONG_CONSTANT("SQL_TYPE_TIMESTAMP", SQL_TYPE_TIMESTAMP, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_LONG_CONSTANT("SQL_WCHAR", SQL_WCHAR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_LONG_CONSTANT("SQL_WVARCHAR", SQL_WVARCHAR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_LONG_CONSTANT("SQL_WLONGVARCHAR", SQL_WLONGVARCHAR, CONST_PERSISTENT | CONST_CS);
|
||||
|
||||
/*
|
||||
* SQLSpecialColumns values
|
||||
@@ -943,9 +946,13 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC)
|
||||
{
|
||||
RETCODE rc;
|
||||
int i;
|
||||
SQLSMALLINT colnamelen; /* Not used */
|
||||
SQLLEN displaysize;
|
||||
SQLSMALLINT colnamelen; /* Not used */
|
||||
SQLLEN displaysize;
|
||||
SQLUSMALLINT colfieldid;
|
||||
int charextraalloc;
|
||||
|
||||
colfieldid = SQL_COLUMN_DISPLAY_SIZE;
|
||||
charextraalloc = 0;
|
||||
result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0);
|
||||
|
||||
result->longreadlen = ODBCG(defaultlrl);
|
||||
@@ -966,6 +973,9 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC)
|
||||
case SQL_VARBINARY:
|
||||
case SQL_LONGVARBINARY:
|
||||
case SQL_LONGVARCHAR:
|
||||
#if defined(ODBCVER) && (ODBCVER >= 0x0300)
|
||||
case SQL_WLONGVARCHAR:
|
||||
#endif
|
||||
result->values[i].value = NULL;
|
||||
break;
|
||||
|
||||
@@ -976,15 +986,27 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC)
|
||||
27, &result->values[i].vallen);
|
||||
break;
|
||||
#endif /* HAVE_ADABAS */
|
||||
case SQL_CHAR:
|
||||
case SQL_VARCHAR:
|
||||
#if defined(ODBCVER) && (ODBCVER >= 0x0300)
|
||||
case SQL_WCHAR:
|
||||
case SQL_WVARCHAR:
|
||||
colfieldid = SQL_DESC_OCTET_LENGTH;
|
||||
#else
|
||||
charextraalloc = 1;
|
||||
#endif
|
||||
default:
|
||||
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE,
|
||||
NULL, 0, NULL, &displaysize);
|
||||
displaysize = displaysize <= result->longreadlen ? displaysize :
|
||||
result->longreadlen;
|
||||
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), colfieldid,
|
||||
NULL, 0, NULL, &displaysize);
|
||||
/* Workaround for Oracle ODBC Driver bug (#50162) when fetching TIMESTAMP column */
|
||||
if (result->values[i].coltype == SQL_TIMESTAMP) {
|
||||
displaysize += 3;
|
||||
}
|
||||
|
||||
if (charextraalloc) {
|
||||
/* Since we don't know the exact # of bytes, allocate extra */
|
||||
displaysize *= 4;
|
||||
}
|
||||
result->values[i].value = (char *)emalloc(displaysize + 1);
|
||||
rc = SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value,
|
||||
displaysize + 1, &result->values[i].vallen);
|
||||
@@ -1725,6 +1747,9 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
|
||||
sql_c_type = SQL_C_BINARY;
|
||||
}
|
||||
case SQL_LONGVARCHAR:
|
||||
#if defined(ODBCVER) && (ODBCVER >= 0x0300)
|
||||
case SQL_WLONGVARCHAR:
|
||||
#endif
|
||||
if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) {
|
||||
Z_STRVAL_P(tmp) = STR_EMPTY_ALLOC();
|
||||
break;
|
||||
@@ -1876,7 +1901,11 @@ PHP_FUNCTION(odbc_fetch_into)
|
||||
break;
|
||||
}
|
||||
if (result->binmode == 1) sql_c_type = SQL_C_BINARY;
|
||||
|
||||
case SQL_LONGVARCHAR:
|
||||
#if defined(ODBCVER) && (ODBCVER >= 0x0300)
|
||||
case SQL_WLONGVARCHAR:
|
||||
#endif
|
||||
if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) {
|
||||
Z_STRVAL_P(tmp) = STR_EMPTY_ALLOC();
|
||||
break;
|
||||
@@ -2095,6 +2124,9 @@ PHP_FUNCTION(odbc_result)
|
||||
break;
|
||||
}
|
||||
case SQL_LONGVARCHAR:
|
||||
#if defined(ODBCVER) && (ODBCVER >= 0x0300)
|
||||
case SQL_WLONGVARCHAR:
|
||||
#endif
|
||||
if (IS_SQL_LONG(result->values[field_ind].coltype)) {
|
||||
if (result->longreadlen <= 0) {
|
||||
break;
|
||||
@@ -2132,7 +2164,11 @@ PHP_FUNCTION(odbc_result)
|
||||
}
|
||||
/* Reduce fieldlen by 1 if we have char data. One day we might
|
||||
have binary strings... */
|
||||
if (result->values[field_ind].coltype == SQL_LONGVARCHAR) {
|
||||
if ((result->values[field_ind].coltype == SQL_LONGVARCHAR)
|
||||
#if defined(ODBCVER) && (ODBCVER >= 0x0300)
|
||||
|| (result->values[field_ind].coltype == SQL_WLONGVARCHAR)
|
||||
#endif
|
||||
) {
|
||||
fieldsize -= 1;
|
||||
}
|
||||
/* Don't duplicate result, saves one emalloc.
|
||||
@@ -2248,6 +2284,9 @@ PHP_FUNCTION(odbc_result_all)
|
||||
}
|
||||
if (result->binmode <= 1) sql_c_type = SQL_C_BINARY;
|
||||
case SQL_LONGVARCHAR:
|
||||
#if defined(ODBCVER) && (ODBCVER >= 0x0300)
|
||||
case SQL_WLONGVARCHAR:
|
||||
#endif
|
||||
if (IS_SQL_LONG(result->values[i].coltype) &&
|
||||
result->longreadlen <= 0) {
|
||||
php_printf("<td>Not printable</td>");
|
||||
|
||||
@@ -115,6 +115,7 @@ PHP_FUNCTION(solid_fetch_prev);
|
||||
#endif
|
||||
|
||||
#define ODBC_TYPE "unixODBC"
|
||||
#undef ODBCVER
|
||||
#include <sql.h>
|
||||
#include <sqlext.h>
|
||||
#define HAVE_SQL_EXTENDED_FETCH 1
|
||||
@@ -284,7 +285,11 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC);
|
||||
|
||||
void odbc_sql_error(ODBC_SQL_ERROR_PARAMS);
|
||||
|
||||
#if defined(ODBCVER) && (ODBCVER >= 0x0300)
|
||||
#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR || x == SQL_WLONGVARCHAR)
|
||||
#else
|
||||
#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR)
|
||||
#endif
|
||||
#define IS_SQL_BINARY(x) (x == SQL_BINARY || x == SQL_VARBINARY || x == SQL_LONGVARBINARY)
|
||||
|
||||
#ifdef ZTS
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
--TEST--
|
||||
odbc_exec(): Getting accurate unicode data from query
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// Test strings
|
||||
mb_internal_encoding("EUC_JP");
|
||||
$euc_jp_base64 = 'pdal6aWkpcCl676uyqo=';
|
||||
$euc_jp = base64_decode($euc_jp_base64);
|
||||
$ascii = 'abcdefghijklmnopqrstuvwxyz;]=#0123456789';
|
||||
|
||||
include 'config.inc';
|
||||
ini_set("odbc.defaultlrl", 4); // Set artifically low
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE DATABASE odbcTEST ENCODING=\'EUC_JP\'');
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE FOO (ID INT, CHAR_COL CHAR(200), VARCHAR_COL VARCHAR(200), TEXT_COL TEXT)');
|
||||
|
||||
odbc_exec($conn, "INSERT INTO FOO(ID, CHAR_COL, VARCHAR_COL, TEXT_COL) VALUES (1, '$euc_jp', '$euc_jp', '$euc_jp')");
|
||||
odbc_exec($conn, "INSERT INTO FOO(ID, CHAR_COL, VARCHAR_COL, TEXT_COL) VALUES (2, '$ascii', '$ascii', '$ascii')");
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM FOO ORDER BY ID ASC');
|
||||
|
||||
while(odbc_fetch_row($res)) {
|
||||
$char_col = odbc_result($res, "CHAR_COL");
|
||||
$varchar_col = odbc_result($res, "VARCHAR_COL");
|
||||
$id = odbc_result($res, "ID");
|
||||
$text_col = "";
|
||||
while (($chunk=odbc_result($res, "TEXT_COL")) !== false) {
|
||||
$text_col .= $chunk;
|
||||
}
|
||||
|
||||
if ($id == 1) {
|
||||
$euc_jp_check = $euc_jp . str_repeat(" ", (200 - mb_strlen($euc_jp)));
|
||||
if (strcmp($char_col, $euc_jp_check) == 0 && strcmp($varchar_col, $euc_jp) == 0 &&
|
||||
strcmp($text_col, $euc_jp) == 0) {
|
||||
print "EUC-JP matched\n";
|
||||
} else {
|
||||
print "EUC-JP mismatched\n";
|
||||
}
|
||||
} else {
|
||||
$ascii_check = $ascii . str_repeat(" ", (200 - strlen($ascii)));
|
||||
if (strcmp($char_col, $ascii_check) == 0 && strcmp($varchar_col, $ascii) == 0 &&
|
||||
strcmp($text_col, $ascii) == 0) {
|
||||
print "ASCII matched\n";
|
||||
} else {
|
||||
print "ASCII mismatched\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
EUC-JP matched
|
||||
ASCII matched
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'DROP TABLE FOO');
|
||||
odbc_exec($conn, 'DROP DATABASE odbcTEST');
|
||||
|
||||
?>
|
||||
@@ -24,9 +24,5 @@ resource(%d) of type (odbc result)
|
||||
bool(false)
|
||||
resource(%d) of type (odbc result)
|
||||
bool(false)
|
||||
|
||||
Warning: odbc_columns(): SQL error: Failed to fetch error message, SQL state HY000 in SQLColumns in %s on line %d
|
||||
resource(%d) of type (odbc result)
|
||||
bool(false)
|
||||
|
||||
Warning: odbc_fetch_row() expects parameter 1 to be resource, boolean given in %s on line %d
|
||||
NULL
|
||||
@@ -12,7 +12,7 @@ $conn = odbc_connect($dsn, $user, $pass);
|
||||
odbc_exec($conn, 'CREATE DATABASE odbcTEST');
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE FOO (TEST INT)');
|
||||
odbc_exec($conn, 'ALTER TABLE FOO ADD PRIMARY KEY FOO(TEST)');
|
||||
odbc_exec($conn, 'ALTER TABLE FOO ADD PRIMARY KEY (TEST)');
|
||||
|
||||
odbc_exec($conn, 'INSERT INTO FOO VALUES (1)');
|
||||
odbc_exec($conn, 'INSERT INTO FOO VALUES (2)');
|
||||
|
||||
@@ -654,7 +654,7 @@ static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr TSRMLS_DC) /* {{{ */
|
||||
return (time_t)-1;
|
||||
}
|
||||
|
||||
if (ASN1_STRING_length(timestr) != strlen(ASN1_STRING_data(timestr))) {
|
||||
if (ASN1_STRING_length(timestr) != strlen((char *)ASN1_STRING_data(timestr))) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "illegal length in timestamp");
|
||||
return (time_t)-1;
|
||||
}
|
||||
@@ -782,13 +782,13 @@ static int add_oid_section(struct php_x509_request * req TSRMLS_DC) /* {{{ */
|
||||
req->config_filename, req->var, req->req_config TSRMLS_CC) == FAILURE) return FAILURE
|
||||
|
||||
#define SET_OPTIONAL_STRING_ARG(key, varname, defval) \
|
||||
if (optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), key, sizeof(key), (void**)&item) == SUCCESS) \
|
||||
if (optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), key, sizeof(key), (void**)&item) == SUCCESS && Z_TYPE_PP(item) == IS_STRING) \
|
||||
varname = Z_STRVAL_PP(item); \
|
||||
else \
|
||||
varname = defval
|
||||
|
||||
#define SET_OPTIONAL_LONG_ARG(key, varname, defval) \
|
||||
if (optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), key, sizeof(key), (void**)&item) == SUCCESS) \
|
||||
if (optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), key, sizeof(key), (void**)&item) == SUCCESS && Z_TYPE_PP(item) == IS_LONG) \
|
||||
varname = Z_LVAL_PP(item); \
|
||||
else \
|
||||
varname = defval
|
||||
@@ -847,7 +847,8 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option
|
||||
}
|
||||
}
|
||||
|
||||
if (req->priv_key_encrypt && optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), "encrypt_key_cipher", sizeof("encrypt_key_cipher"), (void**)&item) == SUCCESS) {
|
||||
if (req->priv_key_encrypt && optional_args && zend_hash_find(Z_ARRVAL_P(optional_args), "encrypt_key_cipher", sizeof("encrypt_key_cipher"), (void**)&item) == SUCCESS
|
||||
&& Z_TYPE_PP(item) == IS_LONG) {
|
||||
long cipher_algo = Z_LVAL_PP(item);
|
||||
const EVP_CIPHER* cipher = php_openssl_get_evp_cipher_from_algo(cipher_algo);
|
||||
if (cipher == NULL) {
|
||||
@@ -1962,7 +1963,7 @@ PHP_FUNCTION(openssl_pkcs12_export_to_file)
|
||||
}
|
||||
|
||||
/* parse extra config from args array, promote this to an extra function */
|
||||
if (args && zend_hash_find(Z_ARRVAL_P(args), "friendly_name", sizeof("friendly_name"), (void**)&item) == SUCCESS)
|
||||
if (args && zend_hash_find(Z_ARRVAL_P(args), "friendly_name", sizeof("friendly_name"), (void**)&item) == SUCCESS && Z_TYPE_PP(item) == IS_STRING)
|
||||
friendly_name = Z_STRVAL_PP(item);
|
||||
/* certpbe (default RC2-40)
|
||||
keypbe (default 3DES)
|
||||
@@ -2040,7 +2041,7 @@ PHP_FUNCTION(openssl_pkcs12_export)
|
||||
}
|
||||
|
||||
/* parse extra config from args array, promote this to an extra function */
|
||||
if (args && zend_hash_find(Z_ARRVAL_P(args), "friendly_name", sizeof("friendly_name"), (void**)&item) == SUCCESS)
|
||||
if (args && zend_hash_find(Z_ARRVAL_P(args), "friendly_name", sizeof("friendly_name"), (void**)&item) == SUCCESS && Z_TYPE_PP(item) == IS_STRING)
|
||||
friendly_name = Z_STRVAL_PP(item);
|
||||
|
||||
if (args && zend_hash_find(Z_ARRVAL_P(args), "extracerts", sizeof("extracerts"), (void**)&item) == SUCCESS)
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Options type checks
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("openssl")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$x = openssl_pkey_new();
|
||||
$csr = openssl_csr_new(["countryName" => "DE"], $x, ["x509_extensions" => 0xDEADBEEF]);
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
||||
@@ -4935,7 +4935,7 @@ by an auxiliary program - but can then be edited by hand if required. There are
|
||||
now no calls to isalnum(), isspace(), isdigit(), isxdigit(), tolower() or
|
||||
toupper() in the code.
|
||||
|
||||
7. Turn the malloc/free funtions variables into pcre_malloc and pcre_free and
|
||||
7. Turn the malloc/free functions variables into pcre_malloc and pcre_free and
|
||||
make them global. Abolish the function for setting them, as the caller can now
|
||||
set them directly.
|
||||
|
||||
|
||||
+1
-1
@@ -640,7 +640,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
}
|
||||
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
|
||||
memset(offsets, 0, size_offsets*sizeof(int));
|
||||
/* Allocate match sets array and initialize the values. */
|
||||
if (global && subpats && subpats_order == PREG_PATTERN_ORDER) {
|
||||
match_sets = (zval **)safe_emalloc(num_subpats, sizeof(zval *), 0);
|
||||
|
||||
@@ -294,7 +294,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
|
||||
sizeof(Oid));
|
||||
}
|
||||
if (param->paramno >= 0) {
|
||||
if (param->paramno > zend_hash_num_elements(stmt->bound_param_map)) {
|
||||
if (param->paramno >= zend_hash_num_elements(stmt->bound_param_map)) {
|
||||
pdo_pgsql_error_stmt(stmt, PGRES_FATAL_ERROR, "HY105");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
--TEST--
|
||||
PDO PgSQL Bug #66584 (Segmentation fault on statement deallocation)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
|
||||
require dirname(__FILE__) . '/config.inc';
|
||||
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
PDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
||||
|
||||
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$pdo->beginTransaction();
|
||||
|
||||
$pdo->query("CREATE TABLE b66584 (a int)");
|
||||
$pdo->query("INSERT INTO b66584 VALUES (165)");
|
||||
|
||||
for ($i = 1; $i >= 0; $i--) {
|
||||
$pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, (bool)$i);
|
||||
|
||||
try {
|
||||
run($pdo, [0 => 1, 2 => 165, 5 => 3]);
|
||||
} catch (\Exception $e) {
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
run($pdo, json_decode('{"0":234,"1":165,"2":221,"3":207,"4":188,"5":216,"6":1150,"7":916,"8":967,"9":987,"10":951,"11":990,"12":959,"13":896,"14":947,"15":877,"16":1000,"17":1023,"18":904,"19":856,"20":860,"21":866,"22":930,"23":974,"24":1032,"25":1016,"26":1050,"27":1059,"28":1040,"29":1064,"30":1004,"31":214,"32":189,"33":166,"34":1002,"35":167,"36":191,"37":859,"38":204,"39":181,"40":1001,"42":208,"43":198,"44":177,"45":1003,"46":858,"47":190,"48":162,"49":210,"50":171,"51":197,"52":168,"53":194,"54":209,"55":200,"56":192,"57":180,"58":232,"59":222,"60":163,"61":196,"62":217,"64":176,"65":193,"66":172,"67":195,"68":170,"69":173,"70":233,"71":223,"72":218,"73":186,"74":175,"75":224,"76":205,"77":211,"78":235,"79":1101,"80":225,"81":236,"82":1102,"83":1164,"84":1083,"85":1005,"86":861,"87":1179,"88":960,"89":991,"90":1187,"91":880,"92":1149,"93":1033,"94":931,"95":1006,"96":862,"97":1151,"98":917,"99":881,"100":1148,"101":1065,"102":867,"103":952,"104":1152,"105":918,"106":961,"107":1180,"108":992,"109":1188,"110":932,"111":933,"112":968,"113":868,"114":882,"115":1147,"116":1017,"117":1131,"118":1174,"119":1178,"120":1186,"121":869,"122":1051,"123":934,"124":969,"125":975,"126":1066,"127":237,"128":953,"129":1024,"130":1146,"131":883,"132":1145,"133":884,"134":885,"135":1144,"136":886,"137":1143,"138":1025,"139":897,"140":898,"141":899,"142":1026,"143":1142,"144":887,"145":1141,"146":888,"147":889,"148":1140,"149":1189,"150":993,"151":1139,"152":890,"153":1138,"154":891,"155":900,"156":892,"157":1137,"158":1027,"159":901,"160":1136,"161":893,"162":870,"163":1052,"164":954,"165":1041,"166":1018,"167":1165,"168":1084,"169":962,"170":1181,"171":994,"172":1190,"173":1042,"174":935,"175":226,"176":871,"177":1191,"178":995,"179":977,"180":948,"181":1175,"182":1053,"183":955,"184":1182,"185":963,"186":1067,"187":919,"188":1153,"189":920,"190":1154,"191":1055,"192":1054,"193":1056,"194":863,"195":872,"196":1028,"197":921,"198":1155,"199":936,"200":970,"201":1019,"202":1166,"203":1085,"204":1135,"205":894,"206":1034,"207":905,"208":873,"209":937,"210":902,"211":1029,"212":1007,"213":864,"214":1043,"215":1057,"216":956,"217":957,"218":939,"219":1086,"220":1167,"221":1087,"222":1168,"223":1173,"224":1108,"225":978,"226":1044,"227":1183,"228":964,"229":965,"230":1184,"231":1045,"232":874,"233":940,"234":1046,"235":979,"236":903,"237":980,"238":1156,"239":922,"240":1035,"241":906,"242":971,"243":972,"244":878,"245":1134,"246":879,"247":1133,"248":907,"249":1036,"250":908,"251":1132,"252":895,"253":909,"254":1060,"255":981,"256":1068,"257":996,"258":1192,"259":941,"260":865,"261":1008,"262":910,"263":997,"264":1193,"265":982,"266":942,"267":1020,"268":983,"269":1061,"270":949,"271":1176,"272":875,"273":911,"274":1069,"275":1157,"276":923,"277":1158,"278":924,"279":988,"280":984,"281":925,"282":1159,"283":1062,"284":1047,"285":1194,"286":998,"287":1021,"288":1030,"289":1031,"290":1070,"291":1088,"292":1169,"293":958,"294":1195,"295":999,"296":966,"297":1185,"298":944,"299":945,"300":1022,"301":1103,"302":220,"303":1099,"304":1048,"305":927,"306":1161,"307":989,"308":973,"309":1071,"310":1074,"311":1072,"312":1073,"313":912,"314":1037,"315":913,"316":914,"317":1177,"318":950,"319":1049,"320":876,"321":985,"322":915,"323":1038,"324":946,"325":1089,"326":1170,"327":1090,"328":1171,"329":1091,"330":1172,"331":1063,"332":986,"333":928,"334":1162,"335":929,"336":1163,"337":976,"338":231,"339":201,"340":1098,"341":215}', true));
|
||||
} catch (\Exception $e) {
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$pdo->query("DROP TABLE b66584");
|
||||
$pdo->rollback();
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
|
||||
function run($pdo, $data)
|
||||
{
|
||||
$bind = join(', ', array_fill(0, count($data), '?'));
|
||||
|
||||
$stmt = $pdo->prepare("SELECT COUNT(*) FROM b66584 WHERE a IN ({$bind})");
|
||||
|
||||
var_dump(count($data));
|
||||
|
||||
$stmt->execute($data);
|
||||
|
||||
var_dump($stmt->fetchColumn());
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(3)
|
||||
string(%d) "SQLSTATE%s"
|
||||
int(340)
|
||||
string(%d) "SQLSTATE%s"
|
||||
int(3)
|
||||
string(%d) "SQLSTATE%s"
|
||||
int(340)
|
||||
string(%d) "SQLSTATE%s"
|
||||
@@ -99,6 +99,9 @@ static size_t readline_shell_write(const char *str, uint str_length TSRMLS_DC) /
|
||||
|
||||
static int readline_shell_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
/* We just store the last char here and then pass back to the
|
||||
caller (sapi_cli_single_write in sapi/cli) which will actually
|
||||
write due to -1 return code */
|
||||
php_last_char = str[str_length-1];
|
||||
return -1;
|
||||
}
|
||||
@@ -587,6 +590,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
|
||||
char *code = emalloc(size);
|
||||
char *prompt = cli_get_prompt("php", '>' TSRMLS_CC);
|
||||
char *history_file;
|
||||
int history_lines_to_write = 0;
|
||||
|
||||
if (PG(auto_prepend_file) && PG(auto_prepend_file)[0]) {
|
||||
zend_file_handle *prepend_file_p;
|
||||
@@ -651,6 +655,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
|
||||
|
||||
if (*line) {
|
||||
add_history(line);
|
||||
history_lines_to_write += 1;
|
||||
}
|
||||
|
||||
free(line);
|
||||
@@ -660,6 +665,15 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (history_lines_to_write) {
|
||||
#if HAVE_LIBEDIT
|
||||
write_history(history_file);
|
||||
#else
|
||||
append_history(history_lines_to_write, history_file);
|
||||
#endif
|
||||
history_lines_to_write = 0;
|
||||
}
|
||||
|
||||
zend_try {
|
||||
zend_eval_stringl(code, pos, NULL, "php shell code" TSRMLS_CC);
|
||||
} zend_end_try();
|
||||
@@ -667,7 +681,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
|
||||
pos = 0;
|
||||
|
||||
if (!pager_pipe && php_last_char != '\0' && php_last_char != '\n') {
|
||||
readline_shell_write("\n", 1 TSRMLS_CC);
|
||||
php_write("\n", 1 TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (EG(exception)) {
|
||||
@@ -681,7 +695,6 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
|
||||
|
||||
php_last_char = '\0';
|
||||
}
|
||||
write_history(history_file);
|
||||
free(history_file);
|
||||
efree(code);
|
||||
efree(prompt);
|
||||
|
||||
+15
-10
@@ -296,7 +296,8 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */
|
||||
|
||||
if (zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **) &array) == SUCCESS &&
|
||||
Z_TYPE_PP(array) == IS_ARRAY &&
|
||||
zend_hash_find(Z_ARRVAL_PP(array), "REMOTE_ADDR", sizeof("REMOTE_ADDR"), (void **) &token) == SUCCESS
|
||||
zend_hash_find(Z_ARRVAL_PP(array), "REMOTE_ADDR", sizeof("REMOTE_ADDR"), (void **) &token) == SUCCESS &&
|
||||
Z_TYPE_PP(token) == IS_STRING
|
||||
) {
|
||||
remote_addr = Z_STRVAL_PP(token);
|
||||
}
|
||||
@@ -1327,9 +1328,16 @@ PHPAPI const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC) /* {{{
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#define PPID2SID \
|
||||
convert_to_string((*ppid)); \
|
||||
PS(id) = estrndup(Z_STRVAL_PP(ppid), Z_STRLEN_PP(ppid))
|
||||
static void ppid2sid(zval **ppid TSRMLS_DC) {
|
||||
if (Z_TYPE_PP(ppid) != IS_STRING) {
|
||||
PS(id) = NULL;
|
||||
PS(send_cookie) = 1;
|
||||
} else {
|
||||
convert_to_string((*ppid));
|
||||
PS(id) = estrndup(Z_STRVAL_PP(ppid), Z_STRLEN_PP(ppid));
|
||||
PS(send_cookie) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void php_session_reset_id(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
@@ -1418,9 +1426,8 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */
|
||||
Z_TYPE_PP(data) == IS_ARRAY &&
|
||||
zend_hash_find(Z_ARRVAL_PP(data), PS(session_name), lensess + 1, (void **) &ppid) == SUCCESS
|
||||
) {
|
||||
PPID2SID;
|
||||
ppid2sid(ppid TSRMLS_CC);
|
||||
PS(apply_trans_sid) = 0;
|
||||
PS(send_cookie) = 0;
|
||||
PS(define_sid) = 0;
|
||||
}
|
||||
|
||||
@@ -1429,8 +1436,7 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */
|
||||
Z_TYPE_PP(data) == IS_ARRAY &&
|
||||
zend_hash_find(Z_ARRVAL_PP(data), PS(session_name), lensess + 1, (void **) &ppid) == SUCCESS
|
||||
) {
|
||||
PPID2SID;
|
||||
PS(send_cookie) = 0;
|
||||
ppid2sid(ppid TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (!PS(use_only_cookies) && !PS(id) &&
|
||||
@@ -1438,8 +1444,7 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */
|
||||
Z_TYPE_PP(data) == IS_ARRAY &&
|
||||
zend_hash_find(Z_ARRVAL_PP(data), PS(session_name), lensess + 1, (void **) &ppid) == SUCCESS
|
||||
) {
|
||||
PPID2SID;
|
||||
PS(send_cookie) = 0;
|
||||
ppid2sid(ppid TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #66827: Session raises E_NOTICE when session name variable is array.
|
||||
--INI--
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$_COOKIE[session_name()] = array();
|
||||
session_start();
|
||||
echo 'OK';
|
||||
--EXPECTF--
|
||||
OK
|
||||
@@ -1,9 +1,7 @@
|
||||
--TEST--
|
||||
Bug #62328 (implementing __toString and a cast to string fails)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once("skipif.inc");
|
||||
?>
|
||||
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
class UberSimpleXML extends SimpleXMLElement {
|
||||
@@ -373,7 +373,7 @@ class Interop_Client
|
||||
}
|
||||
$soap =& $endpoint_info['client'];
|
||||
|
||||
# XXX how do we determine a failure on retreiving/parsing wsdl?
|
||||
# XXX how do we determine a failure on retrieving/parsing wsdl?
|
||||
if ($soap->wsdl->fault) {
|
||||
$fault = $soap->wsdl->fault;
|
||||
$soap_test->setResult(0,'WSDL',
|
||||
|
||||
+1
-1
@@ -326,7 +326,7 @@ PHP_FUNCTION(spl_autoload)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (file_exts == NULL) { /* autoload_extensions is not intialzed, set to defaults */
|
||||
if (file_exts == NULL) { /* autoload_extensions is not initialized, set to defaults */
|
||||
copy = pos1 = estrndup(SPL_DEFAULT_FILE_EXTENSIONS, sizeof(SPL_DEFAULT_FILE_EXTENSIONS)-1);
|
||||
} else {
|
||||
copy = pos1 = estrndup(file_exts, file_exts_len);
|
||||
|
||||
@@ -1745,6 +1745,7 @@ SPL_METHOD(Array, unserialize)
|
||||
const unsigned char *p, *s;
|
||||
php_unserialize_data_t var_hash;
|
||||
zval *pmembers, *pflags = NULL;
|
||||
HashTable *aht;
|
||||
long flags;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) {
|
||||
@@ -1756,6 +1757,12 @@ SPL_METHOD(Array, unserialize)
|
||||
return;
|
||||
}
|
||||
|
||||
aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
|
||||
if (aht->nApplyCount > 0) {
|
||||
zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited");
|
||||
return;
|
||||
}
|
||||
|
||||
/* storage */
|
||||
s = p = (const unsigned char*)buf;
|
||||
PHP_VAR_UNSERIALIZE_INIT(var_hash);
|
||||
|
||||
@@ -43,12 +43,10 @@ PHPAPI zend_class_entry *spl_ce_SplStack;
|
||||
|
||||
#define SPL_LLIST_DELREF(elem) if(!--(elem)->rc) { \
|
||||
efree(elem); \
|
||||
elem = NULL; \
|
||||
}
|
||||
|
||||
#define SPL_LLIST_CHECK_DELREF(elem) if((elem) && !--(elem)->rc) { \
|
||||
efree(elem); \
|
||||
elem = NULL; \
|
||||
}
|
||||
|
||||
#define SPL_LLIST_ADDREF(elem) (elem)->rc++
|
||||
@@ -916,6 +914,11 @@ SPL_METHOD(SplDoublyLinkedList, offsetUnset)
|
||||
llist->dtor(element TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (intern->traverse_pointer == element) {
|
||||
SPL_LLIST_DELREF(element);
|
||||
intern->traverse_pointer = NULL;
|
||||
}
|
||||
|
||||
zval_ptr_dtor((zval **)&element->data);
|
||||
element->data = NULL;
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #67538 (SPL Iterators use-after-free)
|
||||
--FILE--
|
||||
<?php
|
||||
$list = new SplDoublyLinkedList();
|
||||
$list->push('a');
|
||||
$list->push('b');
|
||||
|
||||
$list->rewind();
|
||||
$list->offsetUnset(0);
|
||||
$list->push('b');
|
||||
$list->offsetUnset(0);
|
||||
$list->next();
|
||||
echo "okey";
|
||||
?>
|
||||
--EXPECTF--
|
||||
okey
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #67539 (ArrayIterator use-after-free due to object change during sorting)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$it = new ArrayIterator(array_fill(0,2,'X'), 1 );
|
||||
|
||||
function badsort($a, $b) {
|
||||
$GLOBALS['it']->unserialize($GLOBALS['it']->serialize());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$it->uksort('badsort');
|
||||
--EXPECTF--
|
||||
Warning: Modification of ArrayObject during sorting is prohibited in %sbug67539.php on line %d
|
||||
@@ -2020,7 +2020,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
|
||||
if (should_rehash) {
|
||||
zend_hash_rehash(Z_ARRVAL_P(stack));
|
||||
}
|
||||
} else if (!key_len && index >= Z_ARRVAL_P(stack)->nNextFreeElement - 1) {
|
||||
} else if (!key_len && Z_ARRVAL_P(stack)->nNextFreeElement > 0 && index >= Z_ARRVAL_P(stack)->nNextFreeElement - 1) {
|
||||
Z_ARRVAL_P(stack)->nNextFreeElement = Z_ARRVAL_P(stack)->nNextFreeElement - 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -2309,8 +2309,9 @@ ZEND_BEGIN_ARG_INFO(arginfo_lcfirst, 0)
|
||||
ZEND_ARG_INFO(0, str)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_ucwords, 0)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_ucwords, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, str)
|
||||
ZEND_ARG_INFO(0, delimiters)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_strtr, 0, 0, 2)
|
||||
|
||||
+8
-3
@@ -491,13 +491,18 @@ PHP_FUNCTION(glob)
|
||||
/* now catch the FreeBSD style of "no matches" */
|
||||
if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
|
||||
no_results:
|
||||
#ifndef PHP_WIN32
|
||||
/* Paths containing '*', '?' and some other chars are
|
||||
illegal on Windows but legit on other platforms. For
|
||||
this reason the direct basedir check against the glob
|
||||
query is senseless on windows. For instance while *.txt
|
||||
is a pretty valid filename on EXT3, it's invalid on NTFS. */
|
||||
if (PG(open_basedir) && *PG(open_basedir)) {
|
||||
struct stat s;
|
||||
|
||||
if (0 != VCWD_STAT(pattern, &s) || S_IFDIR != (s.st_mode & S_IFMT)) {
|
||||
if (php_check_open_basedir_ex(pattern, 0 TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
array_init(return_value);
|
||||
return;
|
||||
}
|
||||
|
||||
+60
-24
@@ -412,8 +412,14 @@ PHP_FUNCTION(dns_check_record)
|
||||
|
||||
#if HAVE_FULL_DNS_FUNCS
|
||||
|
||||
#define CHECKCP(n) do { \
|
||||
if (cp + n > end) { \
|
||||
return NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* {{{ php_parserr */
|
||||
static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int store, int raw, zval **subarray)
|
||||
static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_to_fetch, int store, int raw, zval **subarray)
|
||||
{
|
||||
u_short type, class, dlen;
|
||||
u_long ttl;
|
||||
@@ -425,16 +431,18 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
|
||||
|
||||
*subarray = NULL;
|
||||
|
||||
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, sizeof(name) - 2);
|
||||
n = dn_expand(answer->qb2, end, cp, name, sizeof(name) - 2);
|
||||
if (n < 0) {
|
||||
return NULL;
|
||||
}
|
||||
cp += n;
|
||||
|
||||
CHECKCP(10);
|
||||
GETSHORT(type, cp);
|
||||
GETSHORT(class, cp);
|
||||
GETLONG(ttl, cp);
|
||||
GETSHORT(dlen, cp);
|
||||
CHECKCP(dlen);
|
||||
if (type_to_fetch != T_ANY && type != type_to_fetch) {
|
||||
cp += dlen;
|
||||
return cp;
|
||||
@@ -461,12 +469,14 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
|
||||
|
||||
switch (type) {
|
||||
case DNS_T_A:
|
||||
CHECKCP(4);
|
||||
add_assoc_string(*subarray, "type", "A", 1);
|
||||
snprintf(name, sizeof(name), "%d.%d.%d.%d", cp[0], cp[1], cp[2], cp[3]);
|
||||
add_assoc_string(*subarray, "ip", name, 1);
|
||||
cp += dlen;
|
||||
break;
|
||||
case DNS_T_MX:
|
||||
CHECKCP(2);
|
||||
add_assoc_string(*subarray, "type", "MX", 1);
|
||||
GETSHORT(n, cp);
|
||||
add_assoc_long(*subarray, "pri", n);
|
||||
@@ -485,7 +495,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
|
||||
if (type == DNS_T_PTR) {
|
||||
add_assoc_string(*subarray, "type", "PTR", 1);
|
||||
}
|
||||
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2);
|
||||
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2);
|
||||
if (n < 0) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -495,18 +505,22 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
|
||||
case DNS_T_HINFO:
|
||||
/* See RFC 1010 for values */
|
||||
add_assoc_string(*subarray, "type", "HINFO", 1);
|
||||
CHECKCP(1);
|
||||
n = *cp & 0xFF;
|
||||
cp++;
|
||||
CHECKCP(n);
|
||||
add_assoc_stringl(*subarray, "cpu", (char*)cp, n, 1);
|
||||
cp += n;
|
||||
CHECKCP(1);
|
||||
n = *cp & 0xFF;
|
||||
cp++;
|
||||
CHECKCP(n);
|
||||
add_assoc_stringl(*subarray, "os", (char*)cp, n, 1);
|
||||
cp += n;
|
||||
break;
|
||||
case DNS_T_TXT:
|
||||
{
|
||||
int ll = 0;
|
||||
int l1 = 0, l2 = 0;
|
||||
zval *entries = NULL;
|
||||
|
||||
add_assoc_string(*subarray, "type", "TXT", 1);
|
||||
@@ -515,37 +529,41 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
|
||||
MAKE_STD_ZVAL(entries);
|
||||
array_init(entries);
|
||||
|
||||
while (ll < dlen) {
|
||||
n = cp[ll];
|
||||
if ((ll + n) >= dlen) {
|
||||
while (l1 < dlen) {
|
||||
n = cp[l1];
|
||||
if ((l1 + n) >= dlen) {
|
||||
// Invalid chunk length, truncate
|
||||
n = dlen - (ll + 1);
|
||||
n = dlen - (l1 + 1);
|
||||
}
|
||||
memcpy(tp + ll , cp + ll + 1, n);
|
||||
add_next_index_stringl(entries, cp + ll + 1, n, 1);
|
||||
ll = ll + n + 1;
|
||||
if (n) {
|
||||
memcpy(tp + l2 , cp + l1 + 1, n);
|
||||
add_next_index_stringl(entries, cp + l1 + 1, n, 1);
|
||||
}
|
||||
l1 = l1 + n + 1;
|
||||
l2 = l2 + n;
|
||||
}
|
||||
tp[dlen] = '\0';
|
||||
tp[l2] = '\0';
|
||||
cp += dlen;
|
||||
|
||||
add_assoc_stringl(*subarray, "txt", tp, (dlen>0)?dlen - 1:0, 0);
|
||||
add_assoc_stringl(*subarray, "txt", tp, l2, 0);
|
||||
add_assoc_zval(*subarray, "entries", entries);
|
||||
}
|
||||
break;
|
||||
case DNS_T_SOA:
|
||||
add_assoc_string(*subarray, "type", "SOA", 1);
|
||||
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) -2);
|
||||
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) -2);
|
||||
if (n < 0) {
|
||||
return NULL;
|
||||
}
|
||||
cp += n;
|
||||
add_assoc_string(*subarray, "mname", name, 1);
|
||||
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) -2);
|
||||
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) -2);
|
||||
if (n < 0) {
|
||||
return NULL;
|
||||
}
|
||||
cp += n;
|
||||
add_assoc_string(*subarray, "rname", name, 1);
|
||||
CHECKCP(5*4);
|
||||
GETLONG(n, cp);
|
||||
add_assoc_long(*subarray, "serial", n);
|
||||
GETLONG(n, cp);
|
||||
@@ -559,6 +577,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
|
||||
break;
|
||||
case DNS_T_AAAA:
|
||||
tp = (u_char*)name;
|
||||
CHECKCP(8*2);
|
||||
for(i=0; i < 8; i++) {
|
||||
GETSHORT(s, cp);
|
||||
if (s != 0) {
|
||||
@@ -593,6 +612,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
|
||||
case DNS_T_A6:
|
||||
p = cp;
|
||||
add_assoc_string(*subarray, "type", "A6", 1);
|
||||
CHECKCP(1);
|
||||
n = ((int)cp[0]) & 0xFF;
|
||||
cp++;
|
||||
add_assoc_long(*subarray, "masklen", n);
|
||||
@@ -628,6 +648,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
|
||||
cp++;
|
||||
}
|
||||
for (i = (n + 8) / 16; i < 8; i++) {
|
||||
CHECKCP(2);
|
||||
GETSHORT(s, cp);
|
||||
if (s != 0) {
|
||||
if (tp > (u_char *)name) {
|
||||
@@ -657,7 +678,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
|
||||
tp[0] = '\0';
|
||||
add_assoc_string(*subarray, "ipv6", name, 1);
|
||||
if (cp < p + dlen) {
|
||||
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2);
|
||||
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2);
|
||||
if (n < 0) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -666,6 +687,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
|
||||
}
|
||||
break;
|
||||
case DNS_T_SRV:
|
||||
CHECKCP(3*2);
|
||||
add_assoc_string(*subarray, "type", "SRV", 1);
|
||||
GETSHORT(n, cp);
|
||||
add_assoc_long(*subarray, "pri", n);
|
||||
@@ -673,7 +695,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
|
||||
add_assoc_long(*subarray, "weight", n);
|
||||
GETSHORT(n, cp);
|
||||
add_assoc_long(*subarray, "port", n);
|
||||
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2);
|
||||
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2);
|
||||
if (n < 0) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -681,21 +703,35 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
|
||||
add_assoc_string(*subarray, "target", name, 1);
|
||||
break;
|
||||
case DNS_T_NAPTR:
|
||||
CHECKCP(2*2);
|
||||
add_assoc_string(*subarray, "type", "NAPTR", 1);
|
||||
GETSHORT(n, cp);
|
||||
add_assoc_long(*subarray, "order", n);
|
||||
GETSHORT(n, cp);
|
||||
add_assoc_long(*subarray, "pref", n);
|
||||
|
||||
CHECKCP(1);
|
||||
n = (cp[0] & 0xFF);
|
||||
add_assoc_stringl(*subarray, "flags", (char*)++cp, n, 1);
|
||||
cp++;
|
||||
CHECKCP(n);
|
||||
add_assoc_stringl(*subarray, "flags", (char*)cp, n, 1);
|
||||
cp += n;
|
||||
|
||||
CHECKCP(1);
|
||||
n = (cp[0] & 0xFF);
|
||||
add_assoc_stringl(*subarray, "services", (char*)++cp, n, 1);
|
||||
cp++;
|
||||
CHECKCP(n);
|
||||
add_assoc_stringl(*subarray, "services", (char*)cp, n, 1);
|
||||
cp += n;
|
||||
|
||||
CHECKCP(1);
|
||||
n = (cp[0] & 0xFF);
|
||||
add_assoc_stringl(*subarray, "regex", (char*)++cp, n, 1);
|
||||
cp++;
|
||||
CHECKCP(n);
|
||||
add_assoc_stringl(*subarray, "regex", (char*)cp, n, 1);
|
||||
cp += n;
|
||||
n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2);
|
||||
|
||||
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2);
|
||||
if (n < 0) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -888,7 +924,7 @@ PHP_FUNCTION(dns_get_record)
|
||||
while (an-- && cp && cp < end) {
|
||||
zval *retval;
|
||||
|
||||
cp = php_parserr(cp, &answer, type_to_fetch, store_results, raw, &retval);
|
||||
cp = php_parserr(cp, end, &answer, type_to_fetch, store_results, raw, &retval);
|
||||
if (retval != NULL && store_results) {
|
||||
add_next_index_zval(return_value, retval);
|
||||
}
|
||||
@@ -901,7 +937,7 @@ PHP_FUNCTION(dns_get_record)
|
||||
while (ns-- > 0 && cp && cp < end) {
|
||||
zval *retval = NULL;
|
||||
|
||||
cp = php_parserr(cp, &answer, DNS_T_ANY, authns != NULL, raw, &retval);
|
||||
cp = php_parserr(cp, end, &answer, DNS_T_ANY, authns != NULL, raw, &retval);
|
||||
if (retval != NULL) {
|
||||
add_next_index_zval(authns, retval);
|
||||
}
|
||||
@@ -913,7 +949,7 @@ PHP_FUNCTION(dns_get_record)
|
||||
while (ar-- > 0 && cp && cp < end) {
|
||||
zval *retval = NULL;
|
||||
|
||||
cp = php_parserr(cp, &answer, DNS_T_ANY, 1, raw, &retval);
|
||||
cp = php_parserr(cp, end, &answer, DNS_T_ANY, 1, raw, &retval);
|
||||
if (retval != NULL) {
|
||||
add_next_index_zval(addtl, retval);
|
||||
}
|
||||
|
||||
@@ -600,6 +600,14 @@ PHPAPI char *php_get_uname(char mode)
|
||||
|
||||
php_get_windows_cpu(wincpu, sizeof(wincpu));
|
||||
dwBuild = (DWORD)(HIWORD(dwVersion));
|
||||
|
||||
/* Windows "version" 6.2 could be Windows 8/Windows Server 2012, but also Windows 8.1/Windows Server 2012 R2 */
|
||||
if (dwWindowsMajorVersion == 6 && dwWindowsMinorVersion == 2) {
|
||||
if (strncmp(winver, "Windows 8.1", 11) == 0 || strncmp(winver, "Windows Server 2012 R2", 22) == 0) {
|
||||
dwWindowsMinorVersion = 3;
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d build %d (%s) %s",
|
||||
"Windows NT", ComputerName,
|
||||
dwWindowsMajorVersion, dwWindowsMinorVersion, dwBuild, winver?winver:"unknown", wincpu);
|
||||
|
||||
@@ -2742,11 +2742,12 @@ PHP_FUNCTION(lcfirst)
|
||||
Uppercase the first character of every word in a string */
|
||||
PHP_FUNCTION(ucwords)
|
||||
{
|
||||
char *str;
|
||||
char *str, *delims = " \t\r\n\f\v";
|
||||
register char *r, *r_end;
|
||||
int str_len;
|
||||
int str_len, delims_len = 6;
|
||||
char mask[256];
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &delims, &delims_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2754,12 +2755,14 @@ PHP_FUNCTION(ucwords)
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
|
||||
php_charmask((unsigned char *)delims, delims_len, mask TSRMLS_CC);
|
||||
|
||||
ZVAL_STRINGL(return_value, str, str_len, 1);
|
||||
r = Z_STRVAL_P(return_value);
|
||||
|
||||
*r = toupper((unsigned char) *r);
|
||||
for (r_end = r + Z_STRLEN_P(return_value) - 1; r < r_end; ) {
|
||||
if (isspace((int) *(unsigned char *)r++)) {
|
||||
if (mask[(unsigned char)*r++]) {
|
||||
*r = toupper((unsigned char) *r);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #67693 - incorrect push to empty array
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$array = array(-1 => 0);
|
||||
|
||||
array_pop($array);
|
||||
|
||||
array_push($array, 0);
|
||||
array_push($array, 0);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo"\nDone";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(0)
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
|
||||
Done
|
||||
@@ -5,15 +5,30 @@ Test glob() function: ensure no platform difference
|
||||
$path = dirname(__FILE__);
|
||||
|
||||
ini_set('open_basedir', NULL);
|
||||
var_dump(glob("$path/*.none"));
|
||||
|
||||
ini_set('open_basedir', $path);
|
||||
var_dump(glob("$path/*.none"));
|
||||
var_dump(glob("$path/?.none"));
|
||||
var_dump(glob("$path/*{hello,world}.none"));
|
||||
var_dump(glob("$path/*/nothere"));
|
||||
var_dump(glob("$path/[aoeu]*.none"));
|
||||
var_dump(glob("$path/directly_not_exists"));
|
||||
|
||||
$b = ini_get('open_basedir');
|
||||
var_dump(empty($b));
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
array(0) {
|
||||
}
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
bool(true)
|
||||
==DONE==
|
||||
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test glob() function: ensure no platform difference, variation 2
|
||||
--FILE--
|
||||
<?php
|
||||
$path = dirname(__FILE__);
|
||||
|
||||
ini_set('open_basedir', $path);
|
||||
|
||||
var_dump(glob("$path/*.none"));
|
||||
var_dump(glob("$path/?.none"));
|
||||
var_dump(glob("$path/*{hello,world}.none"));
|
||||
var_dump(glob("$path/*/nothere"));
|
||||
var_dump(glob("$path/[aoeu]*.none"));
|
||||
var_dump(glob("$path/directly_not_exists"));
|
||||
|
||||
var_dump($path == ini_get('open_basedir'));
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
bool(true)
|
||||
==DONE==
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Test glob() function: ensure no platform difference, variation 3
|
||||
--SKIPIF--
|
||||
<?php if( substr(PHP_OS, 0, 3) == "WIN" ) {die('skip not valid on Windows');} ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$path = dirname(__FILE__);
|
||||
|
||||
ini_set('open_basedir', '/tmp');
|
||||
|
||||
var_dump(glob("$path/*.none"));
|
||||
var_dump(glob("$path/?.none"));
|
||||
var_dump(glob("$path/*{hello,world}.none"));
|
||||
var_dump(glob("$path/*/nothere"));
|
||||
var_dump(glob("$path/[aoeu]*.none"));
|
||||
var_dump(glob("$path/directly_not_exists"));
|
||||
|
||||
var_dump('/tmp' == ini_get('open_basedir'));
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
==DONE==
|
||||
@@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
Test glob() function: ensure no platform difference, variation 4
|
||||
--SKIPIF--
|
||||
<?php if( substr(PHP_OS, 0, 3) != "WIN" ) {die('skip only valid on Windows');} ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$path = dirname(__FILE__);
|
||||
|
||||
ini_set('open_basedir', 'c:\\windows');
|
||||
|
||||
var_dump(glob("$path/*.none"));
|
||||
var_dump(glob("$path/?.none"));
|
||||
var_dump(glob("$path/*{hello,world}.none"));
|
||||
var_dump(glob("$path/*/nothere"));
|
||||
var_dump(glob("$path/[aoeu]*.none"));
|
||||
var_dump(glob("$path/directly_not_exists"));
|
||||
|
||||
var_dump('c:\\windows' == ini_get('open_basedir'));
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
bool(true)
|
||||
==DONE==
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #68044 Integer overflow in unserialize() (32-bits only)
|
||||
--FILE--
|
||||
<?php
|
||||
echo unserialize('C:3:"XYZ":18446744075857035259:{}');
|
||||
?>
|
||||
===DONE==
|
||||
--EXPECTF--
|
||||
Warning: Insufficient data for unserializing - %d required, 1 present in %s/bug68044.php on line 2
|
||||
|
||||
Notice: unserialize(): Error at offset 32 of 33 bytes in %s/bug68044.php on line 2
|
||||
===DONE==
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Test dirname() function : basic funtionality
|
||||
Test dirname() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: string dirname ( string $path );
|
||||
|
||||
@@ -18,7 +18,7 @@ echo "\n-- Testing ucwords() function with more than expected no. of arguments -
|
||||
$str = 'string_val';
|
||||
$extra_arg = 10;
|
||||
|
||||
var_dump( ucwords($str, $extra_arg) );
|
||||
var_dump( ucwords($str, $extra_arg, $extra_arg) );
|
||||
|
||||
// check if there were any changes made to $str
|
||||
var_dump($str);
|
||||
@@ -30,12 +30,12 @@ echo "Done\n";
|
||||
|
||||
-- Testing ucwords() function with Zero arguments --
|
||||
|
||||
Warning: ucwords() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
Warning: ucwords() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ucwords() function with more than expected no. of arguments --
|
||||
|
||||
Warning: ucwords() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
Warning: ucwords() expects at most 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
string(10) "string_val"
|
||||
Done
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Test ucwords() function : usage variations - custom delimiters
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string ucwords ( string $str )
|
||||
* Description: Uppercase the first character of each word in a string
|
||||
* Source code: ext/standard/string.c
|
||||
*/
|
||||
|
||||
echo "*** Testing ucwords() : usage variations ***\n";
|
||||
|
||||
var_dump(ucwords('testing-dashed-words', '-'));
|
||||
var_dump(ucwords('test(braced)words', '()'));
|
||||
var_dump(ucwords('testing empty delimiters', ''));
|
||||
var_dump(ucwords('testing ranges', 'a..e'));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing ucwords() : usage variations ***
|
||||
string(%d) "Testing-Dashed-Words"
|
||||
string(%d) "Test(Braced)Words"
|
||||
string(%d) "Testing empty delimiters"
|
||||
string(%d) "TeSting raNgeS"
|
||||
Done
|
||||
Loaded 100 of 132 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user