mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-22 00:16:38 +00:00
Compare commits
253
Commits
php-5.5.10
...
php-5.5.12
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58a3e9586b | ||
|
|
61b002b91b | ||
|
|
4344eea421 | ||
|
|
6ee05d3f6b | ||
|
|
da80c3b62f | ||
|
|
8db1ba94e4 | ||
|
|
b8d029435d | ||
|
|
b727934591 | ||
|
|
eea75e7146 | ||
|
|
793f67e852 | ||
|
|
24b72e7a27 | ||
|
|
8bc82718ae | ||
|
|
a186312832 | ||
|
|
56f9727305 | ||
|
|
22acea99ff | ||
|
|
5b8c4b8de5 | ||
|
|
ed4de188dd | ||
|
|
7f43aeb167 | ||
|
|
ad1b9eef98 | ||
|
|
40a9316dff | ||
|
|
dae70a2ff7 | ||
|
|
f6db1057fd | ||
|
|
4268504084 | ||
|
|
57d657987d | ||
|
|
95c57bb646 | ||
|
|
6e81f80a1e | ||
|
|
b80243aece | ||
|
|
9bba219c75 | ||
|
|
5e66ce9293 | ||
|
|
30ec1c0051 | ||
|
|
b05c088a3a | ||
|
|
f1206aef70 | ||
|
|
5558d0db9b | ||
|
|
5811610d71 | ||
|
|
636adf251c | ||
|
|
df8e34bcc1 | ||
|
|
3a2660b302 | ||
|
|
733b09442d | ||
|
|
8c88b6e81c | ||
|
|
c5275b4a92 | ||
|
|
442264ffd6 | ||
|
|
fe72caa6e5 | ||
|
|
1010200da5 | ||
|
|
bf3edbada6 | ||
|
|
beda5093b4 | ||
|
|
191d9fc227 | ||
|
|
f07e37c96d | ||
|
|
2f3056fecc | ||
|
|
eca0644e0a | ||
|
|
1a4a9eede5 | ||
|
|
2876bde634 | ||
|
|
5a0da281e5 | ||
|
|
9302be3754 | ||
|
|
edd90e5ae3 | ||
|
|
e08172e0d5 | ||
|
|
1a0b80fe90 | ||
|
|
1c3ed86211 | ||
|
|
b78d1b901c | ||
|
|
49d46ad29e | ||
|
|
9540ced221 | ||
|
|
e00e4b9334 | ||
|
|
2c8aeda6dc | ||
|
|
287790d5c8 | ||
|
|
a95a6e93ee | ||
|
|
e8d6c6587d | ||
|
|
032921d80c | ||
|
|
4141ceb795 | ||
|
|
0ea731fc83 | ||
|
|
cc20351134 | ||
|
|
7a71f5d112 | ||
|
|
040194d6a0 | ||
|
|
ee1b807219 | ||
|
|
8b0d133b13 | ||
|
|
a3d6f28312 | ||
|
|
bbfda90d72 | ||
|
|
a0beddf5e9 | ||
|
|
c1f273908e | ||
|
|
7e5de3a1ce | ||
|
|
60ef357ffc | ||
|
|
bbd25ca01f | ||
|
|
d08b4dbf23 | ||
|
|
f17fe2cabc | ||
|
|
ba4fddd2da | ||
|
|
7ab5c593f7 | ||
|
|
9eb0c634d4 | ||
|
|
f453917f62 | ||
|
|
1ec83d44a1 | ||
|
|
68556f3384 | ||
|
|
af147ac9b7 | ||
|
|
91a9d24aa3 | ||
|
|
8e238148f9 | ||
|
|
eb84d5d0a6 | ||
|
|
f244513fc0 | ||
|
|
fca1501ed6 | ||
|
|
3cb056f523 | ||
|
|
60fb57d4f6 | ||
|
|
178eac6c98 | ||
|
|
fca331cae9 | ||
|
|
2c204a55af | ||
|
|
972c451c73 | ||
|
|
1283722589 | ||
|
|
84cd0f9911 | ||
|
|
89ea2650a1 | ||
|
|
039cb10fa3 | ||
|
|
170cf3ec00 | ||
|
|
8b7b67a21b | ||
|
|
84b0ab6d8f | ||
|
|
3616db6d38 | ||
|
|
4374a52e9d | ||
|
|
1df558c6a0 | ||
|
|
7477f5b387 | ||
|
|
223f7d9a44 | ||
|
|
6612e1ba6a | ||
|
|
8558640a6a | ||
|
|
76066b304c | ||
|
|
5efda763be | ||
|
|
17a57ad980 | ||
|
|
41b4b84dda | ||
|
|
059bc99d94 | ||
|
|
44fb74fad1 | ||
|
|
d63ed101ee | ||
|
|
c4145619be | ||
|
|
1ff28cd0ec | ||
|
|
9b88bc494e | ||
|
|
2dfb8fbdf4 | ||
|
|
b30304fb78 | ||
|
|
2b811a5aec | ||
|
|
156cc39e21 | ||
|
|
497b918e62 | ||
|
|
46566b78c9 | ||
|
|
66bf216c66 | ||
|
|
80fa2ff646 | ||
|
|
e1d8c0a051 | ||
|
|
87a87c6682 | ||
|
|
17f6391bf8 | ||
|
|
db6c33875c | ||
|
|
356c442558 | ||
|
|
737c187013 | ||
|
|
f7b9c12ed9 | ||
|
|
3f049bcff2 | ||
|
|
495d5335f9 | ||
|
|
862c006da1 | ||
|
|
f2d5b2b6c6 | ||
|
|
06bbb657ad | ||
|
|
68f318a422 | ||
|
|
119821a452 | ||
|
|
dada2f550f | ||
|
|
f8252aa537 | ||
|
|
cb5178a450 | ||
|
|
ddd7ed9b24 | ||
|
|
72050af855 | ||
|
|
1a624e27a6 | ||
|
|
3a8282ed0f | ||
|
|
4dc8610d34 | ||
|
|
73b3f58bcd | ||
|
|
8391277fb8 | ||
|
|
a92240e209 | ||
|
|
c17fd65165 | ||
|
|
b9d494a33b | ||
|
|
cf7e73cf26 | ||
|
|
d2e42d5372 | ||
|
|
28fa31d6e5 | ||
|
|
af41914e15 | ||
|
|
cedc718f73 | ||
|
|
3a76cb2d95 | ||
|
|
a930e04792 | ||
|
|
1fdca8208f | ||
|
|
8e3c2015dc | ||
|
|
0c74d5ef08 | ||
|
|
972935cd95 | ||
|
|
091b7f841b | ||
|
|
3c673fed34 | ||
|
|
ecf7570072 | ||
|
|
e2fc6b52f0 | ||
|
|
70dd3f1731 | ||
|
|
9acdf71194 | ||
|
|
cab1894b81 | ||
|
|
b31a9cd4da | ||
|
|
7d5c11c235 | ||
|
|
721b9a7c8d | ||
|
|
515c103a08 | ||
|
|
af09d8b96a | ||
|
|
b084157d3d | ||
|
|
e590aceb5a | ||
|
|
014b95a0a7 | ||
|
|
5d08cae346 | ||
|
|
c2a9f73c99 | ||
|
|
a33759fd27 | ||
|
|
bc0b6e02e4 | ||
|
|
731013ee8e | ||
|
|
c34f26a938 | ||
|
|
bbd0781b39 | ||
|
|
1533f98afd | ||
|
|
e73c05b75e | ||
|
|
3eb8102348 | ||
|
|
c9680697ec | ||
|
|
362b70a32c | ||
|
|
36c445970e | ||
|
|
2e459be237 | ||
|
|
d022c8565d | ||
|
|
eca13f7909 | ||
|
|
79b3c2a744 | ||
|
|
9443fb999d | ||
|
|
488e64dbe4 | ||
|
|
5fc7382a57 | ||
|
|
b1df743b7a | ||
|
|
c73b0543f1 | ||
|
|
561843c973 | ||
|
|
ccd4bf5147 | ||
|
|
cb0e6124d4 | ||
|
|
82e92c99a6 | ||
|
|
33d372a45f | ||
|
|
816a5d2072 | ||
|
|
9137acc7ec | ||
|
|
fd20278fa5 | ||
|
|
bd961f3e87 | ||
|
|
38797e598b | ||
|
|
d18089d621 | ||
|
|
e1b1ef0d79 | ||
|
|
4d9c556b5d | ||
|
|
eb6941e902 | ||
|
|
6e15afd1be | ||
|
|
a59ec5d1b0 | ||
|
|
ee7671afb5 | ||
|
|
593505f266 | ||
|
|
8cdefd3d10 | ||
|
|
bca0e5edd5 | ||
|
|
c6a4a7cad6 | ||
|
|
2198bbce86 | ||
|
|
3f258e6b46 | ||
|
|
756ee95605 | ||
|
|
851f362882 | ||
|
|
f06b3432c8 | ||
|
|
884bbcd537 | ||
|
|
e244e2245b | ||
|
|
ce1fd72776 | ||
|
|
6d4d4155d2 | ||
|
|
10eb007070 | ||
|
|
ca313caa4b | ||
|
|
afa03a470e | ||
|
|
143bb29c1a | ||
|
|
a7d3606650 | ||
|
|
633f898f15 | ||
|
|
8dd99dd2dc | ||
|
|
a289b37f48 | ||
|
|
1cc5d1009f | ||
|
|
ee4b3892f8 | ||
|
|
0afcbb0ba9 | ||
|
|
be354936b7 | ||
|
|
fb3e21fbcc | ||
|
|
07b9db3def | ||
|
|
9b54901ffb | ||
|
|
82a4f1a1a2 |
No files matched your search
@@ -115,7 +115,6 @@ clean:
|
||||
find . -name \*.la -o -name \*.a | xargs rm -f
|
||||
find . -name \*.so | xargs rm -f
|
||||
find . -name .libs -a -type d|xargs rm -rf
|
||||
find . -name \*.1 | xargs rm -f
|
||||
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_MILTER_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
|
||||
|
||||
distclean: clean
|
||||
|
||||
@@ -1,6 +1,126 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2014, PHP 5.5.10
|
||||
01 May 2014, PHP 5.5.12
|
||||
- Core:
|
||||
. Fixed bug #61019 (Out of memory on command stream_get_contents). (Mike)
|
||||
. Fixed bug #64330 (stream_socket_server() creates wrong Abstract Namespace
|
||||
UNIX sockets). (Mike)
|
||||
. Fixed bug #66182 (exit in stream filter produces segfault). (Mike)
|
||||
. Fixed bug #66736 (fpassthru broken). (Mike)
|
||||
. Fixed bug #67024 (getimagesize should recognize BMP files with negative
|
||||
height). (Gabor Buella)
|
||||
. Fixed bug #67043 (substr_compare broke by previous change) (Tjerk)
|
||||
|
||||
- cURL:
|
||||
. Fixed bug #66562 (curl_exec returns differently than curl_multi_getcontent).
|
||||
(Freek Lijten)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #66721 (__wakeup of DateTime segfaults when invalid object data is
|
||||
supplied). (Boro Sitnikovski)
|
||||
|
||||
- Embed:
|
||||
. Fixed bug #65715 (php5embed.lib isn't provided anymore). (Anatol).
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #66987 (Memory corruption in fileinfo ext / bigendian).
|
||||
(Remi)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #66482 (unknown entry 'priority' in php-fpm.conf).
|
||||
. Fixed bug #67060 (possible privilege escalation due to insecure default configuration). (CVE-2014-0185) (christian at hoffie dot info)
|
||||
|
||||
- JSON:
|
||||
. Fixed bug #66021 (Blank line inside empty array/object when
|
||||
JSON_PRETTY_PRINT is set). (Kevin Israel)
|
||||
|
||||
- LDAP:
|
||||
. Fixed issue with null bytes in LDAP bindings. (Matthew Daley)
|
||||
|
||||
- mysqli:
|
||||
. Fixed problem in mysqli_commit()/mysqli_rollback() with second parameter
|
||||
(extra comma) and third parameters (lack of escaping). (Andrey)
|
||||
|
||||
- OpenSSL:
|
||||
. Fix bug #66942 (memory leak in openssl_seal()). (Chuan Ma)
|
||||
. Fix bug #66952 (memory leak in openssl_open()). (Chuan Ma)
|
||||
|
||||
- SimpleXML:
|
||||
. Fixed bug #66084 (simplexml_load_string() mangles empty node name)
|
||||
(Anatol)
|
||||
|
||||
- SQLite:
|
||||
. Fixed bug #66967 (Updated bundled libsqlite to 3.8.4.3). (Anatol)
|
||||
|
||||
- XSL:
|
||||
. Fixed bug #53965 (<xsl:include> cannot find files with relative paths
|
||||
when loaded with "file://"). (Anatol)
|
||||
|
||||
- Apache2 Handler SAPI:
|
||||
. Fixed Apache log issue caused by APR's lack of support for %zu
|
||||
(APR issue https://issues.apache.org/bugzilla/show_bug.cgi?id=56120).
|
||||
(Jeff Trawick)
|
||||
|
||||
03 Apr 2014, PHP 5.5.11
|
||||
|
||||
- Core:
|
||||
. Allow zero length comparison in substr_compare() (Tjerk)
|
||||
. Fixed bug #60602 (proc_open() changes environment array) (Tjerk)
|
||||
|
||||
- SPL:
|
||||
. Added feature #65545 (SplFileObject::fread()) (Tjerk)
|
||||
. Fixed bug #66702 (RegexIterator::INVERT_MATCH does not invert). (Joshua
|
||||
Thijssen)
|
||||
|
||||
- cURL:
|
||||
. Fixed bug #66109 (Can't reset CURLOPT_CUSTOMREQUEST to default behaviour) (Tjerk)
|
||||
. Fix compilation on libcurl versions between 7.10.5 and 7.12.2, inclusive.
|
||||
(Adam)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #66946i (fileinfo: extensive backtracking in awk rule regular
|
||||
expression). (CVE-2013-7345) (Remi)
|
||||
|
||||
- FPM:
|
||||
. Added clear_env configuration directive to disable clearenv() call.
|
||||
(Github PR# 598, Paul Annesley)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #66714 (imageconvolution breakage). (Brad Daily)
|
||||
. Fixed bug #66869 (Invalid 2nd argument crashes imageaffinematrixget) (Pierre)
|
||||
. Fixed bug #66887 (imagescale - poor quality of scaled image). (Remi)
|
||||
. Fixed bug #66890 (imagescale segfault). (Remi)
|
||||
. Fixed bug #66893 (imagescale ignore method argument). (Remi)
|
||||
|
||||
- Hash:
|
||||
. hash_pbkdf2() now works correctly if the $length argument is not specified.
|
||||
(Nikita)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #66873 (A reproductible crash in UConverter when given invalid
|
||||
encoding) (Stas)
|
||||
|
||||
- Mail:
|
||||
. Fixed bug #66535 (Don't add newline after X-PHP-Originating-Script) (Tjerk)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #66762 (Segfault in mysqli_stmt::bind_result() when link closed)
|
||||
(Remi)
|
||||
|
||||
- OPCache
|
||||
. Added function opcache_is_script_cached(). (Danack)
|
||||
. Added information about interned strings usage. (Terry, Julien, Dmitry)
|
||||
|
||||
- Openssl:
|
||||
. Fixed bug #66833 (Default disgest algo is still MD5, switch to SHA1). (Remi)
|
||||
|
||||
- GMP
|
||||
. Fixed bug #66872 (invalid argument crashes gmp_testbit) (Pierre)
|
||||
|
||||
- SQLite:
|
||||
. Updated bundled libsqlite to 3.8.3.1 (Anatol)
|
||||
|
||||
06 Mar 2014, PHP 5.5.10
|
||||
|
||||
- Core:
|
||||
. Fixed Request #66574i (Allow multiple paths in php_ini_scanned_path). (Remi)
|
||||
@@ -10,7 +130,13 @@ PHP NEWS
|
||||
per offset too). (Derick)
|
||||
|
||||
- Fileinfo:
|
||||
. Bug #66731 (file: infinite recursion). (Remi)
|
||||
. Bug #66731 (file: infinite recursion) (CVE-2014-1943). (Remi)
|
||||
. Fixed bug #66820 (out-of-bounds memory access in fileinfo)
|
||||
(CVE-2014-2270). (Remi)
|
||||
|
||||
- GD
|
||||
. Fixed Bug #66815 (imagecrop(): insufficient fix for NULL defer
|
||||
CVE-2013-7327). (Tomas Hoger, Remi)
|
||||
|
||||
- JSON:
|
||||
. Fixed bug #65753 (JsonSerializeable couldn't implement on module extension)
|
||||
@@ -642,6 +768,12 @@ spaces) (willfitch, iliaa)
|
||||
CURLOPT_RTSP_REQUEST, CURLOPT_RESOLVE, CURLOPT_ACCEPT_ENCODING,
|
||||
CURLOPT_TRANSFER_ENCODING, CURLOPT_DNS_SERVERS and CURLOPT_USE_SSL.
|
||||
(Pierrick)
|
||||
. Added new functions curl_escape, curl_multi_setopt, curl_multi_strerror
|
||||
curl_pause, curl_reset, curl_share_close, curl_share_init,
|
||||
curl_share_setopt curl_strerror and curl_unescape. (Pierrick)
|
||||
. Addes new curl options CURLOPT_TELNETOPTIONS, CURLOPT_GSSAPI_DELEGATION,
|
||||
CURLOPT_ACCEPTTIMEOUT_MS, CURLOPT_SSL_OPTIONS, CURLOPT_TCP_KEEPALIVE,
|
||||
CURLOPT_TCP_KEEPIDLE and CURLOPT_TCP_KEEPINTVL. (Pierrick)
|
||||
. Fixed bug #55635 (CURLOPT_BINARYTRANSFER no longer used. The constant
|
||||
still exists for backward compatibility but is doing nothing). (Pierrick)
|
||||
. Fixed bug #54995 (Missing CURLINFO_RESPONSE_CODE support). (Pierrick)
|
||||
@@ -649,12 +781,6 @@ spaces) (willfitch, iliaa)
|
||||
- DateTime
|
||||
. Added DateTimeImmutable - a variant of DateTime that only returns the
|
||||
modified state instead of changing itself. (Derick)
|
||||
. Added new functions curl_escape, curl_multi_setopt, curl_multi_strerror
|
||||
curl_pause, curl_reset, curl_share_close, curl_share_init,
|
||||
curl_share_setopt curl_strerror and curl_unescape. (Pierrick)
|
||||
. Addes new curl options CURLOPT_TELNETOPTIONS, CURLOPT_GSSAPI_DELEGATION,
|
||||
CURLOPT_ACCEPTTIMEOUT_MS, CURLOPT_SSL_OPTIONS, CURLOPT_TCP_KEEPALIVE,
|
||||
CURLOPT_TCP_KEEPIDLE and CURLOPT_TCP_KEEPINTVL. (Pierrick)
|
||||
. Fixed bug #64825 (Invalid free when unserializing DateTimeZone).
|
||||
(Anatol)
|
||||
. Fixed bug #64359 (strftime crash with VS2012). (Anatol)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define TSRM_CONFIG_COMMON_H
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
# if WINNT|WIN32
|
||||
# ifdef _WIN32
|
||||
# define TSRM_WIN32
|
||||
# endif
|
||||
#endif
|
||||
|
||||
+58
-3
@@ -360,6 +360,11 @@ ZEND_METHOD(error_exception, getSeverity)
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define TRACE_ARG_APPEND(vallen) \
|
||||
*str = (char*)erealloc(*str, *len + 1 + vallen); \
|
||||
memcpy((*str) + *len - l_added + 1 + vallen, (*str) + *len - l_added + 1, l_added);
|
||||
|
||||
/* }}} */
|
||||
|
||||
static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
|
||||
@@ -371,7 +376,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
|
||||
len = va_arg(args, int*);
|
||||
|
||||
/* the trivial way would be to do:
|
||||
* conver_to_string_ex(arg);
|
||||
* convert_to_string_ex(arg);
|
||||
* append it and kill the now tmp arg.
|
||||
* but that could cause some E_NOTICE and also damn long lines.
|
||||
*/
|
||||
@@ -394,8 +399,58 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
|
||||
l_added += 3 + 1;
|
||||
}
|
||||
while (--l_added) {
|
||||
if ((*str)[*len - l_added] < 32) {
|
||||
(*str)[*len - l_added] = '?';
|
||||
unsigned char chr = (*str)[*len - l_added];
|
||||
if (chr < 32 || chr == '\\' || chr > 126) {
|
||||
(*str)[*len - l_added] = '\\';
|
||||
|
||||
switch (chr) {
|
||||
case '\n':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'n';
|
||||
break;
|
||||
case '\r':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'r';
|
||||
break;
|
||||
case '\t':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 't';
|
||||
break;
|
||||
case '\f':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'f';
|
||||
break;
|
||||
case '\v':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'v';
|
||||
break;
|
||||
#ifndef PHP_WIN32
|
||||
case '\e':
|
||||
#else
|
||||
case VK_ESCAPE:
|
||||
#endif
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'e';
|
||||
break;
|
||||
case '\\':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = '\\';
|
||||
break;
|
||||
default:
|
||||
TRACE_ARG_APPEND(3);
|
||||
(*str)[*len - l_added + 1] = 'x';
|
||||
if ((chr >> 4) < 10) {
|
||||
(*str)[*len - l_added + 2] = (chr >> 4) + '0';
|
||||
} else {
|
||||
(*str)[*len - l_added + 2] = (chr >> 4) + 'A' - 10;
|
||||
}
|
||||
if (chr % 16 < 10) {
|
||||
(*str)[*len - l_added + 3] = chr % 16 + '0';
|
||||
} else {
|
||||
(*str)[*len - l_added + 3] = chr % 16 + 'A' - 10;
|
||||
}
|
||||
*len += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -57,7 +57,7 @@ ZEND_API void zend_html_putc(char c)
|
||||
ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC)
|
||||
{
|
||||
const unsigned char *ptr = (const unsigned char*)s, *end = ptr + len;
|
||||
unsigned char *filtered;
|
||||
unsigned char *filtered = NULL;
|
||||
size_t filtered_len;
|
||||
|
||||
if (LANG_SCNG(output_filter)) {
|
||||
|
||||
@@ -1237,7 +1237,7 @@ function gen_vm($def, $skel) {
|
||||
out($f, "# pragma warning(once : 6285)\n");
|
||||
// Suppress (<non-zero constant> || <expression>) warnings on windows
|
||||
out($f, "# pragma warning(once : 6286)\n");
|
||||
// Suppress constant with constant comparsion warnings on windows
|
||||
// Suppress constant with constant comparison warnings on windows
|
||||
out($f, "# pragma warning(once : 6326)\n");
|
||||
}
|
||||
out($f, "#endif\n");
|
||||
|
||||
+2
-2
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=5
|
||||
PHP_RELEASE_VERSION=9
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=12
|
||||
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`
|
||||
|
||||
|
||||
+83
-98
@@ -165,50 +165,62 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
# define php_curl_ret(__ret) RETVAL_FALSE; return;
|
||||
#endif
|
||||
|
||||
static int php_curl_option_url(php_curl *ch, const char *url, const int len TSRMLS_DC) /* {{{ */
|
||||
static int php_curl_option_str(php_curl *ch, long option, const char *str, const int len, zend_bool make_copy TSRMLS_DC)
|
||||
{
|
||||
CURLcode error = CURLE_OK;
|
||||
#if LIBCURL_VERSION_NUM < 0x071100
|
||||
char *copystr = NULL;
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
if (make_copy) {
|
||||
#endif
|
||||
char *copystr;
|
||||
|
||||
/* Strings passed to libcurl as 'char *' arguments, are copied by the library since 7.17.0 */
|
||||
copystr = estrndup(str, len);
|
||||
error = curl_easy_setopt(ch->cp, option, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
} else {
|
||||
error = curl_easy_setopt(ch->cp, option, str);
|
||||
}
|
||||
#endif
|
||||
|
||||
SAVE_CURL_ERROR(ch, error)
|
||||
|
||||
return error == CURLE_OK ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
static int php_curl_option_url(php_curl *ch, const char *url, const int len TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
/* Disable file:// if open_basedir are used */
|
||||
if (PG(open_basedir) && *PG(open_basedir)) {
|
||||
#if LIBCURL_VERSION_NUM >= 0x071304
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_PROTOCOLS, CURLPROTO_ALL & ~CURLPROTO_FILE);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_PROTOCOLS, CURLPROTO_ALL & ~CURLPROTO_FILE);
|
||||
#else
|
||||
php_url *uri;
|
||||
|
||||
if (!(uri = php_url_parse_ex(url, len))) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL '%s'", url);
|
||||
return 0;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (uri->scheme && !strncasecmp("file", uri->scheme, sizeof("file"))) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Protocol 'file' disabled in cURL");
|
||||
php_url_free(uri);
|
||||
return 0;
|
||||
return FAILURE;
|
||||
}
|
||||
php_url_free(uri);
|
||||
#endif
|
||||
}
|
||||
/* Strings passed to libcurl as 'char *' arguments, are copied by the library... NOTE: before 7.17.0 strings were not copied. */
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_URL, url);
|
||||
#else
|
||||
copystr = estrndup(url, len);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_URL, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
#endif
|
||||
|
||||
return (error == CURLE_OK ? 1 : 0);
|
||||
return php_curl_option_str(ch, CURLOPT_URL, url, len, 0 TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
int _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC) /* {{{ */
|
||||
void _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
php_stream *stream;
|
||||
if (!ch || !ch->handlers) {
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ch->handlers->std_err) {
|
||||
@@ -265,7 +277,7 @@ int _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC) /* {{{ */
|
||||
curl_easy_setopt(ch->cp, CURLOPT_FILE, (void *) ch);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return ;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1941,7 +1953,7 @@ PHP_FUNCTION(curl_init)
|
||||
_php_curl_set_default_options(ch);
|
||||
|
||||
if (url) {
|
||||
if (!php_curl_option_url(ch, url, url_len TSRMLS_CC)) {
|
||||
if (php_curl_option_url(ch, url, url_len TSRMLS_CC) == FAILURE) {
|
||||
_php_curl_close_ex(ch TSRMLS_CC);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -2058,7 +2070,7 @@ PHP_FUNCTION(curl_copy_handle)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *return_value TSRMLS_DC) /* {{{ */
|
||||
static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
CURLcode error=CURLE_OK;
|
||||
|
||||
@@ -2225,7 +2237,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
||||
if ((option == CURLOPT_PROTOCOLS || option == CURLOPT_REDIR_PROTOCOLS) &&
|
||||
(PG(open_basedir) && *PG(open_basedir)) && (Z_LVAL_PP(zvalue) & CURLPROTO_FILE)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLPROTO_FILE cannot be activated when an open_basedir is set");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@@ -2240,14 +2251,10 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
||||
case CURLOPT_CAINFO:
|
||||
case CURLOPT_CAPATH:
|
||||
case CURLOPT_COOKIE:
|
||||
case CURLOPT_CUSTOMREQUEST:
|
||||
case CURLOPT_EGDSOCKET:
|
||||
case CURLOPT_FTPPORT:
|
||||
case CURLOPT_INTERFACE:
|
||||
case CURLOPT_PRIVATE:
|
||||
case CURLOPT_PROXY:
|
||||
case CURLOPT_PROXYUSERPWD:
|
||||
case CURLOPT_RANGE:
|
||||
case CURLOPT_REFERER:
|
||||
case CURLOPT_SSLCERTTYPE:
|
||||
case CURLOPT_SSLENGINE:
|
||||
@@ -2256,23 +2263,14 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
||||
case CURLOPT_SSLKEYPASSWD:
|
||||
case CURLOPT_SSLKEYTYPE:
|
||||
case CURLOPT_SSL_CIPHER_LIST:
|
||||
case CURLOPT_URL:
|
||||
case CURLOPT_USERAGENT:
|
||||
case CURLOPT_USERPWD:
|
||||
#if LIBCURL_VERSION_NUM >= 0x070d00 /* Available since 7.13.0 */
|
||||
case CURLOPT_FTP_ACCOUNT:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x070e01 /* Available since 7.14.1 */
|
||||
case CURLOPT_COOKIELIST:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x070f05 /* Available since 7.15.5 */
|
||||
case CURLOPT_FTP_ALTERNATIVE_TO_USER:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
|
||||
case CURLOPT_KRBLEVEL:
|
||||
#else
|
||||
case CURLOPT_KRB4LEVEL:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x071101 /* Available since 7.17.1 */
|
||||
case CURLOPT_SSH_HOST_PUBLIC_KEY_MD5:
|
||||
#endif
|
||||
@@ -2287,7 +2285,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x071400 /* Available since 7.20.0 */
|
||||
case CURLOPT_MAIL_FROM:
|
||||
case CURLOPT_RTSP_SESSION_ID:
|
||||
case CURLOPT_RTSP_STREAM_URI:
|
||||
case CURLOPT_RTSP_TRANSPORT:
|
||||
#endif
|
||||
@@ -2309,32 +2306,44 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
||||
#endif
|
||||
{
|
||||
convert_to_string_ex(zvalue);
|
||||
if (option == CURLOPT_URL) {
|
||||
if (!php_curl_option_url(ch, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue) TSRMLS_CC)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (option == CURLOPT_PRIVATE) {
|
||||
char *copystr;
|
||||
#if LIBCURL_VERSION_NUM < 0x071100
|
||||
string_copy:
|
||||
return php_curl_option_str(ch, option, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
/* Curl nullable string options */
|
||||
case CURLOPT_CUSTOMREQUEST:
|
||||
case CURLOPT_FTPPORT:
|
||||
case CURLOPT_RANGE:
|
||||
#if LIBCURL_VERSION_NUM >= 0x070d00 /* Available since 7.13.0 */
|
||||
case CURLOPT_FTP_ACCOUNT:
|
||||
#endif
|
||||
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
||||
error = curl_easy_setopt(ch->cp, option, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
} else {
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
/* Strings passed to libcurl as ’char *’ arguments, are copied by the library... NOTE: before 7.17.0 strings were not copied. */
|
||||
error = curl_easy_setopt(ch->cp, option, Z_STRVAL_PP(zvalue));
|
||||
#if LIBCURL_VERSION_NUM >= 0x071400 /* Available since 7.20.0 */
|
||||
case CURLOPT_RTSP_SESSION_ID:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
|
||||
case CURLOPT_KRBLEVEL:
|
||||
#else
|
||||
goto string_copy;
|
||||
case CURLOPT_KRB4LEVEL:
|
||||
#endif
|
||||
}
|
||||
{
|
||||
if (Z_TYPE_PP(zvalue) == IS_NULL) {
|
||||
error = curl_easy_setopt(ch->cp, option, NULL);
|
||||
} else {
|
||||
convert_to_string_ex(zvalue);
|
||||
return php_curl_option_str(ch, option, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 0 TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Curl private option */
|
||||
case CURLOPT_PRIVATE:
|
||||
convert_to_string_ex(zvalue);
|
||||
return php_curl_option_str(ch, option, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 1 TSRMLS_CC);
|
||||
|
||||
/* Curl url option */
|
||||
case CURLOPT_URL:
|
||||
convert_to_string_ex(zvalue);
|
||||
return php_curl_option_url(ch, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue) TSRMLS_CC);
|
||||
|
||||
/* Curl file handle options */
|
||||
case CURLOPT_FILE:
|
||||
case CURLOPT_INFILE:
|
||||
@@ -2346,18 +2355,15 @@ string_copy:
|
||||
|
||||
what = zend_fetch_resource(zvalue TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream(), php_file_le_pstream());
|
||||
if (!what) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (FAILURE == php_stream_cast((php_stream *) what, PHP_STREAM_AS_STDIO, (void *) &fp, REPORT_ERRORS)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (!fp) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
error = CURLE_OK;
|
||||
@@ -2373,8 +2379,7 @@ string_copy:
|
||||
ch->handlers->write->stream = *zvalue;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
break;
|
||||
case CURLOPT_WRITEHEADER:
|
||||
@@ -2388,8 +2393,7 @@ string_copy:
|
||||
ch->handlers->write_header->stream = *zvalue;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
break;
|
||||
case CURLOPT_INFILE:
|
||||
@@ -2410,8 +2414,7 @@ string_copy:
|
||||
ch->handlers->std_err = *zvalue;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
/* break omitted intentionally */
|
||||
default:
|
||||
@@ -2473,8 +2476,7 @@ string_copy:
|
||||
#endif
|
||||
}
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must pass either an object or an array with the %s argument", name);
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
for (zend_hash_internal_pointer_reset(ph);
|
||||
@@ -2487,7 +2489,6 @@ string_copy:
|
||||
slist = curl_slist_append(slist, Z_STRVAL_PP(current));
|
||||
if (!slist) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not build curl_slist");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -2507,8 +2508,7 @@ string_copy:
|
||||
if (PG(open_basedir) && *PG(open_basedir)) {
|
||||
if (Z_LVAL_PP(zvalue) != 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
|
||||
@@ -2534,8 +2534,7 @@ string_copy:
|
||||
postfields = HASH_OF(*zvalue);
|
||||
if (!postfields) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't get HashTable in CURLOPT_POSTFIELDS");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
for (zend_hash_internal_pointer_reset(postfields);
|
||||
@@ -2571,7 +2570,6 @@ string_copy:
|
||||
postval = Z_STRVAL_P(prop);
|
||||
|
||||
if (php_check_open_basedir(postval TSRMLS_CC)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2620,8 +2618,7 @@ string_copy:
|
||||
}
|
||||
/* open_basedir check */
|
||||
if (php_check_open_basedir(postval TSRMLS_CC)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
error = curl_formadd(&first, &last,
|
||||
CURLFORM_COPYNAME, string_key,
|
||||
@@ -2652,8 +2649,7 @@ string_copy:
|
||||
|
||||
SAVE_CURL_ERROR(ch, error);
|
||||
if (error != CURLE_OK) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (Z_REFCOUNT_P(ch->clone) <= 1) {
|
||||
@@ -2675,7 +2671,7 @@ string_copy:
|
||||
post = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
||||
zend_llist_add_element(&ch->to_free->str, &post);
|
||||
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_PP(zvalue));
|
||||
#endif
|
||||
}
|
||||
@@ -2773,26 +2769,13 @@ string_copy:
|
||||
case CURLOPT_SSH_KNOWNHOSTS:
|
||||
#endif
|
||||
{
|
||||
#if LIBCURL_VERSION_NUM < 0x071100
|
||||
char *copystr = NULL;
|
||||
#endif
|
||||
|
||||
convert_to_string_ex(zvalue);
|
||||
|
||||
if (Z_STRLEN_PP(zvalue) && php_check_open_basedir(Z_STRVAL_PP(zvalue) TSRMLS_CC)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
error = curl_easy_setopt(ch->cp, option, Z_STRVAL_PP(zvalue));
|
||||
#else
|
||||
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
||||
|
||||
error = curl_easy_setopt(ch->cp, option, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
#endif
|
||||
break;
|
||||
return php_curl_option_str(ch, option, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
case CURLINFO_HEADER_OUT:
|
||||
@@ -2837,9 +2820,9 @@ string_copy:
|
||||
|
||||
SAVE_CURL_ERROR(ch, error);
|
||||
if (error != CURLE_OK) {
|
||||
return 1;
|
||||
return FAILURE;
|
||||
} else {
|
||||
return 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2863,7 +2846,7 @@ PHP_FUNCTION(curl_setopt)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (!_php_curl_setopt(ch, options, zvalue, return_value TSRMLS_CC)) {
|
||||
if (_php_curl_setopt(ch, options, zvalue TSRMLS_CC) == SUCCESS) {
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
@@ -2894,7 +2877,7 @@ PHP_FUNCTION(curl_setopt_array)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array keys must be CURLOPT constants or equivalent integer values");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (_php_curl_setopt(ch, (long) option, entry, return_value TSRMLS_CC)) {
|
||||
if (_php_curl_setopt(ch, (long) option, entry TSRMLS_CC) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
zend_hash_move_forward_ex(Z_ARRVAL_P(arr), &pos);
|
||||
@@ -3159,6 +3142,7 @@ PHP_FUNCTION(curl_getinfo)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if LIBCURL_VERSION_NUM >= 0x070c03 /* Available since 7.12.3 */
|
||||
case CURLINFO_SLIST:
|
||||
{
|
||||
struct curl_slist *slist;
|
||||
@@ -3174,6 +3158,7 @@ PHP_FUNCTION(curl_getinfo)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -248,6 +248,8 @@ PHP_FUNCTION(curl_multi_getcontent)
|
||||
smart_str_0(&ch->handlers->write->buf);
|
||||
RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 1);
|
||||
}
|
||||
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+1
-1
@@ -198,7 +198,7 @@ typedef struct {
|
||||
|
||||
void _php_curl_cleanup_handle(php_curl *);
|
||||
void _php_curl_multi_cleanup_list(void *data);
|
||||
int _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC);
|
||||
void _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC);
|
||||
|
||||
void curlfile_register_class(TSRMLS_D);
|
||||
PHP_CURL_API extern zend_class_entry *curl_CURLFile_class;
|
||||
|
||||
@@ -81,8 +81,7 @@ Ok for CURLOPT_WRITEHEADER
|
||||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
%A
|
||||
Ok for CURLOPT_FILE
|
||||
%AOk for CURLOPT_FILE
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
|
||||
|
||||
@@ -58,15 +58,14 @@ foreach($options_to_check as $option) {
|
||||
--EXPECTF--
|
||||
Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %sbug54798.php on line %d
|
||||
* About to connect() %a
|
||||
* Closing connection #%d
|
||||
* Closing connection %d
|
||||
Ok for CURLOPT_STDERR
|
||||
|
||||
Warning: curl_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %sbug54798.php on line 24
|
||||
Ok for CURLOPT_WRITEHEADER
|
||||
|
||||
Warning: curl_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug54798.php on line 24
|
||||
%a
|
||||
Ok for CURLOPT_FILE
|
||||
%aOk for CURLOPT_FILE
|
||||
|
||||
Warning: curl_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %sbug54798.php on line %d
|
||||
Ok for CURLOPT_INFILE
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Bug #66109 (Option CURLOPT_CUSTOMREQUEST can't be reset to default.)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "{$host}/get.php?test=method");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, NULL);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(6) "DELETE"
|
||||
string(3) "GET"
|
||||
@@ -33,6 +33,5 @@ echo "Closed correctly\n";
|
||||
<?php
|
||||
unlink(dirname(__FILE__) . '/curl_file_deleted_before_curl_close.tmp');
|
||||
?>
|
||||
--EXPECTF--
|
||||
* Closing connection #%d
|
||||
--EXPECT--
|
||||
Closed correctly
|
||||
@@ -48,5 +48,4 @@ curl_close($ch);
|
||||
*** Testing curl_setopt with CURLOPT_STDERR
|
||||
string(%d) "%S"
|
||||
string(%d) "%S"
|
||||
* Closing connection #%d
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
|
||||
}
|
||||
break;
|
||||
case 'method':
|
||||
echo $_SERVER['REQUEST_METHOD'];
|
||||
break;
|
||||
default:
|
||||
echo "Hello World!\n";
|
||||
echo "Hello World!";
|
||||
|
||||
+467
-448
File diff suppressed because it is too large.
Load diff
+11
-12
@@ -28,7 +28,7 @@ static int month_tab[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 24
|
||||
static int days_in_month_leap[13] = { 31, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
static int days_in_month[13] = { 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
|
||||
static int do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, timelib_sll *a, timelib_sll *b)
|
||||
static void do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, timelib_sll *a, timelib_sll *b)
|
||||
{
|
||||
if (*a < start) {
|
||||
*b -= (start - *a - 1) / adj + 1;
|
||||
@@ -38,7 +38,6 @@ static int do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, t
|
||||
*b += *a / adj;
|
||||
*a -= adj * (*a / adj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void inc_month(timelib_sll *y, timelib_sll *m)
|
||||
@@ -170,24 +169,24 @@ static void do_adjust_for_weekday(timelib_time* time)
|
||||
|
||||
void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt)
|
||||
{
|
||||
do {} while (do_range_limit(0, 60, 60, &rt->s, &rt->i));
|
||||
do {} while (do_range_limit(0, 60, 60, &rt->i, &rt->h));
|
||||
do {} while (do_range_limit(0, 24, 24, &rt->h, &rt->d));
|
||||
do {} while (do_range_limit(0, 12, 12, &rt->m, &rt->y));
|
||||
do_range_limit(0, 60, 60, &rt->s, &rt->i);
|
||||
do_range_limit(0, 60, 60, &rt->i, &rt->h);
|
||||
do_range_limit(0, 24, 24, &rt->h, &rt->d);
|
||||
do_range_limit(0, 12, 12, &rt->m, &rt->y);
|
||||
|
||||
do_range_limit_days_relative(&base->y, &base->m, &rt->y, &rt->m, &rt->d, rt->invert);
|
||||
do {} while (do_range_limit(0, 12, 12, &rt->m, &rt->y));
|
||||
do_range_limit(0, 12, 12, &rt->m, &rt->y);
|
||||
}
|
||||
|
||||
void timelib_do_normalize(timelib_time* time)
|
||||
{
|
||||
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 60, 60, &time->s, &time->i));
|
||||
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 60, 60, &time->i, &time->h));
|
||||
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 24, 24, &time->h, &time->d));
|
||||
do {} while (do_range_limit(1, 13, 12, &time->m, &time->y));
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->s, &time->i);
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->i, &time->h);
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 24, 24, &time->h, &time->d);
|
||||
do_range_limit(1, 13, 12, &time->m, &time->y);
|
||||
|
||||
do {} while (do_range_limit_days(&time->y, &time->m, &time->d));
|
||||
do {} while (do_range_limit(1, 13, 12, &time->m, &time->y));
|
||||
do_range_limit(1, 13, 12, &time->m, &time->y);
|
||||
}
|
||||
|
||||
static void do_adjust_relative(timelib_time* time)
|
||||
|
||||
@@ -2781,6 +2781,10 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
|
||||
|
||||
tzi = php_date_parse_tzfile(Z_STRVAL_PP(z_timezone), DATE_TIMEZONEDB TSRMLS_CC);
|
||||
|
||||
if (tzi == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ALLOC_INIT_ZVAL(tmp_obj);
|
||||
tzobj = zend_object_store_get_object(php_date_instantiate(date_ce_timezone, tmp_obj TSRMLS_CC) TSRMLS_CC);
|
||||
tzobj->type = TIMELIB_ZONETYPE_ID;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Test for bug #66721: __wakeup of DateTime segfaults when invalid object data is supplied
|
||||
--CREDITS--
|
||||
Boro Sitnikovski <buritomath@yahoo.com>
|
||||
--FILE--
|
||||
<?php
|
||||
$y = 'O:8:"DateTime":3:{s:4:"date";s:19:"2014-02-15 02:00:51";s:13:"timezone_type";i:3;s:8:"timezone";s:10:"1234567890";}';
|
||||
var_dump(unserialize($y));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Invalid serialization data for DateTime object in %s on line %d
|
||||
@@ -1509,6 +1509,12 @@ char *_dom_get_valid_file_path(char *source, char *resolved_path, int resolved_p
|
||||
|
||||
if (uri->scheme != NULL) {
|
||||
/* absolute file uris - libxml only supports localhost or empty host */
|
||||
#ifdef PHP_WIN32
|
||||
if (strncasecmp(source, "file://",7) == 0 && ':' == source[8]) {
|
||||
isFileUri = 1;
|
||||
source += 7;
|
||||
} else
|
||||
#endif
|
||||
if (strncasecmp(source, "file:///",8) == 0) {
|
||||
isFileUri = 1;
|
||||
#ifdef PHP_WIN32
|
||||
|
||||
+21281
-21281
File diff suppressed because it is too large.
Load diff
+258
-61
@@ -1,6 +1,6 @@
|
||||
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
--- libmagic.orig/apprentice.c 2013-03-21 18:45:14.000000000 +0100
|
||||
+++ libmagic/apprentice.c 2013-04-27 13:53:32.175250261 +0200
|
||||
--- libmagic.orig/apprentice.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/apprentice.c Fri May 3 15:19:35 2013
|
||||
@@ -29,6 +29,8 @@
|
||||
* apprentice - make one pass through /etc/magic, learning its secrets.
|
||||
*/
|
||||
@@ -830,8 +830,8 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
m->str_flags = swap4(m->str_flags);
|
||||
}
|
||||
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
--- libmagic.orig/ascmagic.c 2012-10-31 18:03:01.000000000 +0100
|
||||
+++ libmagic/ascmagic.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/ascmagic.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/ascmagic.c Tue Feb 18 18:44:17 2014
|
||||
@@ -139,7 +139,7 @@
|
||||
/* malloc size is a conservative overestimate; could be
|
||||
improved, or at least realloced after conversion. */
|
||||
@@ -841,6 +841,15 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
file_oomem(ms, mlen);
|
||||
goto done;
|
||||
}
|
||||
@@ -147,7 +147,7 @@
|
||||
== NULL)
|
||||
goto done;
|
||||
if ((rv = file_softmagic(ms, utf8_buf,
|
||||
- (size_t)(utf8_end - utf8_buf), TEXTTEST, text)) == 0)
|
||||
+ (size_t)(utf8_end - utf8_buf), 0, TEXTTEST, text)) == 0)
|
||||
rv = -1;
|
||||
}
|
||||
|
||||
@@ -211,6 +211,7 @@
|
||||
case 0:
|
||||
if (file_printf(ms, ", ") == -1)
|
||||
@@ -860,8 +869,8 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
return rv;
|
||||
}
|
||||
diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
--- libmagic.orig/cdf.c 2013-03-21 18:45:14.000000000 +0100
|
||||
+++ libmagic/cdf.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/cdf.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/cdf.c Sun Apr 7 22:30:22 2013
|
||||
@@ -43,7 +43,17 @@
|
||||
#include <err.h>
|
||||
#endif
|
||||
@@ -923,8 +932,8 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
(void)fprintf(stderr, "timestamp %s\n", buf);
|
||||
} else {
|
||||
diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
--- libmagic.orig/cdf.h 2012-10-31 18:03:01.000000000 +0100
|
||||
+++ libmagic/cdf.h 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/cdf.h Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/cdf.h Sun Apr 7 22:30:22 2013
|
||||
@@ -35,10 +35,12 @@
|
||||
#ifndef _H_CDF_
|
||||
#define _H_CDF_
|
||||
@@ -966,8 +975,8 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
void cdf_swap_header(cdf_header_t *);
|
||||
void cdf_unpack_header(cdf_header_t *, char *);
|
||||
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
--- libmagic.orig/cdf_time.c 2012-10-31 18:03:01.000000000 +0100
|
||||
+++ libmagic/cdf_time.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/cdf_time.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/cdf_time.c Sun Apr 7 22:30:22 2013
|
||||
@@ -96,7 +96,7 @@
|
||||
}
|
||||
|
||||
@@ -1026,8 +1035,8 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
static const cdf_timestamp_t tst = 0x01A5E403C2D59C00ULL;
|
||||
static const char *ref = "Sat Apr 23 01:30:00 1977";
|
||||
diff -u libmagic.orig/compress.c libmagic/compress.c
|
||||
--- libmagic.orig/compress.c 2013-01-06 21:35:43.000000000 +0100
|
||||
+++ libmagic/compress.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/compress.c Sun Jan 6 21:35:43 2013
|
||||
+++ libmagic/compress.c Sun Apr 7 22:30:22 2013
|
||||
@@ -32,6 +32,7 @@
|
||||
* uncompress(method, old, n, newch) - uncompress old into new,
|
||||
* using method, return sizeof new
|
||||
@@ -1189,8 +1198,8 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
|
||||
-#endif
|
||||
+#endif /* if PHP_FILEINFO_UNCOMPRESS */
|
||||
diff -u libmagic.orig/file.h libmagic/file.h
|
||||
--- libmagic.orig/file.h 2013-02-18 16:40:59.000000000 +0100
|
||||
+++ libmagic/file.h 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/file.h Mon Feb 18 16:40:59 2013
|
||||
+++ libmagic/file.h Tue Feb 18 18:44:17 2014
|
||||
@@ -33,11 +33,9 @@
|
||||
#ifndef __file_h__
|
||||
#define __file_h__
|
||||
@@ -1303,7 +1312,13 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
protected int file_zmagic(struct magic_set *, int, const char *,
|
||||
const unsigned char *, size_t);
|
||||
#endif
|
||||
@@ -443,16 +442,13 @@
|
||||
@@ -438,21 +437,18 @@
|
||||
unichar **, size_t *, const char **, const char **, const char **);
|
||||
protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
|
||||
protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
|
||||
- int, int);
|
||||
+ size_t, int, int);
|
||||
protected int file_apprentice(struct magic_set *, const char *, int);
|
||||
protected int file_magicfind(struct magic_set *, const char *, struct mlist *);
|
||||
protected uint64_t file_signextend(struct magic_set *, struct magic *,
|
||||
uint64_t);
|
||||
@@ -1377,22 +1392,24 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H) && !defined(QUICK)
|
||||
#define QUICK
|
||||
@@ -533,4 +511,12 @@
|
||||
#define FILE_RCSID(id)
|
||||
@@ -531,6 +509,14 @@
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define FILE_RCSID(id)
|
||||
+#endif
|
||||
+
|
||||
+#ifdef PHP_WIN32
|
||||
+#define FINFO_LSEEK_FUNC _lseek
|
||||
+#define FINFO_READ_FUNC _read
|
||||
+#else
|
||||
+#define FINFO_LSEEK_FUNC lseek
|
||||
+#define FINFO_READ_FUNC read
|
||||
+#endif
|
||||
+
|
||||
#endif
|
||||
|
||||
#endif /* __file_h__ */
|
||||
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
--- libmagic.orig/fsmagic.c 2013-03-21 18:45:14.000000000 +0100
|
||||
+++ libmagic/fsmagic.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/fsmagic.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/fsmagic.c Sun Apr 7 22:30:22 2013
|
||||
@@ -59,27 +59,21 @@
|
||||
# define minor(dev) ((dev) & 0xff)
|
||||
#endif
|
||||
@@ -1758,8 +1775,8 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
return ret;
|
||||
}
|
||||
diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
--- libmagic.orig/funcs.c 2012-10-31 18:03:01.000000000 +0100
|
||||
+++ libmagic/funcs.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/funcs.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/funcs.c Tue Feb 18 18:44:17 2014
|
||||
@@ -41,52 +41,42 @@
|
||||
#if defined(HAVE_WCTYPE_H)
|
||||
#include <wctype.h>
|
||||
@@ -1896,7 +1913,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "zmagic %d\n", m);
|
||||
goto done;
|
||||
@@ -219,12 +221,17 @@
|
||||
@@ -219,16 +221,21 @@
|
||||
}
|
||||
|
||||
/* Check if we have a CDF file */
|
||||
@@ -1919,6 +1936,11 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
|
||||
/* try soft magic tests */
|
||||
if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
|
||||
- if ((m = file_softmagic(ms, ubuf, nb, BINTEST,
|
||||
+ if ((m = file_softmagic(ms, ubuf, nb, 0, BINTEST,
|
||||
looks_text)) != 0) {
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "softmagic %d\n", m);
|
||||
@@ -296,7 +303,6 @@
|
||||
|
||||
return m;
|
||||
@@ -2047,8 +2069,8 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
}
|
||||
+
|
||||
diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
--- libmagic.orig/magic.c 2013-01-11 17:43:09.000000000 +0100
|
||||
+++ libmagic/magic.c 2013-04-27 13:53:32.175250261 +0200
|
||||
--- libmagic.orig/magic.c Fri Jan 11 17:43:09 2013
|
||||
+++ libmagic/magic.c Fri May 3 15:19:35 2013
|
||||
@@ -25,11 +25,6 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
@@ -2391,8 +2413,8 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
public const char *
|
||||
magic_error(struct magic_set *ms)
|
||||
diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
--- libmagic.orig/magic.h 2013-03-21 18:52:42.000000000 +0100
|
||||
+++ libmagic/magic.h 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/magic.h Thu Mar 21 18:52:42 2013
|
||||
+++ libmagic/magic.h Sun Apr 7 22:30:22 2013
|
||||
@@ -87,6 +87,7 @@
|
||||
|
||||
const char *magic_getpath(const char *, int);
|
||||
@@ -2410,15 +2432,15 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
int magic_errno(magic_t);
|
||||
|
||||
diff -u libmagic.orig/print.c libmagic/print.c
|
||||
--- libmagic.orig/print.c 2013-03-21 18:45:14.000000000 +0100
|
||||
+++ libmagic/print.c 2013-04-27 13:53:32.175250261 +0200
|
||||
@@ -28,13 +28,17 @@
|
||||
/*
|
||||
--- libmagic.orig/print.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/print.c Mon Dec 16 23:09:24 2013
|
||||
@@ -29,12 +29,17 @@
|
||||
* print.c - debugging printout routines
|
||||
*/
|
||||
|
||||
+#define _GNU_SOURCE
|
||||
+#include "php.h"
|
||||
|
||||
+
|
||||
#include "file.h"
|
||||
+#include "cdf.h"
|
||||
|
||||
@@ -2430,7 +2452,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
@@ -43,188 +47,28 @@
|
||||
@@ -43,188 +48,28 @@
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
@@ -2631,7 +2653,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
}
|
||||
|
||||
protected const char *
|
||||
@@ -235,7 +79,7 @@
|
||||
@@ -235,7 +80,7 @@
|
||||
struct tm *tm;
|
||||
|
||||
if (flags & FILE_T_WINDOWS) {
|
||||
@@ -2641,8 +2663,8 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
t = ts.tv_sec;
|
||||
}
|
||||
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
--- libmagic.orig/readcdf.c 2012-10-31 18:03:01.000000000 +0100
|
||||
+++ libmagic/readcdf.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/readcdf.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/readcdf.c Sun Apr 7 22:30:22 2013
|
||||
@@ -30,7 +30,11 @@
|
||||
#endif
|
||||
|
||||
@@ -2704,8 +2726,8 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
if (file_printf(ms, "application/CDFV2-corrupt") == -1)
|
||||
return -1;
|
||||
diff -u libmagic.orig/readelf.c libmagic/readelf.c
|
||||
--- libmagic.orig/readelf.c 2013-03-21 18:45:14.000000000 +0100
|
||||
+++ libmagic/readelf.c 2013-04-08 15:42:57.328298809 +0200
|
||||
--- libmagic.orig/readelf.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/readelf.c Sun Apr 7 22:30:22 2013
|
||||
@@ -48,8 +48,8 @@
|
||||
private int dophn_exec(struct magic_set *, int, int, int, off_t, int, size_t,
|
||||
off_t, int *, int);
|
||||
@@ -2956,8 +2978,8 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
|
||||
|
||||
if (fstat(fd, &st) == -1) {
|
||||
diff -u libmagic.orig/readelf.h libmagic/readelf.h
|
||||
--- libmagic.orig/readelf.h 2013-03-21 18:45:14.000000000 +0100
|
||||
+++ libmagic/readelf.h 2013-03-31 16:57:18.499744030 +0200
|
||||
--- libmagic.orig/readelf.h Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/readelf.h Wed Mar 28 15:35:26 2012
|
||||
@@ -44,9 +44,17 @@
|
||||
typedef uint32_t Elf32_Word;
|
||||
typedef uint8_t Elf32_Char;
|
||||
@@ -2977,8 +2999,8 @@ diff -u libmagic.orig/readelf.h libmagic/readelf.h
|
||||
typedef uint32_t Elf64_Word;
|
||||
typedef uint8_t Elf64_Char;
|
||||
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
--- libmagic.orig/softmagic.c 2013-03-21 18:45:14.000000000 +0100
|
||||
+++ libmagic/softmagic.c 2013-05-14 11:00:07.044745939 +0200
|
||||
--- libmagic.orig/softmagic.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/softmagic.c Mon Mar 10 14:03:18 2014
|
||||
@@ -41,6 +41,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
@@ -2991,7 +3013,32 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
|
||||
private int match(struct magic_set *, struct magic *, uint32_t,
|
||||
const unsigned char *, size_t, size_t, int, int, int, int, int *, int *,
|
||||
@@ -132,7 +137,7 @@
|
||||
@@ -62,6 +67,8 @@
|
||||
private void cvt_32(union VALUETYPE *, const struct magic *);
|
||||
private void cvt_64(union VALUETYPE *, const struct magic *);
|
||||
|
||||
+#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o)))
|
||||
+
|
||||
/*
|
||||
* softmagic - lookup one file in parsed, in-memory copy of database
|
||||
* Passed the name and FILE * of one file to be typed.
|
||||
@@ -69,13 +76,13 @@
|
||||
/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */
|
||||
protected int
|
||||
file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
|
||||
- int mode, int text)
|
||||
+ size_t level, int mode, int text)
|
||||
{
|
||||
struct mlist *ml;
|
||||
int rv, printed_something = 0, need_separator = 0;
|
||||
for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
|
||||
if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
|
||||
- text, 0, 0, &printed_something, &need_separator,
|
||||
+ text, 0, level, &printed_something, &need_separator,
|
||||
NULL)) != 0)
|
||||
return rv;
|
||||
|
||||
@@ -132,7 +139,7 @@
|
||||
struct magic *m = &magic[magindex];
|
||||
|
||||
if (m->type != FILE_NAME)
|
||||
@@ -3000,7 +3047,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
#define FLT (STRING_BINTEST | STRING_TEXTTEST)
|
||||
((text && (m->str_flags & FLT) == STRING_BINTEST) ||
|
||||
(!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
|
||||
@@ -209,8 +214,8 @@
|
||||
@@ -209,8 +216,8 @@
|
||||
if (file_check_mem(ms, ++cont_level) == -1)
|
||||
return -1;
|
||||
|
||||
@@ -3011,7 +3058,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
m = &magic[magindex];
|
||||
ms->line = m->lineno; /* for messages */
|
||||
|
||||
@@ -335,44 +340,22 @@
|
||||
@@ -335,44 +342,22 @@
|
||||
private int
|
||||
check_fmt(struct magic_set *ms, struct magic *m)
|
||||
{
|
||||
@@ -3066,7 +3113,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
private int32_t
|
||||
mprint(struct magic_set *ms, struct magic *m)
|
||||
{
|
||||
@@ -583,13 +566,13 @@
|
||||
@@ -583,13 +568,13 @@
|
||||
char *cp;
|
||||
int rval;
|
||||
|
||||
@@ -3082,7 +3129,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
|
||||
if (rval == -1)
|
||||
return -1;
|
||||
@@ -835,16 +818,16 @@
|
||||
@@ -835,16 +820,16 @@
|
||||
if (m->num_mask) \
|
||||
switch (m->mask_op & FILE_OPS_MASK) { \
|
||||
case FILE_OPADD: \
|
||||
@@ -3103,7 +3150,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
break; \
|
||||
} \
|
||||
|
||||
@@ -1145,9 +1128,6 @@
|
||||
@@ -1145,9 +1130,6 @@
|
||||
"nbytes=%zu, count=%u)\n", m->type, m->flag, offset, o,
|
||||
nbytes, count);
|
||||
mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE));
|
||||
@@ -3113,7 +3160,79 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
}
|
||||
|
||||
if (m->flag & INDIR) {
|
||||
@@ -1644,9 +1624,6 @@
|
||||
@@ -1191,7 +1173,7 @@
|
||||
}
|
||||
switch (cvt_flip(m->in_type, flip)) {
|
||||
case FILE_BYTE:
|
||||
- if (nbytes < (offset + 1))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 1))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1226,7 +1208,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_BESHORT:
|
||||
- if (nbytes < (offset + 2))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1278,7 +1260,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_LESHORT:
|
||||
- if (nbytes < (offset + 2))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1330,7 +1312,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
- if (nbytes < (offset + 2))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1367,7 +1349,7 @@
|
||||
break;
|
||||
case FILE_BELONG:
|
||||
case FILE_BEID3:
|
||||
- if (nbytes < (offset + 4))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1438,7 +1420,7 @@
|
||||
break;
|
||||
case FILE_LELONG:
|
||||
case FILE_LEID3:
|
||||
- if (nbytes < (offset + 4))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1508,7 +1490,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_MELONG:
|
||||
- if (nbytes < (offset + 4))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1578,7 +1560,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_LONG:
|
||||
- if (nbytes < (offset + 4))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1644,23 +1626,20 @@
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0) {
|
||||
mdebug(offset, (char *)(void *)p,
|
||||
sizeof(union VALUETYPE));
|
||||
@@ -3123,23 +3242,101 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1717,12 +1694,12 @@
|
||||
ms->o.buf = sbuf;
|
||||
/* Verify we have enough data to match magic type */
|
||||
switch (m->type) {
|
||||
case FILE_BYTE:
|
||||
- if (nbytes < (offset + 1)) /* should alway be true */
|
||||
+ if (OFFSET_OOB(nbytes, offset, 1))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_SHORT:
|
||||
case FILE_BESHORT:
|
||||
case FILE_LESHORT:
|
||||
- if (nbytes < (offset + 2))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
@@ -1679,38 +1658,40 @@
|
||||
case FILE_FLOAT:
|
||||
case FILE_BEFLOAT:
|
||||
case FILE_LEFLOAT:
|
||||
- if (nbytes < (offset + 4))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_DOUBLE:
|
||||
case FILE_BEDOUBLE:
|
||||
case FILE_LEDOUBLE:
|
||||
- if (nbytes < (offset + 8))
|
||||
+ if (OFFSET_OOB(nbytes, offset, 8))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_STRING:
|
||||
case FILE_PSTRING:
|
||||
case FILE_SEARCH:
|
||||
- if (nbytes < (offset + m->vallen))
|
||||
+ if (OFFSET_OOB(nbytes, offset, m->vallen))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_REGEX:
|
||||
- if (nbytes < offset)
|
||||
+ if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_INDIRECT:
|
||||
- if (nbytes < offset)
|
||||
+ if (offset == 0)
|
||||
+ return 0;
|
||||
+ if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
sbuf = ms->o.buf;
|
||||
soffset = ms->offset;
|
||||
ms->o.buf = NULL;
|
||||
ms->offset = 0;
|
||||
rv = file_softmagic(ms, s + offset, nbytes - offset,
|
||||
- BINTEST, text);
|
||||
+ recursion_level, BINTEST, text);
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
|
||||
rbuf = ms->o.buf;
|
||||
@@ -1718,16 +1699,26 @@
|
||||
ms->offset = soffset;
|
||||
if (rv == 1) {
|
||||
- if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
+ if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
file_printf(ms, m->desc, offset) == -1)
|
||||
- return -1;
|
||||
+ return -1;
|
||||
if (file_printf(ms, "%s", rbuf) == -1)
|
||||
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
- file_printf(ms, m->desc, offset) == -1)
|
||||
+ file_printf(ms, m->desc, offset) == -1) {
|
||||
+ if (rbuf) {
|
||||
+ efree(rbuf);
|
||||
+ }
|
||||
return -1;
|
||||
- if (file_printf(ms, "%s", rbuf) == -1)
|
||||
+ }
|
||||
+ if (file_printf(ms, "%s", rbuf) == -1) {
|
||||
+ if (rbuf) {
|
||||
+ efree(rbuf);
|
||||
+ }
|
||||
return -1;
|
||||
- free(rbuf);
|
||||
+ }
|
||||
+ }
|
||||
+ if (rbuf) {
|
||||
+ efree(rbuf);
|
||||
}
|
||||
return rv;
|
||||
|
||||
@@ -1837,6 +1814,42 @@
|
||||
case FILE_USE:
|
||||
- if (nbytes < offset)
|
||||
+ if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
sbuf = m->value.s;
|
||||
if (*sbuf == '^') {
|
||||
@@ -1837,6 +1828,42 @@
|
||||
return file_strncmp(a, b, len, flags);
|
||||
}
|
||||
|
||||
@@ -3182,7 +3379,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
private int
|
||||
magiccheck(struct magic_set *ms, struct magic *m)
|
||||
{
|
||||
@@ -1996,69 +2009,157 @@
|
||||
@@ -1996,69 +2023,157 @@
|
||||
break;
|
||||
}
|
||||
case FILE_REGEX: {
|
||||
|
||||
@@ -493,12 +493,14 @@ apprentice_unmap(struct magic_map *map)
|
||||
if (map == NULL)
|
||||
return;
|
||||
if (map->p != php_magic_database) {
|
||||
int j;
|
||||
for (j = 0; j < MAGIC_SETS; j++) {
|
||||
if (map->magic[j])
|
||||
efree(map->magic[j]);
|
||||
}
|
||||
if (map->p != NULL) {
|
||||
if (map->p == NULL) {
|
||||
int j;
|
||||
for (j = 0; j < MAGIC_SETS; j++) {
|
||||
if (map->magic[j]) {
|
||||
efree(map->magic[j]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
efree(map->p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ private void cvt_16(union VALUETYPE *, const struct magic *);
|
||||
private void cvt_32(union VALUETYPE *, const struct magic *);
|
||||
private void cvt_64(union VALUETYPE *, const struct magic *);
|
||||
|
||||
#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o)))
|
||||
|
||||
/*
|
||||
* softmagic - lookup one file in parsed, in-memory copy of database
|
||||
* Passed the name and FILE * of one file to be typed.
|
||||
@@ -1171,7 +1173,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
}
|
||||
switch (cvt_flip(m->in_type, flip)) {
|
||||
case FILE_BYTE:
|
||||
if (nbytes < (offset + 1))
|
||||
if (OFFSET_OOB(nbytes, offset, 1))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1206,7 +1208,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_BESHORT:
|
||||
if (nbytes < (offset + 2))
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1258,7 +1260,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_LESHORT:
|
||||
if (nbytes < (offset + 2))
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1310,7 +1312,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
if (nbytes < (offset + 2))
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1347,7 +1349,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
break;
|
||||
case FILE_BELONG:
|
||||
case FILE_BEID3:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1418,7 +1420,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
break;
|
||||
case FILE_LELONG:
|
||||
case FILE_LEID3:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1488,7 +1490,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_MELONG:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1558,7 +1560,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_LONG:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1630,14 +1632,14 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
/* Verify we have enough data to match magic type */
|
||||
switch (m->type) {
|
||||
case FILE_BYTE:
|
||||
if (nbytes < (offset + 1)) /* should always be true */
|
||||
if (OFFSET_OOB(nbytes, offset, 1))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_SHORT:
|
||||
case FILE_BESHORT:
|
||||
case FILE_LESHORT:
|
||||
if (nbytes < (offset + 2))
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
@@ -1656,33 +1658,33 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
case FILE_FLOAT:
|
||||
case FILE_BEFLOAT:
|
||||
case FILE_LEFLOAT:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_DOUBLE:
|
||||
case FILE_BEDOUBLE:
|
||||
case FILE_LEDOUBLE:
|
||||
if (nbytes < (offset + 8))
|
||||
if (OFFSET_OOB(nbytes, offset, 8))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_STRING:
|
||||
case FILE_PSTRING:
|
||||
case FILE_SEARCH:
|
||||
if (nbytes < (offset + m->vallen))
|
||||
if (OFFSET_OOB(nbytes, offset, m->vallen))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_REGEX:
|
||||
if (nbytes < offset)
|
||||
if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_INDIRECT:
|
||||
if (offset == 0)
|
||||
return 0;
|
||||
if (nbytes < offset)
|
||||
if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
sbuf = ms->o.buf;
|
||||
soffset = ms->offset;
|
||||
@@ -1696,17 +1698,27 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
ms->o.buf = sbuf;
|
||||
ms->offset = soffset;
|
||||
if (rv == 1) {
|
||||
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
file_printf(ms, m->desc, offset) == -1)
|
||||
return -1;
|
||||
if (file_printf(ms, "%s", rbuf) == -1)
|
||||
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
file_printf(ms, m->desc, offset) == -1) {
|
||||
if (rbuf) {
|
||||
efree(rbuf);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (file_printf(ms, "%s", rbuf) == -1) {
|
||||
if (rbuf) {
|
||||
efree(rbuf);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (rbuf) {
|
||||
efree(rbuf);
|
||||
}
|
||||
return rv;
|
||||
|
||||
case FILE_USE:
|
||||
if (nbytes < offset)
|
||||
if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
sbuf = m->value.s;
|
||||
if (*sbuf == '^') {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
Patches applied to file sources tree before generating magic.mgc
|
||||
and before running create_data_file.php to create data_file.c.
|
||||
|
||||
|
||||
|
||||
From ef2329cf71acb59204dd981e2c6cce6c81fe467c Mon Sep 17 00:00:00 2001
|
||||
From: Christos Zoulas <christos@zoulas.com>
|
||||
Date: Mon, 25 Mar 2013 14:06:55 +0000
|
||||
Subject: [PATCH] limit to 100 repetitions to avoid excessive backtracking
|
||||
Carsten Wolff
|
||||
|
||||
---
|
||||
magic/Magdir/commands | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/magic/Magdir/commands b/magic/Magdir/commands
|
||||
index 67c3eee..4a7d8dd 100644
|
||||
--- a/magic/Magdir/commands
|
||||
+++ b/magic/Magdir/commands
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
-# $File: commands,v 1.44 2013/02/05 15:20:47 christos Exp $
|
||||
+# $File: commands,v 1.45 2013/02/06 14:18:52 christos Exp $
|
||||
# commands: file(1) magic for various shells and interpreters
|
||||
#
|
||||
#0 string/w : shell archive or script for antique kernel text
|
||||
@@ -49,7 +49,7 @@
|
||||
!:mime text/x-awk
|
||||
0 string/wt #!\ /usr/bin/awk awk script text executable
|
||||
!:mime text/x-awk
|
||||
-0 regex =^\\s*BEGIN\\s*[{] awk script text
|
||||
+0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text
|
||||
|
||||
# AT&T Bell Labs' Plan 9 shell
|
||||
0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable
|
||||
--
|
||||
1.8.5.5
|
||||
|
||||
+13
-28
@@ -4879,7 +4879,7 @@ PHP_FUNCTION(imageconvolution)
|
||||
if (zend_hash_index_find(Z_ARRVAL_PP(var), (j), (void **) &var2) == SUCCESS) {
|
||||
if (Z_TYPE_PP(var2) != IS_DOUBLE) {
|
||||
zval dval;
|
||||
dval = **var;
|
||||
dval = **var2;
|
||||
zval_copy_ctor(&dval);
|
||||
convert_to_double(&dval);
|
||||
matrix[i][j] = (float)Z_DVAL(dval);
|
||||
@@ -5101,40 +5101,24 @@ PHP_FUNCTION(imagescale)
|
||||
{
|
||||
zval *IM;
|
||||
gdImagePtr im;
|
||||
gdImagePtr im_scaled;
|
||||
int new_width, new_height = -1;
|
||||
gdInterpolationMethod method = GD_BILINEAR_FIXED;
|
||||
gdImagePtr im_scaled = NULL;
|
||||
int new_width, new_height;
|
||||
long tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED;
|
||||
gdInterpolationMethod method;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|ll", &IM, &new_width, &new_height, &method) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|ll", &IM, &tmp_w, &tmp_h, &tmp_m) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
method = tmp_m;
|
||||
new_width = tmp_w;
|
||||
new_height = tmp_h;
|
||||
|
||||
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
|
||||
im_scaled = gdImageScale(im, new_width, new_height);
|
||||
goto finish;
|
||||
switch (method) {
|
||||
case GD_NEAREST_NEIGHBOUR:
|
||||
im_scaled = gdImageScaleNearestNeighbour(im, new_width, new_height);
|
||||
break;
|
||||
|
||||
case GD_BILINEAR_FIXED:
|
||||
im_scaled = gdImageScaleBilinear(im, new_width, new_height);
|
||||
break;
|
||||
|
||||
case GD_BICUBIC:
|
||||
im_scaled = gdImageScaleBicubicFixed(im, new_width, new_height);
|
||||
break;
|
||||
|
||||
case GD_BICUBIC_FIXED:
|
||||
im_scaled = gdImageScaleBicubicFixed(im, new_width, new_height);
|
||||
break;
|
||||
|
||||
default:
|
||||
im_scaled = gdImageScaleTwoPass(im, im->sx, im->sy, new_width, new_height);
|
||||
break;
|
||||
|
||||
if (gdImageSetInterpolationMethod(im, method)) {
|
||||
im_scaled = gdImageScale(im, new_width, new_height);
|
||||
}
|
||||
finish:
|
||||
|
||||
if (im_scaled == NULL) {
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
@@ -5298,6 +5282,7 @@ PHP_FUNCTION(imageaffinematrixget)
|
||||
double x, y;
|
||||
if (Z_TYPE_P(options) != IS_ARRAY) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array expected as options");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (zend_hash_find(HASH_OF(options), "x", sizeof("x"), (void **)&tmp) != FAILURE) {
|
||||
if (Z_TYPE_PP(tmp) != IS_DOUBLE) {
|
||||
|
||||
@@ -45,22 +45,20 @@ gdImagePtr gdImageCrop(gdImagePtr src, const gdRectPtr crop)
|
||||
gdImagePtr dst;
|
||||
int y;
|
||||
|
||||
/* check size */
|
||||
if (crop->width<=0 || crop->height<=0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* allocate the requested size (could be only partially filled) */
|
||||
if (src->trueColor) {
|
||||
dst = gdImageCreateTrueColor(crop->width, crop->height);
|
||||
if (dst == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
gdImageSaveAlpha(dst, 1);
|
||||
} else {
|
||||
dst = gdImageCreate(crop->width, crop->height);
|
||||
if (dst == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
gdImagePaletteCopy(dst, src);
|
||||
}
|
||||
if (dst == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
dst->transparent = src->transparent;
|
||||
|
||||
/* check position in the src image */
|
||||
|
||||
@@ -1324,8 +1324,8 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w
|
||||
gdFixed f_j = gd_itofx(j);
|
||||
gdFixed f_a = gd_mulfx(f_i, f_dy);
|
||||
gdFixed f_b = gd_mulfx(f_j, f_dx);
|
||||
const long m = gd_fxtoi(f_a);
|
||||
const long n = gd_fxtoi(f_b);
|
||||
const gdFixed m = gd_fxtoi(f_a);
|
||||
const gdFixed n = gd_fxtoi(f_b);
|
||||
gdFixed f_f = f_a - gd_itofx(m);
|
||||
gdFixed f_g = f_b - gd_itofx(n);
|
||||
|
||||
@@ -1365,10 +1365,10 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w
|
||||
f_a3 = gd_itofx(gdTrueColorGetAlpha(pixel3));
|
||||
f_a4 = gd_itofx(gdTrueColorGetAlpha(pixel4));
|
||||
{
|
||||
const char red = (char) gd_fxtoi(gd_mulfx(f_w1, f_r1) + gd_mulfx(f_w2, f_r2) + gd_mulfx(f_w3, f_r3) + gd_mulfx(f_w4, f_r4));
|
||||
const char green = (char) gd_fxtoi(gd_mulfx(f_w1, f_g1) + gd_mulfx(f_w2, f_g2) + gd_mulfx(f_w3, f_g3) + gd_mulfx(f_w4, f_g4));
|
||||
const char blue = (char) gd_fxtoi(gd_mulfx(f_w1, f_b1) + gd_mulfx(f_w2, f_b2) + gd_mulfx(f_w3, f_b3) + gd_mulfx(f_w4, f_b4));
|
||||
const char alpha = (char) gd_fxtoi(gd_mulfx(f_w1, f_a1) + gd_mulfx(f_w2, f_a2) + gd_mulfx(f_w3, f_a3) + gd_mulfx(f_w4, f_a4));
|
||||
const unsigned char red = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_r1) + gd_mulfx(f_w2, f_r2) + gd_mulfx(f_w3, f_r3) + gd_mulfx(f_w4, f_r4));
|
||||
const unsigned char green = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_g1) + gd_mulfx(f_w2, f_g2) + gd_mulfx(f_w3, f_g3) + gd_mulfx(f_w4, f_g4));
|
||||
const unsigned char blue = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_b1) + gd_mulfx(f_w2, f_b2) + gd_mulfx(f_w3, f_b3) + gd_mulfx(f_w4, f_b4));
|
||||
const unsigned char alpha = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_a1) + gd_mulfx(f_w2, f_a2) + gd_mulfx(f_w3, f_a3) + gd_mulfx(f_w4, f_a4));
|
||||
|
||||
new_img->tpixels[dst_offset_v][dst_offset_h] = gdTrueColorAlpha(red, green, blue, alpha);
|
||||
}
|
||||
@@ -2472,10 +2472,7 @@ int gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMethod id)
|
||||
|
||||
switch (id) {
|
||||
case GD_DEFAULT:
|
||||
im->interpolation_id = GD_BILINEAR_FIXED;
|
||||
im->interpolation = NULL;
|
||||
break;
|
||||
|
||||
id = GD_BILINEAR_FIXED;
|
||||
/* Optimized versions */
|
||||
case GD_BILINEAR_FIXED:
|
||||
case GD_BICUBIC_FIXED:
|
||||
|
||||
@@ -122,6 +122,10 @@ const char * gdJpegGetVersionString()
|
||||
return "8";
|
||||
break;
|
||||
|
||||
case 90:
|
||||
return "9 compatible";
|
||||
break;
|
||||
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ var_dump(imagecrop($img, array("x" => -20, "y" => -20, "width" => 10, "height" =
|
||||
// POC #4
|
||||
var_dump(imagecrop($img, array("x" => 0x7fffff00, "y" => 0, "width" => 10, "height" => 10)));
|
||||
|
||||
// bug 66815
|
||||
var_dump(imagecrop($img, array("x" => 0, "y" => 0, "width" => 65535, "height" => 65535)));
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (gd)
|
||||
@@ -35,6 +37,13 @@ Array
|
||||
[width] => 10
|
||||
[height] => 10
|
||||
)
|
||||
|
||||
Warning: imagecrop(): gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
|
||||
in %sbug66356.php on line %d
|
||||
bool(false)
|
||||
resource(%d) of type (gd)
|
||||
resource(%d) of type (gd)
|
||||
resource(%d) of type (gd)
|
||||
|
||||
Warning: imagecrop(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
|
||||
in %sbug66356.php on line %d
|
||||
bool(false)
|
||||
@@ -1529,6 +1529,7 @@ ZEND_FUNCTION(gmp_testbit)
|
||||
if (mpz_tstbit(*gmpnum_a, index)) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+5
-6
@@ -609,16 +609,15 @@ Generate a PBKDF2 hash of the given password and salt
|
||||
Returns lowercase hexits by default */
|
||||
PHP_FUNCTION(hash_pbkdf2)
|
||||
{
|
||||
char *returnval, *algo, *salt, *pass = NULL;
|
||||
unsigned char *computed_salt, *digest, *temp, *result, *K1, *K2 = NULL;
|
||||
long loops, i, j, algo_len, pass_len, iterations, length, digest_length = 0;
|
||||
int argc, salt_len = 0;
|
||||
char *returnval, *algo, *salt, *pass;
|
||||
unsigned char *computed_salt, *digest, *temp, *result, *K1, *K2;
|
||||
long loops, i, j, iterations, length = 0, digest_length;
|
||||
int algo_len, pass_len, salt_len;
|
||||
zend_bool raw_output = 0;
|
||||
const php_hash_ops *ops;
|
||||
void *context;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "sssl|lb", &algo, &algo_len, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssl|lb", &algo, &algo_len, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ Test hash_pbkdf2() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/* Prototype : string hash_hmac ( string $algo , string $data , string $key [, bool $raw_output ] )
|
||||
/* Prototype : string hash_hmac(string $algo, string $data, string $key [, int $length = 0 [, bool $raw_output = false]])
|
||||
* Description: Generate a keyed hash value using the HMAC method
|
||||
* Source code: ext/hash/hash.c
|
||||
* Alias to functions:
|
||||
@@ -14,10 +14,12 @@ Test hash_pbkdf2() function : basic functionality
|
||||
echo "*** Testing hash_pbkdf2() : basic functionality ***\n";
|
||||
|
||||
echo "sha1: " . hash_pbkdf2('sha1', 'password', 'salt', 1, 20)."\n";
|
||||
echo "sha1(no length): " . hash_pbkdf2('sha1', 'password', 'salt', 1)."\n";
|
||||
echo "sha1(raw): " . bin2hex(hash_pbkdf2('sha1', 'password', 'salt', 1, 20, TRUE))."\n";
|
||||
echo "sha1(rounds): " . hash_pbkdf2('sha1', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 25)."\n";
|
||||
echo "sha1(rounds)(raw): " . bin2hex(hash_pbkdf2('sha1', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 25, TRUE))."\n";
|
||||
echo "sha256: " . hash_pbkdf2('sha256', 'password', 'salt', 1, 20)."\n";
|
||||
echo "sha256(no length): " . hash_pbkdf2('sha256', 'password', 'salt', 1)."\n";
|
||||
echo "sha256(raw): " . bin2hex(hash_pbkdf2('sha256', 'password', 'salt', 1, 20, TRUE))."\n";
|
||||
echo "sha256(rounds): " . hash_pbkdf2('sha256', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 40)."\n";
|
||||
echo "sha256(rounds)(raw): " . bin2hex(hash_pbkdf2('sha256', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 40, TRUE))."\n";
|
||||
@@ -27,10 +29,12 @@ echo "sha256(rounds)(raw): " . bin2hex(hash_pbkdf2('sha256', 'passwordPASSWORDpa
|
||||
--EXPECT--
|
||||
*** Testing hash_pbkdf2() : basic functionality ***
|
||||
sha1: 0c60c80f961f0e71f3a9
|
||||
sha1(no length): 0c60c80f961f0e71f3a9b524af6012062fe037a6
|
||||
sha1(raw): 0c60c80f961f0e71f3a9b524af6012062fe037a6
|
||||
sha1(rounds): 3d2eec4fe41c849b80c8d8366
|
||||
sha1(rounds)(raw): 3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038
|
||||
sha256: 120fb6cffcf8b32c43e7
|
||||
sha256(no length): 120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b
|
||||
sha256(raw): 120fb6cffcf8b32c43e7225256c4f837a86548c9
|
||||
sha256(rounds): 348c89dbcbd32b2f32d814b8116e84cf2b17347e
|
||||
sha256(rounds)(raw): 348c89dbcbd32b2f32d814b8116e84cf2b17347ebc1800181c4e2a1fb8dd53e1c635518c7dac47e9
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
PHP_ARG_WITH(interbase,for InterBase support,
|
||||
[ --with-interbase[=DIR] Include InterBase support. DIR is the InterBase base
|
||||
install directory [/usr/interbase]])
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// $Id$
|
||||
// vim:ft=javascript
|
||||
|
||||
ARG_WITH("interbase", "InterBase support", "no");
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef PHP_IBASE_INCLUDES_H
|
||||
#define PHP_IBASE_INCLUDES_H
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/**
|
||||
* This UDF library adds the ability to call PHP functions from SQL
|
||||
* statements. Because of SQL's strong typing, you will have to declare
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef PHP_INTERBASE_H
|
||||
#define PHP_INTERBASE_H
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php /* $Id$ */
|
||||
<?php
|
||||
|
||||
srand((double)microtime()*1000000);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php /* $Id$ */
|
||||
<?php
|
||||
|
||||
if (!extension_loaded("interbase")) print "skip interbase extension not available";
|
||||
require("interbase.inc");
|
||||
|
||||
@@ -57,6 +57,8 @@ static inline void php_converter_throw_failure(php_converter_object *objval, UEr
|
||||
|
||||
/* {{{ php_converter_default_callback */
|
||||
static void php_converter_default_callback(zval *return_value, zval *zobj, long reason, zval *error TSRMLS_DC) {
|
||||
zval_dtor(error);
|
||||
ZVAL_LONG(error, U_ZERO_ERROR);
|
||||
/* Basic functionality so children can call parent::toUCallback() */
|
||||
switch (reason) {
|
||||
case UCNV_UNASSIGNED:
|
||||
@@ -66,7 +68,16 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, long
|
||||
php_converter_object *objval = (php_converter_object*)CONV_GET(zobj);
|
||||
char chars[127];
|
||||
int8_t chars_len = sizeof(chars);
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
UErrorCode uerror = U_ZERO_ERROR;
|
||||
if(!objval->src) {
|
||||
php_converter_throw_failure(objval, U_INVALID_STATE_ERROR TSRMLS_CC, "Source Converter has not been initialized yet");
|
||||
chars[0] = 0x1A;
|
||||
chars[1] = 0;
|
||||
chars_len = 1;
|
||||
ZVAL_LONG(error, U_INVALID_STATE_ERROR);
|
||||
RETVAL_STRINGL(chars, chars_len, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Yes, this is fairly wasteful at first glance,
|
||||
* but considering that the alternative is to store
|
||||
@@ -75,18 +86,17 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, long
|
||||
* I'd rather take the CPU hit here, than waste time
|
||||
* storing a value I'm unlikely to use.
|
||||
*/
|
||||
ucnv_getSubstChars(objval->src, chars, &chars_len, &error);
|
||||
if (U_FAILURE(error)) {
|
||||
THROW_UFAILURE(objval, "ucnv_getSubstChars", error);
|
||||
ucnv_getSubstChars(objval->src, chars, &chars_len, &uerror);
|
||||
if (U_FAILURE(uerror)) {
|
||||
THROW_UFAILURE(objval, "ucnv_getSubstChars", uerror);
|
||||
chars[0] = 0x1A;
|
||||
chars[1] = 0;
|
||||
chars_len = 1;
|
||||
ZVAL_LONG(error, uerror);
|
||||
}
|
||||
RETVAL_STRINGL(chars, chars_len, 1);
|
||||
}
|
||||
}
|
||||
zval_dtor(error);
|
||||
ZVAL_LONG(error, U_ZERO_ERROR);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
--TEST--
|
||||
Bug #62070: Collator::getSortKey() returns garbage
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
if (version_compare(INTL_ICU_VERSION, '49') < 0)
|
||||
die('skip ICU >= 49 only');
|
||||
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '49') < 0) die('skip for ICU >= 49'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.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, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$s1 = 'Hello';
|
||||
|
||||
$coll = collator_create('en_US');
|
||||
$res = collator_get_sort_key($coll, $s1);
|
||||
|
||||
echo urlencode($res);
|
||||
--EXPECT--
|
||||
71%3F%3FE%01%09%01%DC%08
|
||||
@@ -1,8 +1,9 @@
|
||||
--TEST--
|
||||
create() icu >= 4.8
|
||||
create() icu >= 4.8 && icu < 53.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
|
||||
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip for ICU >= 4.8'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
--TEST--
|
||||
create() icu >= 53.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Try creating collator with different locales
|
||||
* with Procedural and Object methods.
|
||||
*/
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$res_str = '';
|
||||
|
||||
$locales = array(
|
||||
'EN-US-ODESSA',
|
||||
'UK_UA_ODESSA',
|
||||
'uk-ua_CALIFORNIA@currency=;currency=GRN',
|
||||
'',
|
||||
'root',
|
||||
'uk@currency=EURO',
|
||||
'1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
|
||||
);
|
||||
|
||||
foreach( $locales as $locale )
|
||||
{
|
||||
// Create Collator with the current locale.
|
||||
$coll = ut_coll_create( $locale );
|
||||
if( !is_object($coll) )
|
||||
{
|
||||
$res_str .= "Error creating collator with '$locale' locale: " .
|
||||
intl_get_error_message() . "\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the requested, valid and actual locales.
|
||||
$vloc = ut_coll_get_locale( $coll, Locale::VALID_LOCALE );
|
||||
$aloc = ut_coll_get_locale( $coll, Locale::ACTUAL_LOCALE );
|
||||
|
||||
// Show them.
|
||||
$res_str .= "Locale: '$locale'\n" .
|
||||
" ULOC_REQUESTED_LOCALE = '$locale'\n" .
|
||||
" ULOC_VALID_LOCALE = '$vloc'\n" .
|
||||
" ULOC_ACTUAL_LOCALE = '$aloc'\n";
|
||||
}
|
||||
|
||||
return $res_str;
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Locale: 'EN-US-ODESSA'
|
||||
ULOC_REQUESTED_LOCALE = 'EN-US-ODESSA'
|
||||
ULOC_VALID_LOCALE = 'en_US'
|
||||
ULOC_ACTUAL_LOCALE = 'root'
|
||||
Locale: 'UK_UA_ODESSA'
|
||||
ULOC_REQUESTED_LOCALE = 'UK_UA_ODESSA'
|
||||
ULOC_VALID_LOCALE = 'uk'
|
||||
ULOC_ACTUAL_LOCALE = 'uk'
|
||||
Locale: 'uk-ua_CALIFORNIA@currency=;currency=GRN'
|
||||
ULOC_REQUESTED_LOCALE = 'uk-ua_CALIFORNIA@currency=;currency=GRN'
|
||||
ULOC_VALID_LOCALE = 'root'
|
||||
ULOC_ACTUAL_LOCALE = 'root'
|
||||
Locale: ''
|
||||
ULOC_REQUESTED_LOCALE = ''
|
||||
ULOC_VALID_LOCALE = '%s'
|
||||
ULOC_ACTUAL_LOCALE = '%s'
|
||||
Locale: 'root'
|
||||
ULOC_REQUESTED_LOCALE = 'root'
|
||||
ULOC_VALID_LOCALE = 'root'
|
||||
ULOC_ACTUAL_LOCALE = 'root'
|
||||
Locale: 'uk@currency=EURO'
|
||||
ULOC_REQUESTED_LOCALE = 'uk@currency=EURO'
|
||||
ULOC_VALID_LOCALE = 'uk'
|
||||
ULOC_ACTUAL_LOCALE = 'uk'
|
||||
Error creating collator with '1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than 80 characters: U_ILLEGAL_ARGUMENT_ERROR
|
||||
@@ -3,6 +3,7 @@ collator_get_sort_key()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
--TEST--
|
||||
collator_get_sort_key()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.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: 292b2d01070107
|
||||
source: abd
|
||||
key: 292b2f01070107
|
||||
source: aaa
|
||||
key: 29292901070107
|
||||
source: аа
|
||||
key: 5e090901060106
|
||||
source: а
|
||||
key: 5e0901050105
|
||||
source: z
|
||||
key: 5b01050105
|
||||
source:
|
||||
key: 0101
|
||||
source:
|
||||
key: 0101
|
||||
source: 3
|
||||
key: 1a01050105
|
||||
source: y
|
||||
key: 5901050105
|
||||
source: i
|
||||
key: 3901050105
|
||||
source: k
|
||||
key: 3d01050105
|
||||
source: абг
|
||||
key: 2809131701070107
|
||||
source: абв
|
||||
key: 2809131501070107
|
||||
source: жжж
|
||||
key: 2833333301070107
|
||||
source: эюя
|
||||
key: 28cdd1d501070107
|
||||
source: абг
|
||||
key: 5e09131701070107
|
||||
source: абв
|
||||
key: 5e09131501070107
|
||||
source: жжж
|
||||
key: 5e33333301070107
|
||||
source: эюя
|
||||
key: 5ecdd1d501070107
|
||||
@@ -359,40 +359,40 @@ Formatted DateTime is : 20091231 03:02 PM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'America/Los_Angeles',
|
||||
'timezone_type' => 2,
|
||||
'timezone' => 'PDT',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : Saturday, December 30, 2000 5:04:05 PM GMT-10:00
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'America/Los_Angeles',
|
||||
'timezone_type' => 2,
|
||||
'timezone' => 'PDT',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : December 30, 2000 5:04:05 PM GMT-10:00
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'America/Los_Angeles',
|
||||
'timezone_type' => 2,
|
||||
'timezone' => 'PDT',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : Dec 30, 2000 5:04:05 PM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'America/Los_Angeles',
|
||||
'timezone_type' => 2,
|
||||
'timezone' => 'PDT',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : 12/30/00 5:04 PM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'America/Los_Angeles',
|
||||
'timezone_type' => 2,
|
||||
'timezone' => 'PDT',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : 20001230 05:04 PM
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
datefmt_format_code()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 && ICU < 52.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,423 @@
|
||||
--TEST--
|
||||
datefmt_format_code()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '52.1') < 0) die('skip for ICU >= 52.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//ini_set("intl.error_level", E_WARNING);
|
||||
|
||||
/*
|
||||
* Test for the datefmt_format function
|
||||
*/
|
||||
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$timezone = 'GMT-10:00';
|
||||
|
||||
$locale_arr = array (
|
||||
'en_US'
|
||||
);
|
||||
|
||||
$datetype_arr = array (
|
||||
IntlDateFormatter::FULL,
|
||||
IntlDateFormatter::LONG,
|
||||
IntlDateFormatter::MEDIUM,
|
||||
IntlDateFormatter::SHORT,
|
||||
IntlDateFormatter::NONE
|
||||
);
|
||||
|
||||
$res_str = '';
|
||||
|
||||
|
||||
$time_arr = array (
|
||||
0,
|
||||
-1200000,
|
||||
1200000,
|
||||
2200000000.0,
|
||||
-2200000000.0,
|
||||
90099999,
|
||||
3600,
|
||||
-3600
|
||||
);
|
||||
|
||||
$localtime_arr1 = array (
|
||||
'tm_sec' => 24 ,
|
||||
'tm_min' => 3,
|
||||
'tm_hour' => 19,
|
||||
'tm_mday' => 3,
|
||||
'tm_mon' => 3,
|
||||
'tm_year' => 105,
|
||||
);
|
||||
$localtime_arr2 = array (
|
||||
'tm_sec' => 21,
|
||||
'tm_min' => 5,
|
||||
'tm_hour' => 7,
|
||||
'tm_mday' => 13,
|
||||
'tm_mon' => 4,
|
||||
'tm_year' => 205,
|
||||
);
|
||||
$localtime_arr3 = array (
|
||||
'tm_sec' => 11,
|
||||
'tm_min' => 13,
|
||||
'tm_hour' => 0,
|
||||
'tm_mday' => 17,
|
||||
'tm_mon' => 11,
|
||||
'tm_year' => -5
|
||||
);
|
||||
|
||||
$localtime_arr = array (
|
||||
$localtime_arr1,
|
||||
$localtime_arr2,
|
||||
$localtime_arr3
|
||||
);
|
||||
|
||||
$d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC"));
|
||||
$d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC"));
|
||||
$d2->setTimezone(new DateTimeZone("PDT"));
|
||||
$dates = array(
|
||||
$d1,
|
||||
$d2,
|
||||
new StdClass(),
|
||||
);
|
||||
|
||||
//Test format with input as a timestamp : integer
|
||||
foreach( $time_arr as $timestamp_entry){
|
||||
$res_str .= "\n------------\n";
|
||||
$res_str .= "\nInput timestamp is : $timestamp_entry";
|
||||
$res_str .= "\n------------\n";
|
||||
foreach( $locale_arr as $locale_entry ){
|
||||
foreach( $datetype_arr as $datetype_entry )
|
||||
{
|
||||
$res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
|
||||
$fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN);
|
||||
$formatted = ut_datefmt_format( $fmt , $timestamp_entry);
|
||||
$res_str .= "\nFormatted timestamp is : $formatted";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Test format with input as a localtime :array
|
||||
foreach( $localtime_arr as $localtime_entry){
|
||||
$res_str .= "\n------------\n";
|
||||
$res_str .= "\nInput localtime is : ";
|
||||
foreach( $localtime_entry as $key => $value){
|
||||
$res_str .= "$key : '$value' , ";
|
||||
}
|
||||
|
||||
$res_str .= "\n------------\n";
|
||||
foreach( $locale_arr as $locale_entry ){
|
||||
foreach( $datetype_arr as $datetype_entry )
|
||||
{
|
||||
$res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
|
||||
$fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
|
||||
$formatted1 = ut_datefmt_format( $fmt , $localtime_entry);
|
||||
if( intl_get_error_code() == U_ZERO_ERROR){
|
||||
$res_str .= "\nFormatted localtime_array is : $formatted1";
|
||||
}else{
|
||||
$res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($dates as $date_entry) {
|
||||
foreach( $locale_arr as $locale_entry ){
|
||||
foreach( $datetype_arr as $datetype_entry ) {
|
||||
$res_str .= "\n------------";
|
||||
$res_str .= "\nDate is: ".var_export($date_entry, true);
|
||||
$res_str .= "\n------------";
|
||||
|
||||
$fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
|
||||
$formatted1 = ut_datefmt_format( $fmt , $date_entry);
|
||||
if( intl_get_error_code() == U_ZERO_ERROR){
|
||||
$res_str .= "\nFormatted DateTime is : $formatted1";
|
||||
}else{
|
||||
$res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $res_str;
|
||||
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
|
||||
// Run the test
|
||||
ut_run();
|
||||
?>
|
||||
--EXPECT--
|
||||
------------
|
||||
|
||||
Input timestamp is : 0
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Wednesday, December 31, 1969 at 2:00:00 PM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : December 31, 1969 at 2:00:00 PM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Dec 31, 1969, 2:00:00 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 12/31/69, 2:00 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 19691231 02:00 PM
|
||||
------------
|
||||
|
||||
Input timestamp is : -1200000
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Wednesday, December 17, 1969 at 4:40:00 PM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : December 17, 1969 at 4:40:00 PM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Dec 17, 1969, 4:40:00 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 12/17/69, 4:40 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 19691217 04:40 PM
|
||||
------------
|
||||
|
||||
Input timestamp is : 1200000
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Wednesday, January 14, 1970 at 11:20:00 AM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : January 14, 1970 at 11:20:00 AM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Jan 14, 1970, 11:20:00 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 1/14/70, 11:20 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 19700114 11:20 AM
|
||||
------------
|
||||
|
||||
Input timestamp is : 2200000000
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Sunday, September 18, 2039 at 1:06:40 PM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : September 18, 2039 at 1:06:40 PM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Sep 18, 2039, 1:06:40 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 9/18/39, 1:06 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 20390918 01:06 PM
|
||||
------------
|
||||
|
||||
Input timestamp is : -2200000000
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Saturday, April 14, 1900 at 2:53:20 PM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : April 14, 1900 at 2:53:20 PM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Apr 14, 1900, 2:53:20 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 4/14/00, 2:53 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 19000414 02:53 PM
|
||||
------------
|
||||
|
||||
Input timestamp is : 90099999
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Wednesday, November 8, 1972 at 9:46:39 AM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : November 8, 1972 at 9:46:39 AM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Nov 8, 1972, 9:46:39 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 11/8/72, 9:46 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 19721108 09:46 AM
|
||||
------------
|
||||
|
||||
Input timestamp is : 3600
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Wednesday, December 31, 1969 at 3:00:00 PM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : December 31, 1969 at 3:00:00 PM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Dec 31, 1969, 3:00:00 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 12/31/69, 3:00 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 19691231 03:00 PM
|
||||
------------
|
||||
|
||||
Input timestamp is : -3600
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Wednesday, December 31, 1969 at 1:00:00 PM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : December 31, 1969 at 1:00:00 PM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Dec 31, 1969, 1:00:00 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 12/31/69, 1:00 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 19691231 01:00 PM
|
||||
------------
|
||||
|
||||
Input localtime is : tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_mday : '3' , tm_mon : '3' , tm_year : '105' ,
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted localtime_array is : Sunday, April 3, 2005 at 7:03:24 PM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted localtime_array is : April 3, 2005 at 7:03:24 PM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted localtime_array is : Apr 3, 2005, 7:03:24 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted localtime_array is : 4/3/05, 7:03 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted localtime_array is : 20050403 07:03 PM
|
||||
------------
|
||||
|
||||
Input localtime is : tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_mday : '13' , tm_mon : '4' , tm_year : '205' ,
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted localtime_array is : Wednesday, May 13, 2105 at 7:05:21 AM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted localtime_array is : May 13, 2105 at 7:05:21 AM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted localtime_array is : May 13, 2105, 7:05:21 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted localtime_array is : 5/13/05, 7:05 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted localtime_array is : 21050513 07:05 AM
|
||||
------------
|
||||
|
||||
Input localtime is : tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_mday : '17' , tm_mon : '11' , tm_year : '-5' ,
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted localtime_array is : Tuesday, December 17, 1895 at 12:13:11 AM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted localtime_array is : December 17, 1895 at 12:13:11 AM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted localtime_array is : Dec 17, 1895, 12:13:11 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted localtime_array is : 12/17/95, 12:13 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted localtime_array is : 18951217 12:13 AM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2010-01-01 01:02:03',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'UTC',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : Thursday, December 31, 2009 at 3:02:03 PM GMT-10:00
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2010-01-01 01:02:03',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'UTC',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : December 31, 2009 at 3:02:03 PM GMT-10
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2010-01-01 01:02:03',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'UTC',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : Dec 31, 2009, 3:02:03 PM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2010-01-01 01:02:03',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'UTC',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : 12/31/09, 3:02 PM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2010-01-01 01:02:03',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'UTC',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : 20091231 03:02 PM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 2,
|
||||
'timezone' => 'PDT',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : Saturday, December 30, 2000 at 5:04:05 PM GMT-10:00
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 2,
|
||||
'timezone' => 'PDT',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : December 30, 2000 at 5:04:05 PM GMT-10
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 2,
|
||||
'timezone' => 'PDT',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : Dec 30, 2000, 5:04:05 PM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 2,
|
||||
'timezone' => 'PDT',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : 12/30/00, 5:04 PM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 2,
|
||||
'timezone' => 'PDT',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : 20001230 05:04 PM
|
||||
------------
|
||||
Date is: stdClass::__set_state(array(
|
||||
))
|
||||
------------
|
||||
Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
|
||||
------------
|
||||
Date is: stdClass::__set_state(array(
|
||||
))
|
||||
------------
|
||||
Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
|
||||
------------
|
||||
Date is: stdClass::__set_state(array(
|
||||
))
|
||||
------------
|
||||
Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
|
||||
------------
|
||||
Date is: stdClass::__set_state(array(
|
||||
))
|
||||
------------
|
||||
Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
|
||||
------------
|
||||
Date is: stdClass::__set_state(array(
|
||||
))
|
||||
------------
|
||||
Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
|
||||
@@ -2,7 +2,7 @@
|
||||
numfmt_format() icu >= 4.8
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
|
||||
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
--TEST--
|
||||
numfmt_format() icu >= 52.1 && icu < 53.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if(version_compare(INTL_ICU_VERSION, '52.1') < 0) print 'skip for ICU >= 52.1'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.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.89123457'
|
||||
'1,234,567.891'
|
||||
'\$1,234,567.89'
|
||||
'123,456,789%'
|
||||
'1.23456789123457E6'
|
||||
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven'
|
||||
'1,234,567(th|ᵗʰ)'
|
||||
'342:56:07'
|
||||
'#####.###'
|
||||
Bad formatter!
|
||||
|
||||
Locale is: ru_UA
|
||||
'1234567,89123457'
|
||||
'1 234 567,891'
|
||||
'1 234 567,89 ?(грн\.|₴)'
|
||||
'123 456 789 ?%'
|
||||
'1,23456789123457E6'
|
||||
'один миллион двести тридцать четыре тысяч пятьсот шестьдесят семь запятая восемь девять один два три четыре пять семь'
|
||||
'1 234 567.?'
|
||||
'1 234 567'
|
||||
'#####.###'
|
||||
Bad formatter!
|
||||
|
||||
Locale is: de
|
||||
'1234567,89123457'
|
||||
'1.234.567,891'
|
||||
'(¤ )?1.234.567,89( ¤)?'
|
||||
'123\.456\.789 %'
|
||||
'1,23456789123457E6'
|
||||
'eine Million zweihundertvierunddreißigtausendfünfhundertsiebenundsechzig Komma acht neun eins zwei drei vier fünf sieben'
|
||||
'1.234.567.?'
|
||||
'1.234.567'
|
||||
'#####.###'
|
||||
Bad formatter!
|
||||
|
||||
Locale is: fr
|
||||
'1234567,89123457'
|
||||
'1 234 567,891'
|
||||
'1 234 567,89 ¤'
|
||||
'123 456 789 ?%'
|
||||
'1,23456789123457E6'
|
||||
'un million deux cent trente-quatre mille cinq cent soixante-sept virgule huit neuf un deux trois quatre cinq sept'
|
||||
'1 234 567e'
|
||||
'1 234 567'
|
||||
'#####.###'
|
||||
Bad formatter!
|
||||
|
||||
Locale is: en_UK
|
||||
'1234567.89123457'
|
||||
'1,234,567.891'
|
||||
'¤1,234,567.89'
|
||||
'123,456,789%'
|
||||
'1.23456789123457E6'
|
||||
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven'
|
||||
'1,234,567(th|ᵗʰ)'
|
||||
'342:56:07'
|
||||
'#####.###'
|
||||
Bad formatter!
|
||||
@@ -0,0 +1,130 @@
|
||||
--TEST--
|
||||
numfmt_format() icu >= 53.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.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.89123457'
|
||||
'1,234,567.891'
|
||||
'\$1,234,567.89'
|
||||
'123,456,789%'
|
||||
'1.23456789123457E6'
|
||||
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven'
|
||||
'1,234,567(th|ᵗʰ)'
|
||||
'342:56:07'
|
||||
'#####.###'
|
||||
'USD1,234,567.89'
|
||||
|
||||
Locale is: ru_UA
|
||||
'1234567,89123457'
|
||||
'1 234 567,891'
|
||||
'1 234 567,89 ?(грн\.|₴)'
|
||||
'123 456 789 ?%'
|
||||
'1,23456789123457E6'
|
||||
'один миллион двести тридцать четыре тысяч пятьсот шестьдесят семь запятая восемь девять один два три четыре пять семь'
|
||||
'1 234 567.?'
|
||||
'1 234 567'
|
||||
'#####.###'
|
||||
'1 234 567,89 UAH'
|
||||
|
||||
Locale is: de
|
||||
'1234567,89123457'
|
||||
'1.234.567,891'
|
||||
'(¤ )?1.234.567,89( ¤)?'
|
||||
'123\.456\.789 %'
|
||||
'1,23456789123457E6'
|
||||
'eine Million zweihundertvierunddreißigtausendfünfhundertsiebenundsechzig Komma acht neun eins zwei drei vier fünf sieben'
|
||||
'1.234.567.?'
|
||||
'1.234.567'
|
||||
'#####.###'
|
||||
'1.234.567,89 ¤¤'
|
||||
|
||||
Locale is: fr
|
||||
'1234567,89123457'
|
||||
'1 234 567,891'
|
||||
'1 234 567,89 ¤'
|
||||
'123 456 789 ?%'
|
||||
'1,23456789123457E6'
|
||||
'un million deux cent trente-quatre mille cinq cent soixante-sept virgule huit neuf un deux trois quatre cinq sept'
|
||||
'1 234 567e'
|
||||
'1 234 567'
|
||||
'#####.###'
|
||||
'1 234 567,89 ¤¤'
|
||||
|
||||
Locale is: en_UK
|
||||
'1234567.89123457'
|
||||
'1,234,567.891'
|
||||
'¤1,234,567.89'
|
||||
'123,456,789%'
|
||||
'1.23456789123457E6'
|
||||
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven'
|
||||
'1,234,567(th|ᵗʰ)'
|
||||
'342:56:07'
|
||||
'#####.###'
|
||||
'¤¤1,234,567.89'
|
||||
@@ -2,7 +2,7 @@
|
||||
locale_get_display_name() icu >= 51.2
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,343 @@
|
||||
--TEST--
|
||||
locale_get_display_name() icu >= 52.1 && icu < 53.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '52.1') < 0) die('skip for ICU >= 52.1'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Try getting the display_name for different locales
|
||||
* with Procedural and Object methods.
|
||||
*/
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$res_str='';
|
||||
|
||||
$disp_locales=array('en','fr','de');
|
||||
|
||||
$locales = array(
|
||||
'sl_IT_nedis_KIRTI',
|
||||
'sl_IT_nedis-a-kirti-x-xyz',
|
||||
'sl_IT_rozaj',
|
||||
'sl_IT_NEDIS_ROJAZ_1901',
|
||||
'i-enochian',
|
||||
'zh-hakka',
|
||||
'zh-wuu',
|
||||
'i-tay',
|
||||
'sgn-BE-nl',
|
||||
'sgn-CH-de',
|
||||
'sl_IT_rozaj@currency=EUR',
|
||||
'uk-ua_CALIFORNIA@currency=;currency=GRN',
|
||||
'root',
|
||||
'uk@currency=EURO',
|
||||
'Hindi',
|
||||
//Simple language subtag
|
||||
'de',
|
||||
'fr',
|
||||
'ja',
|
||||
'i-enochian', //(example of a grandfathered tag)
|
||||
//Language subtag plus Script subtag:
|
||||
'zh-Hant',
|
||||
'zh-Hans',
|
||||
'sr-Cyrl',
|
||||
'sr-Latn',
|
||||
//Language-Script-Region
|
||||
'zh-Hans-CN',
|
||||
'sr-Latn-CS',
|
||||
//Language-Variant
|
||||
'sl-rozaj',
|
||||
'sl-nedis',
|
||||
//Language-Region-Variant
|
||||
'de-CH-1901',
|
||||
'sl-IT-nedis',
|
||||
//Language-Script-Region-Variant
|
||||
'sl-Latn-IT-nedis',
|
||||
//Language-Region:
|
||||
'de-DE',
|
||||
'en-US',
|
||||
'es-419',
|
||||
//Private use subtags:
|
||||
'de-CH-x-phonebk',
|
||||
'az-Arab-x-AZE-derbend',
|
||||
//Extended language subtags
|
||||
'zh-min',
|
||||
'zh-min-nan-Hant-CN',
|
||||
//Private use registry values
|
||||
'x-whatever',
|
||||
'qaa-Qaaa-QM-x-southern',
|
||||
'sr-Latn-QM',
|
||||
'sr-Qaaa-CS',
|
||||
/*Tags that use extensions (examples ONLY: extensions MUST be defined
|
||||
by revision or update to this document or by RFC): */
|
||||
'en-US-u-islamCal',
|
||||
'zh-CN-a-myExt-x-private',
|
||||
'en-a-myExt-b-another',
|
||||
//Some Invalid Tags:
|
||||
'de-419-DE',
|
||||
'a-DE',
|
||||
'ar-a-aaa-b-bbb-a-ccc'
|
||||
);
|
||||
|
||||
|
||||
$res_str = '';
|
||||
|
||||
foreach( $locales as $locale )
|
||||
{
|
||||
$res_str .= "locale='$locale'\n";
|
||||
foreach( $disp_locales as $disp_locale )
|
||||
{
|
||||
$scr = ut_loc_get_display_name( $locale ,$disp_locale );
|
||||
$scr = str_replace(array('(', ')'), '#', $scr);
|
||||
$res_str .= "disp_locale=$disp_locale : display_name=$scr";
|
||||
$res_str .= "\n";
|
||||
}
|
||||
$res_str .= "-----------------\n";
|
||||
}
|
||||
|
||||
return $res_str;
|
||||
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
locale='sl_IT_nedis_KIRTI'
|
||||
disp_locale=en : display_name=Slovenian #Italy, NEDIS_KIRTI#
|
||||
disp_locale=fr : display_name=slovène #Italie, NEDIS_KIRTI#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_KIRTI#
|
||||
-----------------
|
||||
locale='sl_IT_nedis-a-kirti-x-xyz'
|
||||
disp_locale=en : display_name=Slovenian #Italy, NEDIS_A_KIRTI_X_XYZ#
|
||||
disp_locale=fr : display_name=slovène #Italie, NEDIS_A_KIRTI_X_XYZ#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_A_KIRTI_X_XYZ#
|
||||
-----------------
|
||||
locale='sl_IT_rozaj'
|
||||
disp_locale=en : display_name=Slovenian #Italy, Resian#
|
||||
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch)#
|
||||
-----------------
|
||||
locale='sl_IT_NEDIS_ROJAZ_1901'
|
||||
disp_locale=en : display_name=Slovenian #Italy, NEDIS_ROJAZ_1901#
|
||||
disp_locale=fr : display_name=slovène #Italie, NEDIS_ROJAZ_1901#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_ROJAZ_1901#
|
||||
-----------------
|
||||
locale='i-enochian'
|
||||
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
|
||||
disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian#
|
||||
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
|
||||
-----------------
|
||||
locale='zh-hakka'
|
||||
disp_locale=en : display_name=Chinese( #HAKKA#)?
|
||||
disp_locale=fr : display_name=chinois( #HAKKA#)?
|
||||
disp_locale=de : display_name=Chinesisch( #HAKKA#)?
|
||||
-----------------
|
||||
locale='zh-wuu'
|
||||
disp_locale=en : display_name=Chinese #WUU#
|
||||
disp_locale=fr : display_name=chinois #WUU#
|
||||
disp_locale=de : display_name=Chinesisch #WUU#
|
||||
-----------------
|
||||
locale='i-tay'
|
||||
disp_locale=en : display_name=i-tay
|
||||
disp_locale=fr : display_name=i-tay
|
||||
disp_locale=de : display_name=i-tay
|
||||
-----------------
|
||||
locale='sgn-BE-nl'
|
||||
disp_locale=en : display_name=Sign Languages? #Belgium, NL#
|
||||
disp_locale=fr : display_name=langues? des signes #Belgique, NL#
|
||||
disp_locale=de : display_name=Gebärdensprache #Belgien, NL#
|
||||
-----------------
|
||||
locale='sgn-CH-de'
|
||||
disp_locale=en : display_name=Sign Languages? #Switzerland, DE#
|
||||
disp_locale=fr : display_name=langues? des signes #Suisse, DE#
|
||||
disp_locale=de : display_name=Gebärdensprache #Schweiz, DE#
|
||||
-----------------
|
||||
locale='sl_IT_rozaj@currency=EUR'
|
||||
disp_locale=en : display_name=Slovenian #Italy, Resian, [Cc]urrency=Euro#
|
||||
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia, [Dd]evise=euro#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch), Währung=Euro#
|
||||
-----------------
|
||||
locale='uk-ua_CALIFORNIA@currency=;currency=GRN'
|
||||
disp_locale=en : display_name=
|
||||
disp_locale=fr : display_name=
|
||||
disp_locale=de : display_name=
|
||||
-----------------
|
||||
locale='root'
|
||||
disp_locale=en : display_name=Root
|
||||
disp_locale=fr : display_name=racine
|
||||
disp_locale=de : display_name=[Rr]oot
|
||||
-----------------
|
||||
locale='uk@currency=EURO'
|
||||
disp_locale=en : display_name=Ukrainian #[Cc]urrency=EURO#
|
||||
disp_locale=fr : display_name=ukrainien #[Dd]evise=EURO#
|
||||
disp_locale=de : display_name=Ukrainisch #Währung=EURO#
|
||||
-----------------
|
||||
locale='Hindi'
|
||||
disp_locale=en : display_name=hindi
|
||||
disp_locale=fr : display_name=hindi
|
||||
disp_locale=de : display_name=hindi
|
||||
-----------------
|
||||
locale='de'
|
||||
disp_locale=en : display_name=German
|
||||
disp_locale=fr : display_name=allemand
|
||||
disp_locale=de : display_name=Deutsch
|
||||
-----------------
|
||||
locale='fr'
|
||||
disp_locale=en : display_name=French
|
||||
disp_locale=fr : display_name=français
|
||||
disp_locale=de : display_name=Französisch
|
||||
-----------------
|
||||
locale='ja'
|
||||
disp_locale=en : display_name=Japanese
|
||||
disp_locale=fr : display_name=japonais
|
||||
disp_locale=de : display_name=Japanisch
|
||||
-----------------
|
||||
locale='i-enochian'
|
||||
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
|
||||
disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian#
|
||||
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
|
||||
-----------------
|
||||
locale='zh-Hant'
|
||||
disp_locale=en : display_name=Chinese #Traditional#
|
||||
disp_locale=fr : display_name=chinois #traditionnel#
|
||||
disp_locale=de : display_name=Chinesisch #Traditionell#
|
||||
-----------------
|
||||
locale='zh-Hans'
|
||||
disp_locale=en : display_name=Chinese #Simplified#
|
||||
disp_locale=fr : display_name=chinois #simplifié#
|
||||
disp_locale=de : display_name=Chinesisch #Vereinfacht#
|
||||
-----------------
|
||||
locale='sr-Cyrl'
|
||||
disp_locale=en : display_name=Serbian #Cyrillic#
|
||||
disp_locale=fr : display_name=serbe #cyrillique#
|
||||
disp_locale=de : display_name=Serbisch #Kyrillisch#
|
||||
-----------------
|
||||
locale='sr-Latn'
|
||||
disp_locale=en : display_name=Serbian #Latin#
|
||||
disp_locale=fr : display_name=serbe #latin#
|
||||
disp_locale=de : display_name=Serbisch #Lateinisch#
|
||||
-----------------
|
||||
locale='zh-Hans-CN'
|
||||
disp_locale=en : display_name=Chinese #Simplified, China#
|
||||
disp_locale=fr : display_name=chinois #simplifié, Chine#
|
||||
disp_locale=de : display_name=Chinesisch #Vereinfacht, China#
|
||||
-----------------
|
||||
locale='sr-Latn-CS'
|
||||
disp_locale=en : display_name=Serbian #Latin, Serbia#
|
||||
disp_locale=fr : display_name=serbe #latin, Serbie#
|
||||
disp_locale=de : display_name=Serbisch #Lateinisch, Serbien#
|
||||
-----------------
|
||||
locale='sl-rozaj'
|
||||
disp_locale=en : display_name=Slovenian #Resian#
|
||||
disp_locale=fr : display_name=slovène #dialecte de Resia#
|
||||
disp_locale=de : display_name=Slowenisch( #(ROZAJ|Resianisch)#)?
|
||||
-----------------
|
||||
locale='sl-nedis'
|
||||
disp_locale=en : display_name=Slovenian #Natisone dialect#
|
||||
disp_locale=fr : display_name=slovène #dialecte de Natisone#
|
||||
disp_locale=de : display_name=Slowenisch #Natisone-Dialekt#
|
||||
-----------------
|
||||
locale='de-CH-1901'
|
||||
disp_locale=en : display_name=German #Switzerland, Traditional German orthography#
|
||||
disp_locale=fr : display_name=allemand #Suisse, orthographe allemande traditionnelle#
|
||||
disp_locale=de : display_name=Deutsch #Schweiz, (1901|[aA]lte deutsche Rechtschreibung)#
|
||||
-----------------
|
||||
locale='sl-IT-nedis'
|
||||
disp_locale=en : display_name=Slovenian #Italy, Natisone dialect#
|
||||
disp_locale=fr : display_name=slovène #Italie, dialecte de Natisone#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, (NEDIS|Natisone-Dialekt)#
|
||||
-----------------
|
||||
locale='sl-Latn-IT-nedis'
|
||||
disp_locale=en : display_name=Slovenian #Latin, Italy, Natisone dialect#
|
||||
disp_locale=fr : display_name=slovène #latin, Italie, dialecte de Natisone#
|
||||
disp_locale=de : display_name=Slowenisch #Lateinisch, Italien, (NEDIS|Natisone-Dialekt)#
|
||||
-----------------
|
||||
locale='de-DE'
|
||||
disp_locale=en : display_name=German #Germany#
|
||||
disp_locale=fr : display_name=allemand #Allemagne#
|
||||
disp_locale=de : display_name=Deutsch #Deutschland#
|
||||
-----------------
|
||||
locale='en-US'
|
||||
disp_locale=en : display_name=English #United States#
|
||||
disp_locale=fr : display_name=anglais #États-Unis#
|
||||
disp_locale=de : display_name=Englisch #Vereinigte Staaten#
|
||||
-----------------
|
||||
locale='es-419'
|
||||
disp_locale=en : display_name=Spanish #Latin America#
|
||||
disp_locale=fr : display_name=espagnol #Amérique latine#
|
||||
disp_locale=de : display_name=Spanisch #Lateinamerika#
|
||||
-----------------
|
||||
locale='de-CH-x-phonebk'
|
||||
disp_locale=en : display_name=German #Switzerland, Private-Use=phonebk#
|
||||
disp_locale=fr : display_name=allemand #Suisse, Usage privé=phonebk#
|
||||
disp_locale=de : display_name=Deutsch #Schweiz, Privatnutzung=phonebk#
|
||||
-----------------
|
||||
locale='az-Arab-x-AZE-derbend'
|
||||
disp_locale=en : display_name=Azerbaijani #Arabic, Private-Use=aze-derbend#
|
||||
disp_locale=fr : display_name=azéri #arabe, Usage privé=aze-derbend#
|
||||
disp_locale=de : display_name=Aserbaidschanisch #Arabisch, Privatnutzung=aze-derbend#
|
||||
-----------------
|
||||
locale='zh-min'
|
||||
disp_locale=en : display_name=Chinese #MIN#
|
||||
disp_locale=fr : display_name=chinois #MIN#
|
||||
disp_locale=de : display_name=Chinesisch #MIN#
|
||||
-----------------
|
||||
locale='zh-min-nan-Hant-CN'
|
||||
disp_locale=en : display_name=Chinese #MIN, NAN_HANT_CN#
|
||||
disp_locale=fr : display_name=chinois #MIN, NAN_HANT_CN#
|
||||
disp_locale=de : display_name=Chinesisch #MIN, NAN_HANT_CN#
|
||||
-----------------
|
||||
locale='x-whatever'
|
||||
disp_locale=en : display_name=x-whatever #Private-Use=whatever#
|
||||
disp_locale=fr : display_name=x-whatever #Usage privé=whatever#
|
||||
disp_locale=de : display_name=x-whatever #Privatnutzung=whatever#
|
||||
-----------------
|
||||
locale='qaa-Qaaa-QM-x-southern'
|
||||
disp_locale=en : display_name=qaa #Qaaa, QM, Private-Use=southern#
|
||||
disp_locale=fr : display_name=qaa #Qaaa, QM, Usage privé=southern#
|
||||
disp_locale=de : display_name=qaa #Qaaa, QM, Privatnutzung=southern#
|
||||
-----------------
|
||||
locale='sr-Latn-QM'
|
||||
disp_locale=en : display_name=Serbian #Latin, QM#
|
||||
disp_locale=fr : display_name=serbe #latin, QM#
|
||||
disp_locale=de : display_name=Serbisch #Lateinisch, QM#
|
||||
-----------------
|
||||
locale='sr-Qaaa-CS'
|
||||
disp_locale=en : display_name=Serbian #Qaaa, Serbia#
|
||||
disp_locale=fr : display_name=serbe #Qaaa, Serbie#
|
||||
disp_locale=de : display_name=Serbisch #Qaaa, Serbien#
|
||||
-----------------
|
||||
locale='en-US-u-islamCal'
|
||||
disp_locale=en : display_name=English #United States, attribute=islamcal#
|
||||
disp_locale=fr : display_name=anglais #États-Unis, attribute=islamcal#
|
||||
disp_locale=de : display_name=Englisch #Vereinigte Staaten, attribute=islamcal#
|
||||
-----------------
|
||||
locale='zh-CN-a-myExt-x-private'
|
||||
disp_locale=en : display_name=Chinese #China, a=myext, Private-Use=private#
|
||||
disp_locale=fr : display_name=chinois #Chine, a=myext, Usage privé=private#
|
||||
disp_locale=de : display_name=Chinesisch #China, a=myext, Privatnutzung=private#
|
||||
-----------------
|
||||
locale='en-a-myExt-b-another'
|
||||
disp_locale=en : display_name=English #a=myext, b=another#
|
||||
disp_locale=fr : display_name=anglais #a=myext, b=another#
|
||||
disp_locale=de : display_name=Englisch #a=myext, b=another#
|
||||
-----------------
|
||||
locale='de-419-DE'
|
||||
disp_locale=en : display_name=German #Latin America, DE#
|
||||
disp_locale=fr : display_name=allemand #Amérique latine, DE#
|
||||
disp_locale=de : display_name=Deutsch #Lateinamerika, DE#
|
||||
-----------------
|
||||
locale='a-DE'
|
||||
disp_locale=en : display_name=a #Germany#
|
||||
disp_locale=fr : display_name=a #Allemagne#
|
||||
disp_locale=de : display_name=a #Deutschland#
|
||||
-----------------
|
||||
locale='ar-a-aaa-b-bbb-a-ccc'
|
||||
disp_locale=en : display_name=Arabic #a=aaa, b=bbb#
|
||||
disp_locale=fr : display_name=arabe #a=aaa, b=bbb#
|
||||
disp_locale=de : display_name=Arabisch #a=aaa, b=bbb#
|
||||
-----------------
|
||||
@@ -0,0 +1,342 @@
|
||||
--TEST--
|
||||
locale_get_display_name() icu >= 53.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Try getting the display_name for different locales
|
||||
* with Procedural and Object methods.
|
||||
*/
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$res_str='';
|
||||
|
||||
$disp_locales=array('en','fr','de');
|
||||
|
||||
$locales = array(
|
||||
'sl_IT_nedis_KIRTI',
|
||||
'sl_IT_nedis-a-kirti-x-xyz',
|
||||
'sl_IT_rozaj',
|
||||
'sl_IT_NEDIS_ROJAZ_1901',
|
||||
'i-enochian',
|
||||
'zh-hakka',
|
||||
'zh-wuu',
|
||||
'i-tay',
|
||||
'sgn-BE-nl',
|
||||
'sgn-CH-de',
|
||||
'sl_IT_rozaj@currency=EUR',
|
||||
'uk-ua_CALIFORNIA@currency=;currency=GRN',
|
||||
'root',
|
||||
'uk@currency=EURO',
|
||||
'Hindi',
|
||||
//Simple language subtag
|
||||
'de',
|
||||
'fr',
|
||||
'ja',
|
||||
'i-enochian', //(example of a grandfathered tag)
|
||||
//Language subtag plus Script subtag:
|
||||
'zh-Hant',
|
||||
'zh-Hans',
|
||||
'sr-Cyrl',
|
||||
'sr-Latn',
|
||||
//Language-Script-Region
|
||||
'zh-Hans-CN',
|
||||
'sr-Latn-CS',
|
||||
//Language-Variant
|
||||
'sl-rozaj',
|
||||
'sl-nedis',
|
||||
//Language-Region-Variant
|
||||
'de-CH-1901',
|
||||
'sl-IT-nedis',
|
||||
//Language-Script-Region-Variant
|
||||
'sl-Latn-IT-nedis',
|
||||
//Language-Region:
|
||||
'de-DE',
|
||||
'en-US',
|
||||
'es-419',
|
||||
//Private use subtags:
|
||||
'de-CH-x-phonebk',
|
||||
'az-Arab-x-AZE-derbend',
|
||||
//Extended language subtags
|
||||
'zh-min',
|
||||
'zh-min-nan-Hant-CN',
|
||||
//Private use registry values
|
||||
'x-whatever',
|
||||
'qaa-Qaaa-QM-x-southern',
|
||||
'sr-Latn-QM',
|
||||
'sr-Qaaa-CS',
|
||||
/*Tags that use extensions (examples ONLY: extensions MUST be defined
|
||||
by revision or update to this document or by RFC): */
|
||||
'en-US-u-islamCal',
|
||||
'zh-CN-a-myExt-x-private',
|
||||
'en-a-myExt-b-another',
|
||||
//Some Invalid Tags:
|
||||
'de-419-DE',
|
||||
'a-DE',
|
||||
'ar-a-aaa-b-bbb-a-ccc'
|
||||
);
|
||||
|
||||
|
||||
$res_str = '';
|
||||
|
||||
foreach( $locales as $locale )
|
||||
{
|
||||
$res_str .= "locale='$locale'\n";
|
||||
foreach( $disp_locales as $disp_locale )
|
||||
{
|
||||
$scr = ut_loc_get_display_name( $locale ,$disp_locale );
|
||||
$scr = str_replace(array('(', ')'), '#', $scr);
|
||||
$res_str .= "disp_locale=$disp_locale : display_name=$scr";
|
||||
$res_str .= "\n";
|
||||
}
|
||||
$res_str .= "-----------------\n";
|
||||
}
|
||||
|
||||
return $res_str;
|
||||
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
locale='sl_IT_nedis_KIRTI'
|
||||
disp_locale=en : display_name=Slovenian #Italy, NEDIS_KIRTI#
|
||||
disp_locale=fr : display_name=slovène #Italie, NEDIS_KIRTI#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_KIRTI#
|
||||
-----------------
|
||||
locale='sl_IT_nedis-a-kirti-x-xyz'
|
||||
disp_locale=en : display_name=Slovenian #Italy, NEDIS_A_KIRTI_X_XYZ#
|
||||
disp_locale=fr : display_name=slovène #Italie, NEDIS_A_KIRTI_X_XYZ#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_A_KIRTI_X_XYZ#
|
||||
-----------------
|
||||
locale='sl_IT_rozaj'
|
||||
disp_locale=en : display_name=Slovenian #Italy, Resian#
|
||||
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch)#
|
||||
-----------------
|
||||
locale='sl_IT_NEDIS_ROJAZ_1901'
|
||||
disp_locale=en : display_name=Slovenian #Italy, NEDIS_ROJAZ_1901#
|
||||
disp_locale=fr : display_name=slovène #Italie, NEDIS_ROJAZ_1901#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_ROJAZ_1901#
|
||||
-----------------
|
||||
locale='i-enochian'
|
||||
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
|
||||
disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian#
|
||||
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
|
||||
-----------------
|
||||
locale='zh-hakka'
|
||||
disp_locale=en : display_name=Chinese( #HAKKA#)?
|
||||
disp_locale=fr : display_name=chinois( #HAKKA#)?
|
||||
disp_locale=de : display_name=Chinesisch( #HAKKA#)?
|
||||
-----------------
|
||||
locale='zh-wuu'
|
||||
disp_locale=en : display_name=Chinese #WUU#
|
||||
disp_locale=fr : display_name=chinois #WUU#
|
||||
disp_locale=de : display_name=Chinesisch #WUU#
|
||||
-----------------
|
||||
locale='i-tay'
|
||||
disp_locale=en : display_name=i-tay
|
||||
disp_locale=fr : display_name=i-tay
|
||||
disp_locale=de : display_name=i-tay
|
||||
-----------------
|
||||
locale='sgn-BE-nl'
|
||||
disp_locale=en : display_name=sgn #Belgium, NL#
|
||||
disp_locale=fr : display_name=sgn #Belgique, NL#
|
||||
disp_locale=de : display_name=sgn #Belgien, NL#
|
||||
-----------------
|
||||
locale='sgn-CH-de'
|
||||
disp_locale=en : display_name=sgn #Switzerland, DE#
|
||||
disp_locale=fr : display_name=sgn #Suisse, DE#
|
||||
disp_locale=de : display_name=sgn #Schweiz, DE#
|
||||
-----------------
|
||||
locale='sl_IT_rozaj@currency=EUR'
|
||||
disp_locale=en : display_name=Slovenian #Italy, Resian, [Cc]urrency=Euro#
|
||||
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia, [Dd]evise=euro#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch), Währung=Euro#
|
||||
-----------------
|
||||
locale='uk-ua_CALIFORNIA@currency=;currency=GRN'
|
||||
disp_locale=en : display_name=
|
||||
disp_locale=fr : display_name=
|
||||
disp_locale=de : display_name=
|
||||
-----------------
|
||||
locale='root'
|
||||
disp_locale=en : display_name=Root
|
||||
disp_locale=fr : display_name=racine
|
||||
disp_locale=de : display_name=[Rr]oot
|
||||
-----------------
|
||||
locale='uk@currency=EURO'
|
||||
disp_locale=en : display_name=Ukrainian #[Cc]urrency=EURO#
|
||||
disp_locale=fr : display_name=ukrainien #[Dd]evise=EURO#
|
||||
disp_locale=de : display_name=Ukrainisch #Währung=EURO#
|
||||
-----------------
|
||||
locale='Hindi'
|
||||
disp_locale=en : display_name=hindi
|
||||
disp_locale=fr : display_name=hindi
|
||||
disp_locale=de : display_name=hindi
|
||||
-----------------
|
||||
locale='de'
|
||||
disp_locale=en : display_name=German
|
||||
disp_locale=fr : display_name=allemand
|
||||
disp_locale=de : display_name=Deutsch
|
||||
-----------------
|
||||
locale='fr'
|
||||
disp_locale=en : display_name=French
|
||||
disp_locale=fr : display_name=français
|
||||
disp_locale=de : display_name=Französisch
|
||||
-----------------
|
||||
locale='ja'
|
||||
disp_locale=en : display_name=Japanese
|
||||
disp_locale=fr : display_name=japonais
|
||||
disp_locale=de : display_name=Japanisch
|
||||
-----------------
|
||||
locale='i-enochian'
|
||||
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
|
||||
disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian#
|
||||
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
|
||||
-----------------
|
||||
locale='zh-Hant'
|
||||
disp_locale=en : display_name=Chinese #Traditional#
|
||||
disp_locale=fr : display_name=chinois #traditionnel#
|
||||
disp_locale=de : display_name=Chinesisch #Traditionell#
|
||||
-----------------
|
||||
locale='zh-Hans'
|
||||
disp_locale=en : display_name=Chinese #Simplified#
|
||||
disp_locale=fr : display_name=chinois #simplifié#
|
||||
disp_locale=de : display_name=Chinesisch #Vereinfacht#
|
||||
-----------------
|
||||
locale='sr-Cyrl'
|
||||
disp_locale=en : display_name=Serbian #Cyrillic#
|
||||
disp_locale=fr : display_name=serbe #cyrillique#
|
||||
disp_locale=de : display_name=Serbisch #Kyrillisch#
|
||||
-----------------
|
||||
locale='sr-Latn'
|
||||
disp_locale=en : display_name=Serbian #Latin#
|
||||
disp_locale=fr : display_name=serbe #latin#
|
||||
disp_locale=de : display_name=Serbisch #Lateinisch#
|
||||
-----------------
|
||||
locale='zh-Hans-CN'
|
||||
disp_locale=en : display_name=Chinese #Simplified, China#
|
||||
disp_locale=fr : display_name=chinois #simplifié, Chine#
|
||||
disp_locale=de : display_name=Chinesisch #Vereinfacht, China#
|
||||
-----------------
|
||||
locale='sr-Latn-CS'
|
||||
disp_locale=en : display_name=Serbian #Latin, Serbia#
|
||||
disp_locale=fr : display_name=serbe #latin, Serbie#
|
||||
disp_locale=de : display_name=Serbisch #Lateinisch, Serbien#
|
||||
-----------------
|
||||
locale='sl-rozaj'
|
||||
disp_locale=en : display_name=Slovenian #Resian#
|
||||
disp_locale=fr : display_name=slovène #dialecte de Resia#
|
||||
disp_locale=de : display_name=Slowenisch( #(ROZAJ|Resianisch)#)?
|
||||
-----------------
|
||||
locale='sl-nedis'
|
||||
disp_locale=en : display_name=Slovenian #Natisone dialect#
|
||||
disp_locale=fr : display_name=slovène #dialecte de Natisone#
|
||||
disp_locale=de : display_name=Slowenisch #Natisone-Dialekt#
|
||||
-----------------
|
||||
locale='de-CH-1901'
|
||||
disp_locale=en : display_name=German #Switzerland, Traditional German orthography#
|
||||
disp_locale=fr : display_name=allemand #Suisse, orthographe allemande traditionnelle#
|
||||
disp_locale=de : display_name=Deutsch #Schweiz, (1901|[aA]lte deutsche Rechtschreibung)#
|
||||
-----------------
|
||||
locale='sl-IT-nedis'
|
||||
disp_locale=en : display_name=Slovenian #Italy, Natisone dialect#
|
||||
disp_locale=fr : display_name=slovène #Italie, dialecte de Natisone#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, (NEDIS|Natisone-Dialekt)#
|
||||
-----------------
|
||||
locale='sl-Latn-IT-nedis'
|
||||
disp_locale=en : display_name=Slovenian #Latin, Italy, Natisone dialect#
|
||||
disp_locale=fr : display_name=slovène #latin, Italie, dialecte de Natisone#
|
||||
disp_locale=de : display_name=Slowenisch #Lateinisch, Italien, (NEDIS|Natisone-Dialekt)#
|
||||
-----------------
|
||||
locale='de-DE'
|
||||
disp_locale=en : display_name=German #Germany#
|
||||
disp_locale=fr : display_name=allemand #Allemagne#
|
||||
disp_locale=de : display_name=Deutsch #Deutschland#
|
||||
-----------------
|
||||
locale='en-US'
|
||||
disp_locale=en : display_name=English #United States#
|
||||
disp_locale=fr : display_name=anglais #États-Unis#
|
||||
disp_locale=de : display_name=Englisch #Vereinigte Staaten#
|
||||
-----------------
|
||||
locale='es-419'
|
||||
disp_locale=en : display_name=Spanish #Latin America#
|
||||
disp_locale=fr : display_name=espagnol #Amérique latine#
|
||||
disp_locale=de : display_name=Spanisch #Lateinamerika#
|
||||
-----------------
|
||||
locale='de-CH-x-phonebk'
|
||||
disp_locale=en : display_name=German #Switzerland, Private-Use=phonebk#
|
||||
disp_locale=fr : display_name=allemand #Suisse, Usage privé=phonebk#
|
||||
disp_locale=de : display_name=Deutsch #Schweiz, Privatnutzung=phonebk#
|
||||
-----------------
|
||||
locale='az-Arab-x-AZE-derbend'
|
||||
disp_locale=en : display_name=Azerbaijani #Arabic, Private-Use=aze-derbend#
|
||||
disp_locale=fr : display_name=azéri #arabe, Usage privé=aze-derbend#
|
||||
disp_locale=de : display_name=Aserbaidschanisch #Arabisch, Privatnutzung=aze-derbend#
|
||||
-----------------
|
||||
locale='zh-min'
|
||||
disp_locale=en : display_name=Chinese #MIN#
|
||||
disp_locale=fr : display_name=chinois #MIN#
|
||||
disp_locale=de : display_name=Chinesisch #MIN#
|
||||
-----------------
|
||||
locale='zh-min-nan-Hant-CN'
|
||||
disp_locale=en : display_name=Chinese #MIN, NAN_HANT_CN#
|
||||
disp_locale=fr : display_name=chinois #MIN, NAN_HANT_CN#
|
||||
disp_locale=de : display_name=Chinesisch #MIN, NAN_HANT_CN#
|
||||
-----------------
|
||||
locale='x-whatever'
|
||||
disp_locale=en : display_name=x-whatever #Private-Use=whatever#
|
||||
disp_locale=fr : display_name=x-whatever #Usage privé=whatever#
|
||||
disp_locale=de : display_name=x-whatever #Privatnutzung=whatever#
|
||||
-----------------
|
||||
locale='qaa-Qaaa-QM-x-southern'
|
||||
disp_locale=en : display_name=qaa #Qaaa, QM, Private-Use=southern#
|
||||
disp_locale=fr : display_name=qaa #Qaaa, QM, Usage privé=southern#
|
||||
disp_locale=de : display_name=qaa #Qaaa, QM, Privatnutzung=southern#
|
||||
-----------------
|
||||
locale='sr-Latn-QM'
|
||||
disp_locale=en : display_name=Serbian #Latin, QM#
|
||||
disp_locale=fr : display_name=serbe #latin, QM#
|
||||
disp_locale=de : display_name=Serbisch #Lateinisch, QM#
|
||||
-----------------
|
||||
locale='sr-Qaaa-CS'
|
||||
disp_locale=en : display_name=Serbian #Qaaa, Serbia#
|
||||
disp_locale=fr : display_name=serbe #Qaaa, Serbie#
|
||||
disp_locale=de : display_name=Serbisch #Qaaa, Serbien#
|
||||
-----------------
|
||||
locale='en-US-u-islamCal'
|
||||
disp_locale=en : display_name=English #United States, attribute=islamcal#
|
||||
disp_locale=fr : display_name=anglais #États-Unis, attribute=islamcal#
|
||||
disp_locale=de : display_name=Englisch #Vereinigte Staaten, attribute=islamcal#
|
||||
-----------------
|
||||
locale='zh-CN-a-myExt-x-private'
|
||||
disp_locale=en : display_name=Chinese #China, a=myext, Private-Use=private#
|
||||
disp_locale=fr : display_name=chinois #Chine, a=myext, Usage privé=private#
|
||||
disp_locale=de : display_name=Chinesisch #China, a=myext, Privatnutzung=private#
|
||||
-----------------
|
||||
locale='en-a-myExt-b-another'
|
||||
disp_locale=en : display_name=English #a=myext, b=another#
|
||||
disp_locale=fr : display_name=anglais #a=myext, b=another#
|
||||
disp_locale=de : display_name=Englisch #a=myext, b=another#
|
||||
-----------------
|
||||
locale='de-419-DE'
|
||||
disp_locale=en : display_name=German #Latin America, DE#
|
||||
disp_locale=fr : display_name=allemand #Amérique latine, DE#
|
||||
disp_locale=de : display_name=Deutsch #Lateinamerika, DE#
|
||||
-----------------
|
||||
locale='a-DE'
|
||||
disp_locale=en : display_name=a #Germany#
|
||||
disp_locale=fr : display_name=a #Allemagne#
|
||||
disp_locale=de : display_name=a #Deutschland#
|
||||
-----------------
|
||||
locale='ar-a-aaa-b-bbb-a-ccc'
|
||||
disp_locale=en : display_name=Arabic #a=aaa, b=bbb#
|
||||
disp_locale=fr : display_name=arabe #a=aaa, b=bbb#
|
||||
disp_locale=de : display_name=Arabisch #a=aaa, b=bbb#
|
||||
-----------------
|
||||
@@ -2,7 +2,7 @@
|
||||
locale_get_display_script() icu >= 49
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if(version_compare(INTL_ICU_VERSION, '49') < 0) print 'skip'; ?>
|
||||
<?php if(version_compare(INTL_ICU_VERSION, '49') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
--TEST--
|
||||
locale_get_display_script() icu >= 52.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if(version_compare(INTL_ICU_VERSION, '52.1') < 0) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Try getting the display_script for different locales
|
||||
* with Procedural and Object methods.
|
||||
*/
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$res_str = '';
|
||||
|
||||
$disp_locales=array('en','fr','de');
|
||||
|
||||
$locales = array(
|
||||
'uk-ua_CALIFORNIA@currency=;currency=GRN',
|
||||
'root',
|
||||
'uk@currency=EURO',
|
||||
'Hindi',
|
||||
//Simple language subtag
|
||||
'de',
|
||||
'fr',
|
||||
'ja',
|
||||
'i-enochian', //(example of a grandfathered tag)
|
||||
//Language subtag plus Script subtag:
|
||||
'zh-Hant',
|
||||
'zh-Hans',
|
||||
'sr-Cyrl',
|
||||
'sr-Latn',
|
||||
//Language-Script-Region
|
||||
'zh-Hans-CN',
|
||||
'sr-Latn-CS',
|
||||
//Language-Variant
|
||||
'sl-rozaj',
|
||||
'sl-nedis',
|
||||
//Language-Region-Variant
|
||||
'de-CH-1901',
|
||||
'sl-IT-nedis',
|
||||
//Language-Script-Region-Variant
|
||||
'sl-Latn-IT-nedis',
|
||||
//Language-Region:
|
||||
'de-DE',
|
||||
'en-US',
|
||||
'es-419',
|
||||
//Private use subtags:
|
||||
'de-CH-x-phonebk',
|
||||
'az-Arab-x-AZE-derbend',
|
||||
//Extended language subtags
|
||||
'zh-min',
|
||||
'zh-min-nan-Hant-CN',
|
||||
//Private use registry values
|
||||
'x-whatever',
|
||||
'qaa-Qaaa-QM-x-southern',
|
||||
'sr-Latn-QM',
|
||||
'sr-Qaaa-CS',
|
||||
/*Tags that use extensions (examples ONLY: extensions MUST be defined
|
||||
by revision or update to this document or by RFC): */
|
||||
'en-US-u-islamCal',
|
||||
'zh-CN-a-myExt-x-private',
|
||||
'en-a-myExt-b-another',
|
||||
//Some Invalid Tags:
|
||||
'de-419-DE',
|
||||
'a-DE',
|
||||
'ar-a-aaa-b-bbb-a-ccc'
|
||||
);
|
||||
|
||||
|
||||
$res_str = '';
|
||||
|
||||
foreach( $locales as $locale )
|
||||
{
|
||||
$res_str .= "locale='$locale'\n";
|
||||
foreach( $disp_locales as $disp_locale )
|
||||
{
|
||||
$scr = ut_loc_get_display_script( $locale ,$disp_locale );
|
||||
$res_str .= "disp_locale=$disp_locale : display_script=$scr";
|
||||
$res_str .= "\n";
|
||||
}
|
||||
$res_str .= "-----------------\n";
|
||||
}
|
||||
|
||||
return $res_str;
|
||||
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
locale='uk-ua_CALIFORNIA@currency=;currency=GRN'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='root'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='uk@currency=EURO'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='Hindi'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='de'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='fr'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='ja'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='i-enochian'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='zh-Hant'
|
||||
disp_locale=en : display_script=Traditional Han
|
||||
disp_locale=fr : display_script=sinogrammes traditionnels
|
||||
disp_locale=de : display_script=Traditionelles Chinesisch
|
||||
-----------------
|
||||
locale='zh-Hans'
|
||||
disp_locale=en : display_script=Simplified Han
|
||||
disp_locale=fr : display_script=sinogrammes simplifiés
|
||||
disp_locale=de : display_script=Vereinfachtes Chinesisch
|
||||
-----------------
|
||||
locale='sr-Cyrl'
|
||||
disp_locale=en : display_script=Cyrillic
|
||||
disp_locale=fr : display_script=cyrillique
|
||||
disp_locale=de : display_script=Kyrillisch
|
||||
-----------------
|
||||
locale='sr-Latn'
|
||||
disp_locale=en : display_script=Latin
|
||||
disp_locale=fr : display_script=latin
|
||||
disp_locale=de : display_script=Lateinisch
|
||||
-----------------
|
||||
locale='zh-Hans-CN'
|
||||
disp_locale=en : display_script=Simplified Han
|
||||
disp_locale=fr : display_script=sinogrammes simplifiés
|
||||
disp_locale=de : display_script=Vereinfachtes Chinesisch
|
||||
-----------------
|
||||
locale='sr-Latn-CS'
|
||||
disp_locale=en : display_script=Latin
|
||||
disp_locale=fr : display_script=latin
|
||||
disp_locale=de : display_script=Lateinisch
|
||||
-----------------
|
||||
locale='sl-rozaj'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='sl-nedis'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='de-CH-1901'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='sl-IT-nedis'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='sl-Latn-IT-nedis'
|
||||
disp_locale=en : display_script=Latin
|
||||
disp_locale=fr : display_script=latin
|
||||
disp_locale=de : display_script=Lateinisch
|
||||
-----------------
|
||||
locale='de-DE'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='en-US'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='es-419'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='de-CH-x-phonebk'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='az-Arab-x-AZE-derbend'
|
||||
disp_locale=en : display_script=Arabic
|
||||
disp_locale=fr : display_script=arabe
|
||||
disp_locale=de : display_script=Arabisch
|
||||
-----------------
|
||||
locale='zh-min'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='zh-min-nan-Hant-CN'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='x-whatever'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='qaa-Qaaa-QM-x-southern'
|
||||
disp_locale=en : display_script=Qaaa
|
||||
disp_locale=fr : display_script=Qaaa
|
||||
disp_locale=de : display_script=Qaaa
|
||||
-----------------
|
||||
locale='sr-Latn-QM'
|
||||
disp_locale=en : display_script=Latin
|
||||
disp_locale=fr : display_script=latin
|
||||
disp_locale=de : display_script=Lateinisch
|
||||
-----------------
|
||||
locale='sr-Qaaa-CS'
|
||||
disp_locale=en : display_script=Qaaa
|
||||
disp_locale=fr : display_script=Qaaa
|
||||
disp_locale=de : display_script=Qaaa
|
||||
-----------------
|
||||
locale='en-US-u-islamCal'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='zh-CN-a-myExt-x-private'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='en-a-myExt-b-another'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='de-419-DE'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='a-DE'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
locale='ar-a-aaa-b-bbb-a-ccc'
|
||||
disp_locale=en : display_script=
|
||||
disp_locale=fr : display_script=
|
||||
disp_locale=de : display_script=
|
||||
-----------------
|
||||
@@ -26,7 +26,7 @@ do_test(IntlTimeZone::createTimeZone('GMT+0405'), true);
|
||||
--EXPECTF--
|
||||
string(3) "CET"
|
||||
int(3600000)
|
||||
string(13) "Europe/Berlin"
|
||||
string(%d) "%rEurope\/Berlin|CET%r"
|
||||
int(3600)
|
||||
string(16) "Europe/Amsterdam"
|
||||
int(3600000)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #66873 - crash in UConverter with invalid encoding
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$o = new UConverter(1, 1);
|
||||
$o->toUCallback(1, 1, 1, $b);
|
||||
var_dump($o->getErrorCode());
|
||||
--EXPECT--
|
||||
int(27)
|
||||
+10
-8
@@ -230,7 +230,7 @@ static inline void json_pretty_print_indent(smart_str *buf, int options TSRMLS_D
|
||||
|
||||
static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
int i, r;
|
||||
int i, r, need_comma = 0;
|
||||
HashTable *myht;
|
||||
|
||||
if (Z_TYPE_PP(val) == IS_ARRAY) {
|
||||
@@ -253,7 +253,6 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC)
|
||||
smart_str_appendc(buf, '{');
|
||||
}
|
||||
|
||||
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
|
||||
++JSON_G(encoder_depth);
|
||||
|
||||
i = myht ? zend_hash_num_elements(myht) : 0;
|
||||
@@ -266,7 +265,6 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC)
|
||||
uint key_len;
|
||||
HashPosition pos;
|
||||
HashTable *tmp_ht;
|
||||
int need_comma = 0;
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(myht, &pos);
|
||||
for (;; zend_hash_move_forward_ex(myht, &pos)) {
|
||||
@@ -283,11 +281,11 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC)
|
||||
if (r == PHP_JSON_OUTPUT_ARRAY) {
|
||||
if (need_comma) {
|
||||
smart_str_appendc(buf, ',');
|
||||
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
|
||||
} else {
|
||||
need_comma = 1;
|
||||
}
|
||||
|
||||
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
|
||||
json_pretty_print_indent(buf, options TSRMLS_CC);
|
||||
php_json_encode(buf, *data, options TSRMLS_CC);
|
||||
} else if (r == PHP_JSON_OUTPUT_OBJECT) {
|
||||
@@ -302,11 +300,11 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC)
|
||||
|
||||
if (need_comma) {
|
||||
smart_str_appendc(buf, ',');
|
||||
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
|
||||
} else {
|
||||
need_comma = 1;
|
||||
}
|
||||
|
||||
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
|
||||
json_pretty_print_indent(buf, options TSRMLS_CC);
|
||||
|
||||
json_escape_string(buf, key, key_len - 1, options & ~PHP_JSON_NUMERIC_CHECK TSRMLS_CC);
|
||||
@@ -318,11 +316,11 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC)
|
||||
} else {
|
||||
if (need_comma) {
|
||||
smart_str_appendc(buf, ',');
|
||||
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
|
||||
} else {
|
||||
need_comma = 1;
|
||||
}
|
||||
|
||||
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
|
||||
json_pretty_print_indent(buf, options TSRMLS_CC);
|
||||
|
||||
smart_str_appendc(buf, '"');
|
||||
@@ -347,8 +345,12 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC)
|
||||
JSON_G(error_code) = PHP_JSON_ERROR_DEPTH;
|
||||
}
|
||||
--JSON_G(encoder_depth);
|
||||
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
|
||||
json_pretty_print_indent(buf, options TSRMLS_CC);
|
||||
|
||||
/* Only keep closing bracket on same line for empty arrays/objects */
|
||||
if (need_comma) {
|
||||
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
|
||||
json_pretty_print_indent(buf, options TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (r == PHP_JSON_OUTPUT_ARRAY) {
|
||||
smart_str_appendc(buf, ']');
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #66021 (Blank line inside empty array/object when JSON_PRETTY_PRINT is set)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("json")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Foo {
|
||||
private $bar = 'baz';
|
||||
}
|
||||
|
||||
echo json_encode([[], (object)[], new Foo], JSON_PRETTY_PRINT), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
[
|
||||
[],
|
||||
{},
|
||||
{}
|
||||
]
|
||||
@@ -399,6 +399,16 @@ PHP_FUNCTION(ldap_bind)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (ldap_bind_dn != NULL && memchr(ldap_bind_dn, '\0', ldap_bind_dnlen) != NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "DN contains a null byte");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (ldap_bind_pw != NULL && memchr(ldap_bind_pw, '\0', ldap_bind_pwlen) != NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Password contains a null byte");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
|
||||
|
||||
if ((rc = ldap_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw, LDAP_AUTH_SIMPLE)) != LDAP_SUCCESS) {
|
||||
|
||||
+8
-1
@@ -176,8 +176,11 @@ void php_clear_stmt_bind(MY_STMT *stmt TSRMLS_DC)
|
||||
php_free_stmt_bind_buffer(stmt->param, FETCH_SIMPLE);
|
||||
/* Clean output bind */
|
||||
php_free_stmt_bind_buffer(stmt->result, FETCH_RESULT);
|
||||
#endif
|
||||
|
||||
if (stmt->link_handle) {
|
||||
zend_objects_store_del_ref_by_handle(stmt->link_handle TSRMLS_CC);
|
||||
}
|
||||
#endif
|
||||
if (stmt->query) {
|
||||
efree(stmt->query);
|
||||
}
|
||||
@@ -1069,6 +1072,10 @@ PHP_FUNCTION(mysqli_stmt_construct)
|
||||
efree(stmt);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#ifndef MYSQLI_USE_MYSQLND
|
||||
stmt->link_handle = Z_OBJ_HANDLE(*mysql_link);
|
||||
zend_objects_store_add_ref_by_handle(stmt->link_handle TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
|
||||
mysqli_resource->ptr = (void *)stmt;
|
||||
|
||||
+116
-60
@@ -34,6 +34,111 @@
|
||||
#include "php_mysqli_structs.h"
|
||||
#include "mysqli_priv.h"
|
||||
|
||||
|
||||
#if !defined(MYSQLI_USE_MYSQLND)
|
||||
/* {{{ mysqli_tx_cor_options_to_string */
|
||||
static void mysqli_tx_cor_options_to_string(const MYSQL * const conn, smart_str * str, const unsigned int mode)
|
||||
{
|
||||
if (mode & TRANS_COR_AND_CHAIN && !(mode & TRANS_COR_AND_NO_CHAIN)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, " ", sizeof(" ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "AND CHAIN", sizeof("AND CHAIN") - 1);
|
||||
} else if (mode & TRANS_COR_AND_NO_CHAIN && !(mode & TRANS_COR_AND_CHAIN)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, " ", sizeof(" ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "AND NO CHAIN", sizeof("AND NO CHAIN") - 1);
|
||||
}
|
||||
|
||||
if (mode & TRANS_COR_RELEASE && !(mode & TRANS_COR_NO_RELEASE)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, " ", sizeof(" ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "RELEASE", sizeof("RELEASE") - 1);
|
||||
} else if (mode & TRANS_COR_NO_RELEASE && !(mode & TRANS_COR_RELEASE)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, " ", sizeof(" ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "NO RELEASE", sizeof("NO RELEASE") - 1);
|
||||
}
|
||||
smart_str_0(str);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_escape_string_for_tx_name_in_comment */
|
||||
char *
|
||||
mysqli_escape_string_for_tx_name_in_comment(const char * const name TSRMLS_DC)
|
||||
{
|
||||
char * ret = NULL;
|
||||
if (name) {
|
||||
zend_bool warned = FALSE;
|
||||
const char * p_orig = name;
|
||||
char * p_copy;
|
||||
p_copy = ret = emalloc(strlen(name) + 1 + 2 + 2 + 1); /* space, open, close, NullS */
|
||||
*p_copy++ = ' ';
|
||||
*p_copy++ = '/';
|
||||
*p_copy++ = '*';
|
||||
while (1) {
|
||||
register char v = *p_orig;
|
||||
if (v == 0) {
|
||||
break;
|
||||
}
|
||||
if ((v >= '0' && v <= '9') ||
|
||||
(v >= 'a' && v <= 'z') ||
|
||||
(v >= 'A' && v <= 'Z') ||
|
||||
v == '-' ||
|
||||
v == '_' ||
|
||||
v == ' ' ||
|
||||
v == '=')
|
||||
{
|
||||
*p_copy++ = v;
|
||||
} else if (warned == FALSE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Transaction name truncated. Must be only [0-9A-Za-z\\-_=]+");
|
||||
warned = TRUE;
|
||||
}
|
||||
++p_orig;
|
||||
}
|
||||
*p_copy++ = '*';
|
||||
*p_copy++ = '/';
|
||||
*p_copy++ = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool mysqli_commit_or_rollback_libmysql */
|
||||
static int mysqli_commit_or_rollback_libmysql(MYSQL * conn, zend_bool commit, const unsigned int mode, const char * const name TSRMLS_DC)
|
||||
{
|
||||
int ret;
|
||||
smart_str tmp_str = {0, 0, 0};
|
||||
mysqli_tx_cor_options_to_string(conn, &tmp_str, mode);
|
||||
smart_str_0(&tmp_str);
|
||||
|
||||
{
|
||||
char * query;
|
||||
char * name_esc = mysqli_escape_string_for_tx_name_in_comment(name TSRMLS_CC);
|
||||
size_t query_len;
|
||||
|
||||
query_len = spprintf(&query, 0, (commit? "COMMIT%s %s":"ROLLBACK%s %s"),
|
||||
name_esc? name_esc:"", tmp_str.c? tmp_str.c:"");
|
||||
smart_str_free(&tmp_str);
|
||||
if (name_esc) {
|
||||
efree(name_esc);
|
||||
name_esc = NULL;
|
||||
}
|
||||
|
||||
ret = mysql_real_query(conn, query, query_len);
|
||||
efree(query);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
|
||||
/* {{{ proto mixed mysqli_affected_rows(object link)
|
||||
Get number of affected rows in previous MySQL operation */
|
||||
PHP_FUNCTION(mysqli_affected_rows)
|
||||
@@ -637,66 +742,9 @@ PHP_FUNCTION(mysqli_close)
|
||||
/* }}} */
|
||||
|
||||
|
||||
#if !defined(MYSQLI_USE_MYSQLND)
|
||||
/* {{{ mysqli_tx_cor_options_to_string */
|
||||
static void mysqli_tx_cor_options_to_string(const MYSQL * const conn, smart_str * str, const unsigned int mode)
|
||||
{
|
||||
if (mode & TRANS_COR_AND_CHAIN && !(mode & TRANS_COR_AND_NO_CHAIN)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "AND CHAIN", sizeof("AND CHAIN") - 1);
|
||||
} else if (mode & TRANS_COR_AND_NO_CHAIN && !(mode & TRANS_COR_AND_CHAIN)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "AND NO CHAIN", sizeof("AND NO CHAIN") - 1);
|
||||
}
|
||||
|
||||
if (mode & TRANS_COR_RELEASE && !(mode & TRANS_COR_NO_RELEASE)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "RELEASE", sizeof("RELEASE") - 1);
|
||||
} else if (mode & TRANS_COR_NO_RELEASE && !(mode & TRANS_COR_RELEASE)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "NO RELEASE", sizeof("NO RELEASE") - 1);
|
||||
}
|
||||
smart_str_0(str);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool mysqli_commit_or_rollback_libmysql */
|
||||
static int mysqli_commit_or_rollback_libmysql(MYSQL * conn, zend_bool commit, const unsigned int mode, const char * const name)
|
||||
{
|
||||
int ret;
|
||||
smart_str tmp_str = {0, 0, 0};
|
||||
mysqli_tx_cor_options_to_string(conn, &tmp_str, mode);
|
||||
smart_str_0(&tmp_str);
|
||||
|
||||
{
|
||||
char * commented_name = NULL;
|
||||
unsigned int commented_name_len = name? spprintf(&commented_name, 0, " /*%s*/", name):0;
|
||||
char * query;
|
||||
unsigned int query_len = spprintf(&query, 0, (commit? "COMMIT%s %s":"ROLLBACK%s %s"),
|
||||
commented_name? commented_name:"", tmp_str.c? tmp_str.c:"");
|
||||
smart_str_free(&tmp_str);
|
||||
|
||||
ret = mysql_real_query(conn, query, query_len);
|
||||
efree(query);
|
||||
if (commented_name) {
|
||||
efree(commented_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
|
||||
/* {{{ proto bool mysqli_commit(object link)
|
||||
/* {{{ proto bool mysqli_commit(object link[, int flags [, string name ]])
|
||||
Commit outstanding actions and close transaction */
|
||||
PHP_FUNCTION(mysqli_commit)
|
||||
{
|
||||
@@ -712,7 +760,7 @@ PHP_FUNCTION(mysqli_commit)
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);
|
||||
|
||||
#if !defined(MYSQLI_USE_MYSQLND)
|
||||
if (mysqli_commit_or_rollback_libmysql(mysql->mysql, TRUE, flags, name)) {
|
||||
if (mysqli_commit_or_rollback_libmysql(mysql->mysql, TRUE, flags, name TSRMLS_CC)) {
|
||||
#else
|
||||
if (FAIL == mysqlnd_commit(mysql->mysql, flags, name)) {
|
||||
#endif
|
||||
@@ -1869,6 +1917,10 @@ PHP_FUNCTION(mysqli_prepare)
|
||||
efree(stmt);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#ifndef MYSQLI_USE_MYSQLND
|
||||
stmt->link_handle = Z_OBJ_HANDLE(*mysql_link);
|
||||
zend_objects_store_add_ref_by_handle(stmt->link_handle TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
|
||||
mysqli_resource->ptr = (void *)stmt;
|
||||
@@ -1958,7 +2010,7 @@ PHP_FUNCTION(mysqli_rollback)
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID);
|
||||
|
||||
#if !defined(MYSQLI_USE_MYSQLND)
|
||||
if (mysqli_commit_or_rollback_libmysql(mysql->mysql, FALSE, flags, name)) {
|
||||
if (mysqli_commit_or_rollback_libmysql(mysql->mysql, FALSE, flags, name TSRMLS_CC)) {
|
||||
#else
|
||||
if (FAIL == mysqlnd_rollback(mysql->mysql, flags, name)) {
|
||||
#endif
|
||||
@@ -2413,6 +2465,10 @@ PHP_FUNCTION(mysqli_stmt_init)
|
||||
efree(stmt);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#ifndef MYSQLI_USE_MYSQLND
|
||||
stmt->link_handle = Z_OBJ_HANDLE(*mysql_link);
|
||||
zend_objects_store_add_ref_by_handle(stmt->link_handle TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
|
||||
mysqli_resource->status = MYSQLI_STATUS_INITIALIZED;
|
||||
|
||||
+26
-20
@@ -1046,12 +1046,14 @@ PHP_FUNCTION(mysqli_get_charset)
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(MYSQLI_USE_MYSQLND)
|
||||
extern char * mysqli_escape_string_for_tx_name_in_comment(const char * const name TSRMLS_DC);
|
||||
|
||||
/* {{{ proto bool mysqli_begin_transaction_libmysql */
|
||||
static int mysqli_begin_transaction_libmysql(MYSQL * conn, const unsigned int mode, const char * const name)
|
||||
static int mysqli_begin_transaction_libmysql(MYSQL * conn, const unsigned int mode, const char * const name TSRMLS_DC)
|
||||
{
|
||||
int ret;
|
||||
zend_bool err = FALSE;
|
||||
smart_str tmp_str = {0, 0, 0};
|
||||
if (mode & TRANS_START_WITH_CONSISTENT_SNAPSHOT) {
|
||||
if (tmp_str.len) {
|
||||
@@ -1059,33 +1061,37 @@ static int mysqli_begin_transaction_libmysql(MYSQL * conn, const unsigned int mo
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "WITH CONSISTENT SNAPSHOT", sizeof("WITH CONSISTENT SNAPSHOT") - 1);
|
||||
}
|
||||
if (mode & TRANS_START_READ_WRITE) {
|
||||
if (tmp_str.len) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
if (mode & (TRANS_START_READ_WRITE | TRANS_START_READ_ONLY)) {
|
||||
if (mysql_get_server_version(conn) < 50605L) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "This server version doesn't support 'READ WRITE' and 'READ ONLY'. Minimum 5.6.5 is required");
|
||||
err = TRUE;
|
||||
} else if (mode & TRANS_START_READ_WRITE) {
|
||||
if (tmp_str.len) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ WRITE", sizeof("READ WRITE") - 1);
|
||||
} else if (mode & TRANS_START_READ_ONLY) {
|
||||
if (tmp_str.len) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ ONLY", sizeof("READ ONLY") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ WRITE", sizeof("READ WRITE") - 1);
|
||||
}
|
||||
if (mode & TRANS_START_READ_ONLY) {
|
||||
if (tmp_str.len) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ ONLY", sizeof("READ ONLY") - 1);
|
||||
}
|
||||
smart_str_0(&tmp_str);
|
||||
|
||||
{
|
||||
char * commented_name = NULL;
|
||||
unsigned int commented_name_len = name? spprintf(&commented_name, 0, " /*%s*/", name):0;
|
||||
if (err == FALSE){
|
||||
char * name_esc = mysqli_escape_string_for_tx_name_in_comment(name TSRMLS_CC);
|
||||
char * query;
|
||||
unsigned int query_len = spprintf(&query, 0, "START TRANSACTION%s %s",
|
||||
commented_name? commented_name:"", tmp_str.c? tmp_str.c:"");
|
||||
name_esc? name_esc:"", tmp_str.c? tmp_str.c:"");
|
||||
|
||||
smart_str_free(&tmp_str);
|
||||
if (name_esc) {
|
||||
efree(name_esc);
|
||||
}
|
||||
|
||||
ret = mysql_real_query(conn, query, query_len);
|
||||
efree(query);
|
||||
if (commented_name) {
|
||||
efree(commented_name);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -1120,7 +1126,7 @@ PHP_FUNCTION(mysqli_begin_transaction)
|
||||
}
|
||||
|
||||
#if !defined(MYSQLI_USE_MYSQLND)
|
||||
if (mysqli_begin_transaction_libmysql(mysql->mysql, flags, name)) {
|
||||
if (mysqli_begin_transaction_libmysql(mysql->mysql, flags, name TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -116,6 +116,10 @@ typedef struct {
|
||||
BIND_BUFFER param;
|
||||
BIND_BUFFER result;
|
||||
char *query;
|
||||
#ifndef MYSQLI_USE_MYSQLND
|
||||
/* used to manage refcount with libmysql (already implement in mysqlnd) */
|
||||
zend_object_handle link_handle;
|
||||
#endif
|
||||
} MY_STMT;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #66762 mysqli@libmysql segfault in mysqli_stmt::bind_result() when link closed
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
$mysqli = new mysqli($host, $user, $passwd, $db);
|
||||
|
||||
$read_stmt = $mysqli->prepare("SELECT 1");
|
||||
|
||||
var_dump($read_stmt->bind_result($data));
|
||||
|
||||
unset($mysqli);
|
||||
var_dump($read_stmt->bind_result($data));
|
||||
|
||||
?>
|
||||
done!
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
done!
|
||||
@@ -0,0 +1,126 @@
|
||||
--TEST--
|
||||
mysqli_begin_transaction()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifemb.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
|
||||
require_once('connect.inc');
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
die(sprintf("Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
|
||||
|
||||
if (!have_innodb($link))
|
||||
die(sprintf("Needs InnoDB support, [%d] %s", $link->errno, $link->error));
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
/* {{{ proto bool mysqli_begin_transaction(object link, [int flags [, string name]]) */
|
||||
$tmp = NULL;
|
||||
$link = NULL;
|
||||
|
||||
if (!is_null($tmp = @mysqli_begin_transaction()))
|
||||
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!is_null($tmp = @mysqli_begin_transaction($link)))
|
||||
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!is_null($tmp = @mysqli_begin_transaction($link, $link)))
|
||||
printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
|
||||
if (!is_null($tmp = @mysqli_begin_transaction($link, $link)))
|
||||
printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!is_null($tmp = @mysqli_begin_transaction($link, 0, $link)))
|
||||
printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!is_null($tmp = @mysqli_begin_transaction($link, 0, "mytrx", $link)))
|
||||
printf("[007] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
|
||||
printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
|
||||
printf("[009] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (true !== ($tmp = mysqli_autocommit($link, true)))
|
||||
printf("[010] Cannot turn on autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
/* overrule autocommit */
|
||||
if (true !== ($tmp = mysqli_begin_transaction($link)))
|
||||
printf("[011] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
|
||||
printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
$tmp = mysqli_rollback($link);
|
||||
if ($tmp !== true)
|
||||
printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
/* empty */
|
||||
$res = mysqli_query($link, "SELECT * FROM test");
|
||||
var_dump($res->fetch_assoc());
|
||||
|
||||
/* valid flags */
|
||||
$flags = array(MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT);
|
||||
|
||||
if (mysqli_get_server_version($link) >= 50605) {
|
||||
$flags[] = MYSQLI_TRANS_START_READ_WRITE;
|
||||
$flags[] = MYSQLI_TRANS_START_READ_ONLY;
|
||||
}
|
||||
|
||||
/* just coverage */
|
||||
foreach ($flags as $flag) {
|
||||
if (!mysqli_begin_transaction($link, $flag, sprintf("flag %d", $flag))) {
|
||||
printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
if (!mysqli_query($link, 'SELECT * FROM test') || !mysqli_rollback($link)) {
|
||||
printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
}
|
||||
|
||||
/* does it really set a flag? */
|
||||
if (mysqli_get_server_version($link) >= 50605) {
|
||||
if (!mysqli_begin_transaction($link, MYSQLI_TRANS_START_READ_ONLY, sprintf("flag %d", $flag))) {
|
||||
printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
if (mysqli_query($link, "INSERT INTO test(id) VALUES (2)")) {
|
||||
printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
} else if (!mysqli_commit($link)) {
|
||||
printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
} else {
|
||||
$res = mysqli_query($link, "SELECT id FROM test WHERE id = 2");
|
||||
}
|
||||
}
|
||||
|
||||
if (!mysqli_begin_transaction($link, -1)) {
|
||||
printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
|
||||
if (mysqli_get_server_version($link) >= 50605) {
|
||||
/* does it like stupid names? */
|
||||
if (@!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "*/trick me?\n\0"))
|
||||
printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
/* does it like stupid names? */
|
||||
if (@!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "az09"))
|
||||
printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
|
||||
print "done!";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once("clean_table.inc");
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
|
||||
Warning: mysqli_begin_transaction(): Invalid value for parameter flags (-1) in %s on line %d
|
||||
[019] [%d]%A
|
||||
done!
|
||||
@@ -0,0 +1,119 @@
|
||||
--TEST--
|
||||
mysqli_change_user(), MySQL < 5.6
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifemb.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket));
|
||||
|
||||
if (mysqli_get_server_version($link) >= 50600)
|
||||
die("SKIP For MySQL < 5.6.0");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
$tmp = NULL;
|
||||
$link = NULL;
|
||||
|
||||
if (!is_null($tmp = @mysqli_change_user()))
|
||||
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!is_null($tmp = @mysqli_change_user($link)))
|
||||
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!is_null($tmp = @mysqli_change_user($link, $link)))
|
||||
printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!is_null($tmp = @mysqli_change_user($link, $link, $link)))
|
||||
printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!is_null($tmp = @mysqli_change_user($link, $link, $link, $link, $link)))
|
||||
printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
|
||||
if (false !== ($tmp = mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
|
||||
printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (false !== ($tmp = mysqli_change_user($link, $user, $passwd . '_unknown_really', $db)))
|
||||
printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (false !== ($tmp = mysqli_change_user($link, $user, $passwd, $db . '_unknown_really')))
|
||||
printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
|
||||
printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
|
||||
printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
$tmp = mysqli_fetch_assoc($res);
|
||||
mysqli_free_result($res);
|
||||
if (1 != $tmp['test_var'])
|
||||
printf("[012] Cannot set test variable\n");
|
||||
|
||||
if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db)))
|
||||
printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
|
||||
printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
$tmp = mysqli_fetch_assoc($res);
|
||||
mysqli_free_result($res);
|
||||
|
||||
if (substr($tmp['user'], 0, strlen($user)) !== $user)
|
||||
printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']);
|
||||
if ($tmp['dbname'] != $db)
|
||||
printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
|
||||
|
||||
if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
|
||||
printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
$tmp = mysqli_fetch_assoc($res);
|
||||
mysqli_free_result($res);
|
||||
if (NULL !== $tmp['test_var'])
|
||||
printf("[019] Test variable is still set!\n");
|
||||
|
||||
mysqli_close($link);
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[020] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
}
|
||||
|
||||
if (false !== ($tmp = mysqli_change_user($link, str_repeat('user', 16384), str_repeat('pass', 16384), str_repeat('dbase', 16384))))
|
||||
printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
mysqli_close($link);
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
}
|
||||
|
||||
/* silent protocol change if no db which requires workaround in mysqlnd/libmysql
|
||||
(empty db = no db send with COM_CHANGE_USER) */
|
||||
if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, "")))
|
||||
printf("[023] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
|
||||
printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
$tmp = mysqli_fetch_assoc($res);
|
||||
mysqli_free_result($res);
|
||||
|
||||
if ($tmp['dbname'] != "")
|
||||
printf("[025] Expecting database '', got database() '%s'\n", $tmp['dbname']);
|
||||
|
||||
mysqli_close($link);
|
||||
|
||||
if (NULL !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db)))
|
||||
printf("[026] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
print "done!";
|
||||
?>
|
||||
--EXPECTF--
|
||||
done!
|
||||
@@ -21,49 +21,78 @@ if (!have_innodb($link))
|
||||
$link = NULL;
|
||||
|
||||
$mysqli = new mysqli();
|
||||
if (!is_null($tmp = @$mysqli->commit()))
|
||||
if (!is_null($tmp = @$mysqli->commit())) {
|
||||
printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
|
||||
}
|
||||
|
||||
if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
|
||||
if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
}
|
||||
|
||||
if (true !== ($tmp = $mysqli->commit()))
|
||||
if (true !== ($tmp = $mysqli->commit())) {
|
||||
printf("[002] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
|
||||
}
|
||||
|
||||
if (true !== ($tmp = $mysqli->autocommit(false)))
|
||||
if (true !== ($tmp = $mysqli->autocommit(false))) {
|
||||
printf("[003] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
}
|
||||
|
||||
if (!$mysqli->query('DROP TABLE IF EXISTS test'))
|
||||
if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
|
||||
printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
|
||||
}
|
||||
|
||||
if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB'))
|
||||
if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
|
||||
printf("[005] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error);
|
||||
}
|
||||
|
||||
if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
|
||||
if (!$mysqli->query('INSERT INTO test(id) VALUES (1)')) {
|
||||
printf("[006] [%d] %s\n", $mysqli->errno, $mysqli->error);
|
||||
}
|
||||
|
||||
$tmp = $mysqli->commit();
|
||||
if ($tmp !== true)
|
||||
if ($tmp !== true) {
|
||||
printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
}
|
||||
|
||||
if (!$mysqli->query('ROLLBACK'))
|
||||
printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
|
||||
|
||||
if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
|
||||
if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test')) {
|
||||
printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
|
||||
}
|
||||
|
||||
$tmp = $res->fetch_assoc();
|
||||
if (1 != $tmp['num'])
|
||||
if (1 != $tmp['num']) {
|
||||
printf("[010] Expecting 1 row in table test, found %d rows\n", $tmp['num']);
|
||||
}
|
||||
$res->free();
|
||||
|
||||
if (!$mysqli->query('DROP TABLE IF EXISTS test'))
|
||||
if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
|
||||
printf("[011] [%d] %s\n", $mysqli->errno, $mysqli->error);
|
||||
}
|
||||
|
||||
if (!$mysqli->commit(0 , "tx_name0123")) {
|
||||
printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
|
||||
}
|
||||
if (!$mysqli->commit(0 , "*/ nonsense")) {
|
||||
printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error);
|
||||
}
|
||||
if (!$mysqli->commit(0 , "tx_name ulf вендел")) {
|
||||
printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error);
|
||||
}
|
||||
if (!$mysqli->commit(0 , "tx_name \t\n\r\b")) {
|
||||
printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
|
||||
}
|
||||
if (!$mysqli->commit(MYSQLI_TRANS_COR_AND_CHAIN | MYSQLI_TRANS_COR_NO_RELEASE , "tx_name")) {
|
||||
printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error);
|
||||
}
|
||||
|
||||
$mysqli->close();
|
||||
|
||||
if (NULL !== ($tmp = @$mysqli->commit()))
|
||||
printf("[012] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
if (NULL !== ($tmp = @$mysqli->commit())) {
|
||||
printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
}
|
||||
|
||||
print "done!";
|
||||
?>
|
||||
@@ -72,4 +101,9 @@ if (!have_innodb($link))
|
||||
require_once("clean_table.inc");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: mysqli::commit(): Transaction name truncated. Must be only [0-9A-Za-z\-_=]+ in %s on line %d
|
||||
|
||||
Warning: mysqli::commit(): Transaction name truncated. Must be only [0-9A-Za-z\-_=]+ in %s on line %d
|
||||
|
||||
Warning: mysqli::commit(): Transaction name truncated. Must be only [0-9A-Za-z\-_=]+ in %s on line %d
|
||||
done!
|
||||
+82
-31
@@ -2652,24 +2652,24 @@ MYSQLND_METHOD(mysqlnd_conn_data, tx_cor_options_to_string)(const MYSQLND_CONN_D
|
||||
{
|
||||
if (mode & TRANS_COR_AND_CHAIN && !(mode & TRANS_COR_AND_NO_CHAIN)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
smart_str_appendl(str, " ", sizeof(" ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "AND CHAIN", sizeof("AND CHAIN") - 1);
|
||||
} else if (mode & TRANS_COR_AND_NO_CHAIN && !(mode & TRANS_COR_AND_CHAIN)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
smart_str_appendl(str, " ", sizeof(" ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "AND NO CHAIN", sizeof("AND NO CHAIN") - 1);
|
||||
}
|
||||
|
||||
if (mode & TRANS_COR_RELEASE && !(mode & TRANS_COR_NO_RELEASE)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
smart_str_appendl(str, " ", sizeof(" ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "RELEASE", sizeof("RELEASE") - 1);
|
||||
} else if (mode & TRANS_COR_NO_RELEASE && !(mode & TRANS_COR_RELEASE)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
smart_str_appendl(str, " ", sizeof(" ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "NO RELEASE", sizeof("NO RELEASE") - 1);
|
||||
}
|
||||
@@ -2678,6 +2678,49 @@ MYSQLND_METHOD(mysqlnd_conn_data, tx_cor_options_to_string)(const MYSQLND_CONN_D
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_escape_string_for_tx_name_in_comment */
|
||||
static char *
|
||||
mysqlnd_escape_string_for_tx_name_in_comment(const char * const name TSRMLS_DC)
|
||||
{
|
||||
char * ret = NULL;
|
||||
DBG_ENTER("mysqlnd_escape_string_for_tx_name_in_comment");
|
||||
if (name) {
|
||||
zend_bool warned = FALSE;
|
||||
const char * p_orig = name;
|
||||
char * p_copy;
|
||||
p_copy = ret = mnd_emalloc(strlen(name) + 1 + 2 + 2 + 1); /* space, open, close, NullS */
|
||||
*p_copy++ = ' ';
|
||||
*p_copy++ = '/';
|
||||
*p_copy++ = '*';
|
||||
while (1) {
|
||||
register char v = *p_orig;
|
||||
if (v == 0) {
|
||||
break;
|
||||
}
|
||||
if ((v >= '0' && v <= '9') ||
|
||||
(v >= 'a' && v <= 'z') ||
|
||||
(v >= 'A' && v <= 'Z') ||
|
||||
v == '-' ||
|
||||
v == '_' ||
|
||||
v == ' ' ||
|
||||
v == '=')
|
||||
{
|
||||
*p_copy++ = v;
|
||||
} else if (warned == FALSE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Transaction name truncated. Must be only [0-9A-Za-z\\-_=]+");
|
||||
warned = TRUE;
|
||||
}
|
||||
++p_orig;
|
||||
}
|
||||
*p_copy++ = '*';
|
||||
*p_copy++ = '/';
|
||||
*p_copy++ = 0;
|
||||
}
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_conn_data::tx_commit_ex */
|
||||
static enum_func_status
|
||||
MYSQLND_METHOD(mysqlnd_conn_data, tx_commit_or_rollback)(MYSQLND_CONN_DATA * conn, const zend_bool commit, const unsigned int flags, const char * const name TSRMLS_DC)
|
||||
@@ -2692,23 +2735,26 @@ MYSQLND_METHOD(mysqlnd_conn_data, tx_commit_or_rollback)(MYSQLND_CONN_DATA * con
|
||||
conn->m->tx_cor_options_to_string(conn, &tmp_str, flags TSRMLS_CC);
|
||||
smart_str_0(&tmp_str);
|
||||
|
||||
{
|
||||
char * commented_name = NULL;
|
||||
unsigned int commented_name_len = name? mnd_sprintf(&commented_name, 0, " /*%s*/", name):0;
|
||||
char * query;
|
||||
unsigned int query_len = mnd_sprintf(&query, 0, (commit? "COMMIT%s %s":"ROLLBACK%s %s"),
|
||||
commented_name? commented_name:"", tmp_str.c? tmp_str.c:"");
|
||||
smart_str_free(&tmp_str);
|
||||
|
||||
{
|
||||
char * query;
|
||||
size_t query_len;
|
||||
char * name_esc = mysqlnd_escape_string_for_tx_name_in_comment(name TSRMLS_CC);
|
||||
|
||||
query_len = mnd_sprintf(&query, 0, (commit? "COMMIT%s %s":"ROLLBACK%s %s"),
|
||||
name_esc? name_esc:"", tmp_str.c? tmp_str.c:"");
|
||||
smart_str_free(&tmp_str);
|
||||
if (name_esc) {
|
||||
mnd_efree(name_esc);
|
||||
name_esc = NULL;
|
||||
}
|
||||
if (!query) {
|
||||
SET_OOM_ERROR(*conn->error_info);
|
||||
break;
|
||||
}
|
||||
|
||||
ret = conn->m->query(conn, query, query_len TSRMLS_CC);
|
||||
mnd_sprintf_free(query);
|
||||
if (commented_name) {
|
||||
mnd_sprintf_free(commented_name);
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC);
|
||||
@@ -2736,36 +2782,41 @@ MYSQLND_METHOD(mysqlnd_conn_data, tx_begin)(MYSQLND_CONN_DATA * conn, const unsi
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "WITH CONSISTENT SNAPSHOT", sizeof("WITH CONSISTENT SNAPSHOT") - 1);
|
||||
}
|
||||
if (mode & TRANS_START_READ_WRITE) {
|
||||
if (tmp_str.len) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
if (mode & (TRANS_START_READ_WRITE | TRANS_START_READ_ONLY)) {
|
||||
unsigned long server_version = conn->m->get_server_version(conn TSRMLS_CC);
|
||||
if (server_version < 50605L) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "This server version doesn't support 'READ WRITE' and 'READ ONLY'. Minimum 5.6.5 is required");
|
||||
smart_str_free(&tmp_str);
|
||||
break;
|
||||
} else if (mode & TRANS_START_READ_WRITE) {
|
||||
if (tmp_str.len) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ WRITE", sizeof("READ WRITE") - 1);
|
||||
} else if (mode & TRANS_START_READ_ONLY) {
|
||||
if (tmp_str.len) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ ONLY", sizeof("READ ONLY") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ WRITE", sizeof("READ WRITE") - 1);
|
||||
}
|
||||
if (mode & TRANS_START_READ_ONLY) {
|
||||
if (tmp_str.len) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ ONLY", sizeof("READ ONLY") - 1);
|
||||
}
|
||||
smart_str_0(&tmp_str);
|
||||
|
||||
{
|
||||
char * commented_name = NULL;
|
||||
unsigned int commented_name_len = name? mnd_sprintf(&commented_name, 0, " /*%s*/", name):0;
|
||||
char * name_esc = mysqlnd_escape_string_for_tx_name_in_comment(name TSRMLS_CC);
|
||||
char * query;
|
||||
unsigned int query_len = mnd_sprintf(&query, 0, "START TRANSACTION%s %s", commented_name? commented_name:"", tmp_str.c? tmp_str.c:"");
|
||||
unsigned int query_len = mnd_sprintf(&query, 0, "START TRANSACTION%s %s", name_esc? name_esc:"", tmp_str.c? tmp_str.c:"");
|
||||
smart_str_free(&tmp_str);
|
||||
|
||||
if (name_esc) {
|
||||
mnd_efree(name_esc);
|
||||
name_esc = NULL;
|
||||
}
|
||||
if (!query) {
|
||||
SET_OOM_ERROR(*conn->error_info);
|
||||
break;
|
||||
}
|
||||
ret = conn->m->query(conn, query, query_len TSRMLS_CC);
|
||||
mnd_sprintf_free(query);
|
||||
if (commented_name) {
|
||||
mnd_sprintf_free(commented_name);
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC);
|
||||
|
||||
@@ -1741,8 +1741,9 @@ php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval
|
||||
zval_dtor(*current_field);
|
||||
ZVAL_STRINGL(*current_field, (char *) start, bit_area - start - 1, 0);
|
||||
}
|
||||
} else
|
||||
ZVAL_STRINGL(*current_field, (char *)p, len, 0);
|
||||
} else {
|
||||
ZVAL_STRINGL(*current_field, (char *)p, len, 0);
|
||||
}
|
||||
p += len;
|
||||
last_field_was_string = TRUE;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,21 @@ DRCP: Test setting connection class inline
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||
require(dirname(__FILE__)."/details.inc");
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
if (!$test_drcp) die("skip testing DRCP connection class only works in DRCP mode");
|
||||
if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
|
||||
|
||||
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv);
|
||||
// This test in Oracle 12c needs a non-CDB or the root container
|
||||
if (isset($matches_sv[0]) && $matches_sv[1] >= 12) {
|
||||
$s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual");
|
||||
$r = @oci_execute($s);
|
||||
if (!$r)
|
||||
die('skip could not identify container type');
|
||||
$r = oci_fetch_array($s);
|
||||
if ($r['DBTYPE'] !== 'CDB$ROOT')
|
||||
die('skip cannot run test using a PDB');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -48,7 +48,7 @@ Warning: oci_bind_by_name() expects at least 3 parameters, 2 given in %s on line
|
||||
|
||||
Warning: oci_bind_by_name() expects at least 3 parameters, 1 given in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-00932: %s NUMBER %s BLOB in %s on line %d
|
||||
Warning: oci_execute(): ORA-00932: %s on line %d
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
|
||||
@@ -338,6 +338,7 @@ const char *accel_new_interned_string(const char *arKey, int nKeyLength, int fre
|
||||
if (ZCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength) >=
|
||||
ZCSG(interned_strings_end)) {
|
||||
/* no memory, return the same non-interned string */
|
||||
zend_accel_error(ACCEL_LOG_WARNING, "Interned string buffer overflow");
|
||||
return arKey;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
#endif
|
||||
|
||||
#define ACCELERATOR_PRODUCT_NAME "Zend OPcache"
|
||||
#define ACCELERATOR_VERSION "7.0.3"
|
||||
#define PHP_ZENDOPCACHE_VERSION "7.0.4-dev"
|
||||
#define ACCELERATOR_VERSION PHP_ZENDOPCACHE_VERSION
|
||||
/* 2 - added Profiler support, on 20010712 */
|
||||
/* 3 - added support for Optimizer's encoded-only-files mode */
|
||||
/* 4 - works with the new Optimizer, that supports the file format with licenses */
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
ARG_ENABLE("opcache", "whether to enable Zend OPcache support", "yes");
|
||||
|
||||
if (PHP_OPCACHE != "no") {
|
||||
var PHP_OPCACHE_PGO = false;
|
||||
|
||||
PHP_PGI = "no"; // workaround
|
||||
PHP_PGO = "no"; // workaround
|
||||
if (PHP_OPCACHE != "no") {
|
||||
|
||||
EXTENSION('opcache', "\
|
||||
ZendAccelerator.c \
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Test that script cached info is correct
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(opcache_is_script_cached(__FILE__));
|
||||
var_dump(opcache_is_script_cached("nonexistent.php"));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(false)
|
||||
@@ -57,9 +57,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_invalidate, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, force)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_is_script_cached, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, script)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
/* User functions */
|
||||
static ZEND_FUNCTION(opcache_reset);
|
||||
static ZEND_FUNCTION(opcache_invalidate);
|
||||
static ZEND_FUNCTION(opcache_is_script_cached);
|
||||
|
||||
/* Private functions */
|
||||
static ZEND_FUNCTION(opcache_get_status);
|
||||
@@ -71,6 +76,7 @@ static zend_function_entry accel_functions[] = {
|
||||
ZEND_FE(opcache_reset, arginfo_opcache_none)
|
||||
ZEND_FE(opcache_invalidate, arginfo_opcache_invalidate)
|
||||
ZEND_FE(opcache_compile_file, arginfo_opcache_compile_file)
|
||||
ZEND_FE(opcache_is_script_cached, arginfo_opcache_is_script_cached)
|
||||
/* Private functions */
|
||||
ZEND_FE(opcache_get_configuration, arginfo_opcache_none)
|
||||
ZEND_FE(opcache_get_status, arginfo_opcache_get_status)
|
||||
@@ -438,6 +444,14 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
|
||||
php_info_print_table_row(2, "Free memory", buf);
|
||||
snprintf(buf, sizeof(buf), "%ld", ZSMMG(wasted_shared_memory));
|
||||
php_info_print_table_row(2, "Wasted memory", buf);
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
if (ZCSG(interned_strings_start) && ZCSG(interned_strings_end) && ZCSG(interned_strings_top)) {
|
||||
snprintf(buf, sizeof(buf), "%ld", ZCSG(interned_strings_top) - ZCSG(interned_strings_start));
|
||||
php_info_print_table_row(2, "Interned Strings Used memory", buf);
|
||||
snprintf(buf, sizeof(buf), "%ld", ZCSG(interned_strings_end) - ZCSG(interned_strings_top));
|
||||
php_info_print_table_row(2, "Interned Strings Free memory", buf);
|
||||
}
|
||||
#endif
|
||||
snprintf(buf, sizeof(buf), "%ld", ZCSG(hash).num_direct_entries);
|
||||
php_info_print_table_row(2, "Cached scripts", buf);
|
||||
snprintf(buf, sizeof(buf), "%ld", ZCSG(hash).num_entries);
|
||||
@@ -567,6 +581,20 @@ static ZEND_FUNCTION(opcache_get_status)
|
||||
add_assoc_double(memory_usage, "current_wasted_percentage", (((double) ZSMMG(wasted_shared_memory))/ZCG(accel_directives).memory_consumption)*100.0);
|
||||
add_assoc_zval(return_value, "memory_usage", memory_usage);
|
||||
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
if (ZCSG(interned_strings_start) && ZCSG(interned_strings_end) && ZCSG(interned_strings_top)) {
|
||||
zval *interned_strings_usage;
|
||||
|
||||
MAKE_STD_ZVAL(interned_strings_usage);
|
||||
array_init(interned_strings_usage);
|
||||
add_assoc_long(interned_strings_usage, "buffer_size", ZCSG(interned_strings_end) - ZCSG(interned_strings_start));
|
||||
add_assoc_long(interned_strings_usage, "used_memory", ZCSG(interned_strings_top) - ZCSG(interned_strings_start));
|
||||
add_assoc_long(interned_strings_usage, "free_memory", ZCSG(interned_strings_end) - ZCSG(interned_strings_top));
|
||||
add_assoc_long(interned_strings_usage, "number_of_strings", ZCSG(interned_strings).nNumOfElements);
|
||||
add_assoc_zval(return_value, "interned_strings_usage", interned_strings_usage);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Accelerator statistics */
|
||||
MAKE_STD_ZVAL(statistics);
|
||||
array_init(statistics);
|
||||
@@ -759,3 +787,25 @@ static ZEND_FUNCTION(opcache_compile_file)
|
||||
}
|
||||
zend_destroy_file_handle(&handle TSRMLS_CC);
|
||||
}
|
||||
|
||||
/* {{{ proto bool opcache_is_script_cached(string $script)
|
||||
Return true if the script is cached in OPCache, false if it is not cached or if OPCache is not running. */
|
||||
static ZEND_FUNCTION(opcache_is_script_cached)
|
||||
{
|
||||
char *script_name;
|
||||
int script_name_len;
|
||||
|
||||
if (!validate_api_restriction(TSRMLS_C)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &script_name, &script_name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
RETURN_BOOL(filename_is_in_cache(script_name, script_name_len TSRMLS_CC));
|
||||
}
|
||||
+22
-18
@@ -77,6 +77,10 @@
|
||||
#endif
|
||||
#define DEBUG_SMIME 0
|
||||
|
||||
#if !defined(OPENSSL_NO_EC) && defined(EVP_PKEY_EC)
|
||||
#define HAVE_EVP_PKEY_EC 1
|
||||
#endif
|
||||
|
||||
/* FIXME: Use the openssl constants instead of
|
||||
* enum. It is now impossible to match real values
|
||||
* against php constants. Also sorry to break the
|
||||
@@ -87,7 +91,7 @@ enum php_openssl_key_type {
|
||||
OPENSSL_KEYTYPE_DSA,
|
||||
OPENSSL_KEYTYPE_DH,
|
||||
OPENSSL_KEYTYPE_DEFAULT = OPENSSL_KEYTYPE_RSA,
|
||||
#ifdef EVP_PKEY_EC
|
||||
#ifdef HAVE_EVP_PKEY_EC
|
||||
OPENSSL_KEYTYPE_EC = OPENSSL_KEYTYPE_DH +1
|
||||
#endif
|
||||
};
|
||||
@@ -866,7 +870,7 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option
|
||||
req->digest = req->md_alg = EVP_get_digestbyname(req->digest_name);
|
||||
}
|
||||
if (req->md_alg == NULL) {
|
||||
req->md_alg = req->digest = EVP_md5();
|
||||
req->md_alg = req->digest = EVP_sha1();
|
||||
}
|
||||
|
||||
PHP_SSL_CONFIG_SYNTAX_CHECK(extensions_section);
|
||||
@@ -1128,7 +1132,7 @@ PHP_MINIT_FUNCTION(openssl)
|
||||
REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DSA", OPENSSL_KEYTYPE_DSA, CONST_CS|CONST_PERSISTENT);
|
||||
#endif
|
||||
REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DH", OPENSSL_KEYTYPE_DH, CONST_CS|CONST_PERSISTENT);
|
||||
#ifdef EVP_PKEY_EC
|
||||
#ifdef HAVE_EVP_PKEY_EC
|
||||
REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_EC", OPENSSL_KEYTYPE_EC, CONST_CS|CONST_PERSISTENT);
|
||||
#endif
|
||||
|
||||
@@ -3026,7 +3030,7 @@ static int php_openssl_is_private_key(EVP_PKEY* pkey TSRMLS_DC)
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x0090800fL && !defined(OPENSSL_NO_EC) && defined(EVP_PKEY_EC)
|
||||
#ifdef HAVE_EVP_PKEY_EC
|
||||
case EVP_PKEY_EC:
|
||||
assert(pkey->pkey.ec != NULL);
|
||||
|
||||
@@ -3435,7 +3439,7 @@ PHP_FUNCTION(openssl_pkey_get_details)
|
||||
}
|
||||
|
||||
break;
|
||||
#ifdef EVP_PKEY_EC
|
||||
#ifdef HAVE_EVP_PKEY_EC
|
||||
case EVP_PKEY_EC:
|
||||
ktype = OPENSSL_KEYTYPE_EC;
|
||||
break;
|
||||
@@ -4380,6 +4384,7 @@ PHP_FUNCTION(openssl_seal)
|
||||
|
||||
if (!EVP_EncryptInit(&ctx,cipher,NULL,NULL)) {
|
||||
RETVAL_FALSE;
|
||||
EVP_CIPHER_CTX_cleanup(&ctx);
|
||||
goto clean_exit;
|
||||
}
|
||||
|
||||
@@ -4390,10 +4395,12 @@ PHP_FUNCTION(openssl_seal)
|
||||
#endif
|
||||
/* allocate one byte extra to make room for \0 */
|
||||
buf = emalloc(data_len + EVP_CIPHER_CTX_block_size(&ctx));
|
||||
EVP_CIPHER_CTX_cleanup(&ctx);
|
||||
|
||||
if (!EVP_SealInit(&ctx, cipher, eks, eksl, NULL, pkeys, nkeys) || !EVP_SealUpdate(&ctx, buf, &len1, (unsigned char *)data, data_len)) {
|
||||
RETVAL_FALSE;
|
||||
efree(buf);
|
||||
EVP_CIPHER_CTX_cleanup(&ctx);
|
||||
goto clean_exit;
|
||||
}
|
||||
|
||||
@@ -4426,6 +4433,7 @@ PHP_FUNCTION(openssl_seal)
|
||||
efree(buf);
|
||||
}
|
||||
RETVAL_LONG(len1 + len2);
|
||||
EVP_CIPHER_CTX_cleanup(&ctx);
|
||||
|
||||
clean_exit:
|
||||
for (i=0; i<nkeys; i++) {
|
||||
@@ -4484,25 +4492,21 @@ PHP_FUNCTION(openssl_open)
|
||||
if (EVP_OpenInit(&ctx, cipher, (unsigned char *)ekey, ekey_len, NULL, pkey) && EVP_OpenUpdate(&ctx, buf, &len1, (unsigned char *)data, data_len)) {
|
||||
if (!EVP_OpenFinal(&ctx, buf + len1, &len2) || (len1 + len2 == 0)) {
|
||||
efree(buf);
|
||||
if (keyresource == -1) {
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
RETVAL_FALSE;
|
||||
} else {
|
||||
zval_dtor(opendata);
|
||||
buf[len1 + len2] = '\0';
|
||||
ZVAL_STRINGL(opendata, erealloc(buf, len1 + len2 + 1), len1 + len2, 0);
|
||||
RETVAL_TRUE;
|
||||
}
|
||||
} else {
|
||||
efree(buf);
|
||||
if (keyresource == -1) {
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
if (keyresource == -1) {
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
zval_dtor(opendata);
|
||||
buf[len1 + len2] = '\0';
|
||||
ZVAL_STRINGL(opendata, erealloc(buf, len1 + len2 + 1), len1 + len2, 0);
|
||||
RETURN_TRUE;
|
||||
EVP_CIPHER_CTX_cleanup(&ctx);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -5073,7 +5077,7 @@ PHP_FUNCTION(openssl_cipher_iv_length)
|
||||
|
||||
|
||||
/* {{{ proto string openssl_dh_compute_key(string pub_key, resource dh_key)
|
||||
Computes shared sicret for public value of remote DH key and local DH key */
|
||||
Computes shared secret for public value of remote DH key and local DH key */
|
||||
PHP_FUNCTION(openssl_dh_compute_key)
|
||||
{
|
||||
zval *key;
|
||||
|
||||
@@ -3,6 +3,7 @@ Bug #64802: openssl_x509_parse fails to parse subject properly in some cases
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
if (!defined(OPENSSL_KEYTYPE_EC)) die("skip no EC available);
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -3,6 +3,7 @@ Bug #66501: EC private key support in openssl_sign
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
if (!defined(OPENSSL_KEYTYPE_EC)) die("skip no EC available);
|
||||
--FILE--
|
||||
<?php
|
||||
$pkey = 'ASN1 OID: prime256v1
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Firebird/InterBase driver for PDO
|
||||
Firebird driver for PDO
|
||||
Ard Biesheuvel
|
||||
@@ -1,7 +1,3 @@
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
PHP_ARG_WITH(pdo-firebird,for Firebird support for PDO,
|
||||
[ --with-pdo-firebird[=DIR] PDO: Firebird support. DIR is the Firebird base
|
||||
install directory [/opt/firebird]])
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// $Id$
|
||||
// vim:ft=javascript
|
||||
|
||||
ARG_WITH("pdo-firebird", "Firebird support for PDO", "no");
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
@@ -607,14 +605,14 @@ static int firebird_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *val TS
|
||||
static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
|
||||
ISC_STATUS *s = H->isc_status;
|
||||
const ISC_STATUS *s = H->isc_status;
|
||||
char buf[400];
|
||||
long i = 0, l, sqlcode = isc_sqlcode(s);
|
||||
|
||||
if (sqlcode) {
|
||||
add_next_index_long(info, sqlcode);
|
||||
|
||||
while ((l = isc_interprete(&buf[i],&s))) {
|
||||
while ((sizeof(buf)>(i+2))&&(l = fb_interpret(&buf[i],(sizeof(buf)-i-2),&s))) {
|
||||
i += l;
|
||||
strcpy(&buf[i++], " ");
|
||||
}
|
||||
@@ -697,8 +695,8 @@ static int pdo_firebird_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRM
|
||||
|
||||
if (!dbh->methods) {
|
||||
char errmsg[512];
|
||||
ISC_STATUS *s = H->isc_status;
|
||||
isc_interprete(errmsg, &s);
|
||||
const ISC_STATUS *s = H->isc_status;
|
||||
fb_interpret(errmsg, sizeof(errmsg),&s);
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), H->isc_status[1] TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
|
||||
"HY000", H->isc_status[1], errmsg);
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
@@ -91,7 +89,7 @@ PHP_MSHUTDOWN_FUNCTION(pdo_firebird) /* {{{ */
|
||||
PHP_MINFO_FUNCTION(pdo_firebird) /* {{{ */
|
||||
{
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_header(2, "PDO Driver for Firebird/InterBase", "enabled");
|
||||
php_info_print_table_header(2, "PDO Driver for Firebird", "enabled");
|
||||
php_info_print_table_end();
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef PHP_PDO_FIREBIRD_H
|
||||
#define PHP_PDO_FIREBIRD_H
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef PHP_PDO_FIREBIRD_INT_H
|
||||
#define PHP_PDO_FIREBIRD_INT_H
|
||||
|
||||
|
||||
@@ -64,7 +64,12 @@ static MYSQLND * pdo_mysql_convert_zv_to_mysqlnd(zval * zv TSRMLS_DC)
|
||||
if (Z_TYPE_P(zv) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zv), php_pdo_get_dbh_ce() TSRMLS_CC)) {
|
||||
pdo_dbh_t * dbh = zend_object_store_get_object(zv TSRMLS_CC);
|
||||
|
||||
if (!dbh || dbh->driver != &pdo_mysql_driver) {
|
||||
if (!dbh) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to retrieve handle from object store");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (dbh->driver != &pdo_mysql_driver) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Provided PDO instance is not using MySQL but %s", dbh->driver->driver_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,6 @@ Basic test of POSIX getpgid(), kill(), get_last_error() and strerror() functions
|
||||
Kill pid=%d
|
||||
bool(false)
|
||||
int(%d)
|
||||
string(%d) %sNo such process%s
|
||||
string(%d) %s%rNo such process|Operation not permitted%r%s
|
||||
===DONE====
|
||||
|
||||
|
||||
@@ -56,6 +56,6 @@ string(13) "default value"
|
||||
|
||||
Fatal error: Uncaught exception 'ReflectionException' with message 'Class A does not have a property named ' in %sReflectionClass_getStaticPropertyValue_001_2_4.php:%d
|
||||
Stack trace:
|
||||
#0 %sReflectionClass_getStaticPropertyValue_001_2_4.php(%d): ReflectionClass->getStaticPropertyValue('?A?privateOverr...')
|
||||
#0 %sReflectionClass_getStaticPropertyValue_001_2_4.php(%d): ReflectionClass->getStaticPropertyValue('\x00A\x00privateOverr...')
|
||||
#1 {main}
|
||||
thrown in %sReflectionClass_getStaticPropertyValue_001_2_4.php on line %d
|
||||
Loaded 100 of 166 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user