mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-13 04:00:50 +00:00
Compare commits
182
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c927f3fd2 | ||
|
|
fafaf7eb42 | ||
|
|
4dd99a77c7 | ||
|
|
4baf4964ad | ||
|
|
b5d0eb44c0 | ||
|
|
682d0f8325 | ||
|
|
9e56a3373e | ||
|
|
4ba1fc0a11 | ||
|
|
91954c24da | ||
|
|
28b89afca1 | ||
|
|
57eb25b393 | ||
|
|
d7b060e995 | ||
|
|
3d497f884f | ||
|
|
a370e7d0ad | ||
|
|
338802b543 | ||
|
|
fc296a27db | ||
|
|
37652336c7 | ||
|
|
d2b04c1749 | ||
|
|
bdd67d8175 | ||
|
|
f396d297aa | ||
|
|
a2c0f8722b | ||
|
|
f68662f63f | ||
|
|
eceb34073b | ||
|
|
7c2cc9aa56 | ||
|
|
9cbe1283f7 | ||
|
|
c26902911f | ||
|
|
842bec5b3c | ||
|
|
c614dd677c | ||
|
|
cc1fb02760 | ||
|
|
294fb83ee8 | ||
|
|
6bf681249f | ||
|
|
ab6c45f524 | ||
|
|
a747db872f | ||
|
|
be02b2e8fd | ||
|
|
bc1ecd5d7f | ||
|
|
3bb218a0a7 | ||
|
|
3691b6d245 | ||
|
|
3bc4a63fc2 | ||
|
|
83685b5258 | ||
|
|
d77ac7b3dc | ||
|
|
922f1a0dcf | ||
|
|
05a4fec761 | ||
|
|
19ab91781e | ||
|
|
aed32f2a03 | ||
|
|
49511a5132 | ||
|
|
f56eeb1779 | ||
|
|
68a77fe3d8 | ||
|
|
cba6055cac | ||
|
|
81f23057dc | ||
|
|
9fe7250e5c | ||
|
|
af80ff25f6 | ||
|
|
1b89522974 | ||
|
|
e28516bb91 | ||
|
|
df45faf446 | ||
|
|
4415dab25e | ||
|
|
609afc2992 | ||
|
|
788717d56d | ||
|
|
6623f3caca | ||
|
|
024f3ac160 | ||
|
|
c1de84014d | ||
|
|
23b057742e | ||
|
|
87a9536bda | ||
|
|
be50a72715 | ||
|
|
fa70b91a4f | ||
|
|
90d863898c | ||
|
|
cfdd828163 | ||
|
|
b323e1e8d0 | ||
|
|
28c6125053 | ||
|
|
7a2c9585c4 | ||
|
|
c0a389a927 | ||
|
|
21f8cd2a92 | ||
|
|
0f724453c0 | ||
|
|
64d2978546 | ||
|
|
9459b45e2b | ||
|
|
e58690a26d | ||
|
|
2476fb76a7 | ||
|
|
edec566d9b | ||
|
|
03740ef7df | ||
|
|
08addfea86 | ||
|
|
f1f39d7ed7 | ||
|
|
870d893d0b | ||
|
|
fcf78dfb89 | ||
|
|
742783c3ee | ||
|
|
a6b8651d94 | ||
|
|
f26172f934 | ||
|
|
accf5ed621 | ||
|
|
7fde2243a7 | ||
|
|
cd0a37994e | ||
|
|
7bcda659f8 | ||
|
|
2677d43850 | ||
|
|
1ccc4ff260 | ||
|
|
7fb7869e13 | ||
|
|
58339f37e5 | ||
|
|
6e703c957e | ||
|
|
c1729272b1 | ||
|
|
fd5a453cb9 | ||
|
|
709e4e4f17 | ||
|
|
7881e92c24 | ||
|
|
5fee4e7108 | ||
|
|
7353dae815 | ||
|
|
20849b0b0f | ||
|
|
efb86aef12 | ||
|
|
314b8ecf8b | ||
|
|
e29c946c29 | ||
|
|
7e176ddb57 | ||
|
|
8754d44167 | ||
|
|
6922cae4ae | ||
|
|
6e1980e152 | ||
|
|
8f43ec1e83 | ||
|
|
b9bf9ddce6 | ||
|
|
1c3d5659bd | ||
|
|
6644bd005f | ||
|
|
36946f5c45 | ||
|
|
32a728d351 | ||
|
|
10661e28d1 | ||
|
|
5fb01a3a42 | ||
|
|
cdd9eb8c4a | ||
|
|
70b2fca220 | ||
|
|
2527a0fcfd | ||
|
|
7ad0595712 | ||
|
|
cf2fc66b02 | ||
|
|
73a8f72617 | ||
|
|
4c542e6c13 | ||
|
|
b0da1745be | ||
|
|
41d2102c77 | ||
|
|
4c448334bd | ||
|
|
3257d22fea | ||
|
|
4aa5065bb0 | ||
|
|
837ed71c65 | ||
|
|
acd4264f7b | ||
|
|
ca103b415e | ||
|
|
04c4854fdf | ||
|
|
a158fb958f | ||
|
|
64c88c1e16 | ||
|
|
eb7fca9546 | ||
|
|
a879f4dd22 | ||
|
|
8c92442b49 | ||
|
|
2cdde35d0f | ||
|
|
1f2f2c6b96 | ||
|
|
56abfd2798 | ||
|
|
e20baee136 | ||
|
|
dd0fb4fd9b | ||
|
|
dc3f4f7342 | ||
|
|
859f7fce1f | ||
|
|
9cc74ba229 | ||
|
|
45a05f3841 | ||
|
|
0b9a540dd7 | ||
|
|
f4777c6a51 | ||
|
|
935625f1b8 | ||
|
|
fab7d9f577 | ||
|
|
a3e3d914ed | ||
|
|
fa07b8bbb7 | ||
|
|
86e9965c87 | ||
|
|
4d5edcb4ac | ||
|
|
eceecb6900 | ||
|
|
c8a90606c1 | ||
|
|
8cbb381068 | ||
|
|
6b092bcaae | ||
|
|
b4b14d2106 | ||
|
|
68ab719baa | ||
|
|
45a3c0e596 | ||
|
|
6680d5f875 | ||
|
|
b9c3c1441a | ||
|
|
169a98319a | ||
|
|
8d91e82871 | ||
|
|
0f557756dd | ||
|
|
827abb843f | ||
|
|
18db1ce211 | ||
|
|
fd0fc20d35 | ||
|
|
db8bcdba80 | ||
|
|
c00f5e6531 | ||
|
|
ffae3fb25d | ||
|
|
fa59dc550d | ||
|
|
b71a503844 | ||
|
|
9286681bac | ||
|
|
91996e7ee5 | ||
|
|
0872e80dd8 | ||
|
|
41c69766a4 | ||
|
|
91a0a10f71 | ||
|
|
19592519c2 | ||
|
|
0ba49597b9 | ||
|
|
74988eed99 |
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ environment:
|
||||
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
|
||||
PHP_BUILD_OBJ_DIR: c:\obj
|
||||
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
|
||||
PHP_BUILD_SDK_BRANCH: php-sdk-2.1.7
|
||||
PHP_BUILD_SDK_BRANCH: php-sdk-2.1.9beta1
|
||||
PHP_BUILD_CRT: vc15
|
||||
# ext and env setup for tests
|
||||
#MYSQL_TEST_PASSWD: Password12!
|
||||
|
||||
@@ -191,6 +191,7 @@ sapi/fpm/fpm/php-cgi
|
||||
sapi/phpdbg/phpdbg_parser.c
|
||||
sapi/phpdbg/phpdbg_parser.h
|
||||
sapi/phpdbg/phpdbg
|
||||
sapi/phpdbg/phpdbg.1
|
||||
scripts/php-config
|
||||
scripts/phpize
|
||||
scripts/man1/*.1
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ distclean: clean
|
||||
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
|
||||
rm -f php7.spec main/build-defs.h scripts/phpize
|
||||
rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
|
||||
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 ext/phar/phar.1 ext/phar/phar.phar.1
|
||||
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 sapi/phpdbg/phpdbg.1 ext/phar/phar.1 ext/phar/phar.phar.1
|
||||
rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html
|
||||
rm -f ext/iconv/php_have_bsd_iconv.h ext/iconv/php_have_glibc_iconv.h ext/iconv/php_have_ibm_iconv.h ext/iconv/php_have_iconv.h ext/iconv/php_have_libiconv.h ext/iconv/php_iconv_aliased_libiconv.h ext/iconv/php_iconv_supports_errno.h ext/iconv/php_php_iconv_h_path.h ext/iconv/php_php_iconv_impl.h
|
||||
rm -f ext/phar/phar.phar ext/phar/phar.php
|
||||
|
||||
@@ -1,6 +1,114 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2018, PHP 7.2.9
|
||||
11 Oct 2018, PHP 7.2.11
|
||||
|
||||
- Core:
|
||||
. Fixed bug #76800 (foreach inconsistent if array modified during loop).
|
||||
(Dmitry)
|
||||
. Fixed bug #76901 (method_exists on SPL iterator passthrough method corrupts
|
||||
memory). (Nikita)
|
||||
|
||||
- CURL:
|
||||
. Fixed bug #76480 (Use curl_multi_wait() so that timeouts are respected).
|
||||
(Pierrick)
|
||||
|
||||
- iconv:
|
||||
. Fixed bug #66828 (iconv_mime_encode Q-encoding longer than it should be).
|
||||
(cmb)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #76832 (ZendOPcache.MemoryBase periodically deleted by the OS).
|
||||
(Anatol)
|
||||
. Fixed bug #76796 (Compile-time evaluation of disabled function in opcache
|
||||
causes segfault). (Nikita)
|
||||
|
||||
- POSIX:
|
||||
. Fixed bug #75696 (posix_getgrnam fails to print details of group). (cmb)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #74454 (Wrong exception being thrown when using ReflectionMethod).
|
||||
(cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #73457 (Wrong error message when fopen FTP wrapped fails to open
|
||||
data connection). (Ville Hukkamäki)
|
||||
. Fixed bug #74764 (Bindto IPv6 works with file_get_contents but fails with
|
||||
stream_socket_client). (Ville Hukkamäki)
|
||||
. Fixed bug #75533 (array_reduce is slow when $carry is large array).
|
||||
(Manabu Matsui)
|
||||
|
||||
- XMLRPC:
|
||||
. Fixed bug #76886 (Can't build xmlrpc with expat). (Thomas Petazzoni, cmb)
|
||||
|
||||
- Zlib:
|
||||
. Fixed bug #75273 (php_zlib_inflate_filter() may not update bytes_consumed).
|
||||
(Martin Burke, cmb)
|
||||
|
||||
13 Sep 2018, PHP 7.2.10
|
||||
|
||||
- Core:
|
||||
. Fixed bug #76754 (parent private constant in extends class memory leak).
|
||||
(Laruence)
|
||||
. Fixed bug #72443 (Generate enabled extension). (petk)
|
||||
. Fixed bug #75797 (Memory leak when using class_alias() in non-debug mode).
|
||||
(Massimiliano Braglia)
|
||||
|
||||
- Apache2:
|
||||
. Fixed bug #76582 (Apache bucket brigade sometimes becomes invalid). (stas)
|
||||
|
||||
- Bz2:
|
||||
. Fixed arginfo for bzcompress. (Tyson Andre)
|
||||
|
||||
- gettext:
|
||||
. Fixed bug #76517 (incorrect restoring of LDFLAGS). (sji)
|
||||
|
||||
- iconv:
|
||||
. Fixed bug #68180 (iconv_mime_decode can return extra characters in a
|
||||
header). (cmb)
|
||||
. Fixed bug #63839 (iconv_mime_decode_headers function is skipping headers).
|
||||
(cmb)
|
||||
. Fixed bug #60494 (iconv_mime_decode does ignore special characters). (cmb)
|
||||
. Fixed bug #55146 (iconv_mime_decode_headers() skips some headers). (cmb)
|
||||
|
||||
- intl:
|
||||
. Fixed bug #74484 (MessageFormatter::formatMessage memory corruption with
|
||||
11+ named placeholders). (Anatol)
|
||||
|
||||
- libxml:
|
||||
. Fixed bug #76777 ("public id" parameter of libxml_set_external_entity_loader
|
||||
callback undefined). (Ville Hukkamäki)
|
||||
|
||||
- mbstring:
|
||||
. Fixed bug #76704 (mb_detect_order return value varies based on argument
|
||||
type). (cmb)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #76747 (Opcache treats path containing "test.pharma.tld" as a phar
|
||||
file). (Laruence)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #76705 (unusable ssl => peer_fingerprint in
|
||||
stream_context_create()). (Jakub Zelenka)
|
||||
|
||||
- phpdbg:
|
||||
. Fixed bug #76595 (phpdbg man page contains outdated information).
|
||||
(Kevin Abel)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #68825 (Exception in DirectoryIterator::getLinkTarget()). (cmb)
|
||||
. Fixed bug #68175 (RegexIterator pregFlags are NULL instead of 0). (Tim
|
||||
Siebels)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #76778 (array_reduce leaks memory if callback throws exception).
|
||||
(cmb)
|
||||
|
||||
- zlib:
|
||||
. Fixed bug #65988 (Zlib version check fails when an include/zlib/ style dir
|
||||
is passed to the --with-zlib configure option). (Jay Bonci)
|
||||
. Fixed bug #76709 (Minimal required zlib library is 1.2.0.4). (petk)
|
||||
|
||||
16 Aug 2018, PHP 7.2.9
|
||||
|
||||
- Calendar:
|
||||
. Fixed bug #52974 (jewish.c: compile error under Windows with GBK charset).
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #76754 (parent private constant in extends class memory leak)
|
||||
--INI--
|
||||
opcache.enable=0
|
||||
opcache.enable_cli=0
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class FOO
|
||||
{
|
||||
private const FOO = 'BAR';
|
||||
}
|
||||
|
||||
class BAR extends FOO { }
|
||||
?>
|
||||
okey
|
||||
--EXPECT--
|
||||
okey
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #76800 (foreach inconsistent if array modified during loop)
|
||||
--FILE--
|
||||
<?php
|
||||
$arr = [1 => 1, 3 => 3]; // [1 => 1, 2 => 3] will print both keys
|
||||
foreach($arr as $key => &$val) { // without & will print both keys
|
||||
echo "See key {$key}\n";
|
||||
$arr[0] = 0; // without this line will print both keys
|
||||
unset($arr[0]);
|
||||
}
|
||||
--EXPECT--
|
||||
See key 1
|
||||
See key 3
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #76901: method_exists on SPL iterator passthrough method corrupts memory
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$it = new ArrayIterator([1, 2, 3]);
|
||||
$it = new IteratorIterator($it);
|
||||
foreach ($it as $v) {
|
||||
if (method_exists($it, 'offsetGet')) {
|
||||
var_dump($it->offsetGet(0));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
+5
-2
@@ -2774,12 +2774,15 @@ ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *or
|
||||
ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce) /* {{{ */
|
||||
{
|
||||
zend_string *lcname;
|
||||
int persistent;
|
||||
|
||||
persistent = ce->type != ZEND_USER_CLASS;
|
||||
|
||||
if (name[0] == '\\') {
|
||||
lcname = zend_string_alloc(name_len-1, 1);
|
||||
lcname = zend_string_alloc(name_len-1, persistent);
|
||||
zend_str_tolower_copy(ZSTR_VAL(lcname), name+1, name_len-1);
|
||||
} else {
|
||||
lcname = zend_string_alloc(name_len, 1);
|
||||
lcname = zend_string_alloc(name_len, persistent);
|
||||
zend_str_tolower_copy(ZSTR_VAL(lcname), name, name_len);
|
||||
}
|
||||
|
||||
|
||||
@@ -1294,13 +1294,10 @@ ZEND_FUNCTION(method_exists)
|
||||
if (zend_hash_exists(&ce->function_table, lcname)) {
|
||||
zend_string_release(lcname);
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
union _zend_function *func = NULL;
|
||||
|
||||
if (Z_TYPE_P(klass) == IS_OBJECT
|
||||
&& Z_OBJ_HT_P(klass)->get_method != NULL
|
||||
&& (func = Z_OBJ_HT_P(klass)->get_method(&Z_OBJ_P(klass), method_name, NULL)) != NULL
|
||||
) {
|
||||
} else if (Z_TYPE_P(klass) == IS_OBJECT && Z_OBJ_HT_P(klass)->get_method != NULL) {
|
||||
zend_object *obj = Z_OBJ_P(klass);
|
||||
zend_function *func = Z_OBJ_HT_P(klass)->get_method(&obj, method_name, NULL);
|
||||
if (func != NULL) {
|
||||
if (func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
|
||||
/* Returns true to the fake Closure's __invoke */
|
||||
RETVAL_BOOL(func->common.scope == zend_ce_closure
|
||||
|
||||
+5
-3
@@ -932,9 +932,11 @@ ZEND_API int ZEND_FASTCALL zend_hash_rehash(HashTable *ht)
|
||||
if (UNEXPECTED(ht->nInternalPointer == i)) {
|
||||
ht->nInternalPointer = j;
|
||||
}
|
||||
if (UNEXPECTED(i == iter_pos)) {
|
||||
zend_hash_iterators_update(ht, i, j);
|
||||
iter_pos = zend_hash_iterators_lower_pos(ht, iter_pos + 1);
|
||||
if (UNEXPECTED(i >= iter_pos)) {
|
||||
do {
|
||||
zend_hash_iterators_update(ht, iter_pos, j);
|
||||
iter_pos = zend_hash_iterators_lower_pos(ht, iter_pos + 1);
|
||||
} while (iter_pos < i);
|
||||
}
|
||||
q++;
|
||||
j++;
|
||||
|
||||
@@ -1210,9 +1210,14 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
|
||||
}
|
||||
|
||||
function_add_ref(fn);
|
||||
new_fn = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
|
||||
memcpy(new_fn, fn, sizeof(zend_op_array));
|
||||
new_fn->common.fn_flags |= ZEND_ACC_ARENA_ALLOCATED;
|
||||
if (UNEXPECTED(fn->type == ZEND_INTERNAL_FUNCTION)) {
|
||||
new_fn = zend_arena_alloc(&CG(arena), sizeof(zend_internal_function));
|
||||
memcpy(new_fn, fn, sizeof(zend_internal_function));
|
||||
new_fn->common.fn_flags |= ZEND_ACC_ARENA_ALLOCATED;
|
||||
} else {
|
||||
new_fn = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
|
||||
memcpy(new_fn, fn, sizeof(zend_op_array));
|
||||
}
|
||||
fn = zend_hash_update_ptr(&ce->function_table, key, new_fn);
|
||||
zend_add_magic_methods(ce, key, fn);
|
||||
}
|
||||
|
||||
+1
-1
@@ -297,8 +297,8 @@ ZEND_API void destroy_zend_class(zval *zv)
|
||||
}
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
zend_hash_destroy(&ce->constants_table);
|
||||
}
|
||||
zend_hash_destroy(&ce->constants_table);
|
||||
if (ce->num_interfaces > 0 && ce->interfaces) {
|
||||
efree(ce->interfaces);
|
||||
}
|
||||
|
||||
@@ -3108,7 +3108,7 @@ ZEND_API zend_long ZEND_FASTCALL zend_dval_to_lval_slow(double d)
|
||||
if (dmod < 0) {
|
||||
/* we're going to make this number positive; call ceil()
|
||||
* to simulate rounding towards 0 of the negative number */
|
||||
dmod = ceil(dmod);// + two_pow_32;
|
||||
dmod = ceil(dmod) + two_pow_32;
|
||||
}
|
||||
return (zend_long)(zend_ulong)dmod;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,18 @@ if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw-w64 >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q C:\msys64 >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-Win32 >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-Win64 >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-v11-Win32 >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-v11-Win64 >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
if "%APPVEYOR%" equ "True" del /f /q C:\Windows\System32\libcrypto-1_1-x64.dll >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
if "%APPVEYOR%" equ "True" del /f /q C:\Windows\System32\libssl-1_1-x64.dll >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
cd /D %APPVEYOR_BUILD_FOLDER%
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
+2
-2
@@ -107,8 +107,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=7
|
||||
PHP_MINOR_VERSION=2
|
||||
PHP_RELEASE_VERSION=9
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=11
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_bzerror, 0)
|
||||
ZEND_ARG_INFO(0, bz)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_bzcompress, 0, 0, 2)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_bzcompress, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, source)
|
||||
ZEND_ARG_INFO(0, blocksize)
|
||||
ZEND_ARG_INFO(0, workfactor)
|
||||
|
||||
@@ -82,7 +82,7 @@ static void com_iter_get_key(zend_object_iterator *iter, zval *key)
|
||||
}
|
||||
}
|
||||
|
||||
static int com_iter_move_forwards(zend_object_iterator *iter)
|
||||
static void com_iter_move_forwards(zend_object_iterator *iter)
|
||||
{
|
||||
struct php_com_iterator *I = (struct php_com_iterator*)Z_PTR(iter->data);
|
||||
unsigned long n_fetched;
|
||||
@@ -103,18 +103,18 @@ static int com_iter_move_forwards(zend_object_iterator *iter)
|
||||
} else {
|
||||
/* indicate that there are no more items */
|
||||
I->key = (ulong)-1;
|
||||
return FAILURE;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
/* safe array */
|
||||
if (I->key >= (ULONG) I->sa_max) {
|
||||
I->key = (ulong)-1;
|
||||
return FAILURE;
|
||||
return;
|
||||
}
|
||||
I->key++;
|
||||
if (php_com_safearray_get_elem(&I->safe_array, &I->v, (LONG)I->key) == 0) {
|
||||
I->key = (ulong)-1;
|
||||
return FAILURE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,6 @@ static int com_iter_move_forwards(zend_object_iterator *iter)
|
||||
php_com_zval_from_variant(&ptr, &I->v, I->code_page);
|
||||
/* php_com_wrap_variant(ptr, &I->v, I->code_page); */
|
||||
ZVAL_COPY_VALUE(&I->zdata, &ptr);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -514,15 +514,13 @@ static void saproxy_iter_get_key(zend_object_iterator *iter, zval *key)
|
||||
}
|
||||
}
|
||||
|
||||
static int saproxy_iter_move_forwards(zend_object_iterator *iter)
|
||||
static void saproxy_iter_move_forwards(zend_object_iterator *iter)
|
||||
{
|
||||
php_com_saproxy_iter *I = (php_com_saproxy_iter*)Z_PTR(iter->data);
|
||||
|
||||
if (++I->key >= I->imax) {
|
||||
I->key = -1;
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static zend_object_iterator_funcs saproxy_iter_funcs = {
|
||||
|
||||
@@ -223,9 +223,9 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa
|
||||
}
|
||||
|
||||
/* Type-library stuff */
|
||||
void php_com_typelibrary_dtor(void *pDest)
|
||||
void php_com_typelibrary_dtor(zval *pDest)
|
||||
{
|
||||
ITypeLib **Lib = (ITypeLib**)pDest;
|
||||
ITypeLib **Lib = (ITypeLib**)Z_PTR_P(pDest);
|
||||
ITypeLib_Release(*Lib);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string,
|
||||
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codepage);
|
||||
PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode,
|
||||
int codepage);
|
||||
void php_com_typelibrary_dtor(void *pDest);
|
||||
void php_com_typelibrary_dtor(zval *pDest);
|
||||
ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj, char *dispname, int sink);
|
||||
int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid, int codepage);
|
||||
|
||||
|
||||
+16
-1
@@ -4,13 +4,28 @@
|
||||
ARG_WITH("curl", "cURL support", "no");
|
||||
|
||||
if (PHP_CURL != "no") {
|
||||
var ver_num = NaN;
|
||||
var f = PHP_PHP_BUILD + "/include/curl/curlver.h";
|
||||
if (FSO.FileExists(f)) {
|
||||
var reg = /LIBCURL_VERSION_NUM\s+(0x[a-z0-9]+)/gi;
|
||||
var m = reg.exec(file_get_contents(PHP_PHP_BUILD + "/include/curl/curlver.h"));
|
||||
if (!!m && m.length >= 2) {
|
||||
ver_num = parseInt(m[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if (CHECK_LIB("libcurl_a.lib;libcurl.lib", "curl", PHP_CURL) &&
|
||||
CHECK_HEADER_ADD_INCLUDE("curl/easy.h", "CFLAGS_CURL") &&
|
||||
SETUP_OPENSSL("curl", PHP_CURL) > 0 &&
|
||||
CHECK_LIB("winmm.lib", "curl", PHP_CURL) &&
|
||||
CHECK_LIB("wldap32.lib", "curl", PHP_CURL) &&
|
||||
(((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "curl", PHP_CURL))) ||
|
||||
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "curl", PHP_CURL)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED)))
|
||||
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "curl", PHP_CURL)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) &&
|
||||
!isNaN(ver_num) &&
|
||||
(ver_num <= parseInt("0x073b00") || ver_num > parseInt("0x073b00") &&
|
||||
CHECK_LIB("normaliz.lib", "curl", PHP_CURL) &&
|
||||
CHECK_LIB("libssh2.lib", "curl", PHP_CURL) &&
|
||||
CHECK_LIB("nghttp2.lib", "curl", PHP_CURL))
|
||||
) {
|
||||
EXTENSION("curl", "interface.c multi.c share.c curl_file.c");
|
||||
AC_DEFINE('HAVE_CURL', 1, 'Have cURL library');
|
||||
|
||||
+17
-1
@@ -192,6 +192,7 @@ PHP_FUNCTION(curl_multi_remove_handle)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if LIBCURL_VERSION_NUM < 0x071c00
|
||||
static void _make_timeval_struct(struct timeval *to, double timeout) /* {{{ */
|
||||
{
|
||||
unsigned long conv;
|
||||
@@ -201,6 +202,7 @@ static void _make_timeval_struct(struct timeval *to, double timeout) /* {{{ */
|
||||
to->tv_usec = conv % 1000000;
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
/* {{{ proto int curl_multi_select(resource mh[, double timeout])
|
||||
Get all the sockets associated with the cURL extension, which can then be "selected" */
|
||||
@@ -208,12 +210,16 @@ PHP_FUNCTION(curl_multi_select)
|
||||
{
|
||||
zval *z_mh;
|
||||
php_curlm *mh;
|
||||
double timeout = 1.0;
|
||||
#if LIBCURL_VERSION_NUM >= 0x071c00 /* Available since 7.28.0 */
|
||||
int numfds = 0;
|
||||
#else
|
||||
fd_set readfds;
|
||||
fd_set writefds;
|
||||
fd_set exceptfds;
|
||||
int maxfd;
|
||||
double timeout = 1.0;
|
||||
struct timeval to;
|
||||
#endif
|
||||
CURLMcode error = CURLM_OK;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1,2)
|
||||
@@ -226,6 +232,15 @@ PHP_FUNCTION(curl_multi_select)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x071c00 /* Available since 7.28.0 */
|
||||
error = curl_multi_wait(mh->multi, NULL, 0, (unsigned long) timeout * 1000.0, &numfds);
|
||||
if (CURLM_OK != error) {
|
||||
SAVE_CURLM_ERROR(mh, error);
|
||||
RETURN_LONG(-1);
|
||||
}
|
||||
|
||||
RETURN_LONG(numfds);
|
||||
#else
|
||||
_make_timeval_struct(&to, timeout);
|
||||
|
||||
FD_ZERO(&readfds);
|
||||
@@ -239,6 +254,7 @@ PHP_FUNCTION(curl_multi_select)
|
||||
RETURN_LONG(-1);
|
||||
}
|
||||
RETURN_LONG(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to));
|
||||
#endif
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+3
-3
@@ -120,9 +120,9 @@ dnl [ --with-$extname Include $extname support])
|
||||
|
||||
dnl Otherwise use enable:
|
||||
|
||||
dnl PHP_ARG_ENABLE($extname, whether to enable $extname support,
|
||||
PHP_ARG_ENABLE($extname, whether to enable $extname support,
|
||||
dnl Make sure that the comment is aligned:
|
||||
dnl [ --enable-$extname Enable $extname support])
|
||||
[ --enable-$extname Enable $extname support])
|
||||
|
||||
if test "\$PHP_$EXTNAME" != "no"; then
|
||||
dnl Write more examples of tests here...
|
||||
@@ -197,7 +197,7 @@ cat >config.w32 <<eof
|
||||
// ARG_WITH("$extname", "for $extname support", "no");
|
||||
|
||||
// Otherwise, use ARG_ENABLE
|
||||
// ARG_ENABLE("$extname", "enable $extname support", "no");
|
||||
ARG_ENABLE("$extname", "enable $extname support", "no");
|
||||
|
||||
if (PHP_$EXTNAME != "no") {
|
||||
EXTENSION("$extname", "$extname.c", PHP_EXTNAME_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
|
||||
+30
-18
@@ -356,7 +356,7 @@ if ($pid) {
|
||||
fputs($s, "550 No file named \"{$matches [1]}\"\r\n");
|
||||
break;
|
||||
}
|
||||
}elseif (preg_match('/^RETR ([\w\h]+)/', $buf, $matches)) {
|
||||
}elseif (preg_match('/^RETR ([\/]*[\w\h]+)/', $buf, $matches)) {
|
||||
if(!empty($pasv)){
|
||||
;
|
||||
}
|
||||
@@ -412,6 +412,10 @@ if ($pid) {
|
||||
fputs($fs, "This is line $i of the test data.\n");
|
||||
}
|
||||
fputs($s, "226 Closing data Connection.\r\n");
|
||||
break;
|
||||
case "/bug73457":
|
||||
fputs($s, "150 File status okay; about to open data connection.\r\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
fputs($s, "550 {$matches[1]}: No such file or directory \r\n");
|
||||
@@ -426,29 +430,35 @@ if ($pid) {
|
||||
$host = "127.0.0.1";
|
||||
$i=0;
|
||||
|
||||
do {
|
||||
if (!empty($ssl)) {
|
||||
$soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
|
||||
} else {
|
||||
$soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port");
|
||||
}
|
||||
/* Could bind port, Try another port */
|
||||
if (!$soc) {
|
||||
$pasv_port = rand(50000, 65535);
|
||||
}
|
||||
$i++;
|
||||
} while ($i<10 && !$soc);
|
||||
if (empty($bug73457)) {
|
||||
do {
|
||||
if (!empty($ssl)) {
|
||||
$soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
|
||||
} else {
|
||||
$soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port");
|
||||
}
|
||||
/* Could bind port, Try another port */
|
||||
if (!$soc) {
|
||||
$pasv_port = rand(50000, 65535);
|
||||
}
|
||||
$i++;
|
||||
} while ($i<10 && !$soc);
|
||||
|
||||
if (!$soc) {
|
||||
echo "$errstr ($errno)\n";
|
||||
die("could not bind passive port\n");
|
||||
if (!$soc) {
|
||||
echo "$errstr ($errno)\n";
|
||||
die("could not bind passive port\n");
|
||||
}
|
||||
} else {
|
||||
$pasv_port=1234;
|
||||
}
|
||||
|
||||
$p2 = $pasv_port % ((int) 1 << 8);
|
||||
$p1 = ($pasv_port-$p2)/((int) 1 << 8);
|
||||
fputs($s, "227 Entering Passive Mode. (127,0,0,1,{$p1},{$p2})\r\n");
|
||||
|
||||
$pasvs = stream_socket_accept($soc,10);
|
||||
if (empty($bug73457)) {
|
||||
$pasvs = stream_socket_accept($soc,10);
|
||||
}
|
||||
|
||||
} elseif (preg_match('/^EPSV/', $buf, $matches)) {
|
||||
fputs($s, "550 Extended passsive mode not supported.\r\n");
|
||||
@@ -518,7 +528,9 @@ if ($pid) {
|
||||
|
||||
fputs($s, "226 Closing data Connection.\r\n");
|
||||
fclose($fs);
|
||||
}else {
|
||||
}elseif (preg_match('/^SIZE \/bug73457/', $buf)) {
|
||||
fputs($s, "213 10\r\n");
|
||||
}else {
|
||||
fputs($s, "500 Syntax error, command unrecognized.\r\n");
|
||||
dump_and_exit($buf);
|
||||
}
|
||||
|
||||
@@ -35,10 +35,6 @@ if test "$PHP_GETTEXT" != "no"; then
|
||||
PHP_NEW_EXTENSION(gettext, gettext.c, $ext_shared)
|
||||
PHP_SUBST(GETTEXT_SHARED_LIBADD)
|
||||
|
||||
if test -n "$GETTEXT_LIBS"; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH($GETTEXT_LIBS, $GETTEXT_LIBDIR, GETTEXT_SHARED_LIBADD)
|
||||
fi
|
||||
|
||||
PHP_ADD_INCLUDE($GETTEXT_INCDIR)
|
||||
|
||||
AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, ngettext, [AC_DEFINE(HAVE_NGETTEXT, 1, [ ])])
|
||||
@@ -47,4 +43,7 @@ if test "$PHP_GETTEXT" != "no"; then
|
||||
AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, bind_textdomain_codeset, [AC_DEFINE(HAVE_BIND_TEXTDOMAIN_CODESET, 1, [ ])])
|
||||
LDFLAGS=$O_LDFLAGS
|
||||
|
||||
if test -n "$GETTEXT_LIBS"; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH($GETTEXT_LIBS, $GETTEXT_LIBDIR, GETTEXT_SHARED_LIBADD)
|
||||
fi
|
||||
fi
|
||||
+1
-1
@@ -1362,7 +1362,7 @@ ZEND_END_ARG_INFO()
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_update_file, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, context)
|
||||
ZEND_ARG_INFO(0, filename)
|
||||
ZEND_ARG_INFO(0, context)
|
||||
ZEND_ARG_INFO(0, stream_context)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_final, 0, 0, 1)
|
||||
|
||||
+28
-5
@@ -462,7 +462,7 @@ static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l,
|
||||
|
||||
if (in_p != NULL) {
|
||||
while (in_left > 0) {
|
||||
out_left = buf_growth - out_left;
|
||||
out_left = buf_growth;
|
||||
smart_str_alloc(d, out_left, 0);
|
||||
|
||||
out_p = ZSTR_VAL((d)->s) + ZSTR_LEN((d)->s);
|
||||
@@ -496,7 +496,7 @@ static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l,
|
||||
}
|
||||
} else {
|
||||
for (;;) {
|
||||
out_left = buf_growth - out_left;
|
||||
out_left = buf_growth;
|
||||
smart_str_alloc(d, out_left, 0);
|
||||
|
||||
out_p = ZSTR_VAL((d)->s) + ZSTR_LEN((d)->s);
|
||||
@@ -1358,7 +1358,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
|
||||
prev_in_left = ini_in_left = in_left;
|
||||
ini_in_p = in_p;
|
||||
|
||||
for (out_size = (char_cnt - 2) / 3; out_size > 0;) {
|
||||
for (out_size = (char_cnt - 2); out_size > 0;) {
|
||||
#if !ICONV_SUPPORTS_ERRNO
|
||||
size_t prev_out_left;
|
||||
#endif
|
||||
@@ -1422,7 +1422,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
|
||||
break;
|
||||
}
|
||||
|
||||
out_size -= ((nbytes_required - (char_cnt - 2)) + 1) / 3;
|
||||
out_size -= ((nbytes_required - (char_cnt - 2)) + 2) / 3;
|
||||
in_left = ini_in_left;
|
||||
in_p = ini_in_p;
|
||||
}
|
||||
@@ -1535,7 +1535,10 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
|
||||
break;
|
||||
|
||||
default: /* first letter of a non-encoded word */
|
||||
_php_iconv_appendc(pretval, *p1, cd_pl);
|
||||
err = _php_iconv_appendc(pretval, *p1, cd_pl);
|
||||
if (err != PHP_ICONV_ERR_SUCCESS) {
|
||||
goto out;
|
||||
}
|
||||
encoded_word = NULL;
|
||||
if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {
|
||||
scan_stat = 12;
|
||||
@@ -1546,6 +1549,9 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
|
||||
|
||||
case 1: /* expecting a delimiter */
|
||||
if (*p1 != '?') {
|
||||
if (*p1 == '\r' || *p1 == '\n') {
|
||||
--p1;
|
||||
}
|
||||
err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);
|
||||
if (err != PHP_ICONV_ERR_SUCCESS) {
|
||||
goto out;
|
||||
@@ -1571,6 +1577,23 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
|
||||
case '*': /* new style delimiter: locale id follows */
|
||||
scan_stat = 10;
|
||||
break;
|
||||
|
||||
case '\r': case '\n': /* not an encoded-word */
|
||||
--p1;
|
||||
_php_iconv_appendc(pretval, '=', cd_pl);
|
||||
_php_iconv_appendc(pretval, '?', cd_pl);
|
||||
err = _php_iconv_appendl(pretval, csname, (size_t)((p1 + 1) - csname), cd_pl);
|
||||
if (err != PHP_ICONV_ERR_SUCCESS) {
|
||||
goto out;
|
||||
}
|
||||
csname = NULL;
|
||||
if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {
|
||||
scan_stat = 12;
|
||||
}
|
||||
else {
|
||||
scan_stat = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (scan_stat != 2) {
|
||||
char tmpbuf[80];
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Bug #55146 (iconv_mime_decode_headers() skips some headers)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('iconv')) die('skip iconv extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$headers = <<< HEADERS
|
||||
X-Header-One: H4sIAAAAAAAAA+NgFlsCAAA=
|
||||
X-Header-Two: XtLePq6GTMn8G68F0
|
||||
HEADERS;
|
||||
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR));
|
||||
|
||||
$headers = <<< HEADERS
|
||||
X-Header-One: =
|
||||
X-Header-Two: XtLePq6GTMn8G68F0
|
||||
HEADERS;
|
||||
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_STRICT));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
["X-Header-One"]=>
|
||||
string(24) "H4sIAAAAAAAAA+NgFlsCAAA="
|
||||
["X-Header-Two"]=>
|
||||
string(17) "XtLePq6GTMn8G68F0"
|
||||
}
|
||||
array(2) {
|
||||
["X-Header-One"]=>
|
||||
string(1) "="
|
||||
["X-Header-Two"]=>
|
||||
string(17) "XtLePq6GTMn8G68F0"
|
||||
}
|
||||
===DONE===
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #60494 (iconv_mime_decode does ignore special characters)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('iconv')) die('skip iconv extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(iconv_mime_decode('ä'));
|
||||
var_dump(iconv_mime_decode('ö'));
|
||||
var_dump(iconv_mime_decode('ß'));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,71 @@
|
||||
--TEST--
|
||||
Bug #63839 (iconv_mime_decode_headers function is skipping headers)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('iconv')) die('skip iconv extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$headers = 'From: "xyz" <xyz@xyz.com>
|
||||
To: <xyz@xyz.com>
|
||||
Subject: Reply Is? white side-LED =? in Help
|
||||
Date: Sat, 22 Dec 2012
|
||||
Message-ID: <006f01cde00e$d9f79da0$8de6d8e0>
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/alternative;
|
||||
boundary="----=_NextPart_000_0070_01CDE03C.F3AFD9A0"
|
||||
X-Mailer: Microsoft Office Outlook 12.0
|
||||
Thread-Index: Ac3gDtcH2huHjzYcQVmFJPPoWjJogA==
|
||||
Content-Language: en-us
|
||||
|
||||
';
|
||||
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR));
|
||||
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_STRICT));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
array(10) {
|
||||
["From"]=>
|
||||
string(19) ""xyz" <xyz@xyz.com>"
|
||||
["To"]=>
|
||||
string(13) "<xyz@xyz.com>"
|
||||
["Subject"]=>
|
||||
string(35) "Reply Is? white side-LED =? in Help"
|
||||
["Date"]=>
|
||||
string(16) "Sat, 22 Dec 2012"
|
||||
["Message-ID"]=>
|
||||
string(32) "<006f01cde00e$d9f79da0$8de6d8e0>"
|
||||
["MIME-Version"]=>
|
||||
string(3) "1.0"
|
||||
["Content-Type"]=>
|
||||
string(75) "multipart/alternative; boundary="----=_NextPart_000_0070_01CDE03C.F3AFD9A0""
|
||||
["X-Mailer"]=>
|
||||
string(29) "Microsoft Office Outlook 12.0"
|
||||
["Thread-Index"]=>
|
||||
string(32) "Ac3gDtcH2huHjzYcQVmFJPPoWjJogA=="
|
||||
["Content-Language"]=>
|
||||
string(5) "en-us"
|
||||
}
|
||||
array(10) {
|
||||
["From"]=>
|
||||
string(19) ""xyz" <xyz@xyz.com>"
|
||||
["To"]=>
|
||||
string(13) "<xyz@xyz.com>"
|
||||
["Subject"]=>
|
||||
string(35) "Reply Is? white side-LED =? in Help"
|
||||
["Date"]=>
|
||||
string(16) "Sat, 22 Dec 2012"
|
||||
["Message-ID"]=>
|
||||
string(32) "<006f01cde00e$d9f79da0$8de6d8e0>"
|
||||
["MIME-Version"]=>
|
||||
string(3) "1.0"
|
||||
["Content-Type"]=>
|
||||
string(75) "multipart/alternative; boundary="----=_NextPart_000_0070_01CDE03C.F3AFD9A0""
|
||||
["X-Mailer"]=>
|
||||
string(29) "Microsoft Office Outlook 12.0"
|
||||
["Thread-Index"]=>
|
||||
string(32) "Ac3gDtcH2huHjzYcQVmFJPPoWjJogA=="
|
||||
["Content-Language"]=>
|
||||
string(5) "en-us"
|
||||
}
|
||||
===DONE===
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #66828 (iconv_mime_encode Q-encoding longer than it should be)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('iconv')) die('skip iconv extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$preferences = array(
|
||||
"input-charset" => "ISO-8859-1",
|
||||
"output-charset" => "UTF-8",
|
||||
"line-length" => 76,
|
||||
"line-break-chars" => "\n",
|
||||
"scheme" => "Q"
|
||||
);
|
||||
var_dump(iconv_mime_encode("Subject", "Test Test Test Test Test Test Test Test", $preferences));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
string(74) "Subject: =?UTF-8?Q?Test=20Test=20Test=20Test=20Test=20Test=20Test=20Test?="
|
||||
===DONE===
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #68180 (iconv_mime_decode can return extra characters in a header)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('iconv')) die('skip iconv extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$original = "=?UTF-8?Q?=E3=80=8E=E3=80=90=E5=A4=96=E8=B3=87=E7=B3=BB=E6=88=A6=E7=95=A5=E3=82=B3=E3=83=B3=E3=82=B5=E3=83=AB=E3=81=8C=E9=9B=86=E7=B5=90=E3=80=91=E3=83=88=E3=83=83=E3=83=97=E3=82=B3=E3=83=B3=E3=82=B5=E3=83=AB=E3=82=BF=E3=83=B3=E3=83=88=E3=81=A8=E8=A9=B1=E3=81=9B=E3=82=8B=E3=82=B3=E3=83=B3=E3=82=B5=E3=83=AB=E6=A5=AD=E7=95=8C=E7=A0=94=E7=A9=B6=E3=82=BB=E3=83=9F=E3=83=8A=E3=83=BC=E3=80=8F=E3=81=B8=E3=81=AE=E3=82=A8=E3=83=B3=E3=83=88=E3=83=AA=E3=83=BC=E3=81=82=E3=82=8A=E3=81=8C=E3=81=A8=E3=81=86=E3=81=94=E3=81=96=E3=81=84=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?=";
|
||||
$decoded = iconv_mime_decode($original, ICONV_MIME_DECODE_STRICT, 'utf-8');
|
||||
var_dump($decoded);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
string(183) "『【外資系戦略コンサルが集結】トップコンサルタントと話せるコンサル業界研究セミナー』へのエントリーありがとうございました。"
|
||||
===DONE===
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <unicode/timezone.h>
|
||||
#include <unicode/datefmt.h>
|
||||
#include <unicode/calendar.h>
|
||||
#include <unicode/strenum.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -333,6 +334,24 @@ static void umsg_set_timezone(MessageFormatter_object *mfo,
|
||||
return; /* already done */
|
||||
}
|
||||
|
||||
/* There is a bug in ICU which prevents MessageFormatter::getFormats()
|
||||
to handle more than 10 formats correctly. The enumerator could be
|
||||
used to walk through the present formatters using getFormat(), which
|
||||
however seems to provide just a readonly access. This workaround
|
||||
prevents crash when there are > 10 formats but doesn't set any error.
|
||||
As a result, only DateFormatters with > 10 subformats are affected.
|
||||
This workaround should be ifdef'd out, when the bug has been fixed
|
||||
in ICU. */
|
||||
icu::StringEnumeration* fnames = mf->getFormatNames(err.code);
|
||||
if (!fnames || U_FAILURE(err.code)) {
|
||||
return;
|
||||
}
|
||||
count = fnames->count(err.code);
|
||||
delete fnames;
|
||||
if (count > 10) {
|
||||
return;
|
||||
}
|
||||
|
||||
formats = mf->getFormats(count);
|
||||
|
||||
if (formats == NULL) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Bug #74484 MessageFormatter::formatMessage memory corruption with 11+ named placeholder
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$text = "{a} {b} {c} {d} {e} {f} {g} {h} {i} {j} {k} {l}";
|
||||
|
||||
$vars = array(
|
||||
'a' => 1,
|
||||
'b' => 2,
|
||||
'c' => 3,
|
||||
'd' => 4,
|
||||
'e' => 5,
|
||||
'f' => 6,
|
||||
'g' => 7,
|
||||
'h' => 8,
|
||||
'i' => 9,
|
||||
'j' => 10,
|
||||
'k' => 11,
|
||||
'l' => 12
|
||||
);
|
||||
|
||||
var_dump(MessageFormatter::formatMessage('en_US', $text, $vars));
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
string(26) "1 2 3 4 5 6 7 8 9 10 11 12"
|
||||
==DONE==
|
||||
+2
-2
@@ -591,12 +591,12 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL,
|
||||
if (ID != NULL) {
|
||||
ZVAL_STRING(¶ms[0], ID);
|
||||
} else {
|
||||
ZVAL_UNDEF(¶ms[0]);
|
||||
ZVAL_NULL(¶ms[0]);
|
||||
}
|
||||
if (URL != NULL) {
|
||||
ZVAL_STRING(¶ms[1], URL);
|
||||
} else {
|
||||
ZVAL_UNDEF(¶ms[1]);
|
||||
ZVAL_NULL(¶ms[1]);
|
||||
}
|
||||
ctxzv = ¶ms[2];
|
||||
array_init_size(ctxzv, 4);
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
--TEST--
|
||||
Bug #76777 (first parameter of libxml_set_external_entity_loader callback undefined)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('libxml')) die('skip');
|
||||
if (getenv("SKIP_ONLINE_TESTS")) die('skip online test');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xml=<<<EOF
|
||||
<?xml version="1.0"?>
|
||||
<test/>
|
||||
EOF;
|
||||
|
||||
$xsd=<<<EOF
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:include schemaLocation="nonexistent.xsd"/>
|
||||
<xs:element name="test"/>
|
||||
</xs:schema>
|
||||
EOF;
|
||||
|
||||
libxml_set_external_entity_loader(function($p,$s,$c) {
|
||||
var_dump($p,$s,$c);
|
||||
die();
|
||||
});
|
||||
|
||||
$dom=new DOMDocument($xml);
|
||||
$dom->schemaValidateSource($xsd);
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
string(15) "nonexistent.xsd"
|
||||
array(4) {
|
||||
["directory"]=>
|
||||
NULL
|
||||
["intSubName"]=>
|
||||
NULL
|
||||
["extSubURI"]=>
|
||||
NULL
|
||||
["extSubSystem"]=>
|
||||
NULL
|
||||
}
|
||||
@@ -702,7 +702,7 @@ static sapi_post_entry mbstr_post_entries[] = {
|
||||
/* }}} */
|
||||
|
||||
/* {{{ static int php_mb_parse_encoding_list()
|
||||
* Return 0 if input contains any illegal encoding, otherwise 1.
|
||||
* Return FAILURE if input contains any illegal encoding, otherwise SUCCESS.
|
||||
* Even if any illegal encoding is detected the result may contain a list
|
||||
* of parsed encodings.
|
||||
*/
|
||||
@@ -779,7 +779,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en
|
||||
*entry++ = encoding;
|
||||
n++;
|
||||
} else {
|
||||
ret = 0;
|
||||
ret = FAILURE;
|
||||
}
|
||||
}
|
||||
p1 = p2 + 1;
|
||||
@@ -795,7 +795,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en
|
||||
if (return_list) {
|
||||
*return_list = NULL;
|
||||
}
|
||||
ret = 0;
|
||||
ret = FAILURE;
|
||||
}
|
||||
if (return_size) {
|
||||
*return_size = n;
|
||||
@@ -808,7 +808,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en
|
||||
/* }}} */
|
||||
|
||||
/* {{{ static int php_mb_parse_encoding_array()
|
||||
* Return 0 if input contains any illegal encoding, otherwise 1.
|
||||
* Return FAILURE if input contains any illegal encoding, otherwise SUCCESS.
|
||||
* Even if any illegal encoding is detected the result may contain a list
|
||||
* of parsed encodings.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #76704 (mb_detect_order return value varies based on argument type)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('mbstring')) die('skip mbstring extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mb_detect_order('Foo, UTF-8'));
|
||||
var_dump(mb_detect_order(['Foo', 'UTF-8']))
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -210,11 +210,11 @@ memory_limit=83886080
|
||||
if (mysqli_query($link, "CREATE TABLE `test` (
|
||||
`targetport` int(11) NOT NULL default '0',
|
||||
`sources` double(17,4) default NULL,
|
||||
`current_sources` double(17,0) default NULL,
|
||||
`current_sources` double(17,4) default NULL,
|
||||
`reports` double(17,4) default NULL,
|
||||
`current_reports` double(17,0) default NULL,
|
||||
`current_reports` double(17,4) default NULL,
|
||||
`targets` double(17,4) default NULL,
|
||||
`current_targets` double(17,0) default NULL,
|
||||
`current_targets` double(17,4) default NULL,
|
||||
`maxsources` int(11) default NULL,
|
||||
`maxtargets` int(11) default NULL,
|
||||
`maxreports` int(11) default NULL,
|
||||
@@ -239,7 +239,7 @@ memory_limit=83886080
|
||||
printf("[301] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
break 2;
|
||||
}
|
||||
if ($current_targets > 0 && $trend != 'NULL')
|
||||
if ($current_targets > 0 && $trend !== 'NULL')
|
||||
$values[$trend] = $i;
|
||||
}
|
||||
krsort($values);
|
||||
|
||||
+7
-286
@@ -89,7 +89,6 @@ mysqlnd_run_authentication(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
zend_uchar * switch_to_auth_protocol_data = NULL;
|
||||
size_t switch_to_auth_protocol_data_len = 0;
|
||||
@@ -114,11 +113,10 @@ mysqlnd_run_authentication(
|
||||
DBG_INF_FMT("salt(%d)=[%.*s]", plugin_data_len, plugin_data_len, plugin_data);
|
||||
/* The data should be allocated with malloc() */
|
||||
if (auth_plugin) {
|
||||
scrambled_data = auth_plugin->methods.get_auth_data(
|
||||
NULL, &scrambled_data_len, conn, user, passwd,
|
||||
passwd_len, plugin_data, plugin_data_len,
|
||||
session_options, conn->protocol_frame_codec->data,
|
||||
mysql_flags);
|
||||
scrambled_data =
|
||||
auth_plugin->methods.get_auth_data(NULL, &scrambled_data_len, conn, user, passwd, passwd_len,
|
||||
plugin_data, plugin_data_len, session_options,
|
||||
conn->protocol_frame_codec->data, mysql_flags);
|
||||
}
|
||||
|
||||
if (conn->error_info->error_no) {
|
||||
@@ -129,7 +127,6 @@ mysqlnd_run_authentication(
|
||||
charset_no,
|
||||
first_call,
|
||||
requested_protocol,
|
||||
auth_plugin, plugin_data, plugin_data_len,
|
||||
scrambled_data, scrambled_data_len,
|
||||
&switch_to_auth_protocol, &switch_to_auth_protocol_len,
|
||||
&switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len
|
||||
@@ -251,9 +248,6 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
|
||||
unsigned int server_charset_no,
|
||||
zend_bool use_full_blown_auth_packet,
|
||||
const char * const auth_protocol,
|
||||
struct st_mysqlnd_authentication_plugin * auth_plugin,
|
||||
const zend_uchar * const orig_auth_plugin_data,
|
||||
const size_t orig_auth_plugin_data_len,
|
||||
const zend_uchar * const auth_plugin_data,
|
||||
const size_t auth_plugin_data_len,
|
||||
char ** switch_to_auth_protocol,
|
||||
@@ -324,11 +318,6 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
|
||||
conn->charset = mysqlnd_find_charset_nr(auth_packet->charset_no);
|
||||
}
|
||||
|
||||
if (auth_plugin && auth_plugin->methods.handle_server_response) {
|
||||
auth_plugin->methods.handle_server_response(auth_plugin, conn,
|
||||
orig_auth_plugin_data, orig_auth_plugin_data_len, passwd, passwd_len);
|
||||
}
|
||||
|
||||
if (FAIL == PACKET_READ(auth_resp_packet) || auth_resp_packet->response_code >= 0xFE) {
|
||||
if (auth_resp_packet->response_code == 0xFE) {
|
||||
/* old authentication with new server !*/
|
||||
@@ -624,8 +613,7 @@ static struct st_mysqlnd_authentication_plugin mysqlnd_native_auth_plugin =
|
||||
}
|
||||
},
|
||||
{/* methods */
|
||||
mysqlnd_native_auth_get_auth_data,
|
||||
NULL
|
||||
mysqlnd_native_auth_get_auth_data
|
||||
}
|
||||
};
|
||||
|
||||
@@ -674,8 +662,7 @@ static struct st_mysqlnd_authentication_plugin mysqlnd_pam_authentication_plugin
|
||||
}
|
||||
},
|
||||
{/* methods */
|
||||
mysqlnd_pam_auth_get_auth_data,
|
||||
NULL
|
||||
mysqlnd_pam_auth_get_auth_data
|
||||
}
|
||||
};
|
||||
|
||||
@@ -859,283 +846,17 @@ static struct st_mysqlnd_authentication_plugin mysqlnd_sha256_authentication_plu
|
||||
}
|
||||
},
|
||||
{/* methods */
|
||||
mysqlnd_sha256_auth_get_auth_data,
|
||||
NULL
|
||||
mysqlnd_sha256_auth_get_auth_data
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
/*************************************** CACHING SHA2 Password *******************************/
|
||||
|
||||
#undef L64
|
||||
|
||||
#include "ext/hash/php_hash.h"
|
||||
#include "ext/hash/php_hash_sha.h"
|
||||
|
||||
#define SHA256_LENGTH 32
|
||||
|
||||
/* {{{ php_mysqlnd_scramble_sha2 */
|
||||
void php_mysqlnd_scramble_sha2(zend_uchar * const buffer, const zend_uchar * const scramble, const zend_uchar * const password, const size_t password_len)
|
||||
{
|
||||
PHP_SHA256_CTX context;
|
||||
zend_uchar sha1[SHA256_LENGTH];
|
||||
zend_uchar sha2[SHA256_LENGTH];
|
||||
|
||||
/* Phase 1: hash password */
|
||||
PHP_SHA256Init(&context);
|
||||
PHP_SHA256Update(&context, password, password_len);
|
||||
PHP_SHA256Final(sha1, &context);
|
||||
|
||||
/* Phase 2: hash sha1 */
|
||||
PHP_SHA256Init(&context);
|
||||
PHP_SHA256Update(&context, (zend_uchar*)sha1, SHA256_LENGTH);
|
||||
PHP_SHA256Final(sha2, &context);
|
||||
|
||||
/* Phase 3: hash scramble + sha2 */
|
||||
PHP_SHA256Init(&context);
|
||||
PHP_SHA256Update(&context, (zend_uchar*)sha2, SHA256_LENGTH);
|
||||
PHP_SHA256Update(&context, scramble, SCRAMBLE_LENGTH);
|
||||
PHP_SHA256Final(buffer, &context);
|
||||
|
||||
/* let's crypt buffer now */
|
||||
php_mysqlnd_crypt(buffer, (const zend_uchar *)sha1, (const zend_uchar *)buffer, SHA256_LENGTH);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_native_auth_get_auth_data */
|
||||
static zend_uchar *
|
||||
mysqlnd_caching_sha2_get_auth_data(struct st_mysqlnd_authentication_plugin * self,
|
||||
size_t * auth_data_len,
|
||||
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
|
||||
const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
|
||||
const MYSQLND_SESSION_OPTIONS * const session_options,
|
||||
const MYSQLND_PFC_DATA * const pfc_data,
|
||||
zend_ulong mysql_flags
|
||||
)
|
||||
{
|
||||
zend_uchar * ret = NULL;
|
||||
DBG_ENTER("mysqlnd_caching_sha2_get_auth_data");
|
||||
DBG_INF_FMT("salt(%d)=[%.*s]", auth_plugin_data_len, auth_plugin_data_len, auth_plugin_data);
|
||||
*auth_data_len = 0;
|
||||
|
||||
DBG_INF("First auth step: send hashed password");
|
||||
/* copy scrambled pass*/
|
||||
if (passwd && passwd_len) {
|
||||
ret = malloc(SHA256_LENGTH + 1);
|
||||
*auth_data_len = SHA256_LENGTH;
|
||||
php_mysqlnd_scramble_sha2((zend_uchar*)ret, auth_plugin_data, (zend_uchar*)passwd, passwd_len);
|
||||
ret[SHA256_LENGTH] = '\0';
|
||||
DBG_INF_FMT("hash(%d)=[%.*s]", *auth_data_len, *auth_data_len, ret);
|
||||
}
|
||||
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#ifdef MYSQLND_HAVE_SSL
|
||||
static RSA *
|
||||
mysqlnd_caching_sha2_get_key(MYSQLND_CONN_DATA *conn)
|
||||
{
|
||||
RSA * ret = NULL;
|
||||
const MYSQLND_PFC_DATA * const pfc_data = conn->protocol_frame_codec->data;
|
||||
const char * fname = (pfc_data->sha256_server_public_key && pfc_data->sha256_server_public_key[0] != '\0')?
|
||||
pfc_data->sha256_server_public_key:
|
||||
MYSQLND_G(sha256_server_public_key);
|
||||
php_stream * stream;
|
||||
DBG_ENTER("mysqlnd_cached_sha2_get_key");
|
||||
DBG_INF_FMT("options_s256_pk=[%s] MYSQLND_G(sha256_server_public_key)=[%s]",
|
||||
pfc_data->sha256_server_public_key? pfc_data->sha256_server_public_key:"n/a",
|
||||
MYSQLND_G(sha256_server_public_key)? MYSQLND_G(sha256_server_public_key):"n/a");
|
||||
if (!fname || fname[0] == '\0') {
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT *req_packet = NULL;
|
||||
MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE *pk_resp_packet = NULL;
|
||||
|
||||
do {
|
||||
DBG_INF("requesting the public key from the server");
|
||||
req_packet = conn->payload_decoder_factory->m.get_cached_sha2_result_packet(conn->payload_decoder_factory, FALSE);
|
||||
pk_resp_packet = conn->payload_decoder_factory->m.get_sha256_pk_request_response_packet(conn->payload_decoder_factory, FALSE);
|
||||
req_packet->request = 1;
|
||||
|
||||
if (! PACKET_WRITE(req_packet)) {
|
||||
DBG_ERR_FMT("Error while sending public key request packet");
|
||||
php_error(E_WARNING, "Error while sending public key request packet. PID=%d", getpid());
|
||||
SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
|
||||
break;
|
||||
}
|
||||
if (FAIL == PACKET_READ(pk_resp_packet) || NULL == pk_resp_packet->public_key) {
|
||||
DBG_ERR_FMT("Error while receiving public key");
|
||||
php_error(E_WARNING, "Error while receiving public key. PID=%d", getpid());
|
||||
SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
|
||||
break;
|
||||
}
|
||||
DBG_INF_FMT("Public key(%d):\n%s", pk_resp_packet->public_key_len, pk_resp_packet->public_key);
|
||||
/* now extract the public key */
|
||||
{
|
||||
BIO * bio = BIO_new_mem_buf(pk_resp_packet->public_key, pk_resp_packet->public_key_len);
|
||||
ret = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL);
|
||||
BIO_free(bio);
|
||||
}
|
||||
} while (0);
|
||||
PACKET_FREE(req_packet);
|
||||
PACKET_FREE(pk_resp_packet);
|
||||
|
||||
DBG_INF_FMT("ret=%p", ret);
|
||||
DBG_RETURN(ret);
|
||||
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE,
|
||||
"caching_sha2_server_public_key is not set for the connection or as mysqlnd.sha256_server_public_key");
|
||||
DBG_ERR("server_public_key is not set");
|
||||
DBG_RETURN(NULL);
|
||||
} else {
|
||||
zend_string * key_str;
|
||||
DBG_INF_FMT("Key in a file. [%s]", fname);
|
||||
stream = php_stream_open_wrapper((char *) fname, "rb", REPORT_ERRORS, NULL);
|
||||
|
||||
if (stream) {
|
||||
if ((key_str = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0)) != NULL) {
|
||||
BIO * bio = BIO_new_mem_buf(ZSTR_VAL(key_str), ZSTR_LEN(key_str));
|
||||
ret = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL);
|
||||
BIO_free(bio);
|
||||
DBG_INF("Successfully loaded");
|
||||
DBG_INF_FMT("Public key:%*.s", ZSTR_LEN(key_str), ZSTR_VAL(key_str));
|
||||
zend_string_release(key_str);
|
||||
}
|
||||
php_stream_close(stream);
|
||||
}
|
||||
}
|
||||
DBG_RETURN(ret);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* {{{ mysqlnd_caching_sha2_get_key */
|
||||
static size_t
|
||||
mysqlnd_caching_sha2_get_and_use_key(MYSQLND_CONN_DATA *conn,
|
||||
const zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
|
||||
unsigned char **crypted,
|
||||
const char * const passwd,
|
||||
const size_t passwd_len)
|
||||
{
|
||||
#ifdef MYSQLND_HAVE_SSL
|
||||
static RSA *server_public_key;
|
||||
server_public_key = mysqlnd_caching_sha2_get_key(conn);
|
||||
|
||||
DBG_ENTER("mysqlnd_caching_sha2_get_and_use_key(");
|
||||
|
||||
if (server_public_key) {
|
||||
int server_public_key_len;
|
||||
char xor_str[passwd_len + 1];
|
||||
memcpy(xor_str, passwd, passwd_len);
|
||||
xor_str[passwd_len] = '\0';
|
||||
mysqlnd_xor_string(xor_str, passwd_len, (char *) auth_plugin_data, auth_plugin_data_len);
|
||||
|
||||
server_public_key_len = RSA_size(server_public_key);
|
||||
/*
|
||||
Because RSA_PKCS1_OAEP_PADDING is used there is a restriction on the passwd_len.
|
||||
RSA_PKCS1_OAEP_PADDING is recommended for new applications. See more here:
|
||||
http://www.openssl.org/docs/crypto/RSA_public_encrypt.html
|
||||
*/
|
||||
if ((size_t) server_public_key_len - 41 <= passwd_len) {
|
||||
/* password message is to long */
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "password is too long");
|
||||
DBG_ERR("password is too long");
|
||||
DBG_RETURN(0);
|
||||
}
|
||||
|
||||
*crypted = emalloc(server_public_key_len);
|
||||
RSA_public_encrypt(passwd_len + 1, (zend_uchar *) xor_str, *crypted, server_public_key, RSA_PKCS1_OAEP_PADDING);
|
||||
DBG_RETURN(server_public_key_len);
|
||||
}
|
||||
DBG_RETURN(0);
|
||||
#else
|
||||
DBG_ENTER("mysqlnd_caching_sha2_get_and_use_key(");
|
||||
php_error_docref(NULL, E_WARNING, "PHP was built without openssl extension, can't send password encrypted");
|
||||
DBG_RETURN(0);
|
||||
#endif
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ mysqlnd_native_auth_get_auth_data */
|
||||
static void
|
||||
mysqlnd_caching_sha2_handle_server_response(struct st_mysqlnd_authentication_plugin *self,
|
||||
MYSQLND_CONN_DATA * conn,
|
||||
const zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
|
||||
const char * const passwd,
|
||||
const size_t passwd_len)
|
||||
{
|
||||
DBG_ENTER("mysqlnd_caching_sha2_handle_server_response");
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT *result_packet;
|
||||
result_packet = conn->payload_decoder_factory->m.get_cached_sha2_result_packet(conn->payload_decoder_factory, FALSE);
|
||||
|
||||
if (FAIL == PACKET_READ(result_packet)) {
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
|
||||
switch (result_packet->response_code) {
|
||||
case 3:
|
||||
DBG_INF("fast path suceeded");
|
||||
PACKET_FREE(result_packet);
|
||||
DBG_VOID_RETURN;
|
||||
case 4:
|
||||
if (conn->vio->data->ssl || conn->unix_socket.s) {
|
||||
DBG_INF("fast path failed, doing full auth via SSL");
|
||||
result_packet->password = (zend_uchar *)passwd;
|
||||
result_packet->password_len = passwd_len + 1;
|
||||
PACKET_WRITE(result_packet);
|
||||
} else {
|
||||
DBG_INF("fast path failed, doing full auth without SSL");
|
||||
result_packet->password_len = mysqlnd_caching_sha2_get_and_use_key(conn, auth_plugin_data, auth_plugin_data_len, &result_packet->password, passwd, passwd_len);
|
||||
PACKET_WRITE(result_packet);
|
||||
efree(result_packet->password);
|
||||
}
|
||||
PACKET_FREE(result_packet);
|
||||
DBG_VOID_RETURN;
|
||||
case 2:
|
||||
// The server tried to send a key, which we didn't expect
|
||||
// fall-through
|
||||
default:
|
||||
php_error_docref(NULL, E_WARNING, "Unexpected server respose while doing caching_sha2 auth: %i", result_packet->response_code);
|
||||
}
|
||||
|
||||
PACKET_FREE(result_packet);
|
||||
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static struct st_mysqlnd_authentication_plugin mysqlnd_caching_sha2_auth_plugin =
|
||||
{
|
||||
{
|
||||
MYSQLND_PLUGIN_API_VERSION,
|
||||
"auth_plugin_caching_sha2_password",
|
||||
MYSQLND_VERSION_ID,
|
||||
PHP_MYSQLND_VERSION,
|
||||
"PHP License 3.01",
|
||||
"Johannes Schlüter <johannes.schlueter@php.net>",
|
||||
{
|
||||
NULL, /* no statistics , will be filled later if there are some */
|
||||
NULL, /* no statistics */
|
||||
},
|
||||
{
|
||||
NULL /* plugin shutdown */
|
||||
}
|
||||
},
|
||||
{/* methods */
|
||||
mysqlnd_caching_sha2_get_auth_data,
|
||||
mysqlnd_caching_sha2_handle_server_response
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* {{{ mysqlnd_register_builtin_authentication_plugins */
|
||||
void
|
||||
mysqlnd_register_builtin_authentication_plugins(void)
|
||||
{
|
||||
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_native_auth_plugin);
|
||||
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_pam_authentication_plugin);
|
||||
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_caching_sha2_auth_plugin);
|
||||
#ifdef MYSQLND_HAVE_SSL
|
||||
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_sha256_authentication_plugin);
|
||||
#endif
|
||||
|
||||
@@ -31,9 +31,26 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
|
||||
unsigned int server_charset_no,
|
||||
zend_bool use_full_blown_auth_packet,
|
||||
const char * const auth_protocol,
|
||||
struct st_mysqlnd_authentication_plugin * auth_plugin,
|
||||
const zend_uchar * const orig_auth_plugin_data,
|
||||
const size_t orig_auth_plugin_data_len,
|
||||
const zend_uchar * const auth_plugin_data,
|
||||
const size_t auth_plugin_data_len,
|
||||
char ** switch_to_auth_protocol,
|
||||
size_t * switch_to_auth_protocol_len,
|
||||
zend_uchar ** switch_to_auth_protocol_data,
|
||||
size_t * switch_to_auth_protocol_data_len
|
||||
);
|
||||
|
||||
enum_func_status
|
||||
mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
|
||||
const char * const user,
|
||||
const char * const passwd,
|
||||
const size_t passwd_len,
|
||||
const char * const db,
|
||||
const size_t db_len,
|
||||
const MYSQLND_SESSION_OPTIONS * const session_options,
|
||||
zend_ulong mysql_flags,
|
||||
unsigned int server_charset_no,
|
||||
zend_bool use_full_blown_auth_packet,
|
||||
const char * const auth_protocol,
|
||||
const zend_uchar * const auth_plugin_data,
|
||||
const size_t auth_plugin_data_len,
|
||||
char ** switch_to_auth_protocol,
|
||||
|
||||
@@ -678,13 +678,9 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
|
||||
|
||||
{
|
||||
const MYSQLND_CSTRING scheme = { transport.s, transport.l };
|
||||
/* This will be overwritten below with a copy, but we can use it during authentication */
|
||||
conn->unix_socket.s = (char *)socket_or_pipe.s;
|
||||
if (FAIL == conn->m->connect_handshake(conn, &scheme, &username, &password, &database, mysql_flags)) {
|
||||
conn->unix_socket.s = NULL;
|
||||
goto err;
|
||||
}
|
||||
conn->unix_socket.s = NULL;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -631,7 +631,6 @@ enum mysqlnd_packet_type
|
||||
PROT_CHG_USER_RESP_PACKET,
|
||||
PROT_SHA256_PK_REQUEST_PACKET,
|
||||
PROT_SHA256_PK_REQUEST_RESPONSE_PACKET,
|
||||
PROT_CACHED_SHA2_RESULT_PACKET,
|
||||
PROT_LAST /* should always be last */
|
||||
};
|
||||
|
||||
|
||||
@@ -970,7 +970,6 @@ struct st_mysqlnd_packet_chg_user_resp;
|
||||
struct st_mysqlnd_packet_auth_pam;
|
||||
struct st_mysqlnd_packet_sha256_pk_request;
|
||||
struct st_mysqlnd_packet_sha256_pk_request_response;
|
||||
struct st_mysqlnd_packet_cached_sha2_result;
|
||||
|
||||
typedef struct st_mysqlnd_packet_greet * (*func_mysqlnd_protocol_payload_decoder_factory__get_greet_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
typedef struct st_mysqlnd_packet_auth * (*func_mysqlnd_protocol_payload_decoder_factory__get_auth_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
@@ -987,7 +986,6 @@ typedef struct st_mysqlnd_packet_prepare_response *(*func_mysqlnd_protocol_paylo
|
||||
typedef struct st_mysqlnd_packet_chg_user_resp*(*func_mysqlnd_protocol_payload_decoder_factory__get_change_user_response_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
typedef struct st_mysqlnd_packet_sha256_pk_request *(*func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
typedef struct st_mysqlnd_packet_sha256_pk_request_response *(*func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_response_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
typedef struct st_mysqlnd_packet_cached_sha2_result *(*func_mysqlnd_protocol_payload_decoder_factory__get_cached_sha2_result_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
|
||||
typedef enum_func_status (*func_mysqlnd_protocol_payload_decoder_factory__send_command)(
|
||||
MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * payload_decoder_factory,
|
||||
@@ -1045,7 +1043,6 @@ MYSQLND_CLASS_METHODS_TYPE(mysqlnd_protocol_payload_decoder_factory)
|
||||
func_mysqlnd_protocol_payload_decoder_factory__get_change_user_response_packet get_change_user_response_packet;
|
||||
func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_packet get_sha256_pk_request_packet;
|
||||
func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_response_packet get_sha256_pk_request_response_packet;
|
||||
func_mysqlnd_protocol_payload_decoder_factory__get_cached_sha2_result_packet get_cached_sha2_result_packet;
|
||||
|
||||
func_mysqlnd_protocol_payload_decoder_factory__send_command send_command;
|
||||
func_mysqlnd_protocol_payload_decoder_factory__send_command_handle_response send_command_handle_response;
|
||||
@@ -1358,18 +1355,11 @@ typedef zend_uchar * (*func_auth_plugin__get_auth_data)(struct st_mysqlnd_authen
|
||||
const MYSQLND_PFC_DATA * const pfc_data, zend_ulong mysql_flags
|
||||
);
|
||||
|
||||
typedef void (*func_auth_plugin__handle_server_response)(struct st_mysqlnd_authentication_plugin * self,
|
||||
MYSQLND_CONN_DATA * conn,
|
||||
const zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
|
||||
const char * const passwd,
|
||||
const size_t passwd_len);
|
||||
|
||||
struct st_mysqlnd_authentication_plugin
|
||||
{
|
||||
struct st_mysqlnd_plugin_header plugin_header;
|
||||
struct {
|
||||
func_auth_plugin__get_auth_data get_auth_data;
|
||||
func_auth_plugin__handle_server_response handle_server_response;
|
||||
} methods;
|
||||
};
|
||||
|
||||
|
||||
@@ -2273,85 +2273,7 @@ php_mysqlnd_sha256_pk_request_response_free_mem(void * _packet, zend_bool stack_
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static
|
||||
size_t php_mysqlnd_cached_sha2_result_write(void * _packet)
|
||||
{
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT * packet= (MYSQLND_PACKET_CACHED_SHA2_RESULT *) _packet;
|
||||
MYSQLND_ERROR_INFO * error_info = packet->header.error_info;
|
||||
MYSQLND_PFC * pfc = packet->header.protocol_frame_codec;
|
||||
MYSQLND_VIO * vio = packet->header.vio;
|
||||
MYSQLND_STATS * stats = packet->header.stats;
|
||||
#ifndef _MSC_VER
|
||||
zend_uchar buffer[MYSQLND_HEADER_SIZE + packet->password_len + 1];
|
||||
#else
|
||||
ALLOCA_FLAG(use_heap)
|
||||
zend_uchar *buffer = do_alloca(MYSQLND_HEADER_SIZE + packet->password_len + 1, use_heap);
|
||||
#endif
|
||||
size_t sent;
|
||||
|
||||
DBG_ENTER("php_mysqlnd_cached_sha2_result_write");
|
||||
|
||||
if (packet->request == 1) {
|
||||
int1store(buffer + MYSQLND_HEADER_SIZE, '\2');
|
||||
sent = pfc->data->m.send(pfc, vio, buffer, 1, stats, error_info);
|
||||
} else {
|
||||
memcpy(buffer + MYSQLND_HEADER_SIZE, packet->password, packet->password_len);
|
||||
sent = pfc->data->m.send(pfc, vio, buffer, packet->password_len, stats, error_info);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
free_alloca(buffer, use_heap);
|
||||
#endif
|
||||
|
||||
DBG_RETURN(sent);
|
||||
}
|
||||
|
||||
static enum_func_status
|
||||
php_mysqlnd_cached_sha2_result_read(void * _packet)
|
||||
{
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT * packet= (MYSQLND_PACKET_CACHED_SHA2_RESULT *) _packet;
|
||||
MYSQLND_ERROR_INFO * error_info = packet->header.error_info;
|
||||
MYSQLND_PFC * pfc = packet->header.protocol_frame_codec;
|
||||
MYSQLND_VIO * vio = packet->header.vio;
|
||||
MYSQLND_STATS * stats = packet->header.stats;
|
||||
MYSQLND_CONNECTION_STATE * connection_state = packet->header.connection_state;
|
||||
zend_uchar buf[SHA256_PK_REQUEST_RESP_BUFFER_SIZE];
|
||||
zend_uchar *p = buf;
|
||||
const zend_uchar * const begin = buf;
|
||||
|
||||
DBG_ENTER("php_mysqlnd_cached_sha2_result_read");
|
||||
if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, connection_state, buf, sizeof(buf), "PROT_CACHED_SHA2_RESULT_PACKET", PROT_CACHED_SHA2_RESULT_PACKET)) {
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
BAIL_IF_NO_MORE_DATA;
|
||||
|
||||
p++;
|
||||
packet->response_code = uint1korr(p);
|
||||
BAIL_IF_NO_MORE_DATA;
|
||||
|
||||
p++;
|
||||
packet->result = uint1korr(p);
|
||||
BAIL_IF_NO_MORE_DATA;
|
||||
|
||||
DBG_RETURN(PASS);
|
||||
|
||||
premature_end:
|
||||
DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - begin - packet->header.size);
|
||||
php_error_docref(NULL, E_WARNING, "SHA256_PK_REQUEST_RESPONSE packet "MYSQLND_SZ_T_SPEC" bytes shorter than expected",
|
||||
p - begin - packet->header.size);
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
|
||||
static void
|
||||
php_mysqlnd_cached_sha2_result_free_mem(void * _packet, zend_bool stack_allocation)
|
||||
{
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT * p = (MYSQLND_PACKET_CACHED_SHA2_RESULT *) _packet;
|
||||
|
||||
if (!stack_allocation) {
|
||||
mnd_pefree(p, p->header.persistent);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
/* {{{ packet_methods */
|
||||
static
|
||||
mysqlnd_packet_methods packet_methods[PROT_LAST] =
|
||||
@@ -2445,15 +2367,9 @@ mysqlnd_packet_methods packet_methods[PROT_LAST] =
|
||||
php_mysqlnd_sha256_pk_request_response_read,
|
||||
NULL, /* write */
|
||||
php_mysqlnd_sha256_pk_request_response_free_mem,
|
||||
}, /* PROT_SHA256_PK_REQUEST_RESPONSE_PACKET */
|
||||
{
|
||||
sizeof(MYSQLND_PACKET_CACHED_SHA2_RESULT),
|
||||
php_mysqlnd_cached_sha2_result_read,
|
||||
php_mysqlnd_cached_sha2_result_write,
|
||||
php_mysqlnd_cached_sha2_result_free_mem
|
||||
} /* PROT_CACHED_SHA2_RESULT_PACKET */
|
||||
} /* PROT_SHA256_PK_REQUEST_RESPONSE_PACKET */
|
||||
};
|
||||
/* }}} */
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_protocol::get_greet_packet */
|
||||
@@ -2802,30 +2718,6 @@ MYSQLND_METHOD(mysqlnd_protocol, get_sha256_pk_request_response_packet)(MYSQLND_
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ mysqlnd_protocol::init_cached_sha2_result_packet */
|
||||
static struct st_mysqlnd_packet_cached_sha2_result *
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_cached_sha2_result_packet)
|
||||
(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent)
|
||||
{
|
||||
struct st_mysqlnd_packet_cached_sha2_result * packet = mnd_pecalloc(1, packet_methods[PROT_CACHED_SHA2_RESULT_PACKET].struct_size, persistent);
|
||||
DBG_ENTER("mysqlnd_protocol::init_cached_sha2_result_packet");
|
||||
if (packet) {
|
||||
memset(packet, 0, sizeof(*packet));
|
||||
packet->header.m = &packet_methods[PROT_CACHED_SHA2_RESULT_PACKET];
|
||||
packet->header.factory = factory;
|
||||
|
||||
packet->header.protocol_frame_codec = factory->conn->protocol_frame_codec;
|
||||
packet->header.vio = factory->conn->vio;
|
||||
packet->header.stats = factory->conn->stats;
|
||||
packet->header.error_info = factory->conn->error_info;
|
||||
packet->header.connection_state = &factory->conn->state;
|
||||
|
||||
packet->header.persistent = persistent;
|
||||
}
|
||||
DBG_RETURN(packet);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_protocol::send_command */
|
||||
static enum_func_status
|
||||
@@ -3056,7 +2948,6 @@ MYSQLND_CLASS_METHODS_START(mysqlnd_protocol_payload_decoder_factory)
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_change_user_response_packet),
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_sha256_pk_request_packet),
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_sha256_pk_request_response_packet),
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_cached_sha2_result_packet),
|
||||
|
||||
MYSQLND_METHOD(mysqlnd_protocol, send_command),
|
||||
MYSQLND_METHOD(mysqlnd_protocol, send_command_handle_response),
|
||||
|
||||
@@ -292,16 +292,6 @@ typedef struct st_mysqlnd_packet_sha256_pk_request_response {
|
||||
size_t public_key_len;
|
||||
} MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE;
|
||||
|
||||
typedef struct st_mysqlnd_packet_cached_sha2_result {
|
||||
MYSQLND_PACKET_HEADER header;
|
||||
uint8_t response_code;
|
||||
uint8_t result;
|
||||
uint8_t request;
|
||||
zend_uchar * password;
|
||||
size_t password_len;
|
||||
} MYSQLND_PACKET_CACHED_SHA2_RESULT;
|
||||
|
||||
|
||||
|
||||
zend_ulong php_mysqlnd_net_field_length(const zend_uchar **packet);
|
||||
zend_uchar * php_mysqlnd_net_store_length(zend_uchar *packet, const uint64_t length);
|
||||
|
||||
+13
-13
@@ -1,7 +1,7 @@
|
||||
--------------------------------------------------------------------
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2018 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, is permitted provided that the following conditions
|
||||
@@ -9,22 +9,22 @@ are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
|
||||
3. The name "PHP" must not be used to endorse or promote products
|
||||
derived from this software without prior written permission. For
|
||||
written permission, please contact group@php.net.
|
||||
|
||||
|
||||
4. Products derived from this software may not be called "PHP", nor
|
||||
may "PHP" appear in their name, without prior written permission
|
||||
from group@php.net. You may indicate that your software works in
|
||||
conjunction with PHP by saying "Foo for PHP" instead of calling
|
||||
it "PHP Foo" or "phpfoo"
|
||||
|
||||
|
||||
5. The PHP Group may publish revised and/or new versions of the
|
||||
license from time to time. Each version will be given a
|
||||
distinguishing version number.
|
||||
@@ -41,27 +41,27 @@ are met:
|
||||
"This product includes PHP software, freely available from
|
||||
<http://www.php.net/software/>".
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
|
||||
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
|
||||
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
|
||||
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--------------------------------------------------------------------
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals on behalf of the PHP Group.
|
||||
|
||||
The PHP Group can be contacted via Email at group@php.net.
|
||||
|
||||
For more information on the PHP Group and the PHP project,
|
||||
For more information on the PHP Group and the PHP project,
|
||||
please see <http://www.php.net>.
|
||||
|
||||
PHP includes the Zend Engine, freely available at
|
||||
|
||||
+7
-7
@@ -66,8 +66,8 @@ AC_DEFUN([AC_OCI8_ORACLE_VERSION],[
|
||||
OCI8_ORACLE_VERSION=8.1
|
||||
elif test -f $OCI8_LCS_BASE.1.0; then
|
||||
OCI8_ORACLE_VERSION=8.0
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.a; then
|
||||
if test -f $OCI8_DIR/$OCI8_LIB_DIR/libcore4.a; then
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.a; then
|
||||
if test -f $OCI8_DIR/$OCI8_LIB_DIR/libcore4.a; then
|
||||
OCI8_ORACLE_VERSION=8.0
|
||||
else
|
||||
OCI8_ORACLE_VERSION=8.1
|
||||
@@ -86,7 +86,7 @@ dnl support DTrace for extensions. Creating OCI8_INIT_DTRACE
|
||||
dnl independently instead of using a refactored PHP_INIT_DTRACE allows
|
||||
dnl OCI8 to be DTraced on versions of PHP where core PHP DTrace support
|
||||
dnl isn't available.
|
||||
dnl
|
||||
dnl
|
||||
AC_DEFUN([OCI8_INIT_DTRACE],[
|
||||
ac_srcdir=[]PHP_EXT_SRCDIR([oci8])/
|
||||
ac_bdir=[]PHP_EXT_BUILDDIR([oci8])/
|
||||
@@ -173,7 +173,7 @@ PHP_ARG_WITH(oci8, for Oracle Database OCI8 support,
|
||||
Use --with-oci8=instantclient,/path/to/instant/client/lib
|
||||
to use an Oracle Instant Client installation])
|
||||
|
||||
if test "$PHP_OCI8" != "no"; then
|
||||
if test "$PHP_OCI8" != "no"; then
|
||||
|
||||
if test -z "$PHP_OCI8"; then
|
||||
dnl --with-oci8=$ORACLE_HOME where ORACLE_HOME isn't set (or is mistyped) will match this case
|
||||
@@ -211,12 +211,12 @@ if test "$PHP_OCI8" != "no"; then
|
||||
fi
|
||||
|
||||
dnl Check whether --enable-dtrace was set.
|
||||
dnl To use DTrace with a PECL install, extract the OCI8 archive, phpize it, and set
|
||||
dnl To use DTrace with a PECL install, extract the OCI8 archive, phpize it, and set
|
||||
dnl PHP_DTRACE=yes before running configure
|
||||
AC_MSG_CHECKING([OCI8 DTrace support])
|
||||
oci8_do_dtrace="`echo $PHP_OCI8 | cut -d, -f3`"
|
||||
if test "$PHP_DTRACE" = "yes" -o "$oci8_do_dtrace" = "dtrace" ; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_MSG_RESULT([yes])
|
||||
if test "$ext_shared" = "no"; then
|
||||
AC_MSG_ERROR([For DTrace support OCI8 must be configured as a shared extension])
|
||||
else
|
||||
@@ -242,7 +242,7 @@ if test "$PHP_OCI8" != "no"; then
|
||||
AC_MSG_CHECKING([checking if we're on a 64-bit platform])
|
||||
if test "$ac_cv_sizeof_long_int" = "4"; then
|
||||
AC_MSG_RESULT([no])
|
||||
PHP_OCI8_OH_LIBDIR=lib32
|
||||
PHP_OCI8_OH_LIBDIR=lib32
|
||||
PHP_OCI8_IC_LIBDIR_SUFFIX=""
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
+46
-6
@@ -1207,7 +1207,6 @@ PHP_MINFO_FUNCTION(oci)
|
||||
php_info_print_table_row(2, "OCI8 DTrace Support", "disabled");
|
||||
#endif
|
||||
php_info_print_table_row(2, "OCI8 Version", PHP_OCI8_VERSION);
|
||||
php_info_print_table_row(2, "Revision", "$Id$");
|
||||
|
||||
#if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2)))
|
||||
php_oci_client_get_version(ver, sizeof(ver));
|
||||
@@ -1455,8 +1454,13 @@ void php_oci_column_hash_dtor(zval *data)
|
||||
if (column->descid) {
|
||||
if (GC_REFCOUNT(column->descid) == 1)
|
||||
zend_list_close(column->descid);
|
||||
else
|
||||
else {
|
||||
#if PHP_VERSION_ID < 70300
|
||||
GC_REFCOUNT(column->descid)--;
|
||||
#else
|
||||
GC_DELREF(column->descid);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (column->data) {
|
||||
@@ -1537,7 +1541,7 @@ sb4 php_oci_error(OCIError *err_p, sword errstatus)
|
||||
case OCI_ERROR:
|
||||
errcode = php_oci_fetch_errmsg(err_p, errbuf, sizeof(errbuf));
|
||||
if (errcode) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", errbuf, sizeof(errbuf));
|
||||
php_error_docref(NULL, E_WARNING, "%s", errbuf);
|
||||
} else {
|
||||
php_error_docref(NULL, E_WARNING, "failed to fetch error message");
|
||||
}
|
||||
@@ -1784,12 +1788,12 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
|
||||
timestamp = time(NULL);
|
||||
|
||||
smart_str_append_unsigned_ex(&hashed_details, session_mode, 0);
|
||||
smart_str_0(&hashed_details);
|
||||
|
||||
if (persistent) {
|
||||
smart_str_appendl_ex(&hashed_details, "pc", sizeof("pc") - 1, 0);
|
||||
}
|
||||
|
||||
smart_str_0(&hashed_details);
|
||||
|
||||
/* make it lowercase */
|
||||
php_strtolower(ZSTR_VAL(hashed_details.s), ZSTR_LEN(hashed_details.s));
|
||||
|
||||
@@ -1872,13 +1876,17 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
|
||||
if ((tmp_val != NULL) && (Z_TYPE_P(tmp_val) == IS_RESOURCE)) {
|
||||
tmp = Z_RES_VAL_P(tmp_val);
|
||||
}
|
||||
|
||||
|
||||
if ((tmp_val != NULL) && (tmp != NULL) &&
|
||||
(ZSTR_LEN(tmp->hash_key) == ZSTR_LEN(hashed_details.s)) &&
|
||||
(memcmp(ZSTR_VAL(tmp->hash_key), ZSTR_VAL(hashed_details.s),
|
||||
ZSTR_LEN(tmp->hash_key)) == 0)) {
|
||||
connection = tmp;
|
||||
#if PHP_VERSION_ID < 70300
|
||||
++GC_REFCOUNT(connection->id);
|
||||
#else
|
||||
GC_ADDREF(connection->id);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
PHP_OCI_REGISTER_RESOURCE(connection, le_pconnection);
|
||||
@@ -1888,7 +1896,11 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
|
||||
* decremented in the persistent helper
|
||||
*/
|
||||
if (OCI_G(old_oci_close_semantics)) {
|
||||
#if PHP_VERSION_ID < 70300
|
||||
++GC_REFCOUNT(connection->id);
|
||||
#else
|
||||
GC_ADDREF(connection->id);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
smart_str_free(&hashed_details);
|
||||
@@ -1899,7 +1911,11 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
|
||||
} else {
|
||||
/* we do not ping non-persistent connections */
|
||||
smart_str_free(&hashed_details);
|
||||
#if PHP_VERSION_ID < 70300
|
||||
++GC_REFCOUNT(connection->id);
|
||||
#else
|
||||
GC_ADDREF(connection->id);
|
||||
#endif
|
||||
return connection;
|
||||
}
|
||||
} /* is_open is true? */
|
||||
@@ -2041,8 +2057,10 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
|
||||
|
||||
/* add to the appropriate hash */
|
||||
if (connection->is_persistent) {
|
||||
#if PHP_VERSION_ID < 70300
|
||||
new_le.ptr = connection;
|
||||
new_le.type = le_pconnection;
|
||||
#endif
|
||||
connection->used_this_request = 1;
|
||||
PHP_OCI_REGISTER_RESOURCE(connection, le_pconnection);
|
||||
|
||||
@@ -2051,9 +2069,17 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
|
||||
* refcount is decremented in the persistent helper
|
||||
*/
|
||||
if (OCI_G(old_oci_close_semantics)) {
|
||||
#if PHP_VERSION_ID < 70300
|
||||
++GC_REFCOUNT(connection->id);
|
||||
#else
|
||||
GC_ADDREF(connection->id);
|
||||
#endif
|
||||
}
|
||||
#if PHP_VERSION_ID < 70300
|
||||
zend_hash_update_mem(&EG(persistent_list), connection->hash_key, (void *)&new_le, sizeof(zend_resource));
|
||||
#else
|
||||
zend_register_persistent_resource_ex(connection->hash_key, connection, le_pconnection);
|
||||
#endif
|
||||
OCI_G(num_persistent)++;
|
||||
OCI_G(num_links)++;
|
||||
} else if (!exclusive) {
|
||||
@@ -2448,7 +2474,11 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode)
|
||||
|
||||
if (column->is_cursor) { /* REFCURSOR -> simply return the statement id */
|
||||
ZVAL_RES(value, column->stmtid);
|
||||
#if PHP_VERSION_ID < 70300
|
||||
++GC_REFCOUNT(column->stmtid);
|
||||
#else
|
||||
GC_ADDREF(column->stmtid);
|
||||
#endif
|
||||
} else if (column->is_descr) {
|
||||
|
||||
if (column->data_type != SQLT_RDD) {
|
||||
@@ -2492,7 +2522,11 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode)
|
||||
/* return the locator */
|
||||
object_init_ex(value, oci_lob_class_entry_ptr);
|
||||
add_property_resource(value, "descriptor", column->descid);
|
||||
#if PHP_VERSION_ID < 70300
|
||||
++GC_REFCOUNT(column->descid);
|
||||
#else
|
||||
GC_ADDREF(column->descid);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
switch (column->retcode) {
|
||||
@@ -2874,7 +2908,9 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *
|
||||
{
|
||||
smart_str spool_hashed_details = {0};
|
||||
php_oci_spool *session_pool = NULL;
|
||||
#if PHP_VERSION_ID < 70300
|
||||
zend_resource spool_le = {{0}};
|
||||
#endif
|
||||
zend_resource *spool_out_le = NULL;
|
||||
zend_bool iserror = 0;
|
||||
zval *spool_out_zv = NULL;
|
||||
@@ -2921,10 +2957,14 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *
|
||||
iserror = 1;
|
||||
goto exit_get_spool;
|
||||
}
|
||||
#if PHP_VERSION_ID < 70300
|
||||
spool_le.ptr = session_pool;
|
||||
spool_le.type = le_psessionpool;
|
||||
PHP_OCI_REGISTER_RESOURCE(session_pool, le_psessionpool);
|
||||
zend_hash_update_mem(&EG(persistent_list), session_pool->spool_hash_key, (void *)&spool_le, sizeof(zend_resource));
|
||||
#else
|
||||
zend_register_persistent_resource_ex(session_pool->spool_hash_key, session_pool, le_psessionpool);
|
||||
#endif
|
||||
} else if (spool_out_le->type == le_psessionpool &&
|
||||
ZSTR_LEN(((php_oci_spool *)(spool_out_le->ptr))->spool_hash_key) == ZSTR_LEN(spool_hashed_details.s) &&
|
||||
memcmp(ZSTR_VAL(((php_oci_spool *)(spool_out_le->ptr))->spool_hash_key), ZSTR_VAL(spool_hashed_details.s), ZSTR_LEN(spool_hashed_details.s)) == 0) {
|
||||
|
||||
+33
-29
@@ -41,18 +41,22 @@
|
||||
/* {{{ php_oci_collection_create()
|
||||
Create and return connection handle */
|
||||
php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len)
|
||||
{
|
||||
{
|
||||
dvoid *dschp1 = NULL;
|
||||
dvoid *parmp1;
|
||||
dvoid *parmp2;
|
||||
php_oci_collection *collection;
|
||||
sword errstatus;
|
||||
|
||||
|
||||
collection = emalloc(sizeof(php_oci_collection));
|
||||
|
||||
collection->connection = connection;
|
||||
collection->collection = NULL;
|
||||
#if PHP_VERSION_ID < 70300
|
||||
++GC_REFCOUNT(collection->connection->id);
|
||||
#else
|
||||
GC_ADDREF(collection->connection->id);
|
||||
#endif
|
||||
|
||||
/* get type handle by name */
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCITypeByName,
|
||||
@@ -195,7 +199,7 @@ php_oci_collection *php_oci_collection_create(php_oci_connection *connection, ch
|
||||
default:
|
||||
php_error_docref(NULL, E_WARNING, "unknown collection type %d", collection->coll_typecode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create object to hold return table */
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIObjectNew,
|
||||
@@ -221,7 +225,7 @@ php_oci_collection *php_oci_collection_create(php_oci_connection *connection, ch
|
||||
PHP_OCI_REGISTER_RESOURCE(collection, le_collection);
|
||||
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
|
||||
return collection;
|
||||
|
||||
|
||||
CLEANUP:
|
||||
|
||||
if (dschp1) {
|
||||
@@ -230,7 +234,7 @@ CLEANUP:
|
||||
}
|
||||
connection->errcode = php_oci_error(connection->err, errstatus);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
php_oci_collection_close(collection);
|
||||
php_oci_collection_close(collection);
|
||||
return NULL;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -241,7 +245,7 @@ int php_oci_collection_size(php_oci_collection *collection, sb4 *size)
|
||||
{
|
||||
php_oci_connection *connection = collection->connection;
|
||||
sword errstatus;
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size));
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
@@ -259,7 +263,7 @@ int php_oci_collection_size(php_oci_collection *collection, sb4 *size)
|
||||
int php_oci_collection_max(php_oci_collection *collection, zend_long *max)
|
||||
{
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(*max, OCICollMax, (connection->env, collection->collection));
|
||||
|
||||
/* error handling is not necessary here? */
|
||||
@@ -296,7 +300,7 @@ int php_oci_collection_append_null(php_oci_collection *collection)
|
||||
|
||||
/* append NULL element */
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection));
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
errstatus = php_oci_error(connection->err, errstatus);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
@@ -341,7 +345,7 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
|
||||
return 0;
|
||||
}
|
||||
@@ -358,7 +362,7 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe
|
||||
sword errstatus;
|
||||
|
||||
element_double = zend_strtod(number, NULL);
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
@@ -396,7 +400,7 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme
|
||||
OCIString *ocistr = (OCIString *)0;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
sword errstatus;
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
@@ -433,12 +437,12 @@ int php_oci_collection_append(php_oci_collection *collection, char *element, int
|
||||
if (element_len == 0) {
|
||||
return php_oci_collection_append_null(collection);
|
||||
}
|
||||
|
||||
|
||||
switch(collection->element_typecode) {
|
||||
case OCI_TYPECODE_DATE:
|
||||
return php_oci_collection_append_date(collection, element, element_len);
|
||||
break;
|
||||
|
||||
|
||||
case OCI_TYPECODE_VARCHAR2 :
|
||||
return php_oci_collection_append_string(collection, element, element_len);
|
||||
break;
|
||||
@@ -478,7 +482,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind
|
||||
oratext buff[1024];
|
||||
ub4 buff_len = 1024;
|
||||
sword errstatus;
|
||||
|
||||
|
||||
ZVAL_NULL(result_element);
|
||||
|
||||
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
|
||||
@@ -500,7 +504,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (exists == 0) {
|
||||
/* element doesn't exist */
|
||||
return 1;
|
||||
@@ -514,7 +518,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind
|
||||
switch (collection->element_typecode) {
|
||||
case OCI_TYPECODE_DATE:
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff));
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, errstatus);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
@@ -523,7 +527,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind
|
||||
|
||||
ZVAL_STRINGL(result_element, (char *)buff, buff_len);
|
||||
Z_STRVAL_P(result_element)[buff_len] = '\0';
|
||||
|
||||
|
||||
return 0;
|
||||
break;
|
||||
|
||||
@@ -531,9 +535,9 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind
|
||||
{
|
||||
OCIString *oci_string = *(OCIString **)element;
|
||||
text *str;
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(str, OCIStringPtr, (connection->env, oci_string));
|
||||
|
||||
|
||||
if (str) {
|
||||
ZVAL_STRING(result_element, (char *)str);
|
||||
}
|
||||
@@ -554,7 +558,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind
|
||||
case OCI_TYPECODE_SMALLINT: /* SMALLINT */
|
||||
{
|
||||
double double_number;
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number));
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
@@ -562,7 +566,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
ZVAL_DOUBLE(result_element, double_number);
|
||||
|
||||
return 0;
|
||||
@@ -588,7 +592,7 @@ int php_oci_collection_element_set_null(php_oci_collection *collection, zend_lon
|
||||
|
||||
/* set NULL element */
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection));
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, errstatus);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
@@ -634,7 +638,7 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, zend_lon
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
|
||||
return 0;
|
||||
}
|
||||
@@ -651,7 +655,7 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, zend_l
|
||||
sword errstatus;
|
||||
|
||||
element_double = zend_strtod(number, NULL);
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
@@ -690,7 +694,7 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, zend_l
|
||||
OCIString *ocistr = (OCIString *)0;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
sword errstatus;
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
@@ -728,12 +732,12 @@ int php_oci_collection_element_set(php_oci_collection *collection, zend_long ind
|
||||
if (value_len == 0) {
|
||||
return php_oci_collection_element_set_null(collection, index);
|
||||
}
|
||||
|
||||
|
||||
switch(collection->element_typecode) {
|
||||
case OCI_TYPECODE_DATE:
|
||||
return php_oci_collection_element_set_date(collection, index, value, value_len);
|
||||
break;
|
||||
|
||||
|
||||
case OCI_TYPECODE_VARCHAR2 :
|
||||
return php_oci_collection_element_set_string(collection, index, value, value_len);
|
||||
break;
|
||||
@@ -768,7 +772,7 @@ int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_colle
|
||||
{
|
||||
php_oci_connection *connection = collection_dest->connection;
|
||||
sword errstatus;
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection));
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
@@ -798,7 +802,7 @@ void php_oci_collection_close(php_oci_collection *collection)
|
||||
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
zend_list_delete(collection->connection->id);
|
||||
efree(collection);
|
||||
return;
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "php_oci8.h"
|
||||
#include "php_oci8_int.h"
|
||||
|
||||
/* {{{ callback_fn()
|
||||
/* {{{ callback_fn()
|
||||
OCI TAF callback function, calling userspace function */
|
||||
sb4 callback_fn(void *svchp, void *envhp, void *fo_ctx, ub4 fo_type, ub4 fo_event)
|
||||
{
|
||||
@@ -71,7 +71,7 @@ sb4 callback_fn(void *svchp, void *envhp, void *fo_ctx, ub4 fo_type, ub4 fo_even
|
||||
returnValue = (sb4) Z_LVAL(retval);
|
||||
}
|
||||
|
||||
/* Setting params[0] to null so ressource isn't destroyed on zval_dtor */
|
||||
/* Setting params[0] to null so resource isn't destroyed on zval_dtor */
|
||||
ZVAL_NULL(¶ms[0]);
|
||||
|
||||
/* Cleanup */
|
||||
@@ -106,7 +106,7 @@ int php_oci_register_taf_callback(php_oci_connection *connection, zval *callback
|
||||
if (!callback) {
|
||||
/* Unregister callback */
|
||||
if (Z_ISUNDEF(connection->taf_callback) || Z_ISNULL(connection->taf_callback)) {
|
||||
return 0; // Nothing to unregister
|
||||
return 0; // Nothing to unregister
|
||||
}
|
||||
|
||||
registered = 1;
|
||||
|
||||
+171
-143
@@ -56,20 +56,32 @@ PHP_FUNCTION(oci_register_taf_callback)
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
#if PHP_MAJOR_VERSION > 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION >= 2)
|
||||
#if PHP_MAJOR_VERSION > 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION >= 2)
|
||||
if (!zend_is_callable(callback, 0, 0)) {
|
||||
callback_name = zend_get_callable_name(callback);
|
||||
php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(callback_name));
|
||||
#if PHP_VERSION_ID < 70300
|
||||
zend_string_release(callback_name);
|
||||
#else
|
||||
zend_string_release_ex(callback_name, 0);
|
||||
#endif
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#else
|
||||
if (!zend_is_callable(callback, 0, &callback_name)) {
|
||||
php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(callback_name));
|
||||
#if PHP_VERSION_ID < 70300
|
||||
zend_string_release(callback_name);
|
||||
#else
|
||||
zend_string_release_ex(callback_name, 0);
|
||||
#endif
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#if PHP_VERSION_ID < 70300
|
||||
zend_string_release(callback_name);
|
||||
#else
|
||||
zend_string_release_ex(callback_name, 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -141,10 +153,18 @@ PHP_FUNCTION(oci_define_by_name)
|
||||
/* if (zend_hash_add(statement->defines, name, name_len, define, sizeof(php_oci_define), (void **)&tmp_define) == SUCCESS) { */
|
||||
zvtmp = zend_string_init(name, name_len, 0);
|
||||
if ((define = zend_hash_add_new_ptr(statement->defines, zvtmp, define)) != NULL) {
|
||||
#if PHP_VERSION_ID < 70300
|
||||
zend_string_release(zvtmp);
|
||||
#else
|
||||
zend_string_release_ex(zvtmp, 0);
|
||||
#endif
|
||||
} else {
|
||||
efree(define);
|
||||
#if PHP_VERSION_ID < 70300
|
||||
zend_string_release(zvtmp);
|
||||
#else
|
||||
zend_string_release_ex(zvtmp, 0);
|
||||
#endif
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -172,7 +192,7 @@ PHP_FUNCTION(oci_bind_by_name)
|
||||
zval *z_statement;
|
||||
zval *bind_var = NULL;
|
||||
php_oci_statement *statement;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz|ll", &z_statement, &name, &name_len, &bind_var, &maxlen, &type) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -180,7 +200,7 @@ PHP_FUNCTION(oci_bind_by_name)
|
||||
if (type) {
|
||||
bind_type = (ub2) type;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
|
||||
|
||||
if (php_oci_bind_by_name(statement, name, name_len, bind_var, maxlen, bind_type)) {
|
||||
@@ -202,7 +222,7 @@ PHP_FUNCTION(oci_bind_array_by_name)
|
||||
zval *z_statement;
|
||||
zval *bind_var = NULL;
|
||||
php_oci_statement *statement;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rszl|ll", &z_statement, &name, &name_len, &bind_var, &max_array_len, &max_item_len, &type) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -212,12 +232,12 @@ PHP_FUNCTION(oci_bind_array_by_name)
|
||||
if (ZEND_NUM_ARGS() == 5 && max_item_len <= 0) {
|
||||
max_item_len = -1;
|
||||
}
|
||||
|
||||
|
||||
if (max_array_len <= 0) {
|
||||
php_error_docref(NULL, E_WARNING, "Maximum array length must be greater than zero");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (php_oci_bind_array_by_name(statement, name, (sb4) name_len, bind_var, max_array_len, max_item_len, type)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -237,7 +257,7 @@ PHP_FUNCTION(oci_free_descriptor)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
@@ -271,7 +291,7 @@ PHP_FUNCTION(oci_lob_save)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
@@ -283,7 +303,7 @@ PHP_FUNCTION(oci_lob_save)
|
||||
php_error_docref(NULL, E_WARNING, "Offset parameter must be greater than or equal to 0");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (php_oci_lob_write(descriptor, (ub4) offset, data, (ub4) data_len, &bytes_written)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -308,7 +328,7 @@ PHP_FUNCTION(oci_lob_import)
|
||||
else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Op", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
@@ -337,14 +357,14 @@ PHP_FUNCTION(oci_lob_load)
|
||||
if (!getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
if (php_oci_lob_read(descriptor, -1, 0, &buffer, &buffer_len)) {
|
||||
@@ -380,24 +400,24 @@ PHP_FUNCTION(oci_lob_read)
|
||||
else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &z_descriptor, oci_lob_class_entry_ptr, &length) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
if (length <= 0) {
|
||||
php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (php_oci_lob_read(descriptor, length, descriptor->lob_current_position, &buffer, &buffer_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
if (buffer_len > 0) {
|
||||
zend_string *ret = zend_string_init(buffer, buffer_len, 0);
|
||||
efree(buffer);
|
||||
@@ -416,20 +436,20 @@ PHP_FUNCTION(oci_lob_eof)
|
||||
zval *tmp, *z_descriptor = getThis();
|
||||
php_oci_descriptor *descriptor;
|
||||
ub4 lob_length;
|
||||
|
||||
|
||||
if (!getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
|
||||
if (!php_oci_lob_get_length(descriptor, &lob_length)) {
|
||||
if (lob_length == descriptor->lob_current_position) {
|
||||
RETURN_TRUE;
|
||||
@@ -445,21 +465,21 @@ PHP_FUNCTION(oci_lob_tell)
|
||||
{
|
||||
zval *tmp, *z_descriptor = getThis();
|
||||
php_oci_descriptor *descriptor;
|
||||
|
||||
|
||||
if (!getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
RETURN_LONG(descriptor->lob_current_position);
|
||||
|
||||
RETURN_LONG(descriptor->lob_current_position);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -469,20 +489,20 @@ PHP_FUNCTION(oci_lob_rewind)
|
||||
{
|
||||
zval *tmp, *z_descriptor = getThis();
|
||||
php_oci_descriptor *descriptor;
|
||||
|
||||
|
||||
if (!getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
|
||||
descriptor->lob_current_position = 0;
|
||||
|
||||
RETURN_TRUE;
|
||||
@@ -497,7 +517,7 @@ PHP_FUNCTION(oci_lob_seek)
|
||||
php_oci_descriptor *descriptor;
|
||||
zend_long offset, whence = PHP_OCI_SEEK_SET;
|
||||
ub4 lob_length;
|
||||
|
||||
|
||||
if (getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &offset, &whence) == FAILURE) {
|
||||
return;
|
||||
@@ -506,14 +526,14 @@ PHP_FUNCTION(oci_lob_seek)
|
||||
else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol|l", &z_descriptor, oci_lob_class_entry_ptr, &offset, &whence) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
if (php_oci_lob_get_length(descriptor, &lob_length)) {
|
||||
@@ -536,7 +556,7 @@ PHP_FUNCTION(oci_lob_seek)
|
||||
default:
|
||||
descriptor->lob_current_position = (offset > 0) ? (ub4) offset : 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (descriptor->lob_current_position > UB4MAXVAL) {
|
||||
php_error_docref(NULL, E_WARNING, "Invalid offset or LOB position");
|
||||
RETURN_FALSE;
|
||||
@@ -552,20 +572,20 @@ PHP_FUNCTION(oci_lob_size)
|
||||
zval *tmp, *z_descriptor = getThis();
|
||||
php_oci_descriptor *descriptor;
|
||||
ub4 lob_length;
|
||||
|
||||
|
||||
if (!getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
|
||||
if (php_oci_lob_get_length(descriptor, &lob_length)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -583,12 +603,12 @@ PHP_FUNCTION(oci_lob_write)
|
||||
zend_long write_len = 0;
|
||||
ub4 bytes_written;
|
||||
char *data;
|
||||
|
||||
|
||||
if (getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &data, &data_len, &write_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (ZEND_NUM_ARGS() == 2) {
|
||||
data_len = MIN((zend_long) data_len, write_len);
|
||||
}
|
||||
@@ -602,18 +622,18 @@ PHP_FUNCTION(oci_lob_write)
|
||||
data_len = MIN((zend_long) data_len, write_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
|
||||
if (data_len <= 0) {
|
||||
RETURN_LONG(0);
|
||||
}
|
||||
|
||||
|
||||
if (php_oci_lob_write(descriptor, descriptor->lob_current_position, data, (ub4) data_len, &bytes_written)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -627,7 +647,7 @@ PHP_FUNCTION(oci_lob_append)
|
||||
{
|
||||
zval *tmp_dest, *tmp_from, *z_descriptor_dest = getThis(), *z_descriptor_from;
|
||||
php_oci_descriptor *descriptor_dest, *descriptor_from;
|
||||
|
||||
|
||||
if (getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor_from, oci_lob_class_entry_ptr) == FAILURE) {
|
||||
return;
|
||||
@@ -636,22 +656,22 @@ PHP_FUNCTION(oci_lob_append)
|
||||
else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_dest, descriptor_dest);
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_from, descriptor_from);
|
||||
|
||||
|
||||
if (php_oci_lob_append(descriptor_dest, descriptor_from)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -668,7 +688,7 @@ PHP_FUNCTION(oci_lob_truncate)
|
||||
php_oci_descriptor *descriptor;
|
||||
zend_long trim_length = 0;
|
||||
ub4 ub_trim_length;
|
||||
|
||||
|
||||
if (getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &trim_length) == FAILURE) {
|
||||
return;
|
||||
@@ -677,9 +697,9 @@ PHP_FUNCTION(oci_lob_truncate)
|
||||
else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|l", &z_descriptor, oci_lob_class_entry_ptr, &trim_length) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
@@ -692,7 +712,7 @@ PHP_FUNCTION(oci_lob_truncate)
|
||||
|
||||
ub_trim_length = (ub4) trim_length;
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
|
||||
if (php_oci_lob_truncate(descriptor, ub_trim_length)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -708,7 +728,7 @@ PHP_FUNCTION(oci_lob_erase)
|
||||
php_oci_descriptor *descriptor;
|
||||
ub4 bytes_erased;
|
||||
zend_long offset = -1, length = -1;
|
||||
|
||||
|
||||
if (getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &offset, &length) == FAILURE) {
|
||||
return;
|
||||
@@ -733,7 +753,7 @@ PHP_FUNCTION(oci_lob_erase)
|
||||
php_error_docref(NULL, E_WARNING, "Offset must be greater than or equal to 0");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (ZEND_NUM_ARGS() > 2 && length < 0) {
|
||||
php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to 0");
|
||||
RETURN_FALSE;
|
||||
@@ -761,7 +781,7 @@ PHP_FUNCTION(oci_lob_flush)
|
||||
zval *tmp, *z_descriptor = getThis();
|
||||
php_oci_descriptor *descriptor;
|
||||
zend_long flush_flag = 0;
|
||||
|
||||
|
||||
if (getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flush_flag) == FAILURE) {
|
||||
return;
|
||||
@@ -772,14 +792,14 @@ PHP_FUNCTION(oci_lob_flush)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
|
||||
if (descriptor->buffering == PHP_OCI_LOB_BUFFER_DISABLED) {
|
||||
/* buffering wasn't enabled, there is nothing to flush */
|
||||
RETURN_FALSE;
|
||||
@@ -799,7 +819,7 @@ PHP_FUNCTION(ocisetbufferinglob)
|
||||
zval *tmp, *z_descriptor = getThis();
|
||||
php_oci_descriptor *descriptor;
|
||||
zend_bool flag;
|
||||
|
||||
|
||||
if (getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &flag) == FAILURE) {
|
||||
return;
|
||||
@@ -808,16 +828,16 @@ PHP_FUNCTION(ocisetbufferinglob)
|
||||
else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ob", &z_descriptor, oci_lob_class_entry_ptr, &flag) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
|
||||
if (php_oci_lob_set_buffering(descriptor, flag)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -831,20 +851,20 @@ PHP_FUNCTION(ocigetbufferinglob)
|
||||
{
|
||||
zval *tmp, *z_descriptor = getThis();
|
||||
php_oci_descriptor *descriptor;
|
||||
|
||||
|
||||
if (!getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
|
||||
if (descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
@@ -859,29 +879,29 @@ PHP_FUNCTION(oci_lob_copy)
|
||||
zval *tmp_dest, *tmp_from, *z_descriptor_dest, *z_descriptor_from;
|
||||
php_oci_descriptor *descriptor_dest, *descriptor_from;
|
||||
zend_long length = 0;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO|l", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr, &length) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_dest, descriptor_dest);
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_from, descriptor_from);
|
||||
|
||||
|
||||
if (ZEND_NUM_ARGS() == 3 && length < 0) {
|
||||
php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (ZEND_NUM_ARGS() == 2) {
|
||||
/* indicate that we want to copy from the current position to the end of the LOB */
|
||||
length = -1;
|
||||
@@ -901,28 +921,28 @@ PHP_FUNCTION(oci_lob_is_equal)
|
||||
zval *tmp_first, *tmp_second, *z_descriptor_first, *z_descriptor_second;
|
||||
php_oci_descriptor *descriptor_first, *descriptor_second;
|
||||
boolean is_equal;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &z_descriptor_first, oci_lob_class_entry_ptr, &z_descriptor_second, oci_lob_class_entry_ptr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((tmp_first = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_first), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if ((tmp_second = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_second), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_first, descriptor_first);
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_second, descriptor_second);
|
||||
|
||||
if (php_oci_lob_is_equal(descriptor_first, descriptor_second, &is_equal)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (is_equal == TRUE) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
@@ -933,7 +953,7 @@ PHP_FUNCTION(oci_lob_is_equal)
|
||||
/* {{{ proto bool oci_lob_export([string filename [, int start [, int length]]])
|
||||
Writes a large object into a file */
|
||||
PHP_FUNCTION(oci_lob_export)
|
||||
{
|
||||
{
|
||||
zval *tmp, *z_descriptor = getThis();
|
||||
php_oci_descriptor *descriptor;
|
||||
char *filename;
|
||||
@@ -947,7 +967,7 @@ PHP_FUNCTION(oci_lob_export)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|ll", &filename, &filename_len, &start, &length) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (ZEND_NUM_ARGS() > 1 && start < 0) {
|
||||
php_error_docref(NULL, E_WARNING, "Start parameter must be greater than or equal to 0");
|
||||
RETURN_FALSE;
|
||||
@@ -961,7 +981,7 @@ PHP_FUNCTION(oci_lob_export)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Op|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (ZEND_NUM_ARGS() > 2 && start < 0) {
|
||||
php_error_docref(NULL, E_WARNING, "Start parameter must be greater than or equal to 0");
|
||||
RETURN_FALSE;
|
||||
@@ -976,13 +996,13 @@ PHP_FUNCTION(oci_lob_export)
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
|
||||
if (php_oci_lob_get_length(descriptor, &lob_length)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (start == -1) {
|
||||
start = 0;
|
||||
}
|
||||
@@ -1026,7 +1046,7 @@ PHP_FUNCTION(oci_lob_export)
|
||||
if (buffer) {
|
||||
efree(buffer);
|
||||
}
|
||||
|
||||
|
||||
length -= tmp_bytes_read;
|
||||
descriptor->lob_current_position += tmp_bytes_read;
|
||||
start += tmp_bytes_read;
|
||||
@@ -1059,14 +1079,14 @@ PHP_FUNCTION(oci_lob_write_temporary)
|
||||
else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &type) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
if (php_oci_lob_write_tmp(descriptor, type, data, (int) data_len)) {
|
||||
@@ -1082,18 +1102,18 @@ PHP_FUNCTION(oci_lob_close)
|
||||
{
|
||||
zval *tmp, *z_descriptor = getThis();
|
||||
php_oci_descriptor *descriptor;
|
||||
|
||||
|
||||
if (!getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
|
||||
|
||||
if (php_oci_lob_close(descriptor)) {
|
||||
@@ -1119,8 +1139,8 @@ PHP_FUNCTION(oci_new_descriptor)
|
||||
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
|
||||
|
||||
/* php_oci_lob_create() checks type */
|
||||
descriptor = php_oci_lob_create(connection, type);
|
||||
|
||||
descriptor = php_oci_lob_create(connection, type);
|
||||
|
||||
if (!descriptor) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
@@ -1170,7 +1190,7 @@ PHP_FUNCTION(oci_commit)
|
||||
if (connection->descriptors) {
|
||||
php_oci_connection_descriptors_free(connection);
|
||||
}
|
||||
|
||||
|
||||
if (php_oci_connection_commit(connection)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1245,7 +1265,7 @@ PHP_FUNCTION(oci_field_type)
|
||||
if (!column) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
switch (column->data_type) {
|
||||
#ifdef SQLT_TIMESTAMP
|
||||
case SQLT_TIMESTAMP:
|
||||
@@ -1460,7 +1480,7 @@ PHP_FUNCTION(oci_fetch_all)
|
||||
|
||||
while (!php_oci_statement_fetch(statement, nrows)) {
|
||||
zval row;
|
||||
|
||||
|
||||
array_init_size(&row, statement->ncolumns);
|
||||
|
||||
for (i = 0; i < statement->ncolumns; i++) {
|
||||
@@ -1472,7 +1492,11 @@ PHP_FUNCTION(oci_fetch_all)
|
||||
zend_string *zvtmp;
|
||||
zvtmp = zend_string_init(columns[ i ]->name, columns[ i ]->name_len, 0);
|
||||
zend_symtable_update(Z_ARRVAL(row), zvtmp, &element);
|
||||
#if PHP_VERSION_ID < 70300
|
||||
zend_string_release(zvtmp);
|
||||
#else
|
||||
zend_string_release_ex(zvtmp, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1491,11 +1515,11 @@ PHP_FUNCTION(oci_fetch_all)
|
||||
array_init_size(array, statement->ncolumns);
|
||||
columns = safe_emalloc(statement->ncolumns, sizeof(php_oci_out_column *), 0);
|
||||
outarrs = safe_emalloc(statement->ncolumns, sizeof(zval*), 0);
|
||||
|
||||
|
||||
if (flags & PHP_OCI_NUM) {
|
||||
for (i = 0; i < statement->ncolumns; i++) {
|
||||
columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0);
|
||||
|
||||
|
||||
array_init(&tmp);
|
||||
outarrs[ i ] = zend_hash_next_index_insert(Z_ARRVAL_P(array), &tmp);
|
||||
}
|
||||
@@ -1503,11 +1527,15 @@ PHP_FUNCTION(oci_fetch_all)
|
||||
for (i = 0; i < statement->ncolumns; i++) {
|
||||
zend_string *zvtmp;
|
||||
columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0);
|
||||
|
||||
|
||||
array_init(&tmp);
|
||||
zvtmp = zend_string_init(columns[ i ]->name, columns[ i ]->name_len, 0);
|
||||
outarrs[ i ] = zend_symtable_update(Z_ARRVAL_P(array), zvtmp, &tmp);
|
||||
#if PHP_VERSION_ID < 70300
|
||||
zend_string_release(zvtmp);
|
||||
#else
|
||||
zend_string_release_ex(zvtmp, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1524,7 +1552,7 @@ PHP_FUNCTION(oci_fetch_all)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
efree(columns);
|
||||
efree(outarrs);
|
||||
}
|
||||
@@ -1605,7 +1633,7 @@ PHP_FUNCTION(oci_close)
|
||||
/* do nothing to keep BC */
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_connection) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1622,7 +1650,7 @@ PHP_FUNCTION(oci_close)
|
||||
}
|
||||
|
||||
/* ZVAL_NULL(z_connection); */
|
||||
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2071,7 +2099,7 @@ PHP_FUNCTION(oci_new_cursor)
|
||||
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
|
||||
|
||||
statement = php_oci_statement_create(connection, NULL, 0);
|
||||
|
||||
|
||||
if (statement) {
|
||||
RETURN_RES(statement->id);
|
||||
}
|
||||
@@ -2084,7 +2112,7 @@ PHP_FUNCTION(oci_new_cursor)
|
||||
PHP_FUNCTION(oci_result)
|
||||
{
|
||||
php_oci_out_column *column;
|
||||
|
||||
|
||||
column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
|
||||
if(column) {
|
||||
php_oci_column_to_zval(column, return_value, 0);
|
||||
@@ -2124,7 +2152,7 @@ PHP_FUNCTION(oci_server_version)
|
||||
if (php_oci_server_get_version(connection, version, sizeof(version))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
ret = zend_string_init(version, strlen(version), 0);
|
||||
RETURN_STR(ret);
|
||||
}
|
||||
@@ -2216,14 +2244,14 @@ PHP_FUNCTION(oci_free_collection)
|
||||
if (!getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
|
||||
|
||||
zend_list_close(collection->id);
|
||||
@@ -2248,14 +2276,14 @@ PHP_FUNCTION(oci_collection_append)
|
||||
else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Os", &z_collection, oci_coll_class_entry_ptr, &value, &value_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
|
||||
|
||||
if (php_oci_collection_append(collection, value, (int) value_len)) {
|
||||
@@ -2282,20 +2310,20 @@ PHP_FUNCTION(oci_collection_element_get)
|
||||
else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &z_collection, oci_coll_class_entry_ptr, &element_index) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
|
||||
|
||||
if (php_oci_collection_element_get(collection, element_index, &value)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
RETURN_ZVAL(&value, 1, 1);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2315,9 +2343,9 @@ PHP_FUNCTION(oci_collection_assign)
|
||||
else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &z_collection_dest, oci_coll_class_entry_ptr, &z_collection_from, oci_coll_class_entry_ptr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_collection_dest), "collection", sizeof("collection")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find collection property. The first argument should be valid collection object");
|
||||
RETURN_FALSE;
|
||||
@@ -2356,14 +2384,14 @@ PHP_FUNCTION(oci_collection_element_assign)
|
||||
else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ols", &z_collection, oci_coll_class_entry_ptr, &element_index, &value, &value_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
|
||||
|
||||
if (php_oci_collection_element_set(collection, element_index, value, (int) value_len)) {
|
||||
@@ -2380,18 +2408,18 @@ PHP_FUNCTION(oci_collection_size)
|
||||
zval *tmp, *z_collection = getThis();
|
||||
php_oci_collection *collection;
|
||||
sb4 size = 0;
|
||||
|
||||
|
||||
if (!getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
|
||||
|
||||
if (php_oci_collection_size(collection, &size)) {
|
||||
@@ -2408,18 +2436,18 @@ PHP_FUNCTION(oci_collection_max)
|
||||
zval *tmp, *z_collection = getThis();
|
||||
php_oci_collection *collection;
|
||||
zend_long max;
|
||||
|
||||
|
||||
if (!getThis()) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
|
||||
|
||||
if (php_oci_collection_max(collection, &max)) {
|
||||
@@ -2445,20 +2473,20 @@ PHP_FUNCTION(oci_collection_trim)
|
||||
else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &z_collection, oci_coll_class_entry_ptr, &trim_size) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
|
||||
|
||||
if (php_oci_collection_trim(collection, trim_size)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_TRUE;
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -2471,13 +2499,13 @@ PHP_FUNCTION(oci_new_collection)
|
||||
php_oci_collection *collection;
|
||||
char *tdo, *schema = NULL;
|
||||
size_t tdo_len, schema_len = 0;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|s", &z_connection, &tdo, &tdo_len, &schema, &schema_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
|
||||
|
||||
|
||||
if ( (collection = php_oci_collection_create(connection, tdo, (int) tdo_len, schema, (int) schema_len)) ) {
|
||||
object_init_ex(return_value, oci_coll_class_entry_ptr);
|
||||
add_property_resource(return_value, "collection", collection->id);
|
||||
|
||||
+52
-48
@@ -67,7 +67,11 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, zend_lon
|
||||
descriptor = ecalloc(1, sizeof(php_oci_descriptor));
|
||||
descriptor->type = (ub4) type;
|
||||
descriptor->connection = connection;
|
||||
#if PHP_VERSION_ID < 70300
|
||||
++GC_REFCOUNT(descriptor->connection->id);
|
||||
#else
|
||||
GC_ADDREF(descriptor->connection->id);
|
||||
#endif
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0));
|
||||
|
||||
@@ -81,7 +85,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, zend_lon
|
||||
}
|
||||
|
||||
PHP_OCI_REGISTER_RESOURCE(descriptor, le_descriptor);
|
||||
|
||||
|
||||
descriptor->lob_current_position = 0;
|
||||
descriptor->lob_size = -1; /* we should set it to -1 to know, that it's just not initialized */
|
||||
descriptor->buffering = PHP_OCI_LOB_BUFFER_DISABLED; /* buffering is off by default */
|
||||
@@ -97,7 +101,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, zend_lon
|
||||
zend_hash_init(connection->descriptors, 0, NULL, php_oci_descriptor_flush_hash_dtor, 0);
|
||||
connection->descriptor_count = 0;
|
||||
}
|
||||
|
||||
|
||||
descriptor->index = (connection->descriptor_count)++;
|
||||
if (connection->descriptor_count == LONG_MAX) {
|
||||
php_error_docref(NULL, E_WARNING, "Internal descriptor counter has reached limit");
|
||||
@@ -120,7 +124,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length)
|
||||
sword errstatus;
|
||||
|
||||
*length = 0;
|
||||
|
||||
|
||||
if (descriptor->lob_size >= 0) {
|
||||
*length = descriptor->lob_size;
|
||||
return 0;
|
||||
@@ -133,7 +137,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length));
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
@@ -156,7 +160,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length)
|
||||
|
||||
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
|
||||
}
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -203,7 +207,7 @@ sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_calculate_buffer()
|
||||
/* {{{ php_oci_lob_calculate_buffer()
|
||||
Work out the size for LOB buffering */
|
||||
static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, zend_long read_length)
|
||||
{
|
||||
@@ -226,7 +230,7 @@ static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, z
|
||||
descriptor->chunk_size = chunk_size;
|
||||
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
|
||||
}
|
||||
|
||||
|
||||
if ((read_length % descriptor->chunk_size) != 0) {
|
||||
return (int) descriptor->chunk_size * (((int) read_length / descriptor->chunk_size) + 1);
|
||||
}
|
||||
@@ -264,24 +268,24 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, zend_long read_length, zen
|
||||
if (length <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (initial_offset > length) {
|
||||
php_error_docref(NULL, E_WARNING, "Offset must be less than size of the LOB");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (read_length == -1) {
|
||||
requested_len = length;
|
||||
}
|
||||
|
||||
|
||||
if ((ub4) requested_len > (length - (ub4) initial_offset)) {
|
||||
requested_len = length - initial_offset;
|
||||
}
|
||||
|
||||
|
||||
if (requested_len <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
offset = initial_offset;
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_FILE) {
|
||||
@@ -352,15 +356,15 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, zend_long read_length, zen
|
||||
(ub1) descriptor->charset_form /* The character set form of the buffer data. */
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
efree(bufp);
|
||||
|
||||
|
||||
if (is_clob) {
|
||||
offset = descriptor->lob_current_position + chars_read;
|
||||
} else {
|
||||
offset = descriptor->lob_current_position + bytes_read;
|
||||
}
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, errstatus);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
@@ -371,7 +375,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, zend_long read_length, zen
|
||||
*data_len = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
descriptor->lob_current_position = (int)offset;
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_FILE) {
|
||||
@@ -402,20 +406,20 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i
|
||||
php_oci_connection *connection = (php_oci_connection *) descriptor->connection;
|
||||
ub4 lob_length;
|
||||
sword errstatus;
|
||||
|
||||
|
||||
*bytes_written = 0;
|
||||
if (php_oci_lob_get_length(descriptor, &lob_length)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (!data || data_len <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (offset > descriptor->lob_current_position) {
|
||||
offset = descriptor->lob_current_position;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCILobWrite,
|
||||
(
|
||||
connection->svc,
|
||||
@@ -441,16 +445,16 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i
|
||||
}
|
||||
*bytes_written = data_len;
|
||||
descriptor->lob_current_position += data_len;
|
||||
|
||||
|
||||
if ((int) descriptor->lob_current_position > (int) descriptor->lob_size) {
|
||||
descriptor->lob_size = descriptor->lob_current_position;
|
||||
}
|
||||
|
||||
|
||||
/* marking buffer as used */
|
||||
if (descriptor->buffering == PHP_OCI_LOB_BUFFER_ENABLED) {
|
||||
descriptor->buffering = PHP_OCI_LOB_BUFFER_USED;
|
||||
}
|
||||
|
||||
|
||||
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
|
||||
return 0;
|
||||
}
|
||||
@@ -467,12 +471,12 @@ int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off)
|
||||
/* disabling when it's already off */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (on_off && descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) {
|
||||
/* enabling when it's already on */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (on_off) {
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor));
|
||||
} else {
|
||||
@@ -509,11 +513,11 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d
|
||||
php_oci_connection *connection = descriptor_dest->connection;
|
||||
ub4 length_dest, length_from, copy_len;
|
||||
sword errstatus;
|
||||
|
||||
|
||||
if (php_oci_lob_get_length(descriptor_dest, &length_dest)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (php_oci_lob_get_length(descriptor_from, &length_from)) {
|
||||
return 1;
|
||||
}
|
||||
@@ -546,7 +550,7 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
|
||||
return 0;
|
||||
}
|
||||
@@ -573,7 +577,7 @@ int php_oci_lob_close (php_oci_descriptor *descriptor)
|
||||
if (php_oci_temp_lob_close(descriptor)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -587,16 +591,16 @@ int php_oci_temp_lob_close (php_oci_descriptor *descriptor)
|
||||
sword errstatus;
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary));
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, errstatus);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (is_temporary) {
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor));
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(connection->err, errstatus);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
@@ -630,7 +634,7 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, zend_long flush_flag)
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* do not really flush buffer, but report success
|
||||
* to suppress OCI error when flushing not used buffer
|
||||
* */
|
||||
@@ -683,7 +687,7 @@ void php_oci_lob_free (php_oci_descriptor *descriptor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* flushing Lobs & Files with buffering enabled */
|
||||
if ((descriptor->type == OCI_DTYPE_FILE || descriptor->type == OCI_DTYPE_LOB) && descriptor->buffering == PHP_OCI_LOB_BUFFER_USED) {
|
||||
php_oci_lob_flush(descriptor, OCI_LOB_BUFFER_FREE);
|
||||
@@ -711,17 +715,17 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename)
|
||||
char buf[8192];
|
||||
ub4 offset = 1;
|
||||
sword errstatus;
|
||||
|
||||
|
||||
if (php_check_open_basedir(filename)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if ((fp = VCWD_OPEN(filename, O_RDONLY|O_BINARY)) == -1) {
|
||||
php_error_docref(NULL, E_WARNING, "Can't open file %s", filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
while ((loblen = read(fp, &buf, sizeof(buf))) > 0) {
|
||||
while ((loblen = read(fp, &buf, sizeof(buf))) > 0) {
|
||||
PHP_OCI_CALL_RETURN(errstatus,
|
||||
OCILobWrite,
|
||||
(
|
||||
@@ -751,7 +755,7 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename)
|
||||
offset += loblen;
|
||||
}
|
||||
close(fp);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -769,7 +773,7 @@ int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor
|
||||
if (php_oci_lob_get_length(descriptor_dest, &dest_len)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (php_oci_lob_get_length(descriptor_from, &from_len)) {
|
||||
return 1;
|
||||
}
|
||||
@@ -798,11 +802,11 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, zend_long new_lob_leng
|
||||
OCILobLocator *lob = descriptor->descriptor;
|
||||
ub4 lob_length;
|
||||
sword errstatus;
|
||||
|
||||
|
||||
if (php_oci_lob_get_length(descriptor, &lob_length)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (lob_length <= 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -816,7 +820,7 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, zend_long new_lob_leng
|
||||
php_error_docref(NULL, E_WARNING, "Size must be less than or equal to the current LOB size");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCILobTrim, (connection->svc, connection->err, lob, (ub4) new_lob_length));
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
@@ -824,7 +828,7 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, zend_long new_lob_leng
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
descriptor->lob_size = (ub4) new_lob_length;
|
||||
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
|
||||
|
||||
@@ -842,11 +846,11 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, zend_long offset, ub4 len
|
||||
sword errstatus;
|
||||
|
||||
*bytes_erased = 0;
|
||||
|
||||
|
||||
if (php_oci_lob_get_length(descriptor, &lob_length)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (offset == -1) {
|
||||
offset = descriptor->lob_current_position;
|
||||
}
|
||||
@@ -854,7 +858,7 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, zend_long offset, ub4 len
|
||||
if (length == -1) {
|
||||
length = lob_length;
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, (ub4) offset+1));
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
@@ -862,7 +866,7 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, zend_long offset, ub4 len
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
*bytes_erased = length;
|
||||
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
|
||||
return 0;
|
||||
@@ -898,7 +902,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, zend_long type, char
|
||||
OCILobLocator *lob = descriptor->descriptor;
|
||||
ub4 bytes_written = 0;
|
||||
sword errstatus;
|
||||
|
||||
|
||||
switch (type) {
|
||||
case OCI_TEMP_BLOB:
|
||||
case OCI_TEMP_CLOB:
|
||||
|
||||
+121
-75
@@ -60,9 +60,9 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char
|
||||
/* do not allocate stmt handle for refcursors, we'll get it from OCIStmtPrepare2() */
|
||||
PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->stmt), OCI_HTYPE_STMT, 0, NULL));
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NULL));
|
||||
|
||||
|
||||
if (query_len > 0) {
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIStmtPrepare2,
|
||||
(
|
||||
@@ -93,7 +93,7 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (query && query_len) {
|
||||
statement->last_query = ecalloc(1, query_len + 1);
|
||||
memcpy(statement->last_query, query, query_len);
|
||||
@@ -111,18 +111,22 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char
|
||||
statement->impres_child_stmt = NULL;
|
||||
statement->impres_count = 0;
|
||||
statement->impres_flag = PHP_OCI_IMPRES_UNKNOWN; /* may or may not have Implicit Result Set children */
|
||||
#if PHP_VERSION_ID < 70300
|
||||
++GC_REFCOUNT(statement->connection->id);
|
||||
#else
|
||||
GC_ADDREF(statement->connection->id);
|
||||
#endif
|
||||
|
||||
if (OCI_G(default_prefetch) >= 0) {
|
||||
php_oci_statement_set_prefetch(statement, (ub4)OCI_G(default_prefetch));
|
||||
} else {
|
||||
php_oci_statement_set_prefetch(statement, (ub4)100); /* semi-arbitrary, "sensible default" */
|
||||
}
|
||||
|
||||
|
||||
PHP_OCI_REGISTER_RESOURCE(statement, le_statement);
|
||||
|
||||
OCI_G(num_statements)++;
|
||||
|
||||
|
||||
return statement;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -153,7 +157,7 @@ php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement)
|
||||
statement2 = ecalloc(1,sizeof(php_oci_statement));
|
||||
|
||||
PHP_OCI_CALL(OCIHandleAlloc, (statement->connection->env, (dvoid **)&(statement2->err), OCI_HTYPE_ERROR, 0, NULL));
|
||||
statement2->stmt = (OCIStmt *)result;
|
||||
statement2->stmt = (OCIStmt *)result;
|
||||
statement2->parent_stmtid = statement->id;
|
||||
statement2->impres_child_stmt = NULL;
|
||||
statement2->impres_count = 0;
|
||||
@@ -171,15 +175,20 @@ php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement)
|
||||
statement2->has_descr = 0;
|
||||
statement2->stmttype = 0;
|
||||
|
||||
#if PHP_VERSION_ID < 70300
|
||||
GC_REFCOUNT(statement->id)++;
|
||||
GC_REFCOUNT(statement2->connection->id)++;
|
||||
#else
|
||||
GC_ADDREF(statement->id);
|
||||
GC_ADDREF(statement2->connection->id);
|
||||
#endif
|
||||
|
||||
php_oci_statement_set_prefetch(statement2, statement->prefetch_count);
|
||||
|
||||
|
||||
PHP_OCI_REGISTER_RESOURCE(statement2, le_statement);
|
||||
|
||||
|
||||
OCI_G(num_statements)++;
|
||||
|
||||
|
||||
return statement2;
|
||||
}
|
||||
#endif /* OCI_MAJOR_VERSION < 12 */
|
||||
@@ -197,7 +206,7 @@ int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch )
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err));
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
statement->errcode = php_oci_error(statement->err, errstatus);
|
||||
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
|
||||
@@ -293,7 +302,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows)
|
||||
piecewisecols = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while (errstatus == OCI_NEED_DATA) {
|
||||
if (piecewisecols) {
|
||||
PHP_OCI_CALL_RETURN(errstatus,
|
||||
@@ -359,11 +368,11 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows)
|
||||
if (column == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!column->define) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
ZEND_ASSERT(Z_ISREF(column->define->val));
|
||||
zval_ptr_dtor(Z_REFVAL(column->define->val));
|
||||
ZVAL_NULL(Z_REFVAL(column->define->val));
|
||||
@@ -419,11 +428,11 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
|
||||
php_oci_out_column *outcol = (php_oci_out_column *)ctx;
|
||||
|
||||
if (!outcol) {
|
||||
|
||||
|
||||
php_error_docref(NULL, E_WARNING, "Invalid context pointer value");
|
||||
return OCI_ERROR;
|
||||
}
|
||||
|
||||
|
||||
switch(outcol->data_type) {
|
||||
case SQLT_RSET: {
|
||||
php_oci_statement *nested_stmt;
|
||||
@@ -433,7 +442,11 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
|
||||
return OCI_ERROR;
|
||||
}
|
||||
nested_stmt->parent_stmtid = outcol->statement->id;
|
||||
#if PHP_VERSION_ID < 70300
|
||||
++GC_REFCOUNT(outcol->statement->id);
|
||||
#else
|
||||
GC_ADDREF(outcol->statement->id);
|
||||
#endif
|
||||
outcol->nested_statement = nested_stmt;
|
||||
outcol->stmtid = nested_stmt->id;
|
||||
|
||||
@@ -466,7 +479,7 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
|
||||
}
|
||||
outcol->descid = descr->id;
|
||||
descr->charset_form = outcol->charset_form;
|
||||
|
||||
|
||||
*bufpp = descr->descriptor;
|
||||
*alenpp = &(outcol->retlen4);
|
||||
*piecep = OCI_ONE_PIECE;
|
||||
@@ -512,7 +525,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode)
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (!statement->stmttype) {
|
||||
/* get statement type */
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err));
|
||||
@@ -531,7 +544,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode)
|
||||
} else {
|
||||
iters = 1;
|
||||
}
|
||||
|
||||
|
||||
if (statement->last_query) { /* Don't execute REFCURSORS or Implicit Result Set handles */
|
||||
|
||||
if (statement->binds) {
|
||||
@@ -550,7 +563,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode)
|
||||
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (statement->binds) {
|
||||
zend_hash_apply(statement->binds, php_oci_bind_post_exec);
|
||||
}
|
||||
@@ -575,15 +588,15 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode)
|
||||
if (statement->stmttype == OCI_STMT_SELECT && statement->executed == 0) {
|
||||
/* we only need to do the define step is this very statement is executed the first time! */
|
||||
statement->executed = 1;
|
||||
|
||||
|
||||
ALLOC_HASHTABLE(statement->columns);
|
||||
zend_hash_init(statement->columns, 13, NULL, php_oci_column_hash_dtor, 0);
|
||||
|
||||
|
||||
counter = 1;
|
||||
|
||||
/* get number of columns */
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_ATTR_PARAM_COUNT, statement->err));
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
statement->errcode = php_oci_error(statement->err, errstatus);
|
||||
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
|
||||
@@ -591,19 +604,23 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode)
|
||||
}
|
||||
|
||||
statement->ncolumns = colcount;
|
||||
|
||||
|
||||
for (counter = 1; counter <= colcount; counter++) {
|
||||
outcol = (php_oci_out_column *) ecalloc(1, sizeof(php_oci_out_column));
|
||||
|
||||
|
||||
#if PHP_VERSION_ID < 70300
|
||||
if ((outcol = zend_hash_index_update_ptr(statement->columns, counter, outcol)) == NULL) {
|
||||
FREE_HASHTABLE(statement->columns);
|
||||
/* out of memory */
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
outcol = zend_hash_index_update_ptr(statement->columns, counter, outcol);
|
||||
#endif
|
||||
|
||||
/* get column */
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)¶m, counter));
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
statement->errcode = php_oci_error(statement->err, errstatus);
|
||||
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
|
||||
@@ -629,7 +646,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode)
|
||||
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* get character set id */
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err));
|
||||
|
||||
@@ -639,10 +656,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode)
|
||||
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* get size of the column */
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err));
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
|
||||
statement->errcode = php_oci_error(statement->err, errstatus);
|
||||
@@ -655,7 +672,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode)
|
||||
|
||||
/* get scale of the column */
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err));
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
|
||||
statement->errcode = php_oci_error(statement->err, errstatus);
|
||||
@@ -665,17 +682,17 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode)
|
||||
|
||||
/* get precision of the column */
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err));
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
|
||||
statement->errcode = php_oci_error(statement->err, errstatus);
|
||||
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* get name of the column */
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err));
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
|
||||
statement->errcode = php_oci_error(statement->err, errstatus);
|
||||
@@ -766,9 +783,9 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode)
|
||||
} else {
|
||||
outcol->storage_size4++; /* add one for string terminator */
|
||||
}
|
||||
|
||||
|
||||
outcol->storage_size4 *= 3;
|
||||
|
||||
|
||||
dynamic = OCI_DEFAULT;
|
||||
buf = outcol->data = (text *) safe_emalloc(1, outcol->storage_size4, 0);
|
||||
memset(buf, 0, outcol->storage_size4);
|
||||
@@ -812,7 +829,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
statement->errcode = php_oci_error(statement->err, errstatus);
|
||||
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
|
||||
@@ -902,7 +919,7 @@ void php_oci_statement_free(php_oci_statement *statement)
|
||||
|
||||
zend_list_delete(statement->connection->id);
|
||||
efree(statement);
|
||||
|
||||
|
||||
OCI_G(num_statements)--;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -923,7 +940,7 @@ int php_oci_bind_pre_exec(zval *data, void *result)
|
||||
* bind->indicator are not used for oci_bind_array_by_name.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
switch (bind->type) {
|
||||
case SQLT_NTY:
|
||||
case SQLT_BFILEE:
|
||||
@@ -936,7 +953,7 @@ int php_oci_bind_pre_exec(zval *data, void *result)
|
||||
*(int *)result = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SQLT_CHR:
|
||||
case SQLT_AFC:
|
||||
case SQLT_INT:
|
||||
@@ -993,8 +1010,12 @@ int php_oci_bind_post_exec(zval *data)
|
||||
* binds, php_oci_bind_out_callback() should have allocated a
|
||||
* new string that we can modify here.
|
||||
*/
|
||||
#if PHP_VERSION_ID < 70300
|
||||
SEPARATE_STRING(zv);
|
||||
Z_STR_P(zv) = zend_string_extend(Z_STR_P(zv), Z_STRLEN_P(zv)+1, 0);
|
||||
#else
|
||||
ZVAL_NEW_STR(zv, zend_string_extend(Z_STR_P(zv), Z_STRLEN_P(zv)+1, 0));
|
||||
#endif
|
||||
Z_STRVAL_P(zv)[ Z_STRLEN_P(zv) ] = '\0';
|
||||
} else if (Z_TYPE_P(zv) == IS_ARRAY) {
|
||||
int i;
|
||||
@@ -1036,7 +1057,7 @@ int php_oci_bind_post_exec(zval *data)
|
||||
ub4 buff_len = 1024;
|
||||
|
||||
memset((void*)buff,0,sizeof(buff));
|
||||
|
||||
|
||||
if ((i < (int) bind->array.old_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
|
||||
zval_ptr_dtor(entry);
|
||||
@@ -1063,7 +1084,7 @@ int php_oci_bind_post_exec(zval *data)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SQLT_AFC:
|
||||
case SQLT_CHR:
|
||||
case SQLT_VCS:
|
||||
@@ -1119,7 +1140,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
|
||||
case SQLT_NTY:
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
|
||||
if (Z_TYPE_P(param) != IS_OBJECT || (tmp = zend_hash_str_find(Z_OBJPROP_P(param), "collection", sizeof("collection")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
|
||||
return 1;
|
||||
@@ -1128,7 +1149,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
|
||||
PHP_OCI_ZVAL_TO_COLLECTION_EX(tmp, bind_collection);
|
||||
value_sz = sizeof(void*);
|
||||
mode = OCI_DEFAULT;
|
||||
|
||||
|
||||
if (!bind_collection->collection) {
|
||||
return 1;
|
||||
}
|
||||
@@ -1141,7 +1162,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
|
||||
case SQLT_RDD:
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
|
||||
if (Z_TYPE_P(param) != IS_OBJECT || (tmp = zend_hash_str_find(Z_OBJPROP_P(param), "descriptor", sizeof("descriptor")-1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
|
||||
return 1;
|
||||
@@ -1150,15 +1171,15 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
|
||||
PHP_OCI_ZVAL_TO_DESCRIPTOR_EX(tmp, bind_descriptor);
|
||||
|
||||
value_sz = sizeof(void*);
|
||||
|
||||
|
||||
oci_desc = bind_descriptor->descriptor;
|
||||
|
||||
|
||||
if (!oci_desc) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SQLT_INT:
|
||||
case SQLT_NUM:
|
||||
if (Z_TYPE_P(param) == IS_RESOURCE || Z_TYPE_P(param) == IS_OBJECT) {
|
||||
@@ -1170,7 +1191,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
|
||||
value_sz = sizeof(oci_phpsized_int);
|
||||
mode = OCI_DEFAULT;
|
||||
break;
|
||||
|
||||
|
||||
case SQLT_LBI:
|
||||
case SQLT_BIN:
|
||||
case SQLT_LNG:
|
||||
@@ -1257,15 +1278,19 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
|
||||
zvtmp = zend_string_init(name, name_len, 0);
|
||||
bindp = (php_oci_bind *) ecalloc(1, sizeof(php_oci_bind));
|
||||
bindp = zend_hash_update_ptr(statement->binds, zvtmp, bindp);
|
||||
#if PHP_VERSION_ID < 70300
|
||||
zend_string_release(zvtmp);
|
||||
#else
|
||||
zend_string_release_ex(zvtmp, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Make sure the minimum of value_sz is 1 to avoid ORA-3149
|
||||
/* Make sure the minimum of value_sz is 1 to avoid ORA-3149
|
||||
* when both in/out parameters are bound with empty strings
|
||||
*/
|
||||
if (value_sz == 0)
|
||||
value_sz = 1;
|
||||
|
||||
|
||||
bindp->descriptor = oci_desc;
|
||||
bindp->statement = oci_stmt;
|
||||
bindp->parent_statement = statement;
|
||||
@@ -1283,7 +1308,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
|
||||
statement->stmt, /* statement handle */
|
||||
(OCIBind **)&bindp->bind, /* bind hdl (will alloc) */
|
||||
statement->err, /* error handle */
|
||||
(text*) name, /* placeholder name */
|
||||
(text*) name, /* placeholder name */
|
||||
(sb4) name_len, /* placeholder length */
|
||||
(dvoid *)bind_data, /* in/out data */
|
||||
value_sz, /* PHP_OCI_MAX_DATA_SIZE, */ /* max size of input/output data */
|
||||
@@ -1335,14 +1360,14 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
|
||||
(ub4 *) 0
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
if (errstatus) {
|
||||
statement->errcode = php_oci_error(statement->err, errstatus);
|
||||
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */
|
||||
return 0;
|
||||
}
|
||||
@@ -1484,7 +1509,7 @@ sb4 php_oci_bind_out_callback(
|
||||
Z_STRVAL_P(val) = ecalloc(1, Z_STRLEN_P(val) + 1);
|
||||
/* XXX is this right? */
|
||||
ZVAL_STRINGL(val, NULL, Z_STRLEN(val) + 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* XXX we assume that zend-zval len has 4 bytes */
|
||||
*alenpp = (ub4*) &Z_STRLEN_P(val);
|
||||
@@ -1520,7 +1545,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME
|
||||
if (need_data && !statement->has_data) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if (Z_TYPE_P(column_index) == IS_STRING) {
|
||||
column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), (int) Z_STRLEN_P(column_index));
|
||||
if (!column) {
|
||||
@@ -1528,6 +1553,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
#if PHP_VERSION_ID < 70300
|
||||
zval tmp;
|
||||
/* NB: for PHP4 compat only, it should be using 'Z' instead */
|
||||
tmp = *column_index;
|
||||
@@ -1540,6 +1566,17 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME
|
||||
return NULL;
|
||||
}
|
||||
zval_ptr_dtor(&tmp);
|
||||
#else
|
||||
zend_long tmp;
|
||||
/* NB: for PHP4 compat only, it should be using 'Z' instead */
|
||||
|
||||
tmp = zval_get_long(column_index);
|
||||
column = php_oci_statement_get_column(statement, tmp, NULL, 0);
|
||||
if (!column) {
|
||||
php_error_docref(NULL, E_WARNING, "Invalid column index \"" ZEND_LONG_FMT "\"", tmp);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return column;
|
||||
}
|
||||
@@ -1551,9 +1588,9 @@ int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type)
|
||||
{
|
||||
ub2 statement_type;
|
||||
sword errstatus;
|
||||
|
||||
|
||||
*type = 0;
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err));
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
@@ -1574,9 +1611,9 @@ int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows)
|
||||
{
|
||||
ub4 statement_numrows;
|
||||
sword errstatus;
|
||||
|
||||
|
||||
*numrows = 0;
|
||||
|
||||
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, OCI_ATTR_ROW_COUNT, statement->err));
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
@@ -1602,14 +1639,19 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t
|
||||
|
||||
ZEND_ASSERT(Z_ISREF_P(var));
|
||||
val = Z_REFVAL_P(var);
|
||||
#if PHP_VERSION_ID < 70300
|
||||
SEPARATE_ZVAL_NOREF(val);
|
||||
convert_to_array(val);
|
||||
#else
|
||||
convert_to_array(val);
|
||||
SEPARATE_ARRAY(val);
|
||||
#endif
|
||||
|
||||
if (maxlength < -1) {
|
||||
php_error_docref(NULL, E_WARNING, "Invalid max length value (" ZEND_LONG_FMT ")", maxlength);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
switch(type) {
|
||||
case SQLT_NUM:
|
||||
case SQLT_INT:
|
||||
@@ -1620,7 +1662,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t
|
||||
case SQLT_FLT:
|
||||
bind = php_oci_bind_array_helper_double(val, max_table_length);
|
||||
break;
|
||||
|
||||
|
||||
case SQLT_AFC:
|
||||
case SQLT_CHR:
|
||||
case SQLT_VCS:
|
||||
@@ -1646,7 +1688,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t
|
||||
/* failed to generate bind struct */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
bind->descriptor = NULL;
|
||||
bind->statement = NULL;
|
||||
bind->parent_statement = statement;
|
||||
@@ -1675,8 +1717,8 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t
|
||||
(ub4) OCI_DEFAULT
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
if (errstatus != OCI_SUCCESS) {
|
||||
if (bind->array.elements) {
|
||||
efree(bind->array.elements);
|
||||
@@ -1706,7 +1748,11 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t
|
||||
|
||||
zvtmp = zend_string_init(name, name_len, 0);
|
||||
zend_hash_update_ptr(statement->binds, zvtmp, bind);
|
||||
#if PHP_VERSION_ID < 70300
|
||||
zend_string_release(zvtmp);
|
||||
#else
|
||||
zend_string_release_ex(zvtmp, 0);
|
||||
#endif
|
||||
|
||||
statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */
|
||||
return 0;
|
||||
@@ -1737,7 +1783,7 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, zend_long max_table_le
|
||||
zend_hash_move_forward(hash);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bind = emalloc(sizeof(php_oci_bind));
|
||||
ZVAL_UNDEF(&bind->val);
|
||||
bind->array.elements = (text *)safe_emalloc(max_table_length * (maxlength + 1), sizeof(text), 0);
|
||||
@@ -1749,9 +1795,9 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, zend_long max_table_le
|
||||
memset(bind->array.element_lengths, 0, max_table_length*sizeof(ub2));
|
||||
bind->array.indicators = safe_emalloc(max_table_length, sizeof(sb2), 0);
|
||||
memset(bind->array.indicators, 0, max_table_length*sizeof(sb2));
|
||||
|
||||
|
||||
zend_hash_internal_pointer_reset(hash);
|
||||
|
||||
|
||||
for (i = 0; i < bind->array.current_length; i++) {
|
||||
if ((entry = zend_hash_get_current_data(hash)) != NULL) {
|
||||
convert_to_string_ex(entry);
|
||||
@@ -1769,13 +1815,13 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, zend_long max_table_le
|
||||
for (i = 0; i < max_table_length; i++) {
|
||||
if ((i < bind->array.current_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
|
||||
int element_length;
|
||||
|
||||
|
||||
convert_to_string_ex(entry);
|
||||
element_length = ((size_t) maxlength > Z_STRLEN_P(entry)) ? (int) Z_STRLEN_P(entry) : (int) maxlength;
|
||||
|
||||
|
||||
memcpy((text *)bind->array.elements + i*maxlength, Z_STRVAL_P(entry), element_length);
|
||||
((text *)bind->array.elements)[i*maxlength + element_length] = '\0';
|
||||
|
||||
|
||||
zend_hash_move_forward(hash);
|
||||
} else {
|
||||
((text *)bind->array.elements)[i*maxlength] = '\0';
|
||||
@@ -1808,7 +1854,7 @@ php_oci_bind *php_oci_bind_array_helper_number(zval *var, zend_long max_table_le
|
||||
bind->array.element_lengths = safe_emalloc(max_table_length, sizeof(ub2), 0);
|
||||
memset(bind->array.element_lengths, 0, max_table_length * sizeof(ub2));
|
||||
bind->array.indicators = NULL;
|
||||
|
||||
|
||||
zend_hash_internal_pointer_reset(hash);
|
||||
for (i = 0; i < max_table_length; i++) {
|
||||
if (i < bind->array.current_length) {
|
||||
@@ -1849,7 +1895,7 @@ php_oci_bind *php_oci_bind_array_helper_double(zval *var, zend_long max_table_le
|
||||
bind->array.element_lengths = safe_emalloc(max_table_length, sizeof(ub2), 0);
|
||||
memset(bind->array.element_lengths, 0, max_table_length * sizeof(ub2));
|
||||
bind->array.indicators = NULL;
|
||||
|
||||
|
||||
zend_hash_internal_pointer_reset(hash);
|
||||
for (i = 0; i < max_table_length; i++) {
|
||||
if (i < bind->array.current_length) {
|
||||
@@ -1899,7 +1945,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, zend_long max_table_leng
|
||||
bind->array.element_lengths[i] = sizeof(OCIDate);
|
||||
}
|
||||
if ((i < bind->array.current_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
|
||||
|
||||
|
||||
convert_to_string_ex(entry);
|
||||
PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_P(entry), (ub4) Z_STRLEN_P(entry), NULL, 0, NULL, 0, &oci_date));
|
||||
|
||||
@@ -1912,7 +1958,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, zend_long max_table_leng
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
((OCIDate *)bind->array.elements)[i] = oci_date;
|
||||
zend_hash_move_forward(hash);
|
||||
} else {
|
||||
@@ -1927,7 +1973,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, zend_long max_table_leng
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
((OCIDate *)bind->array.elements)[i] = oci_date;
|
||||
}
|
||||
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
|
||||
|
||||
+10
-10
@@ -508,7 +508,7 @@ Fixed bug #74625 (Integer overflow in oci_bind_array_by_name). (Ingmar Runge)
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<release>
|
||||
<version>
|
||||
<release>2.1.5</release>
|
||||
<api>2.1.5</api>
|
||||
@@ -520,9 +520,9 @@ Fixed bug #74625 (Integer overflow in oci_bind_array_by_name). (Ingmar Runge)
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>
|
||||
This version is for PHP 7 only.
|
||||
Added TAF callback support (PR #2459, KoenigsKind)
|
||||
Added TAF callback support (PR #2459, KoenigsKind)
|
||||
</notes>
|
||||
</release>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
@@ -555,7 +555,7 @@ This version is for PHP 7 only.
|
||||
Fixed bug #71148 (Bind reference overwritten on PHP 7)
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>2.1.2</release>
|
||||
@@ -588,7 +588,7 @@ This version is for PHP 7 only.
|
||||
Fixed bug #71600 (oci_fetch_all segfaults when selecting more than 8 columns)
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>2.1.0</release>
|
||||
@@ -601,7 +601,7 @@ Fixed bug #71600 (oci_fetch_all segfaults when selecting more than 8 columns)
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>
|
||||
This version is for PHP 7 only.
|
||||
Updated driver name format.
|
||||
Updated driver name format.
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
@@ -661,7 +661,7 @@ Enhancement - Improve performance of multi-row OCI_RETURN_LOB queries (Bug #6687
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>
|
||||
Added oci_bind_by_name() support for PL/SQL BOOLEAN type
|
||||
Added oci_bind_by_name() support for PL/SQL BOOLEAN type
|
||||
Build change: Fix source variable definition for C89 compatibility
|
||||
</notes>
|
||||
</release>
|
||||
@@ -763,7 +763,7 @@ Add the connection handle to several DTrace probes.
|
||||
<api>devel</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>
|
||||
<notes>
|
||||
Fixed --enable-maintainer-zts mode.
|
||||
Allow Implicit Result Set statement resources to inherit the parent's current prefetch count.
|
||||
Allow OCI8 to be DTrace-enabled independently from core PHP.
|
||||
@@ -781,7 +781,7 @@ Require OCI8 to be configured 'shared' when enabling DTrace support.
|
||||
<api>devel</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>
|
||||
<notes>
|
||||
- NEW FUNCTIONALITY:
|
||||
|
||||
- Added Implicit Result Set support for Oracle Database 12c.
|
||||
@@ -844,7 +844,7 @@ Require OCI8 to be configured 'shared' when enabling DTrace support.
|
||||
- Regularized code prototypes and fixed some in-line documentation
|
||||
prototypes.
|
||||
|
||||
- Fixed code folding.
|
||||
- Fixed code folding.
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ extern zend_class_entry *oci_coll_class_entry_ptr;
|
||||
#define PHP_OCI_ERRBUF_LEN OCI_ERROR_MAXMSG_SIZE2
|
||||
#else
|
||||
#define PHP_OCI_ERRBUF_LEN OCI_ERROR_MAXMSG_SIZE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* The mode parameter for oci_connect() is overloaded and accepts both
|
||||
* privilege and external authentication flags OR'd together.
|
||||
@@ -136,7 +136,7 @@ typedef struct {
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_oci_connection */
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
zend_resource *id; /* resource ID */
|
||||
OCIEnv *env; /* private env handle */
|
||||
ub2 charset; /* charset ID */
|
||||
@@ -170,7 +170,7 @@ typedef struct {
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_oci_descriptor */
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
zend_resource *id;
|
||||
zend_ulong index; /* descriptors hash table index */
|
||||
php_oci_connection *connection; /* parent connection handle */
|
||||
@@ -187,7 +187,7 @@ typedef struct {
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_ctx */
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
char **lob_data; /* address of pointer to LOB data */
|
||||
ub4 *lob_len; /* address of LOB length variable (bytes) */
|
||||
ub4 alloc_len;
|
||||
@@ -195,7 +195,7 @@ typedef struct {
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_oci_collection */
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
zend_resource *id;
|
||||
php_oci_connection *connection; /* parent connection handle */
|
||||
OCIType *tdo; /* collection's type handle */
|
||||
@@ -208,7 +208,7 @@ typedef struct {
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_oci_define */
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
zval val; /* zval used in define */
|
||||
text *name; /* placeholder's name */
|
||||
ub4 name_len; /* placeholder's name length */
|
||||
@@ -217,7 +217,7 @@ typedef struct {
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_oci_statement */
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
zend_resource *id;
|
||||
zend_resource *parent_stmtid; /* parent statement id */
|
||||
struct php_oci_statement *impres_child_stmt;/* child of current Implicit Result Set statement handle */
|
||||
@@ -242,7 +242,7 @@ typedef struct {
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_oci_bind */
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
OCIBind *bind; /* bind handle */
|
||||
zval val; /* value */
|
||||
dvoid *descriptor; /* used for binding of LOBS etc */
|
||||
@@ -265,7 +265,7 @@ typedef struct {
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_oci_out_column */
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
php_oci_statement *statement; /* statement handle. used when fetching REFCURSORS */
|
||||
php_oci_statement *nested_statement; /* statement handle. used when fetching REFCURSORS */
|
||||
OCIDefine *oci_define; /* define handle */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 1
|
||||
oci_bind_array_by_name() and invalid values 1
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
@@ -16,15 +16,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_001_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_001_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_001_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_001_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_001_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -58,7 +58,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): OCI-21560: argument 3 is null, invalid, or out of range in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
|
||||
|
||||
@@ -16,15 +16,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_002_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_002_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_002_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_002_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_002_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -58,7 +58,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): Maximum array length must be greater than zero in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
|
||||
|
||||
@@ -4,7 +4,7 @@ oci_bind_array_by_name() and invalid values 3
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -19,15 +19,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_003_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_003_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_003_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_003_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_003_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_execute(): ORA-01403: %s
|
||||
ORA-06512: at "%s.ARRAY_BIND_003_PKG", line %d
|
||||
ORA-06512: at line %d in %sarray_bind_003.php on line %d
|
||||
|
||||
@@ -4,7 +4,7 @@ oci_bind_array_by_name() and invalid values 4
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -19,15 +19,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_004_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_004_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_004_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_004_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_004_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_execute(): ORA-01403: %s
|
||||
ORA-06512: at "%s.ARRAY_BIND_004_PKG", line %d
|
||||
ORA-06512: at line %d in %sarray_bind_004.php on line %d
|
||||
|
||||
@@ -4,7 +4,7 @@ oci_bind_array_by_name() and invalid values 5
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -19,15 +19,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_005_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_005_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_005_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_005_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_005_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
|
||||
@@ -4,7 +4,7 @@ oci_bind_array_by_name(), SQLT_CHR and default max_length
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -19,15 +19,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_006_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_006_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_006_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_006_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_006_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(4) "five"
|
||||
|
||||
@@ -16,15 +16,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_007_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_007_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_007_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_007_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_007_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -58,7 +58,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: -1 in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
|
||||
|
||||
@@ -4,7 +4,7 @@ oci_bind_array_by_name() and invalid values 8
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -19,15 +19,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_008_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_008_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_008_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_008_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_008_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_execute(): ORA-06550: line %d, column %d:
|
||||
PLS-00418: %s
|
||||
ORA-06550: %s
|
||||
|
||||
@@ -11,7 +11,7 @@ var_dump(oci_bind_array_by_name($c, ":c1", $array, 5, 5, SQLT_CHR));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): supplied resource is not a valid oci8 statement resource in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -19,7 +19,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): ORA-01036: illegal variable name/number in %s on line %d
|
||||
array(5) {
|
||||
[0]=>
|
||||
|
||||
@@ -16,15 +16,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_011_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_011_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_011_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_011_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_011_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -58,7 +58,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
|
||||
|
||||
@@ -19,7 +19,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): Invalid max length value (-10) in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name() expects at most 6 parameters, 7 given in %s on line %d
|
||||
NULL
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ oci_bind_array_by_name() and NUMBERs
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -19,15 +19,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_014_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_014_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_014_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_014_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_014_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -60,7 +60,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(5)
|
||||
|
||||
@@ -5,7 +5,7 @@ Unsupported type: oci_bind_array_by_name() and SQLT_BDOUBLE
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
if (!defined('SQLT_BDOUBLE')) die('skip SQLT_BDOUBLE type not available on older Oracle clients');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ Unsupported type: oci_bind_array_by_name() and SQLT_BFLOAT
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
if (!defined('SQLT_BFLOAT')) die('skip SQLT_BFLOAT type not available on older Oracle clients');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ oci_bind_array_by_name() and SQLT_ODT
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -19,15 +19,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_DATE_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_DATE_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_DATE_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_DATE_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_DATE_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(9) "05-NOV-05"
|
||||
|
||||
@@ -4,7 +4,7 @@ oci_bind_array_by_name() and SQLT_ODT
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -19,15 +19,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_DATE1_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_DATE1_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_DATE1_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_DATE1_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_DATE1_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(9) "05-NOV-05"
|
||||
|
||||
@@ -4,7 +4,7 @@ oci_bind_array_by_name() and SQLT_FLT
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -19,15 +19,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_FLOAT_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF FLOAT INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_FLOAT_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF FLOAT INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_FLOAT_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_FLOAT_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_FLOAT_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
float(5.9999)
|
||||
|
||||
@@ -4,7 +4,7 @@ oci_bind_array_by_name() and SQLT_FLT
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -19,15 +19,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_FLOAT1_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF FLOAT INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_FLOAT1_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF FLOAT INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_FLOAT1_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_FLOAT1_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_FLOAT1_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
float(5.9999)
|
||||
|
||||
@@ -4,7 +4,7 @@ oci_bind_array_by_name() and SQLT_INT
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -19,15 +19,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_INT_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_INT_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_INT_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_INT_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_INT_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(5)
|
||||
|
||||
@@ -4,7 +4,7 @@ oci_bind_array_by_name() and SQLT_INT
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -19,15 +19,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_INT1_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_INT1_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_INT1_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_INT1_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_INT1_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(5)
|
||||
|
||||
@@ -4,7 +4,7 @@ oci_bind_array_by_name() and SQLT_CHR
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -19,15 +19,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_STR_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_STR_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_STR_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_STR_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_STR_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(4) "five"
|
||||
|
||||
@@ -4,7 +4,7 @@ oci_bind_array_by_name() and SQLT_CHR
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -19,15 +19,15 @@ $statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_STR1_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
CREATE OR REPLACE PACKAGE ARRAY_BIND_STR1_PKG AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAY_BIND_STR1_PKG;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_STR1_PKG AS
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_STR1_PKG AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(4) "five"
|
||||
|
||||
@@ -4,7 +4,7 @@ Unsupported type: oci_bind_array_by_name() and SQLT_UIN
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ Bug #47243 (Crash on exit with ZTS mode)
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -21,5 +21,5 @@ oci_fetch_all($s, $r);
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -4,7 +4,7 @@ Bug #47243 (Crash on exit with ZTS mode)
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -22,5 +22,5 @@ oci_free_statement($s);
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -4,7 +4,7 @@ Bug #47243 (Crash on exit with ZTS mode)
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -23,5 +23,5 @@ oci_close($c);
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -1,15 +1,15 @@
|
||||
--TEST--
|
||||
Basic PL/SQL "BOOLEAN" (SQLT_BOL) bind test
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||
<?php
|
||||
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
|
||||
if (!(isset($matches[0]) && $matches[1] >= 12)) {
|
||||
die("skip expected output only valid when using Oracle Database 12c or greater");
|
||||
}
|
||||
preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
|
||||
if (!(isset($matches[0]) && $matches[0] >= 12)) {
|
||||
if (!(isset($matches[0]) && $matches[0] >= 12)) {
|
||||
die("skip works only with Oracle 12c or greater version of Oracle client libraries");
|
||||
}
|
||||
?>
|
||||
@@ -46,7 +46,7 @@ var_dump($b);
|
||||
|
||||
echo "Test 3\n";
|
||||
|
||||
$sql =
|
||||
$sql =
|
||||
"begin
|
||||
if (:input < 10) then
|
||||
:output := true;
|
||||
@@ -64,7 +64,7 @@ for ($input = 5; $input < 15; ++$input) {
|
||||
|
||||
echo "Test 4\n";
|
||||
|
||||
$sql =
|
||||
$sql =
|
||||
"begin
|
||||
if (mod(:userid,2) = 0) then
|
||||
:b := true;
|
||||
@@ -82,7 +82,7 @@ for ($userid = 1; $userid <= 10; ++$userid) {
|
||||
|
||||
echo "Test 5\n";
|
||||
|
||||
$sql =
|
||||
$sql =
|
||||
"declare
|
||||
l boolean;
|
||||
begin
|
||||
@@ -102,7 +102,7 @@ var_dump($b1, $b2);
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
Test 1
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
@@ -26,7 +26,7 @@ $stmtarray = array(
|
||||
"insert into bind_char_tab values (2, NULL, 'abc')",
|
||||
"insert into bind_char_tab values (3, NULL, 'abc ')"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
@@ -196,7 +196,7 @@ function do_e_q($s)
|
||||
$stmtarray = array(
|
||||
"drop table bind_char_tab"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
@@ -28,7 +28,7 @@ $stmtarray = array(
|
||||
"insert into bind_char_tab values (2, NULL, 'abc')",
|
||||
"insert into bind_char_tab values (3, NULL, 'abc ')"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
@@ -198,7 +198,7 @@ function do_e_q($s)
|
||||
$stmtarray = array(
|
||||
"drop table bind_char_tab"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
@@ -25,7 +25,7 @@ $stmtarray = array(
|
||||
"create table bind_char_tab (id number, c1 date)",
|
||||
"insert into bind_char_tab values (1, '2008-04-20')",
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
@@ -85,7 +85,7 @@ function do_e_q($s)
|
||||
$stmtarray = array(
|
||||
"drop table bind_char_tab"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
@@ -25,7 +25,7 @@ $stmtarray = array(
|
||||
"create table bind_char_tab (id number, c1 date)",
|
||||
"insert into bind_char_tab values (1, '2008-04-20')",
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
@@ -85,7 +85,7 @@ function do_e_q($s)
|
||||
$stmtarray = array(
|
||||
"drop table bind_char_tab"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
@@ -243,7 +243,7 @@ oci8_test_sql_execute($c, $stmtarray);
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default
|
||||
Executing:
|
||||
Oci_execute error ORA-6502
|
||||
|
||||
@@ -22,7 +22,7 @@ require(dirname(__FILE__).'/connect.inc');
|
||||
$stmtarray = array(
|
||||
"create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
@@ -243,7 +243,7 @@ oci8_test_sql_execute($c, $stmtarray);
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default
|
||||
Executing:
|
||||
Oci_execute error ORA-6502
|
||||
|
||||
@@ -24,7 +24,7 @@ require(dirname(__FILE__).'/connect.inc');
|
||||
$stmtarray = array(
|
||||
"create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
@@ -245,7 +245,7 @@ oci8_test_sql_execute($c, $stmtarray);
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default
|
||||
Executing:
|
||||
Oci_execute error ORA-6502
|
||||
|
||||
@@ -24,7 +24,7 @@ require(dirname(__FILE__).'/connect.inc');
|
||||
$stmtarray = array(
|
||||
"create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
@@ -245,7 +245,7 @@ oci8_test_sql_execute($c, $stmtarray);
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default
|
||||
Executing:
|
||||
Oci_execute error ORA-6502
|
||||
|
||||
@@ -91,7 +91,7 @@ $statement = oci_parse($c, $drop);
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
Test 1
|
||||
bool(true)
|
||||
Test 2
|
||||
|
||||
@@ -4,7 +4,7 @@ bind LONG field
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ bind LONG RAW field
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ Bind miscellaneous column types using default types
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -270,7 +270,7 @@ oci_close($c);
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
TEST86 insert all ORATYPE values
|
||||
|
||||
TEST87 SELECT all values using DEFINEs
|
||||
|
||||
@@ -45,7 +45,7 @@ function check_col($c, $colname, $id)
|
||||
|
||||
// Tests
|
||||
|
||||
echo "\nTest 1 insert numbers \n";
|
||||
echo "\nTest 1 insert numbers\n";
|
||||
|
||||
$n1 = -23253245.3432467;
|
||||
|
||||
@@ -55,7 +55,7 @@ oci_execute($s);
|
||||
|
||||
check_col($c, 'number_t6', 57);
|
||||
|
||||
echo "\nTest 2 insert numbers \n";
|
||||
echo "\nTest 2 insert numbers\n";
|
||||
|
||||
$n1 = "Hello";
|
||||
|
||||
@@ -119,7 +119,7 @@ oci_close($c);
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
Test 1 insert numbers
|
||||
Test 1 insert numbers
|
||||
|
||||
Warning: oci_execute(): ORA-01438: %s in %sbind_misccoltypes_errs.php on line %d
|
||||
array(1) {
|
||||
@@ -128,7 +128,7 @@ array(1) {
|
||||
}
|
||||
}
|
||||
|
||||
Test 2 insert numbers
|
||||
Test 2 insert numbers
|
||||
|
||||
Warning: oci_execute(): ORA-01722: %s in %sbind_misccoltypes_errs.php on line %d
|
||||
array(1) {
|
||||
|
||||
@@ -64,7 +64,7 @@ oci8_test_sql_execute($c, $stmtarray);
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
Test 1
|
||||
array(1) {
|
||||
[0]=>
|
||||
|
||||
@@ -4,7 +4,7 @@ bind RAW field
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
Loaded 100 of 421 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user