mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-23 00:45:43 +00:00
Compare commits
317
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 | ||
|
|
095a30e11b | ||
|
|
e111ef5626 | ||
|
|
2870178720 | ||
|
|
d207d6a57f | ||
|
|
cc69950b15 | ||
|
|
ce66492a13 | ||
|
|
ed7e3bc70a | ||
|
|
a96ca13963 | ||
|
|
40bd84d3e3 | ||
|
|
033dac7a6f | ||
|
|
2a181b5ea0 | ||
|
|
38d97557da | ||
|
|
c20a97df6d | ||
|
|
2139c2c2de | ||
|
|
33eb30274f | ||
|
|
99fdf5916e | ||
|
|
2073e96ec5 | ||
|
|
9e54d9d692 | ||
|
|
ca618a4f10 | ||
|
|
0510b47894 | ||
|
|
e5b27b9916 | ||
|
|
1ba3314335 | ||
|
|
b494d94f16 | ||
|
|
dfc2e3a2ac | ||
|
|
d011da9d1a | ||
|
|
c4106d4569 | ||
|
|
1127163996 | ||
|
|
b52c4fcbcd | ||
|
|
e069b0beba | ||
|
|
ebd5f56442 | ||
|
|
a536d6d61b | ||
|
|
4e92cd172a | ||
|
|
bddf8140e4 | ||
|
|
f151e048ed | ||
|
|
b73a108543 | ||
|
|
289cb0f77c | ||
|
|
3462efa386 | ||
|
|
1baeae4270 | ||
|
|
8efd3c3387 | ||
|
|
0f8c1ee76d | ||
|
|
dee191ee07 | ||
|
|
141072a838 | ||
|
|
f28aeaee05 | ||
|
|
99fe18503a | ||
|
|
77ced46dea | ||
|
|
236ae06e0b | ||
|
|
9443c61928 | ||
|
|
cc7b000d2c | ||
|
|
cc266045a5 | ||
|
|
98102648cb | ||
|
|
a766f65ca3 | ||
|
|
c23736216d | ||
|
|
9026562c79 | ||
|
|
ebb590b625 | ||
|
|
08f08858f3 | ||
|
|
474292c3e4 | ||
|
|
a820aab9da | ||
|
|
a6e8c73c43 | ||
|
|
2c43fb49d6 | ||
|
|
545a29d0cb | ||
|
|
ad790bea2e | ||
|
|
77a841db48 | ||
|
|
5d0d812a53 | ||
|
|
47fb17b108 | ||
|
|
d207fd449c | ||
|
|
1ae888d984 | ||
|
|
ea24847620 | ||
|
|
d85651d58d | ||
|
|
246cb03e26 | ||
|
|
3847a6fcb6 | ||
|
|
137f22ad36 | ||
|
|
268e801cb1 | ||
|
|
f3dc67b255 | ||
|
|
791f07e4f0 | ||
|
|
e5ef7cbe87 | ||
|
|
8bf21adb8c | ||
|
|
9bbb9e537c | ||
|
|
c97b8bbf82 | ||
|
|
3a236d0587 | ||
|
|
787593b708 | ||
|
|
09bb2527e9 | ||
|
|
c793885b76 | ||
|
|
26a33a96fa | ||
|
|
f8258325b4 | ||
|
|
39d668e927 | ||
|
|
a72bab1b9a | ||
|
|
ae163d9a36 | ||
|
|
1118fca75d | ||
|
|
0f1726e45d | ||
|
|
9b0df97a42 | ||
|
|
34deda13a8 | ||
|
|
2eb6a541a9 | ||
|
|
e2285eb542 | ||
|
|
ae04110032 | ||
|
|
deb1bad80f | ||
|
|
962706d16c | ||
|
|
15ad5d31d1 | ||
|
|
ef274e0b60 | ||
|
|
fb09f1341f | ||
|
|
486f18f09e | ||
|
|
cb97fd3097 | ||
|
|
00c0d7702c | ||
|
|
bf5a802f5a | ||
|
|
c5276ad380 | ||
|
|
f6430e3fe2 | ||
|
|
e835916f65 | ||
|
|
88b5df91f6 | ||
|
|
b35f45ded2 | ||
|
|
19b4fa17d3 | ||
|
|
809a7b5f8f | ||
|
|
5d7f9dcca7 | ||
|
|
1f6b842af4 | ||
|
|
7b98d056d3 | ||
|
|
3521661bd1 | ||
|
|
d1b1866a3a | ||
|
|
2458dab466 | ||
|
|
6b5597f7d8 | ||
|
|
096fd88dcb | ||
|
|
5af0db88fa | ||
|
|
14b22704c7 | ||
|
|
701460ba84 | ||
|
|
ed9d1b708b | ||
|
|
4a4c72a82a | ||
|
|
1f726c9925 | ||
|
|
d95ee27551 | ||
|
|
77bd405959 | ||
|
|
b20bcbc363 | ||
|
|
3c42f64e6e | ||
|
|
e62c6e7dbe | ||
|
|
939e1095f2 | ||
|
|
6531719da5 | ||
|
|
011be49dda | ||
|
|
bcf2e10ae7 | ||
|
|
44f4d2be01 | ||
|
|
69dee5c732 |
No files matched your search
+1
-7
@@ -8,12 +8,6 @@ branches:
|
||||
- PHP-5.6
|
||||
- PHP-7.0
|
||||
|
||||
skip_commits:
|
||||
files:
|
||||
- NEWS
|
||||
- UPGRADING*
|
||||
- README.*
|
||||
|
||||
clone_depth: 64
|
||||
|
||||
cache:
|
||||
@@ -23,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.5
|
||||
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
@@ -1,6 +1,6 @@
|
||||
dist: trusty
|
||||
language: c
|
||||
sudo: false
|
||||
sudo: required
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
|
||||
+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,17 +1,205 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? ????, PHP 7.2.8
|
||||
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).
|
||||
(cmb)
|
||||
|
||||
- Filter:
|
||||
. Fixed bug #76366 (References in sub-array for filtering breaks the filter).
|
||||
(ZiHang Gao)
|
||||
|
||||
- PDO_Firebird:
|
||||
. Fixed bug #76488 (Memory leak when fetching a BLOB field). (Simonov Denis)
|
||||
|
||||
- PDO_PgSQL:
|
||||
. Fixed bug #75402 (Possible Memory Leak using PDO::CURSOR_SCROLL option).
|
||||
(Anatol)
|
||||
|
||||
- SQLite3:
|
||||
. Fixed #76665 (SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle).
|
||||
(cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #73817 (Incorrect entries in get_html_translation_table). (cmb)
|
||||
. Fixed bug #68553 (array_column: null values in $index_key become incrementing
|
||||
keys in result). (Laruence)
|
||||
. Fixed bug #76643 (Segmentation fault when using `output_add_rewrite_var`).
|
||||
(cmb)
|
||||
|
||||
- Zip:
|
||||
. Fixed bug #76524 (ZipArchive memory leak (OVERWRITE flag and empty archive)).
|
||||
(Timur Ibragimov)
|
||||
|
||||
19 Jul 2018, PHP 7.2.8
|
||||
|
||||
- Core:
|
||||
. Fixed bug #76534 (PHP hangs on 'illegal string offset on string references
|
||||
with an error handler). (Laruence)
|
||||
. Fixed bug #76520 (Object creation leaks memory when executed over HTTP).
|
||||
(Nikita)
|
||||
. Fixed bug #76502 (Chain of mixed exceptions and errors does not serialize
|
||||
properly). (Nikita)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #76462 (Undefined property: DateInterval::$f). (Anatol)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #76409 (heap use after free in _php_stream_free). (cmb)
|
||||
. Fixed bug #76423 (Int Overflow lead to Heap OverFlow in
|
||||
exif_thumbnail_extract of exif.c). (Stas)
|
||||
. Fixed bug #76557 (heap-buffer-overflow (READ of size 48) while reading exif
|
||||
data). (Stas)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #73342 (Vulnerability in php-fpm by changing stdin to
|
||||
non-blocking). (Nikita)
|
||||
|
||||
- GMP:
|
||||
. Fixed bug #74670 (Integer Underflow when unserializing GMP and possible
|
||||
other classes). (Nikita)
|
||||
|
||||
- intl:
|
||||
. Fixed bug #76556 (get_debug_info handler for BreakIterator shows wrong
|
||||
type). (cmb)
|
||||
|
||||
- mbstring:
|
||||
. Fixed bug #76532 (Integer overflow and excessive memory usage
|
||||
in mb_strimwidth). (MarcusSchwarz)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #76477 (Opcache causes empty return value).
|
||||
(Nikita, Laruence)
|
||||
|
||||
- PGSQL:
|
||||
. Fixed bug #76548 (pg_fetch_result did not fetch the next row). (Anatol)
|
||||
|
||||
- phpdbg:
|
||||
. Fix arginfo wrt. optional/required parameters. (cmb)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #76536 (PHP crashes with core dump when throwing exception in
|
||||
error handler). (Laruence)
|
||||
. Fixed bug #75231 (ReflectionProperty#getValue() incorrectly works with
|
||||
inherited classes). (Nikita)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #76505 (array_merge_recursive() is duplicating sub-array keys).
|
||||
(Laruence)
|
||||
. Fixed bug #71848 (getimagesize with $imageinfo returns false). (cmb)
|
||||
|
||||
- Win32:
|
||||
. Fixed bug #76459 (windows linkinfo lacks openbasedir check). (Anatol)
|
||||
|
||||
- ZIP:
|
||||
. Fixed bug #76461 (OPSYS_Z_CPM defined instead of OPSYS_CPM).
|
||||
(Dennis Birkholz, Remi)
|
||||
|
||||
+3
-3
@@ -60,7 +60,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#include <math.h>
|
||||
|
||||
#ifndef zend_isnan
|
||||
#if HAVE_DECL_ISNAN
|
||||
#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
@@ -69,7 +69,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_ISINF
|
||||
#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_isinf(a) isinf(a)
|
||||
#elif defined(INFINITY)
|
||||
/* Might not work, but is required by ISO C99 */
|
||||
@@ -80,7 +80,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#define zend_isinf(a) 0
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_ISFINITE
|
||||
#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(HAVE_FINITE)
|
||||
#define zend_finite(a) finite(a)
|
||||
|
||||
@@ -20,7 +20,7 @@ assert(0 && ($a = function () {
|
||||
yield from $x;
|
||||
}));
|
||||
|
||||
assert(0 && ($a = function &(array &$a, X $b = null) use ($c,&$d) : X {
|
||||
assert(0 && ($a = function &(array &$a, ?X $b = null) use ($c,&$d) : ?X {
|
||||
abstract class A extends B implements C, D {
|
||||
const X = 12;
|
||||
const Y = self::X, Z = "aaa";
|
||||
@@ -161,7 +161,7 @@ Warning: assert(): assert(0 && ($a = function () {
|
||||
yield from $x;
|
||||
})) failed in %sexpect_015.php on line %d
|
||||
|
||||
Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c, &$d): X {
|
||||
Warning: assert(): assert(0 && ($a = function &(array &$a, ?X $b = null) use($c, &$d): ?X {
|
||||
abstract class A extends B implements C, D {
|
||||
const X = 12;
|
||||
const Y = self::X, Z = 'aaa';
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Bug #76502: Chain of mixed exceptions and errors does not serialize properly
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$examples = [
|
||||
"Exception(Exception())" => new Exception("outer", 0, new Exception("inner")),
|
||||
"Error(Error())" => new Error("outer", 0, new Error("inner")),
|
||||
"Error(Exception())" => new Error("outer", 0, new Exception("inner")),
|
||||
"Exception(Error())" => new Exception("outer", 0, new Error("inner"))
|
||||
];
|
||||
|
||||
foreach ($examples as $name => $example) {
|
||||
$processed = unserialize(serialize($example));
|
||||
$processedPrev = $processed->getPrevious();
|
||||
echo "---- $name ----\n";
|
||||
echo "before: ", get_class($example), ".previous == ",
|
||||
get_class($example->getPrevious()), "\n";
|
||||
echo "after : ", get_class($processed), ".previous == ",
|
||||
$processedPrev ? get_class($processedPrev) : "null", "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
---- Exception(Exception()) ----
|
||||
before: Exception.previous == Exception
|
||||
after : Exception.previous == Exception
|
||||
---- Error(Error()) ----
|
||||
before: Error.previous == Error
|
||||
after : Error.previous == Error
|
||||
---- Error(Exception()) ----
|
||||
before: Error.previous == Exception
|
||||
after : Error.previous == Exception
|
||||
---- Exception(Error()) ----
|
||||
before: Exception.previous == Error
|
||||
after : Exception.previous == Error
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #76534 (PHP hangs on 'illegal string offset on string references with an error handler)
|
||||
--FILE--
|
||||
<?php
|
||||
set_error_handler(function ($severity, $message, $file, $line) {
|
||||
throw new \Exception($message);
|
||||
});
|
||||
|
||||
$x = "foo";
|
||||
$y = &$x["bar"];
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Exception: Illegal string offset 'bar' in %sbug76534.php:%d
|
||||
Stack trace:
|
||||
#0 %sbug76534.php(%d): {closure}(2, 'Illegal string ...', '%s', %d, Array)
|
||||
#1 {main}
|
||||
thrown in %sbug76534.php on line %d
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+8
-1
@@ -195,7 +195,14 @@ ZEND_API void * __zend_realloc(void *p, size_t len) ZEND_ATTRIBUTE_ALLOC_SIZE(2)
|
||||
#define pemalloc(size, persistent) ((persistent)?__zend_malloc(size):emalloc(size))
|
||||
#define safe_pemalloc(nmemb, size, offset, persistent) ((persistent)?_safe_malloc(nmemb, size, offset):safe_emalloc(nmemb, size, offset))
|
||||
#define pefree(ptr, persistent) ((persistent)?free(ptr):efree(ptr))
|
||||
#define pefree_size(ptr, size, persistent) ((persistent)?free(ptr):efree_size(ptr, size))
|
||||
#define pefree_size(ptr, size, persistent) do { \
|
||||
if (persistent) { \
|
||||
free(ptr); \
|
||||
} else { \
|
||||
efree_size(ptr, size);\
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define pecalloc(nmemb, size, persistent) ((persistent)?__zend_calloc((nmemb), (size)):ecalloc((nmemb), (size)))
|
||||
#define perealloc(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc((ptr), (size)))
|
||||
#define perealloc2(ptr, size, copy_size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc2((ptr), (size), (copy_size)))
|
||||
|
||||
@@ -1076,6 +1076,9 @@ tail_call:
|
||||
zend_ast_export_ex(str, decl->child[1], 0, indent);
|
||||
if (decl->child[3]) {
|
||||
smart_str_appends(str, ": ");
|
||||
if (decl->child[3]->attr & ZEND_TYPE_NULLABLE) {
|
||||
smart_str_appendc(str, '?');
|
||||
}
|
||||
zend_ast_export_ns_name(str, decl->child[3], 0, indent);
|
||||
}
|
||||
if (decl->child[2]) {
|
||||
@@ -1610,6 +1613,9 @@ simple_list:
|
||||
break;
|
||||
case ZEND_AST_PARAM:
|
||||
if (ast->child[0]) {
|
||||
if (ast->child[0]->attr & ZEND_TYPE_NULLABLE) {
|
||||
smart_str_appendc(str, '?');
|
||||
}
|
||||
zend_ast_export_ns_name(str, ast->child[0], 0, indent);
|
||||
smart_str_appendc(str, ' ');
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-2
@@ -968,8 +968,8 @@ static zend_always_inline int zend_check_arg_send_type(const zend_function *zf,
|
||||
#define ZEND_RETURN_REF 1
|
||||
|
||||
|
||||
#define ZEND_RETURNS_FUNCTION 1<<0
|
||||
#define ZEND_RETURNS_VALUE 1<<1
|
||||
#define ZEND_RETURNS_FUNCTION (1<<0)
|
||||
#define ZEND_RETURNS_VALUE (1<<1)
|
||||
|
||||
#define ZEND_ARRAY_ELEMENT_REF (1<<0)
|
||||
#define ZEND_ARRAY_NOT_PACKED (1<<1)
|
||||
|
||||
@@ -323,7 +323,7 @@ ZEND_METHOD(exception, __wakeup)
|
||||
CHECK_EXC_TYPE(ZEND_STR_TRACE, IS_ARRAY);
|
||||
pvalue = zend_read_property(i_get_exception_base(object), object, "previous", sizeof("previous")-1, 1, &value);
|
||||
if (pvalue && Z_TYPE_P(pvalue) != IS_NULL && (Z_TYPE_P(pvalue) != IS_OBJECT ||
|
||||
!instanceof_function(Z_OBJCE_P(pvalue), i_get_exception_base(object)) ||
|
||||
!instanceof_function(Z_OBJCE_P(pvalue), zend_ce_throwable) ||
|
||||
pvalue == object)) {
|
||||
zend_unset_property(i_get_exception_base(object), object, "previous", sizeof("previous")-1);
|
||||
}
|
||||
|
||||
+9
-4
@@ -990,9 +990,12 @@ static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
|
||||
zend_class_entry *ce = NULL;
|
||||
void *dummy_cache_slot = NULL;
|
||||
|
||||
if (UNEXPECTED(ZEND_TYPE_CODE(ret_info->type) == IS_VOID && Z_TYPE_P(ret) != IS_NULL)) {
|
||||
zend_verify_void_return_error(zf, zend_zval_type_name(ret), "");
|
||||
return 0;
|
||||
if (ZEND_TYPE_CODE(ret_info->type) == IS_VOID) {
|
||||
if (UNEXPECTED(Z_TYPE_P(ret) != IS_NULL)) {
|
||||
zend_verify_void_return_error(zf, zend_zval_type_name(ret), "");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (UNEXPECTED(!zend_check_type(ret_info->type, ret, &ce, &dummy_cache_slot, NULL, NULL, 1))) {
|
||||
@@ -1651,7 +1654,9 @@ fetch_from_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, type EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
ZVAL_ERROR(result);
|
||||
} else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
|
||||
|
||||
@@ -142,6 +142,7 @@ void init_executor(void) /* {{{ */
|
||||
EG(in_autoload) = NULL;
|
||||
EG(autoload_func) = NULL;
|
||||
EG(error_handling) = EH_NORMAL;
|
||||
EG(flags) = EG_FLAGS_INITIAL;
|
||||
|
||||
zend_vm_stack_init();
|
||||
|
||||
|
||||
+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;
|
||||
}
|
||||
|
||||
+3
-1
@@ -916,7 +916,9 @@ ZEND_VM_C_LABEL(assign_dim_op_convert_to_array):
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
|
||||
+24
-8
@@ -17661,7 +17661,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -20685,7 +20687,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -21999,7 +22003,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -24605,7 +24611,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -35400,7 +35408,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -39558,7 +39568,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -41917,7 +41929,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -45591,7 +45605,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
|
||||
@@ -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
|
||||
|
||||
+5
-5
@@ -68,7 +68,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#include <math.h>
|
||||
|
||||
#ifndef zend_isnan
|
||||
#if HAVE_DECL_ISNAN
|
||||
#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
@@ -77,7 +77,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_ISINF
|
||||
#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_isinf(a) isinf(a)
|
||||
#elif defined(INFINITY)
|
||||
/* Might not work, but is required by ISO C99 */
|
||||
@@ -88,7 +88,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#define zend_isinf(a) 0
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_ISFINITE
|
||||
#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(HAVE_FINITE)
|
||||
#define zend_finite(a) finite(a)
|
||||
@@ -107,8 +107,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=7
|
||||
PHP_MINOR_VERSION=2
|
||||
PHP_RELEASE_VERSION=7
|
||||
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)
|
||||
|
||||
+25
-25
@@ -340,38 +340,38 @@ char *JewishMonthName[14] =
|
||||
char *JewishMonthHebNameLeap[14] =
|
||||
{
|
||||
"",
|
||||
"תשרי",
|
||||
"חשון",
|
||||
"כסלו",
|
||||
"טבת",
|
||||
"שבט",
|
||||
"אדר א'",
|
||||
"אדר ב'",
|
||||
"ניסן",
|
||||
"אייר",
|
||||
"סיון",
|
||||
"תמוז",
|
||||
"אב",
|
||||
"אלול"
|
||||
"\xFA\xF9\xF8\xE9",
|
||||
"\xE7\xF9\xE5\xEF",
|
||||
"\xEB\xF1\xEC\xE5",
|
||||
"\xE8\xE1\xFA",
|
||||
"\xF9\xE1\xE8",
|
||||
"\xE0\xE3\xF8 \xE0'",
|
||||
"\xE0\xE3\xF8 \xE1'",
|
||||
"\xF0\xE9\xF1\xEF",
|
||||
"\xE0\xE9\xE9\xF8",
|
||||
"\xF1\xE9\xe5\xEF",
|
||||
"\xFA\xEE\xE5\xE6",
|
||||
"\xE0\xE1",
|
||||
"\xE0\xEC\xE5\xEC"
|
||||
};
|
||||
|
||||
/* names for regular year */
|
||||
char *JewishMonthHebName[14] =
|
||||
{
|
||||
"",
|
||||
"תשרי",
|
||||
"חשון",
|
||||
"כסלו",
|
||||
"טבת",
|
||||
"שבט",
|
||||
"\xFA\xF9\xF8\xE9",
|
||||
"\xE7\xF9\xE5\xEF",
|
||||
"\xEB\xF1\xEC\xE5",
|
||||
"\xE8\xE1\xFA",
|
||||
"\xF9\xE1\xE8",
|
||||
"",
|
||||
"אדר",
|
||||
"ניסן",
|
||||
"אייר",
|
||||
"סיון",
|
||||
"תמוז",
|
||||
"אב",
|
||||
"אלול"
|
||||
"\xE0\xE3\xF8",
|
||||
"\xF0\xE9\xF1\xEF",
|
||||
"\xE0\xE9\xE9\xF8",
|
||||
"\xF1\xE9\xE5\xEF",
|
||||
"\xFA\xEE\xE5\xE6",
|
||||
"\xE0\xE1",
|
||||
"\xE0\xEC\xE5\xEC"
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
--TEST--
|
||||
Test all hebrew month names
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('calendar')) die('skip calendar extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
for ($year = 5000; $year <= 5001; $year++) {
|
||||
$leap = ($year === 5001) ? 'leap' : 'normal';
|
||||
echo "$leap year $year\n";
|
||||
for ($month = 1; $month <= 13; $month++) {
|
||||
$jd = jewishtojd($month, 1, $year);
|
||||
$hebrew = jdtojewish($jd, true);
|
||||
$hex = bin2hex($hebrew);
|
||||
echo "$hex\n";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
normal year 5000
|
||||
e020faf9f8e920e4
|
||||
e020e7f9e5ef20e4
|
||||
e020ebf1ece520e4
|
||||
e020e8e1fa20e4
|
||||
e020f9e1e820e4
|
||||
e020e0e3f820e02720e4
|
||||
e020e0e3f820e12720e4
|
||||
e020f0e9f1ef20e4
|
||||
e020e0e9e9f820e4
|
||||
e020f1e9e5ef20e4
|
||||
e020faeee5e620e4
|
||||
e020e0e120e4
|
||||
e020e0ece5ec20e4
|
||||
|
||||
leap year 5001
|
||||
e020faf9f8e920e4e0
|
||||
e020e7f9e5ef20e4e0
|
||||
e020ebf1ece520e4e0
|
||||
e020e8e1fa20e4e0
|
||||
e020f9e1e820e4e0
|
||||
e020e0e3f820e4e0
|
||||
e020e0e3f820e4e0
|
||||
e020f0e9f1ef20e4e0
|
||||
e020e0e9e9f820e4e0
|
||||
e020f1e9e5ef20e4e0
|
||||
e020faeee5e620e4e0
|
||||
e020e0e120e4e0
|
||||
e020e0ece5ec20e4e0
|
||||
|
||||
===DONE===
|
||||
@@ -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
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -42,7 +42,11 @@ struct _notationIterator {
|
||||
xmlNotation *notation;
|
||||
};
|
||||
|
||||
static void itemHashScanner (void *payload, void *data, xmlChar *name) /* {{{ */
|
||||
#if LIBXML_VERSION >= 20908
|
||||
static void itemHashScanner (void *payload, void *data, const xmlChar *name) /* {{{ */
|
||||
#else
|
||||
static void itemHashScanner (void *payload, void *data, xmlChar *name)
|
||||
#endif
|
||||
{
|
||||
nodeIterator *priv = (nodeIterator *)data;
|
||||
|
||||
|
||||
+9
-3
@@ -2944,7 +2944,10 @@ static void exif_thumbnail_extract(image_info_type *ImageInfo, char *offset, siz
|
||||
return;
|
||||
}
|
||||
/* Check to make sure we are not going to go past the ExifLength */
|
||||
if ((ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length) {
|
||||
if (ImageInfo->Thumbnail.size > length
|
||||
|| (ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length
|
||||
|| ImageInfo->Thumbnail.offset > length - ImageInfo->Thumbnail.size
|
||||
) {
|
||||
EXIF_ERRLOG_THUMBEOF(ImageInfo)
|
||||
return;
|
||||
}
|
||||
@@ -3126,7 +3129,8 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
#endif
|
||||
const maker_note_type *maker_note;
|
||||
char *dir_start;
|
||||
|
||||
int data_len;
|
||||
|
||||
for (i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) {
|
||||
if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) {
|
||||
#ifdef EXIF_DEBUG
|
||||
@@ -3180,6 +3184,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
switch (maker_note->offset_mode) {
|
||||
case MN_OFFSET_MAKER:
|
||||
offset_base = value_ptr;
|
||||
data_len = value_len;
|
||||
break;
|
||||
#ifdef KALLE_0
|
||||
case MN_OFFSET_GUESS:
|
||||
@@ -3197,6 +3202,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
return FALSE;
|
||||
}
|
||||
offset_base = value_ptr + offset_diff;
|
||||
data_len = value_len - offset_diff;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -3211,7 +3217,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
|
||||
for (de=0;de<NumDirEntries;de++) {
|
||||
if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
|
||||
offset_base, IFDlength, displacement, section_index, 0, maker_note->tag_table)) {
|
||||
offset_base, data_len, displacement, section_index, 0, maker_note->tag_table)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #76423 (Int Overflow lead to Heap OverFlow in exif_thumbnail_extract of exif.c)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('exif')) die('skip exif extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
exif_read_data(__DIR__ . '/bug76423.jpg', 0, true, true);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
|
||||
Warning: exif_read_data(%s.jpg): Thumbnail goes IFD boundary or end of file reached in %s on line %d
|
||||
|
||||
Warning: exif_read_data(%s.jpg): File structure corrupted in %s on line %d
|
||||
|
||||
Warning: exif_read_data(%s.jpg): Invalid JPEG file in %s on line %d
|
||||
===DONE===
|
||||
Binary file not shown.
@@ -0,0 +1,79 @@
|
||||
--TEST--
|
||||
Bug 76557 (heap-buffer-overflow (READ of size 48) while reading exif data)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(exif_read_data(dirname(__FILE__) . "/bug76557.jpg"));
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x010F=Make ): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x8769=Exif_IFD_Po): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x927C=MakerNote ): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal pointer offset(x30303030 + x30303030 = x60606060 > x00EE) in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): File structure corrupted in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Invalid JPEG file in %sbug76557.php on line %d
|
||||
bool(false)
|
||||
DONE
|
||||
+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");
|
||||
|
||||
@@ -621,6 +621,9 @@ static void php_filter_call(zval *filtered, zend_long filter, zval *filter_args,
|
||||
}
|
||||
|
||||
if ((option = zend_hash_str_find(HASH_OF(filter_args), "options", sizeof("options") - 1)) != NULL) {
|
||||
/* avoid reference type */
|
||||
ZVAL_DEREF(option);
|
||||
|
||||
if (filter != FILTER_CALLBACK) {
|
||||
if (Z_TYPE_P(option) == IS_ARRAY) {
|
||||
options = option;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Bug #76366 (references in sub-array for filtering breaks the filter)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('filter')) die('skip filter extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
#array to filter
|
||||
$data = ['foo' => 6];
|
||||
|
||||
#filter args
|
||||
$args = [
|
||||
'foo'=> [
|
||||
'filter' => FILTER_VALIDATE_INT,
|
||||
'flags' => FILTER_FORCE_ARRAY
|
||||
]
|
||||
];
|
||||
|
||||
$args['foo']['options'] = [];
|
||||
|
||||
#create reference
|
||||
$options = &$args['foo']['options'];
|
||||
|
||||
#set options
|
||||
$options['min_range'] = 1;
|
||||
$options['max_range'] = 5;
|
||||
|
||||
#show the filter result
|
||||
var_dump(filter_var_array($data, $args));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
bool(false)
|
||||
}
|
||||
}
|
||||
+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
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Bug #74670: Integer Underflow when unserializing GMP and possible other classes
|
||||
--FILE--
|
||||
<?php
|
||||
$str = 'C:3:"GMP":4:{s:6666666666:""}';
|
||||
var_dump(unserialize($str));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: unserialize(): Error at offset 13 of 29 bytes in %s on line %d
|
||||
bool(false)
|
||||
@@ -18,7 +18,7 @@ try {
|
||||
} catch (Exception $e) { var_dump($e->getMessage()); }
|
||||
|
||||
try {
|
||||
unserialize('C:3:"GMP":8:{s:2:"42";}');
|
||||
unserialize('C:3:"GMP":9:{s:2:"42";}');
|
||||
} catch (Exception $e) { var_dump($e->getMessage()); }
|
||||
|
||||
?>
|
||||
|
||||
+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===
|
||||
@@ -167,7 +167,7 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp)
|
||||
}
|
||||
|
||||
ZVAL_STRING(&val, const_cast<char*>(typeid(*biter).name()));
|
||||
zend_hash_str_update(debug_info, "type", sizeof("type") - 1, &bio->text);
|
||||
zend_hash_str_update(debug_info, "type", sizeof("type") - 1, &val);
|
||||
|
||||
return debug_info;
|
||||
}
|
||||
|
||||
@@ -18,9 +18,6 @@ if test "$PHP_INTL" != "no"; then
|
||||
else
|
||||
icu_spoof_src=""
|
||||
fi
|
||||
if test "$icu_version" -ge "59000"; then
|
||||
ICU_CXXFLAGS="$ICU_CXXFLAGS -std=c++11 -stdlib=libc++"
|
||||
fi
|
||||
PHP_NEW_EXTENSION(intl, php_intl.c \
|
||||
intl_error.c \
|
||||
intl_convert.c \
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -3,6 +3,7 @@ Bug #62070: Collator::getSortKey() returns garbage
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$s1 = 'Hello';
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #62070: Collator::getSortKey() returns garbage
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$s1 = 'Hello';
|
||||
|
||||
$coll = collator_create('en_US');
|
||||
$res = collator_get_sort_key($coll, $s1);
|
||||
|
||||
echo urlencode($res);
|
||||
--EXPECT--
|
||||
82%40%40F%01%09%01%DC%08
|
||||
@@ -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==
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #76556 (get_debug_info handler for BreakIterator shows wrong type)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl')) die('skip intl extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$it = IntlBreakIterator::createCharacterInstance();
|
||||
$it->setText('foo');
|
||||
var_dump($it);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
object(IntlRuleBasedBreakIterator)#%d (3) {
|
||||
["valid"]=>
|
||||
bool(true)
|
||||
["text"]=>
|
||||
string(3) "foo"
|
||||
["type"]=>
|
||||
string(%d) "%SRuleBasedBreakIterator%S"
|
||||
}
|
||||
===DONE===
|
||||
@@ -3,6 +3,7 @@ collator_get_sort_key() icu >= 56.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '56.1') < 0) die('skip for ICU >= 56.1'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
--TEST--
|
||||
collator_get_sort_key() icu >= 62.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Get sort keys using various locales
|
||||
*/
|
||||
function sort_arrays( $locale, $data )
|
||||
{
|
||||
$res_str = '';
|
||||
|
||||
$coll = ut_coll_create( $locale );
|
||||
|
||||
foreach($data as $value) {
|
||||
$res_val = ut_coll_get_sort_key( $coll, $value );
|
||||
$res_str .= "source: ".$value."\n".
|
||||
"key: ".bin2hex($res_val)."\n";
|
||||
}
|
||||
|
||||
return $res_str;
|
||||
}
|
||||
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$res_str = '';
|
||||
|
||||
// Regular strings keys
|
||||
$test_params = array(
|
||||
'abc', 'abd', 'aaa',
|
||||
'аа', 'а', 'z',
|
||||
'', null , '3',
|
||||
'y' , 'i' , 'k'
|
||||
);
|
||||
|
||||
$res_str .= sort_arrays( 'en_US', $test_params );
|
||||
|
||||
// Sort a non-ASCII array using ru_RU locale.
|
||||
$test_params = array(
|
||||
'абг', 'абв', 'жжж', 'эюя'
|
||||
);
|
||||
|
||||
$res_str .= sort_arrays( 'ru_RU', $test_params );
|
||||
|
||||
// Sort an array using Lithuanian locale.
|
||||
$res_str .= sort_arrays( 'lt_LT', $test_params );
|
||||
|
||||
return $res_str . "\n";
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
?>
|
||||
--EXPECT--
|
||||
source: abc
|
||||
key: 2a2c2e01070107
|
||||
source: abd
|
||||
key: 2a2c3001070107
|
||||
source: aaa
|
||||
key: 2a2a2a01070107
|
||||
source: аа
|
||||
key: 61060601060106
|
||||
source: а
|
||||
key: 610601050105
|
||||
source: z
|
||||
key: 5c01050105
|
||||
source:
|
||||
key: 0101
|
||||
source:
|
||||
key: 0101
|
||||
source: 3
|
||||
key: 1901050105
|
||||
source: y
|
||||
key: 5a01050105
|
||||
source: i
|
||||
key: 3a01050105
|
||||
source: k
|
||||
key: 3e01050105
|
||||
source: абг
|
||||
key: 27060c1001070107
|
||||
source: абв
|
||||
key: 27060c0e01070107
|
||||
source: жжж
|
||||
key: 272c2c2c01070107
|
||||
source: эюя
|
||||
key: 27eef0f401070107
|
||||
source: абг
|
||||
key: 61060c1001070107
|
||||
source: абв
|
||||
key: 61060c0e01070107
|
||||
source: жжж
|
||||
key: 612c2c2c01070107
|
||||
source: эюя
|
||||
key: 61eef0f401070107
|
||||
@@ -1,8 +1,9 @@
|
||||
--TEST--
|
||||
numfmt_format() icu >= 61.1
|
||||
numfmt_format() icu >= 61.1 && < 62.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '61.1') < 0) die('skip for ICU >= 61.1'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
--TEST--
|
||||
numfmt_format() icu >= 62.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Format a number using misc locales/patterns.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TODO: doesn't pass on ICU 3.6 because 'ru' and 'de' locales changed
|
||||
* currency and percent formatting.
|
||||
*/
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$styles = array(
|
||||
NumberFormatter::PATTERN_DECIMAL => '##.#####################',
|
||||
NumberFormatter::DECIMAL => '',
|
||||
NumberFormatter::CURRENCY => '',
|
||||
NumberFormatter::PERCENT => '',
|
||||
NumberFormatter::SCIENTIFIC => '',
|
||||
NumberFormatter::SPELLOUT => '@@@@@@@',
|
||||
NumberFormatter::ORDINAL => '',
|
||||
NumberFormatter::DURATION => '',
|
||||
NumberFormatter::PATTERN_RULEBASED => '#####.###',
|
||||
1234999, // bad one
|
||||
);
|
||||
|
||||
$integer = array(
|
||||
NumberFormatter::ORDINAL => '',
|
||||
NumberFormatter::DURATION => '',
|
||||
);
|
||||
$locales = array(
|
||||
'en_US',
|
||||
'ru_UA',
|
||||
'de',
|
||||
'fr',
|
||||
'en_UK'
|
||||
);
|
||||
|
||||
$str_res = '';
|
||||
$number = 1234567.891234567890000;
|
||||
|
||||
foreach( $locales as $locale )
|
||||
{
|
||||
$str_res .= "\nLocale is: $locale\n";
|
||||
foreach( $styles as $style => $pattern )
|
||||
{
|
||||
$fmt = ut_nfmt_create( $locale, $style, $pattern );
|
||||
|
||||
if(!$fmt) {
|
||||
$str_res .= "Bad formatter!\n";
|
||||
continue;
|
||||
}
|
||||
$str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
|
||||
}
|
||||
}
|
||||
return $str_res;
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
|
||||
// Run the test
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
Locale is: en_US
|
||||
'1234567.8912345\d+'
|
||||
'1,234,567.891'
|
||||
'\$1,234,567.89'
|
||||
'123,456,789%'
|
||||
'1.2345678912345\d+E6'
|
||||
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five( six)? seven( nine)?'
|
||||
'1,234,567(th|ᵗʰ)'
|
||||
'342:56:07'
|
||||
'#####.###'
|
||||
'USD 1,234,567.89'
|
||||
|
||||
Locale is: ru_UA
|
||||
'1234567.8912345\d+'
|
||||
'1 234 567,891'
|
||||
'1 234 567,89 ?(грн\.|₴)'
|
||||
'123 456 789 ?%'
|
||||
'1.2345678912345\d+E6'
|
||||
'один миллион двести тридцать четыре тысячи пятьсот шестьдесят семь целых восемьдесят девять миллионов сто двадцать три тысячи четыреста пятьдесят семь стомиллионных'
|
||||
'1 234 567.?'
|
||||
'1 234 567'
|
||||
'#####.###'
|
||||
'1 234 567,89 UAH'
|
||||
|
||||
Locale is: de
|
||||
'1234567.8912345\d+'
|
||||
'1.234.567,891'
|
||||
'1.234.567,89 XXX'
|
||||
'123\.456\.789 %'
|
||||
'1.2345678912345\d+E6'
|
||||
'eine Million zweihundertvierunddreißigtausendfünfhundertsiebenundsechzig Komma acht neun eins zwei drei vier fünf( sechs)? sieben( neun)?'
|
||||
'1.234.567.?'
|
||||
'1.234.567'
|
||||
'#####.###'
|
||||
'1.234.567,89 XXX'
|
||||
|
||||
Locale is: fr
|
||||
'1234567.8912345\d+'
|
||||
'1 234 567,891'
|
||||
'1 234 567,89 XXX'
|
||||
'123 456 789 ?%'
|
||||
'1.2345678912345\d+E6'
|
||||
'un million deux cent trente-quatre mille cinq cent soixante-sept virgule huit neuf un deux trois quatre cinq( six)? sept( neuf)?'
|
||||
'1 234 567e'
|
||||
'1 234 567'
|
||||
'#####.###'
|
||||
'1 234 567,89 XXX'
|
||||
|
||||
Locale is: en_UK
|
||||
'1234567.8912345\d+'
|
||||
'1,234,567.891'
|
||||
'XXX 1,234,567.89'
|
||||
'123,456,789%'
|
||||
'1.2345678912345\d+E6'
|
||||
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five( six)? seven( nine)?'
|
||||
'1,234,567(th|ᵗʰ)'
|
||||
'342:56:07'
|
||||
'#####.###'
|
||||
'XXX 1,234,567.89'
|
||||
@@ -42,9 +42,9 @@ include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
en_UK: '£1,234,567.89'
|
||||
en_US: '$1,234,567.89'
|
||||
ru: '1 234 567,89 р.'
|
||||
uk: '1 234 567,89 ₴'
|
||||
en: 'UAH1,234,567.89'
|
||||
en: 'UAH%A1,234,567.89'
|
||||
@@ -3,6 +3,7 @@ numfmt_get_locale()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '58.1') < 0) die('skip for ICU >= 58.1'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
--TEST--
|
||||
numfmt_get_locale()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Get locale.
|
||||
*/
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$locales = array(
|
||||
'en_UK',
|
||||
'en_US',
|
||||
'fr_CA',
|
||||
);
|
||||
|
||||
$loc_types = array(
|
||||
Locale::ACTUAL_LOCALE => 'actual',
|
||||
Locale::VALID_LOCALE => 'valid',
|
||||
);
|
||||
|
||||
$res_str = '';
|
||||
|
||||
foreach( $locales as $locale )
|
||||
{
|
||||
$fmt = ut_nfmt_create( $locale, NumberFormatter::DECIMAL );
|
||||
$res_str .= "$locale: ";
|
||||
foreach( $loc_types as $loc_type => $loc_type_name )
|
||||
$res_str .= sprintf( " %s=%s",
|
||||
$loc_type_name,
|
||||
dump( ut_nfmt_get_locale( $fmt, $loc_type ) ) );
|
||||
$res_str .= "\n";
|
||||
}
|
||||
|
||||
return $res_str;
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
|
||||
// Run the test
|
||||
ut_run();
|
||||
?>
|
||||
--EXPECT--
|
||||
en_UK: actual='en' valid='en'
|
||||
en_US: actual='en_US' valid='en_US'
|
||||
fr_CA: actual='fr_CA' valid='fr_CA'
|
||||
@@ -2,6 +2,7 @@
|
||||
numfmt_get/set_pattern()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
--TEST--
|
||||
numfmt_get/set_pattern()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Get/set pattern.
|
||||
*/
|
||||
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$res_str = '';
|
||||
$test_value = 12345.123456;
|
||||
$fmt = ut_nfmt_create( "en_US", NumberFormatter::PATTERN_DECIMAL );
|
||||
|
||||
// Get default patten.
|
||||
$res_str .= "Default pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
|
||||
$res_str .= "Formatting result: " . ut_nfmt_format( $fmt, $test_value ) . "\n";
|
||||
|
||||
// Set a new pattern.
|
||||
$res = ut_nfmt_set_pattern( $fmt, "0.0" );
|
||||
if( $res === false )
|
||||
$res_str .= ut_nfmt_get_error_message( $fmt ) . " (" . ut_nfmt_get_error_code( $fmt ) . ")\n";
|
||||
|
||||
// Check if the pattern has been changed.
|
||||
$res = ut_nfmt_get_pattern( $fmt );
|
||||
if( $res === false )
|
||||
$res_str .= ut_nfmt_get_error_message( $fmt ) . " (" . ut_nfmt_get_error_code( $fmt ) . ")\n";
|
||||
$res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
|
||||
$res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n";
|
||||
|
||||
ut_nfmt_set_pattern($fmt, str_repeat('@', 200));
|
||||
$res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
|
||||
$res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n";
|
||||
|
||||
return $res_str;
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Default pattern: '#'
|
||||
Formatting result: 12345.123456
|
||||
New pattern: '0.0'
|
||||
Formatted number: 12345.1
|
||||
New pattern: '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
|
||||
Formatted number: 12345.123456000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
@@ -88,7 +88,7 @@ include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Symbol 'DECIMAL_SEPARATOR_SYMBOL'
|
||||
Default symbol: [.]
|
||||
New symbol: [_._]
|
||||
@@ -132,7 +132,7 @@ A number formatted with the new symbol: 1.2345123456E4
|
||||
Symbol 'CURRENCY_SYMBOL'
|
||||
Default symbol: [$]
|
||||
New symbol: [_$_]
|
||||
A number formatted with the new symbol: _$_12,345.12
|
||||
A number formatted with the new symbol: _$_%A12,345.12
|
||||
|
||||
Symbol 'INTL_CURRENCY_SYMBOL'
|
||||
Default symbol: [USD]
|
||||
|
||||
+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
|
||||
}
|
||||
@@ -1875,7 +1875,7 @@ mbfl_strimwidth(
|
||||
mbfl_string_init(result);
|
||||
result->no_language = string->no_language;
|
||||
result->no_encoding = string->no_encoding;
|
||||
mbfl_memory_device_init(&pc.device, width, 0);
|
||||
mbfl_memory_device_init(&pc.device, MIN(string->len, width), 0);
|
||||
|
||||
/* output code filter */
|
||||
pc.decoder = mbfl_convert_filter_new(
|
||||
|
||||
@@ -113,6 +113,13 @@
|
||||
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG 2
|
||||
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY 3
|
||||
|
||||
/*
|
||||
* convenience macros
|
||||
*/
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* buffering converter
|
||||
*/
|
||||
|
||||
@@ -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,12 @@
|
||||
--TEST--
|
||||
Bug #76532 (Integer overflow and excessive memory usage in mb_strimwidth)
|
||||
--SKIPIF--
|
||||
<?php require 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$string_to_trim = '得很幸福。有一天,一个长得很丑的老人带着一只木马来到王';
|
||||
$width = 2147483647;
|
||||
var_dump(mb_strimwidth($string_to_trim, 0, $width));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(81) "得很幸福。有一天,一个长得很丑的老人带着一只木马来到王"
|
||||
@@ -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
|
||||
|
||||
Loaded 100 of 598 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user