diff options
author | Andrey Hristov <andrey@php.net> | 2014-04-10 16:49:13 +0300 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2014-04-10 16:49:13 +0300 |
commit | 090c3e87c0449e6eadf83815bb57c8a6eff4b56e (patch) | |
tree | 946fdc55ed17d2dc07a99b388565cc96197026dd | |
parent | 63791d055ad64762c3f63e08ca7ad8ba1f44e0ab (diff) | |
parent | 3204ad5858a5abc50b11b8527d22c82eb07a80cc (diff) | |
download | php-git-090c3e87c0449e6eadf83815bb57c8a6eff4b56e.tar.gz |
Merge branch 'PHP-5.6' of git.php.net:php-src into PHP-5.6
Conflicts:
ext/mysqli/tests/mysqli_begin_transaction.phpt
140 files changed, 4197 insertions, 2020 deletions
@@ -1,14 +1,25 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? 2014, PHP 5.6.0 Beta 1 +?? ??? 2014, PHP 5.6.0 Beta 2 + +10 Apr 2014, PHP 5.6.0 Beta 1 - Core: . Allow zero length comparison in substr_compare() (Tjerk) . Fixed bug #60602 (proc_open() changes environment array) (Tjerk) + . 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 #66822 (Cannot use T_POW in const expression) (Tjerk) + . Fixed bug #67043 (substr_compare broke by previous change) (Tjerk) - SPL: . Added feature #65545 (SplFileObject::fread()) (Tjerk) + . Fixed bug #66834 (empty() does not work on classes that extend ArrayObject) (Tjerk) + . Fixed bug #66702 (RegexIterator::INVERT_MATCH does not invert). (Joshua + Thijssen) - cURL: . Fixed bug #66109 (Can't reset CURLOPT_CUSTOMREQUEST to default behaviour) @@ -20,20 +31,47 @@ PHP NEWS . Added DateTimeImmutable::createFromMutable to create a DateTimeImmutable object from an existing DateTime (mutable) object (Derick) +- Embed: + . Fixed bug #65715 (php5embed.lib isn't provided anymore). (Anatol). + +- Fileinfo: + . Fixed bug #66820 (out-of-bounds memory access in fileinfo) + (CVE-2014-2270). (Remi) + . Fixed bug #66946i (fileinfo: extensive backtracking in awk rule regular + expression). (CVE-2013-7345) (Remi) + . Fixed bug #66987 (Memory corruption in fileinfo ext / bigendian). + (Remi) + + - GD: . Fixed bug #66815 (imagecrop(): insufficient fix for NULL defer CVE-2013-7327). (Tomas Hoger, Remi). + . Fixed #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) +- GMP: + . Fixed bug #66872 (invalid argument crashes gmp_testbit) (Pierre) + - Hash: . Fixed bug #66698 (Missing FNV1a32 and FNV1a64 hash functions). (Michael M Slusarz). + . Implemented timing attack safe string comparison function + (RFC: https://wiki.php.net/rfc/timing_attack). (Rouven Weßling) + . 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) +- Mbstring: + . Upgraded to oniguruma 5.9.5 (Anatol) + - Mcrypt: . No longer allow invalid key sizes, invalid IV sizes or missing required IV in mcrypt_encrypt, mcrypt_decrypt and the deprecated mode functions. @@ -55,6 +93,13 @@ PHP NEWS peer verification fails. (Daniel Lowrey) . Encrypted TLS servers now support the server name indication TLS extension via the new "SNI_server_certs" SSL context option. (Daniel Lowrey) + . Fixed bug #66833 (Default disgest algo is still MD5, switch to SHA1). (Remi) + +- PCRE: + . Added support for (*MARK) backtracking verbs. (Nikita) + +- PDO_firebird: + . Fixed Bug #66071 (memory corruption in error handling) (Popa) - PDO_pgsql: . Cleaned up code by increasing the requirements to libpq versions providing @@ -67,9 +112,31 @@ PHP NEWS without preparing them, while still passing parameters separately from the command text using PQexecParams. (Matteo) +- Pgsql: + . Read-only access to the socket stream underlying database connections is + exposed via a new pg_socket() function to allow read/write polling when + establishing asynchronous connections and executing queries in non-blocking + applications. (Daniel Lowrey) + . Asynchronous connections are now possible using the PGSQL_CONNECT_ASYNC + flag in conjunction with a new pg_connect_poll() function and connection + polling status constants. (Daniel Lowrey) + . New pg_flush() and pg_consume_input() functions added to manually complete + non-blocking reads/writes to underlying connection sockets. (Daniel Lowrey) + +- Session + . Remove session_gc() and session_serializer_name() wich were introduced in the first 5.6.0 alpha. + +- SimpleXML: + . Fixed bug #66084 (simplexml_load_string() mangles empty node name) + (Anatol) + - SQLite: . Updated the bundled libsqlite to the version 3.8.3.1 (Anatol) +- XSL: + . Fixed bug #53965 (<xsl:include> cannot find files with relative paths + when loaded with "file://"). (Anatol) + ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 27 Feb 2014, PHP 5.6.0 Alpha 3 @@ -71,6 +71,9 @@ PHP 5.6 UPGRADE NOTES - Added use function and use const. (https://wiki.php.net/rfc/use_function) +- Added a function for timing attack safe string comparison + (https://wiki.php.net/rfc/timing_attack) + - Added gost-crypto (CryptoPro S-box) hash algorithm. - Stream wrappers verify peer certificates and host names by default in @@ -127,6 +130,12 @@ PHP 5.6 UPGRADE NOTES - Stream crypto method specification now accepts flags instead of values allowing support for multiple discrete protocols in a given stream. +- PostgreSQL database connections may now be established asynchronously using + new constants and polling functions in ext/pgsql. + +- Non-blocking read/write query behavior now optionally available in database + operations using the ext/pgsql extension. + ======================================== 2. Changes in SAPI modules ======================================== @@ -145,16 +154,27 @@ PHP 5.6 UPGRADE NOTES Instance calls from an incompatible context are now deprecated and issue E_DEPRECATED instead of E_STRICT. See https://wiki.php.net/rfc/incompat_ctx -- The "CN_match" SSL context option is deprecated in favor of the new - "peer_name" option. Name verification now checks certificate SAN names as - well as the CN field and "CN_match" is deprecated to avoid confusion. Its - use triggers E_DEPRECATED but continues to work as before. If both values - are specified "CN_match" takes precedence. Otherwise, the two options are - interchangeable. +- The "CN_match" and "SNI_server_name" SSL context options are deprecated in + favor of the new "peer_name" option. Name verification now checks certificate + SAN names as well as the CN field and the specific name fields are deprecated + to avoid confusion. Their use triggers E_DEPRECATED but continues to work as + before. If specified, the specific values take precedence over the general + "peer_name" value. - Deprecated PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, an undocument constant effectively equivalent to PDO::ATTR_EMULATE_PREPARES. +- Deprecated INIs: Following INIs are deprecated in favour of new + internal_encoding/input_encoding/output_encoding. Refer to "Changes to + encodings in PHP 5.6" in "11. Other Changes" section for more details. + + iconv.input_encoding + iconv.output_encoding + iconv.internal_encoding + mbstring.http_input + mbstring.http_output + mbstring.internal_encoding + ======================================== 4. Changed Functions ======================================== @@ -163,6 +183,18 @@ PHP 5.6 UPGRADE NOTES CURLOPT_SAFE_UPLOAD is now turned on by default and uploads with @file do not work unless it is explicitly set to false. + curl_setopt() now supports the following nullable settings (>= 5.5.11): + . CURLOPT_CUSTOMREQUEST + . CURLOPT_FTPPORT + . CURLOPT_RANGE + . CURLOPT_FTP_ACCOUNT + . CURLOPT_RTSP_SESSION_ID + . CURLOPT_KRBLEVEL + . CURLOPT_KRB4LEVEL + +- Strings: + substr_compare() now allows $length to be zero. + - Crypt: crypt() will now raise an E_NOTICE error if the salt parameter is omitted. See: https://wiki.php.net/rfc/crypt_function_salt @@ -177,6 +209,12 @@ PHP 5.6 UPGRADE NOTES - Pgsql: pg_insert()/pg_select()/pg_update()/pg_delete() are no longer EXPERIMENTAL. + The following functions no longer block until query write completion if the + socket stream underlying a database connection is set to non-blocking mode: + . pg_send_execute() + . pg_send_prepare() + . pg_send_query() + . pg_send_query_params() ======================================== 5. New Functions @@ -185,6 +223,9 @@ PHP 5.6 UPGRADE NOTES - GMP: Added gmp_root($a, $nth) and gmp_rootrem($a, $nth) for calculating nth roots. +- Hash + Added hash_equals($known_string, $user_string) + - OpenSSL: Added string openssl_x509_fingerprint($x509, $type, $binary). Added string openssl_spki_new($private_key, $challenge, $algorithm) @@ -198,6 +239,12 @@ PHP 5.6 UPGRADE NOTES Added ldap_modify_batch($link_identifier, $dn, $modifications) described in https://wiki.php.net/rfc/ldap_modify_batch. +- Pgsql: + Added pg_socket($connection) to allow async connections and non-blocking IO + Added pg_connect_poll($connection) for establishing async connections + Added pg_consume_input($connection) for non-blocking query result consumption + Added pg_flush($connection) for non-blocking query write completion + - PDO_pgsql Added PDO::pgsqlGetNotify($result_type = PDO::FETCH_USE_DEFAULT, $ms_timeout = 0) Added PDO::pgsqlGetPid() @@ -205,6 +252,9 @@ PHP 5.6 UPGRADE NOTES - Zip: Added ZipArchive::setPassword($password) +- SPL + Added SplFileObject::fread($length) to complement fwrite() method (>= 5.5.11) + ======================================== 6. New Classes and Interfaces ======================================== @@ -246,6 +296,15 @@ PHP 5.6 UPGRADE NOTES - The oci_internal_debug() function is now a no-op. - The phpinfo() output format for OCI8 has changed. +- OpenSSL: + - The "SNI_enabled" SSL stream context option is now set to TRUE by default + if supported by the underlying openssl library. + +- PCRE: + - The information collected by the (*MARK) backtracking control verb is now + collected into the "MARK" index of the $matches array for preg_match(), + preg_match_all() and preg_replace_callback(). + - Pgsql: - pg_insert()/pg_select()/pg_update()/pg_delete()/pg_meta_data()/pg_convert() are no longer EXPERIMENTAL @@ -256,6 +315,12 @@ PHP 5.6 UPGRADE NOTES - pg_select() returns PostgreSQL query resource when query is executed. - Added extended flag parameter for pg_meta_data(). pg_meta_data() always returns "is enum" attribute. + - The new pg_socket() function returns a socket stream with no behavior other + than to allow IO-readiness polling on a DB connection socket. Calling + stream_set_blocking() on its result enables non-blocking behavior. + - Passing the new PGSQL_CONNECT_ASYNC flag to pg_connect() allows applications + to poll for IO readiness via pg_connect_poll() and establish connections + asynchronously. - PDO_pgsql: - Added PDO::PGSQL_ATTR_DISABLE_PREPARES constant to execute the queries @@ -274,6 +339,18 @@ PHP 5.6 UPGRADE NOTES - Pgsql: PGSQL_DML_ESCAPE int(4096) + PGSQL_CONNECT_ASYNC + PGSQL_CONNECTION_STARTED + PGSQL_CONNECTION_MADE + PGSQL_CONNECTION_AWAITING_RESPONSE + PGSQL_CONNECTION_AUTH_OK + PGSQL_CONNECTION_SSL_STARTUP + PGSQL_CONNECTION_SETENV + PGSQL_POLLING_FAILED + PGSQL_POLLING_READING + PGSQL_POLLING_WRITING + PGSQL_POLLING_OK + PGSQL_POLLING_ACTIVE - OpenSSL: STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT int(9) @@ -295,6 +372,18 @@ PHP 5.6 UPGRADE NOTES enabled and to recognize the value -1 for never populating the global $HTTP_RAW_POST_DATA variable, which will be default in future PHP versions. + default_charset is set to UTF-8. It was empty previously. default_charset + is used where it is applicable. Iconv/Mbstring/htmlentities/htmlspecialchars/ + html_entity_decode use default_charset as default encoding. + + internal_encoding/input_encoding/output_encoding is added for encoding + handling modules. Refer to "Changes to encodings in PHP 5.6" in "11. Other Changes" + section for more details. + +- cURL: + If the new openssl.cafile ini directive is specified ext/curl will give the + openssl path precedence over its own curl.cainfo directive. + - OpenSSL: openssl.cafile and openssl.capath ini directives have been added to allow global CA default specification as necessary. @@ -318,3 +407,43 @@ PHP 5.6 UPGRADE NOTES - Zip: New --with-libzip option allow to use system libzip. Version > 0.11 required, Version >= 0.11.2 recommended for all features. + +- Changes to encodings in PHP 5.6 + The default value of default_charset is now UTF-8 when it is not + explicitly set in php.ini + + The following php.ini parameters were added: + internal_encoding + input_encoding + output_encoding + + The values of the following php.ini parameters have become empty in + PHP 5.6 (previously they were all ISO-8859-1) + + iconv.input_encoding + iconv.output_encoding + iconv.internal_encoding + + Changes were made to character set handling in: + - the iconv and mbstring extensions, + - and htmlentities(), htmlspecialchars(), html_entity_decode() functions + + The precedence for these is now: + + default_charset < internal/input/output_encoding < (mbstring.* || iconv.*) < function parameter + + For example, the easiest way to use the UTF-8 encoding is to set + default_charset=UTF-8 and leave the following php.ini parameters + + empty: + + iconv.input_encoding + iconv.output_encoding + iconv.internal_encoding + mbstring.http_input + mbstring.http_output + mbstring.internal_encoding + internal_encoding + input_encoding + output_encoding + diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index e8e0982042..474aed55f7 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -8,6 +8,7 @@ UPGRADE NOTES - PHP X.Y c. POST data handling d. Arginfo changes e. tsrm_virtual_cwd.h moved to zend_virtual_cwd.h + f. empty strings are interned 2. Build system changes a. Unix build system changes @@ -115,6 +116,13 @@ UPGRADE NOTES - PHP X.Y Memory allocation is now managed by emalloc/efree instead of malloc/free. + f. empty strings are interned + + String created using STR_EMPTY_ALLOC() are now interned. + convert_to_string use STR_EMPTY_ALLOC() for zval when IS_NULL. + STR_FREE() shoud be prefered as efree on such strings can raise memory corruption. + + ======================== 2. Build system changes ======================== diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 9b7d3689c6..e4570269e3 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -363,7 +363,7 @@ 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); + memmove((*str) + *len - l_added + 1 + vallen, (*str) + *len - l_added + 1, l_added); /* }}} */ diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 829cd33641..309631338a 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -29,18 +29,24 @@ (element)->pNext->pLast = (element); \ } -#define CONNECT_TO_GLOBAL_DLLIST(element, ht) \ - (element)->pListLast = (ht)->pListTail; \ - (ht)->pListTail = (element); \ - (element)->pListNext = NULL; \ - if ((element)->pListLast != NULL) { \ - (element)->pListLast->pListNext = (element); \ - } \ - if (!(ht)->pListHead) { \ +#define CONNECT_TO_GLOBAL_DLLIST_EX(element, ht, last, next)\ + (element)->pListLast = (last); \ + (element)->pListNext = (next); \ + if ((last) != NULL) { \ + (last)->pListNext = (element); \ + } else { \ (ht)->pListHead = (element); \ } \ - if ((ht)->pInternalPointer == NULL) { \ - (ht)->pInternalPointer = (element); \ + if ((next) != NULL) { \ + (next)->pListLast = (element); \ + } else { \ + (ht)->pListTail = (element); \ + } \ + +#define CONNECT_TO_GLOBAL_DLLIST(element, ht) \ + CONNECT_TO_GLOBAL_DLLIST_EX(element, ht, (ht)->pListTail, (Bucket *) NULL); \ + if ((ht)->pInternalPointer == NULL) { \ + (ht)->pInternalPointer = (element); \ } #if ZEND_DEBUG @@ -122,13 +128,13 @@ ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength) memcpy((p)->pData, pData, nDataSize); \ } -#define INIT_DATA(ht, p, pData, nDataSize); \ +#define INIT_DATA(ht, p, _pData, nDataSize); \ if (nDataSize == sizeof(void*)) { \ - memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \ + memcpy(&(p)->pDataPtr, (_pData), sizeof(void *)); \ (p)->pData = &(p)->pDataPtr; \ } else { \ (p)->pData = (void *) pemalloc_rel(nDataSize, (ht)->persistent);\ - memcpy((p)->pData, pData, nDataSize); \ + memcpy((p)->pData, (_pData), nDataSize); \ (p)->pDataPtr=NULL; \ } @@ -141,6 +147,51 @@ ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength) static const Bucket *uninitialized_bucket = NULL; +static zend_always_inline void i_zend_hash_bucket_delete(HashTable *ht, Bucket *p) +{ +#ifdef ZEND_SIGNALS + TSRMLS_FETCH(); +#endif + + HANDLE_BLOCK_INTERRUPTIONS(); + if (p->pLast) { + p->pLast->pNext = p->pNext; + } else { + ht->arBuckets[p->h & ht->nTableMask] = p->pNext; + } + if (p->pNext) { + p->pNext->pLast = p->pLast; + } + if (p->pListLast != NULL) { + p->pListLast->pListNext = p->pListNext; + } else { + /* Deleting the head of the list */ + ht->pListHead = p->pListNext; + } + if (p->pListNext != NULL) { + p->pListNext->pListLast = p->pListLast; + } else { + /* Deleting the tail of the list */ + ht->pListTail = p->pListLast; + } + if (ht->pInternalPointer == p) { + ht->pInternalPointer = p->pListNext; + } + ht->nNumOfElements--; + if (ht->pDestructor) { + ht->pDestructor(p->pData); + } + if (p->pData != &p->pDataPtr) { + pefree(p->pData, ht->persistent); + } + pefree(p, ht->persistent); + HANDLE_UNBLOCK_INTERRUPTIONS(); +} + +static void zend_hash_bucket_delete(HashTable *ht, Bucket *p) { + i_zend_hash_bucket_delete(ht, p); +} + ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC) { uint i = 3; @@ -358,9 +409,6 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void } UPDATE_DATA(ht, p, pData, nDataSize); HANDLE_UNBLOCK_INTERRUPTIONS(); - if ((long)h >= (long)ht->nNextFreeElement) { - ht->nNextFreeElement = h < LONG_MAX ? h + 1 : LONG_MAX; - } if (pDest) { *pDest = p->pData; } @@ -424,23 +472,42 @@ ZEND_API int zend_hash_rehash(HashTable *ht) } memset(ht->arBuckets, 0, ht->nTableSize * sizeof(Bucket *)); - p = ht->pListHead; - while (p != NULL) { + for (p = ht->pListHead; p != NULL; p = p->pListNext) { nIndex = p->h & ht->nTableMask; CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]); ht->arBuckets[nIndex] = p; - p = p->pListNext; } return SUCCESS; } +ZEND_API void zend_hash_reindex(HashTable *ht, zend_bool only_integer_keys) { + Bucket *p; + uint nIndex; + ulong offset = 0; + + IS_CONSISTENT(ht); + if (UNEXPECTED(ht->nNumOfElements == 0)) { + return; + } + + memset(ht->arBuckets, 0, ht->nTableSize * sizeof(Bucket *)); + for (p = ht->pListHead; p != NULL; p = p->pListNext) { + if (!only_integer_keys || p->nKeyLength == 0) { + p->h = offset++; + p->nKeyLength = 0; + } + + nIndex = p->h & ht->nTableMask; + CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]); + ht->arBuckets[nIndex] = p; + } + ht->nNextFreeElement = offset; +} + ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, int flag) { uint nIndex; Bucket *p; -#ifdef ZEND_SIGNALS - TSRMLS_FETCH(); -#endif IS_CONSISTENT(ht); @@ -455,38 +522,7 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint n && (p->nKeyLength == nKeyLength) && ((p->nKeyLength == 0) /* Numeric index (short circuits the memcmp() check) */ || !memcmp(p->arKey, arKey, nKeyLength))) { /* String index */ - HANDLE_BLOCK_INTERRUPTIONS(); - if (p == ht->arBuckets[nIndex]) { - ht->arBuckets[nIndex] = p->pNext; - } else { - p->pLast->pNext = p->pNext; - } - if (p->pNext) { - p->pNext->pLast = p->pLast; - } - if (p->pListLast != NULL) { - p->pListLast->pListNext = p->pListNext; - } else { - /* Deleting the head of the list */ - ht->pListHead = p->pListNext; - } - if (p->pListNext != NULL) { - p->pListNext->pListLast = p->pListLast; - } else { - ht->pListTail = p->pListLast; - } - if (ht->pInternalPointer == p) { - ht->pInternalPointer = p->pListNext; - } - ht->nNumOfElements--; - if (ht->pDestructor) { - ht->pDestructor(p->pData); - } - if (p->pData != &p->pDataPtr) { - pefree(p->pData, ht->persistent); - } - pefree(p, ht->persistent); - HANDLE_UNBLOCK_INTERRUPTIONS(); + i_zend_hash_bucket_delete(ht, p); return SUCCESS; } p = p->pNext; @@ -553,73 +589,14 @@ ZEND_API void zend_hash_clean(HashTable *ht) } } -/* This function is used by the various apply() functions. - * It deletes the passed bucket, and returns the address of the - * next bucket. The hash *may* be altered during that time, the - * returned value will still be valid. - */ -static Bucket *zend_hash_apply_deleter(HashTable *ht, Bucket *p) -{ - Bucket *retval; -#ifdef ZEND_SIGNALS - TSRMLS_FETCH(); -#endif - - HANDLE_BLOCK_INTERRUPTIONS(); - if (p->pLast) { - p->pLast->pNext = p->pNext; - } else { - uint nIndex; - - nIndex = p->h & ht->nTableMask; - ht->arBuckets[nIndex] = p->pNext; - } - if (p->pNext) { - p->pNext->pLast = p->pLast; - } else { - /* Nothing to do as this list doesn't have a tail */ - } - - if (p->pListLast != NULL) { - p->pListLast->pListNext = p->pListNext; - } else { - /* Deleting the head of the list */ - ht->pListHead = p->pListNext; - } - if (p->pListNext != NULL) { - p->pListNext->pListLast = p->pListLast; - } else { - ht->pListTail = p->pListLast; - } - if (ht->pInternalPointer == p) { - ht->pInternalPointer = p->pListNext; - } - ht->nNumOfElements--; - HANDLE_UNBLOCK_INTERRUPTIONS(); - - if (ht->pDestructor) { - ht->pDestructor(p->pData); - } - if (p->pData != &p->pDataPtr) { - pefree(p->pData, ht->persistent); - } - retval = p->pListNext; - pefree(p, ht->persistent); - - return retval; -} - - ZEND_API void zend_hash_graceful_destroy(HashTable *ht) { - Bucket *p; - IS_CONSISTENT(ht); - p = ht->pListHead; - while (p != NULL) { - p = zend_hash_apply_deleter(ht, p); + while (ht->pListHead != NULL) { + zend_hash_bucket_delete(ht, ht->pListHead); } + if (ht->nTableMask) { pefree(ht->arBuckets, ht->persistent); } @@ -629,14 +606,10 @@ ZEND_API void zend_hash_graceful_destroy(HashTable *ht) ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht) { - Bucket *p; - IS_CONSISTENT(ht); - p = ht->pListTail; - while (p != NULL) { - zend_hash_apply_deleter(ht, p); - p = ht->pListTail; + while (ht->pListTail != NULL) { + zend_hash_bucket_delete(ht, ht->pListTail); } if (ht->nTableMask) { @@ -665,12 +638,13 @@ ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC) p = ht->pListHead; while (p != NULL) { int result = apply_func(p->pData TSRMLS_CC); - + + Bucket *p_next = p->pListNext; if (result & ZEND_HASH_APPLY_REMOVE) { - p = zend_hash_apply_deleter(ht, p); - } else { - p = p->pListNext; + zend_hash_bucket_delete(ht, p); } + p = p_next; + if (result & ZEND_HASH_APPLY_STOP) { break; } @@ -690,11 +664,12 @@ ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t appl while (p != NULL) { int result = apply_func(p->pData, argument TSRMLS_CC); + Bucket *p_next = p->pListNext; if (result & ZEND_HASH_APPLY_REMOVE) { - p = zend_hash_apply_deleter(ht, p); - } else { - p = p->pListNext; + zend_hash_bucket_delete(ht, p); } + p = p_next; + if (result & ZEND_HASH_APPLY_STOP) { break; } @@ -716,17 +691,20 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func p = ht->pListHead; while (p != NULL) { int result; + Bucket *p_next; + va_start(args, num_args); hash_key.arKey = p->arKey; hash_key.nKeyLength = p->nKeyLength; hash_key.h = p->h; result = apply_func(p->pData TSRMLS_CC, num_args, args, &hash_key); + p_next = p->pListNext; if (result & ZEND_HASH_APPLY_REMOVE) { - p = zend_hash_apply_deleter(ht, p); - } else { - p = p->pListNext; + zend_hash_bucket_delete(ht, p); } + p = p_next; + if (result & ZEND_HASH_APPLY_STOP) { va_end(args); break; @@ -740,7 +718,7 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC) { - Bucket *p, *q; + Bucket *p; IS_CONSISTENT(ht); @@ -749,11 +727,12 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR while (p != NULL) { int result = apply_func(p->pData TSRMLS_CC); - q = p; - p = p->pListLast; + Bucket *p_last = p->pListLast; if (result & ZEND_HASH_APPLY_REMOVE) { - zend_hash_apply_deleter(ht, q); + zend_hash_bucket_delete(ht, p); } + p = p_last; + if (result & ZEND_HASH_APPLY_STOP) { break; } @@ -1223,8 +1202,6 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const return FAILURE; } - HANDLE_BLOCK_INTERRUPTIONS(); - if (q) { if (mode != HASH_UPDATE_KEY_ANYWAY) { Bucket *r = p->pListLast; @@ -1239,73 +1216,17 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const } if (mode & found) { /* delete current bucket */ - if (p == ht->arBuckets[p->h & ht->nTableMask]) { - ht->arBuckets[p->h & ht->nTableMask] = p->pNext; - } else { - p->pLast->pNext = p->pNext; - } - if (p->pNext) { - p->pNext->pLast = p->pLast; - } - if (p->pListLast != NULL) { - p->pListLast->pListNext = p->pListNext; - } else { - /* Deleting the head of the list */ - ht->pListHead = p->pListNext; - } - if (p->pListNext != NULL) { - p->pListNext->pListLast = p->pListLast; - } else { - ht->pListTail = p->pListLast; - } - if (ht->pInternalPointer == p) { - ht->pInternalPointer = p->pListNext; - } - ht->nNumOfElements--; - if (ht->pDestructor) { - ht->pDestructor(p->pData); - } - if (p->pData != &p->pDataPtr) { - pefree(p->pData, ht->persistent); - } - pefree(p, ht->persistent); - HANDLE_UNBLOCK_INTERRUPTIONS(); + zend_hash_bucket_delete(ht, p); return FAILURE; } } + /* delete another bucket with the same key */ - if (q == ht->arBuckets[q->h & ht->nTableMask]) { - ht->arBuckets[q->h & ht->nTableMask] = q->pNext; - } else { - q->pLast->pNext = q->pNext; - } - if (q->pNext) { - q->pNext->pLast = q->pLast; - } - if (q->pListLast != NULL) { - q->pListLast->pListNext = q->pListNext; - } else { - /* Deleting the head of the list */ - ht->pListHead = q->pListNext; - } - if (q->pListNext != NULL) { - q->pListNext->pListLast = q->pListLast; - } else { - ht->pListTail = q->pListLast; - } - if (ht->pInternalPointer == q) { - ht->pInternalPointer = q->pListNext; - } - ht->nNumOfElements--; - if (ht->pDestructor) { - ht->pDestructor(q->pData); - } - if (q->pData != &q->pDataPtr) { - pefree(q->pData, ht->persistent); - } - pefree(q, ht->persistent); + zend_hash_bucket_delete(ht, q); } + HANDLE_BLOCK_INTERRUPTIONS(); + if (p->pNext) { p->pNext->pLast = p->pLast; } @@ -1332,21 +1253,12 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const q->pData = p->pData; } q->pDataPtr = p->pDataPtr; - q->pListNext = p->pListNext; - q->pListLast = p->pListLast; - if (q->pListNext) { - p->pListNext->pListLast = q; - } else { - ht->pListTail = q; - } - if (q->pListLast) { - p->pListLast->pListNext = q; - } else { - ht->pListHead = q; - } + + CONNECT_TO_GLOBAL_DLLIST_EX(q, ht, p->pListLast, p->pListNext); if (ht->pInternalPointer == p) { ht->pInternalPointer = q; } + if (pos) { *pos = q; } @@ -1377,6 +1289,75 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const } } +/* Performs an in-place splice operation on a hashtable: + * The elements between offset and offset+length are removed and the elements in list[list_count] + * are inserted in their place. The removed elements can be optionally collected into a hashtable. + * This operation reindexes the hashtable, i.e. integer keys will be zero-based and sequential, + * while string keys stay intact. The same applies to the elements inserted into the removed HT. */ +ZEND_API void _zend_hash_splice(HashTable *ht, uint nDataSize, copy_ctor_func_t pCopyConstructor, uint offset, uint length, void **list, uint list_count, HashTable *removed ZEND_FILE_LINE_DC) /* {{{ */ +{ + int pos; + Bucket *p; + + IS_CONSISTENT(ht); + CHECK_INIT(ht); + + /* Skip all elements until offset */ + for (pos = 0, p = ht->pListHead; pos < offset && p; pos++, p = p->pListNext); + + while (pos < offset + length && p) { + /* Copy removed element into HT, if it was specified */ + if (removed != NULL) { + void *new_entry; + + if (p->nKeyLength == 0) { + zend_hash_next_index_insert(removed, p->pData, sizeof(zval *), &new_entry); + } else { + zend_hash_quick_update(removed, p->arKey, p->nKeyLength, p->h, p->pData, sizeof(zval *), &new_entry); + } + + if (pCopyConstructor) { + pCopyConstructor(new_entry); + } + } + + /* Remove element */ + { + Bucket *p_next = p->pListNext; + zend_hash_bucket_delete(ht, p); + p = p_next; + } + + pos++; + } + + if (list != NULL) { + int i; + for (i = 0; i < list_count; i++) { + /* Add new element only to the global linked list, not the bucket list. + * Also use key 0 for everything, as we'll reindex the hashtable anyways. */ + Bucket *q = pemalloc_rel(sizeof(Bucket), ht->persistent); + q->arKey = NULL; + q->nKeyLength = 0; + q->h = 0; + INIT_DATA(ht, q, list[i], nDataSize); + + CONNECT_TO_GLOBAL_DLLIST_EX(q, ht, p ? p->pListLast : ht->pListTail, p); + + ht->nNumOfElements++; + + if (pCopyConstructor) { + pCopyConstructor(q->pData); + } + } + + ZEND_HASH_IF_FULL_DO_RESIZE(ht); + } + + zend_hash_reindex(ht, 1); +} +/* }}} */ + ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compar, int renumber TSRMLS_DC) { @@ -1423,15 +1404,7 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, HANDLE_UNBLOCK_INTERRUPTIONS(); if (renumber) { - p = ht->pListHead; - i=0; - while (p != NULL) { - p->nKeyLength = 0; - p->h = i++; - p = p->pListNext; - } - ht->nNextFreeElement = i; - zend_hash_rehash(ht); + zend_hash_reindex(ht, 0); } return SUCCESS; } diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index d990c16674..03f83dfb18 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -227,6 +227,11 @@ ZEND_API int zend_hash_minmax(const HashTable *ht, compare_func_t compar, int fl ZEND_API int zend_hash_num_elements(const HashTable *ht); ZEND_API int zend_hash_rehash(HashTable *ht); +ZEND_API void zend_hash_reindex(HashTable *ht, zend_bool only_integer_keys); + +ZEND_API void _zend_hash_splice(HashTable *ht, uint nDataSize, copy_ctor_func_t pCopyConstructor, uint offset, uint length, void **list, uint list_count, HashTable *removed ZEND_FILE_LINE_DC); +#define zend_hash_splice(ht, nDataSize, pCopyConstructor, offset, length, list, list_count, removed) \ + _zend_hash_splice(ht, nDataSize, pCopyConstructor, offset, length, list, list_count, removed ZEND_FILE_LINE_CC) /* * DJBX33A (Daniel J. Bernstein, Times 33 with Addition) diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c index 2f440597ba..cc845584f0 100644 --- a/ext/bz2/bz2.c +++ b/ext/bz2/bz2.c @@ -31,6 +31,7 @@ #include "ext/standard/file.h" #include "ext/standard/info.h" #include "ext/standard/php_string.h" +#include "main/php_network.h" /* for fileno() */ #include <stdio.h> @@ -245,7 +246,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper, stream = php_stream_open_wrapper(path, mode, options | STREAM_WILL_CAST, opened_path); if (stream) { - int fd; + php_socket_t fd; if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **) &fd, REPORT_ERRORS)) { bz_file = BZ2_bzdopen(fd, mode); } @@ -394,7 +395,7 @@ static PHP_FUNCTION(bzopen) NULL); } else if (Z_TYPE_PP(file) == IS_RESOURCE) { /* If it is a resource, than its a stream resource */ - int fd; + php_socket_t fd; int stream_mode_len; php_stream_from_zval(stream, file); diff --git a/ext/date/lib/timezonedb.h b/ext/date/lib/timezonedb.h index 4a4b041882..d2292d63b1 100644 --- a/ext/date/lib/timezonedb.h +++ b/ext/date/lib/timezonedb.h @@ -1,4 +1,4 @@ -const timelib_tzdb_index_entry timezonedb_idx_builtin[579] = { +const timelib_tzdb_index_entry timezonedb_idx_builtin[580] = { { "Africa/Abidjan" , 0x000000 }, { "Africa/Accra" , 0x000055 }, { "Africa/Addis_Ababa" , 0x0000FD }, @@ -227,360 +227,361 @@ const timelib_tzdb_index_entry timezonedb_idx_builtin[579] = { { "Antarctica/Rothera" , 0x01848C }, { "Antarctica/South_Pole" , 0x018502 }, { "Antarctica/Syowa" , 0x018880 }, - { "Antarctica/Vostok" , 0x0188EE }, - { "Arctic/Longyearbyen" , 0x01895F }, - { "Asia/Aden" , 0x018C91 }, - { "Asia/Almaty" , 0x018CE6 }, - { "Asia/Amman" , 0x018E65 }, - { "Asia/Anadyr" , 0x01911B }, - { "Asia/Aqtau" , 0x019300 }, - { "Asia/Aqtobe" , 0x0194FF }, - { "Asia/Ashgabat" , 0x0196B7 }, - { "Asia/Ashkhabad" , 0x0197D4 }, - { "Asia/Baghdad" , 0x0198F1 }, - { "Asia/Bahrain" , 0x019A66 }, - { "Asia/Baku" , 0x019ACC }, - { "Asia/Bangkok" , 0x019DB4 }, - { "Asia/Beirut" , 0x019E09 }, - { "Asia/Bishkek" , 0x01A116 }, - { "Asia/Brunei" , 0x01A2C2 }, - { "Asia/Calcutta" , 0x01A324 }, - { "Asia/Choibalsan" , 0x01A39D }, - { "Asia/Chongqing" , 0x01A516 }, - { "Asia/Chungking" , 0x01A605 }, - { "Asia/Colombo" , 0x01A6B4 }, - { "Asia/Dacca" , 0x01A750 }, - { "Asia/Damascus" , 0x01A7F6 }, - { "Asia/Dhaka" , 0x01AB46 }, - { "Asia/Dili" , 0x01ABEC }, - { "Asia/Dubai" , 0x01AC76 }, - { "Asia/Dushanbe" , 0x01ACCB }, - { "Asia/Gaza" , 0x01ADCE }, - { "Asia/Harbin" , 0x01B121 }, - { "Asia/Hebron" , 0x01B208 }, - { "Asia/Ho_Chi_Minh" , 0x01B564 }, - { "Asia/Hong_Kong" , 0x01B5DC }, - { "Asia/Hovd" , 0x01B79E }, - { "Asia/Irkutsk" , 0x01B916 }, - { "Asia/Istanbul" , 0x01BAFC }, - { "Asia/Jakarta" , 0x01BEE9 }, - { "Asia/Jayapura" , 0x01BF93 }, - { "Asia/Jerusalem" , 0x01C02F }, - { "Asia/Kabul" , 0x01C35E }, - { "Asia/Kamchatka" , 0x01C3AF }, - { "Asia/Karachi" , 0x01C58B }, - { "Asia/Kashgar" , 0x01C640 }, - { "Asia/Kathmandu" , 0x01C711 }, - { "Asia/Katmandu" , 0x01C777 }, - { "Asia/Khandyga" , 0x01C7DD }, - { "Asia/Kolkata" , 0x01CA02 }, - { "Asia/Krasnoyarsk" , 0x01CA7B }, - { "Asia/Kuala_Lumpur" , 0x01CC63 }, - { "Asia/Kuching" , 0x01CD20 }, - { "Asia/Kuwait" , 0x01CE0E }, - { "Asia/Macao" , 0x01CE63 }, - { "Asia/Macau" , 0x01CF9E }, - { "Asia/Magadan" , 0x01D0D9 }, - { "Asia/Makassar" , 0x01D2BB }, - { "Asia/Manila" , 0x01D380 }, - { "Asia/Muscat" , 0x01D405 }, - { "Asia/Nicosia" , 0x01D45A }, - { "Asia/Novokuznetsk" , 0x01D742 }, - { "Asia/Novosibirsk" , 0x01D944 }, - { "Asia/Omsk" , 0x01DB2F }, - { "Asia/Oral" , 0x01DD16 }, - { "Asia/Phnom_Penh" , 0x01DEE6 }, - { "Asia/Pontianak" , 0x01DF5E }, - { "Asia/Pyongyang" , 0x01E020 }, - { "Asia/Qatar" , 0x01E08D }, - { "Asia/Qyzylorda" , 0x01E0F3 }, - { "Asia/Rangoon" , 0x01E2C9 }, - { "Asia/Riyadh" , 0x01E341 }, - { "Asia/Saigon" , 0x01E396 }, - { "Asia/Sakhalin" , 0x01E40E }, - { "Asia/Samarkand" , 0x01E605 }, - { "Asia/Seoul" , 0x01E73B }, - { "Asia/Shanghai" , 0x01E7DF }, - { "Asia/Singapore" , 0x01E8BF }, - { "Asia/Taipei" , 0x01E976 }, - { "Asia/Tashkent" , 0x01EA8E }, - { "Asia/Tbilisi" , 0x01EBBF }, - { "Asia/Tehran" , 0x01ED79 }, - { "Asia/Tel_Aviv" , 0x01EFE7 }, - { "Asia/Thimbu" , 0x01F316 }, - { "Asia/Thimphu" , 0x01F37C }, - { "Asia/Tokyo" , 0x01F3E2 }, - { "Asia/Ujung_Pandang" , 0x01F46B }, - { "Asia/Ulaanbaatar" , 0x01F4E8 }, - { "Asia/Ulan_Bator" , 0x01F643 }, - { "Asia/Urumqi" , 0x01F790 }, - { "Asia/Ust-Nera" , 0x01F857 }, - { "Asia/Vientiane" , 0x01FA5C }, - { "Asia/Vladivostok" , 0x01FAD4 }, - { "Asia/Yakutsk" , 0x01FCC0 }, - { "Asia/Yekaterinburg" , 0x01FEA5 }, - { "Asia/Yerevan" , 0x0200B0 }, - { "Atlantic/Azores" , 0x0202B0 }, - { "Atlantic/Bermuda" , 0x0207B3 }, - { "Atlantic/Canary" , 0x020A94 }, - { "Atlantic/Cape_Verde" , 0x020D6A }, - { "Atlantic/Faeroe" , 0x020DE3 }, - { "Atlantic/Faroe" , 0x021087 }, - { "Atlantic/Jan_Mayen" , 0x02132B }, - { "Atlantic/Madeira" , 0x02165D }, - { "Atlantic/Reykjavik" , 0x021B66 }, - { "Atlantic/South_Georgia" , 0x021D1F }, - { "Atlantic/St_Helena" , 0x021F31 }, - { "Atlantic/Stanley" , 0x021D63 }, - { "Australia/ACT" , 0x021F86 }, - { "Australia/Adelaide" , 0x0222A3 }, - { "Australia/Brisbane" , 0x0225CF }, - { "Australia/Broken_Hill" , 0x022696 }, - { "Australia/Canberra" , 0x0229D4 }, - { "Australia/Currie" , 0x022CF1 }, - { "Australia/Darwin" , 0x023024 }, - { "Australia/Eucla" , 0x0230AA }, - { "Australia/Hobart" , 0x02317F }, - { "Australia/LHI" , 0x0234DD }, - { "Australia/Lindeman" , 0x023778 }, - { "Australia/Lord_Howe" , 0x023859 }, - { "Australia/Melbourne" , 0x023B04 }, - { "Australia/North" , 0x023E29 }, - { "Australia/NSW" , 0x023E9D }, - { "Australia/Perth" , 0x0241BA }, - { "Australia/Queensland" , 0x024292 }, - { "Australia/South" , 0x02433E }, - { "Australia/Sydney" , 0x02465B }, - { "Australia/Tasmania" , 0x024998 }, - { "Australia/Victoria" , 0x024CDD }, - { "Australia/West" , 0x024FFA }, - { "Australia/Yancowinna" , 0x0250B0 }, - { "Brazil/Acre" , 0x0253D2 }, - { "Brazil/DeNoronha" , 0x0254D6 }, - { "Brazil/East" , 0x0255F6 }, - { "Brazil/West" , 0x0258D3 }, - { "Canada/Atlantic" , 0x0259CB }, - { "Canada/Central" , 0x025EB3 }, - { "Canada/East-Saskatchewan" , 0x0267BD }, - { "Canada/Eastern" , 0x0262CD }, - { "Canada/Mountain" , 0x026946 }, - { "Canada/Newfoundland" , 0x026CBC }, - { "Canada/Pacific" , 0x0271E7 }, - { "Canada/Saskatchewan" , 0x027600 }, - { "Canada/Yukon" , 0x027789 }, - { "CET" , 0x027A8C }, - { "Chile/Continental" , 0x027D95 }, - { "Chile/EasterIsland" , 0x028130 }, - { "CST6CDT" , 0x028472 }, - { "Cuba" , 0x0287C3 }, - { "EET" , 0x028B36 }, - { "Egypt" , 0x028DE9 }, - { "Eire" , 0x0290AC }, - { "EST" , 0x0295BD }, - { "EST5EDT" , 0x029601 }, - { "Etc/GMT" , 0x029952 }, - { "Etc/GMT+0" , 0x029A1E }, - { "Etc/GMT+1" , 0x029AA8 }, - { "Etc/GMT+10" , 0x029B35 }, - { "Etc/GMT+11" , 0x029BC3 }, - { "Etc/GMT+12" , 0x029C51 }, - { "Etc/GMT+2" , 0x029D6C }, - { "Etc/GMT+3" , 0x029DF8 }, - { "Etc/GMT+4" , 0x029E84 }, - { "Etc/GMT+5" , 0x029F10 }, - { "Etc/GMT+6" , 0x029F9C }, - { "Etc/GMT+7" , 0x02A028 }, - { "Etc/GMT+8" , 0x02A0B4 }, - { "Etc/GMT+9" , 0x02A140 }, - { "Etc/GMT-0" , 0x0299DA }, - { "Etc/GMT-1" , 0x029A62 }, - { "Etc/GMT-10" , 0x029AEE }, - { "Etc/GMT-11" , 0x029B7C }, - { "Etc/GMT-12" , 0x029C0A }, - { "Etc/GMT-13" , 0x029C98 }, - { "Etc/GMT-14" , 0x029CDF }, - { "Etc/GMT-2" , 0x029D26 }, - { "Etc/GMT-3" , 0x029DB2 }, - { "Etc/GMT-4" , 0x029E3E }, - { "Etc/GMT-5" , 0x029ECA }, - { "Etc/GMT-6" , 0x029F56 }, - { "Etc/GMT-7" , 0x029FE2 }, - { "Etc/GMT-8" , 0x02A06E }, - { "Etc/GMT-9" , 0x02A0FA }, - { "Etc/GMT0" , 0x029996 }, - { "Etc/Greenwich" , 0x02A186 }, - { "Etc/UCT" , 0x02A1CA }, - { "Etc/Universal" , 0x02A20E }, - { "Etc/UTC" , 0x02A252 }, - { "Etc/Zulu" , 0x02A296 }, - { "Europe/Amsterdam" , 0x02A2DA }, - { "Europe/Andorra" , 0x02A718 }, - { "Europe/Athens" , 0x02A994 }, - { "Europe/Belfast" , 0x02ACD7 }, - { "Europe/Belgrade" , 0x02B20E }, - { "Europe/Berlin" , 0x02B4D7 }, - { "Europe/Bratislava" , 0x02B83B }, - { "Europe/Brussels" , 0x02BB6D }, - { "Europe/Bucharest" , 0x02BFA4 }, - { "Europe/Budapest" , 0x02C2CE }, - { "Europe/Busingen" , 0x02C641 }, - { "Europe/Chisinau" , 0x02C8F8 }, - { "Europe/Copenhagen" , 0x02CC86 }, - { "Europe/Dublin" , 0x02CF90 }, - { "Europe/Gibraltar" , 0x02D4A1 }, - { "Europe/Guernsey" , 0x02D8F8 }, - { "Europe/Helsinki" , 0x02DE2F }, - { "Europe/Isle_of_Man" , 0x02E0E5 }, - { "Europe/Istanbul" , 0x02E61C }, - { "Europe/Jersey" , 0x02EA09 }, - { "Europe/Kaliningrad" , 0x02EF40 }, - { "Europe/Kiev" , 0x02F1A6 }, - { "Europe/Lisbon" , 0x02F4BD }, - { "Europe/Ljubljana" , 0x02F9C1 }, - { "Europe/London" , 0x02FC8A }, - { "Europe/Luxembourg" , 0x0301C1 }, - { "Europe/Madrid" , 0x030617 }, - { "Europe/Malta" , 0x0309DD }, - { "Europe/Mariehamn" , 0x030D96 }, - { "Europe/Minsk" , 0x03104C }, - { "Europe/Monaco" , 0x03125A }, - { "Europe/Moscow" , 0x031695 }, - { "Europe/Nicosia" , 0x0318E6 }, - { "Europe/Oslo" , 0x031BCE }, - { "Europe/Paris" , 0x031F00 }, - { "Europe/Podgorica" , 0x032346 }, - { "Europe/Prague" , 0x03260F }, - { "Europe/Riga" , 0x032941 }, - { "Europe/Rome" , 0x032C86 }, - { "Europe/Samara" , 0x033049 }, - { "Europe/San_Marino" , 0x03327C }, - { "Europe/Sarajevo" , 0x03363F }, - { "Europe/Simferopol" , 0x033908 }, - { "Europe/Skopje" , 0x033C33 }, - { "Europe/Sofia" , 0x033EFC }, - { "Europe/Stockholm" , 0x034204 }, - { "Europe/Tallinn" , 0x0344B3 }, - { "Europe/Tirane" , 0x0347ED }, - { "Europe/Tiraspol" , 0x034AF3 }, - { "Europe/Uzhgorod" , 0x034E81 }, - { "Europe/Vaduz" , 0x035198 }, - { "Europe/Vatican" , 0x035447 }, - { "Europe/Vienna" , 0x03580A }, - { "Europe/Vilnius" , 0x035B37 }, - { "Europe/Volgograd" , 0x035E76 }, - { "Europe/Warsaw" , 0x036076 }, - { "Europe/Zagreb" , 0x036457 }, - { "Europe/Zaporozhye" , 0x036720 }, - { "Europe/Zurich" , 0x036A61 }, - { "Factory" , 0x036D10 }, - { "GB" , 0x036D81 }, - { "GB-Eire" , 0x0372B8 }, - { "GMT" , 0x0377EF }, - { "GMT+0" , 0x0378BB }, - { "GMT-0" , 0x037877 }, - { "GMT0" , 0x037833 }, - { "Greenwich" , 0x0378FF }, - { "Hongkong" , 0x037943 }, - { "HST" , 0x037B05 }, - { "Iceland" , 0x037B49 }, - { "Indian/Antananarivo" , 0x037D02 }, - { "Indian/Chagos" , 0x037D76 }, - { "Indian/Christmas" , 0x037DD8 }, - { "Indian/Cocos" , 0x037E1C }, - { "Indian/Comoro" , 0x037E60 }, - { "Indian/Kerguelen" , 0x037EB5 }, - { "Indian/Mahe" , 0x037F0A }, - { "Indian/Maldives" , 0x037F5F }, - { "Indian/Mauritius" , 0x037FB4 }, - { "Indian/Mayotte" , 0x03802A }, - { "Indian/Reunion" , 0x03807F }, - { "Iran" , 0x0380D4 }, - { "Israel" , 0x038342 }, - { "Jamaica" , 0x038671 }, - { "Japan" , 0x038736 }, - { "Kwajalein" , 0x0387BF }, - { "Libya" , 0x038822 }, - { "MET" , 0x03892B }, - { "Mexico/BajaNorte" , 0x038C34 }, - { "Mexico/BajaSur" , 0x038F9D }, - { "Mexico/General" , 0x0391E2 }, - { "MST" , 0x039440 }, - { "MST7MDT" , 0x039484 }, - { "Navajo" , 0x0397D5 }, - { "NZ" , 0x039B4E }, - { "NZ-CHAT" , 0x039ECC }, - { "Pacific/Apia" , 0x03A1B4 }, - { "Pacific/Auckland" , 0x03A350 }, - { "Pacific/Chatham" , 0x03A6DC }, - { "Pacific/Chuuk" , 0x03A9D3 }, - { "Pacific/Easter" , 0x03AA2C }, - { "Pacific/Efate" , 0x03AD8A }, - { "Pacific/Enderbury" , 0x03AE50 }, - { "Pacific/Fakaofo" , 0x03AEBE }, - { "Pacific/Fiji" , 0x03AF0F }, - { "Pacific/Funafuti" , 0x03B0A2 }, - { "Pacific/Galapagos" , 0x03B0E6 }, - { "Pacific/Gambier" , 0x03B15E }, - { "Pacific/Guadalcanal" , 0x03B1C3 }, - { "Pacific/Guam" , 0x03B218 }, - { "Pacific/Honolulu" , 0x03B26E }, - { "Pacific/Johnston" , 0x03B2E5 }, - { "Pacific/Kiritimati" , 0x03B364 }, - { "Pacific/Kosrae" , 0x03B3CF }, - { "Pacific/Kwajalein" , 0x03B42C }, - { "Pacific/Majuro" , 0x03B498 }, - { "Pacific/Marquesas" , 0x03B4F7 }, - { "Pacific/Midway" , 0x03B55E }, - { "Pacific/Nauru" , 0x03B5E8 }, - { "Pacific/Niue" , 0x03B660 }, - { "Pacific/Norfolk" , 0x03B6BE }, - { "Pacific/Noumea" , 0x03B713 }, - { "Pacific/Pago_Pago" , 0x03B7A3 }, - { "Pacific/Palau" , 0x03B82C }, - { "Pacific/Pitcairn" , 0x03B870 }, - { "Pacific/Pohnpei" , 0x03B8C5 }, - { "Pacific/Ponape" , 0x03B91A }, - { "Pacific/Port_Moresby" , 0x03B95F }, - { "Pacific/Rarotonga" , 0x03B9A3 }, - { "Pacific/Saipan" , 0x03BA7F }, - { "Pacific/Samoa" , 0x03BAE2 }, - { "Pacific/Tahiti" , 0x03BB6B }, - { "Pacific/Tarawa" , 0x03BBD0 }, - { "Pacific/Tongatapu" , 0x03BC24 }, - { "Pacific/Truk" , 0x03BCB0 }, - { "Pacific/Wake" , 0x03BCF5 }, - { "Pacific/Wallis" , 0x03BD45 }, - { "Pacific/Yap" , 0x03BD89 }, - { "Poland" , 0x03BDCE }, - { "Portugal" , 0x03C1AF }, - { "PRC" , 0x03C6AB }, - { "PST8PDT" , 0x03C75C }, - { "ROC" , 0x03CAAD }, - { "ROK" , 0x03CBC5 }, - { "Singapore" , 0x03CC69 }, - { "Turkey" , 0x03CD20 }, - { "UCT" , 0x03D10D }, - { "Universal" , 0x03D151 }, - { "US/Alaska" , 0x03D195 }, - { "US/Aleutian" , 0x03D4FE }, - { "US/Arizona" , 0x03D864 }, - { "US/Central" , 0x03D8F2 }, - { "US/East-Indiana" , 0x03E2FC }, - { "US/Eastern" , 0x03DDFD }, - { "US/Hawaii" , 0x03E566 }, - { "US/Indiana-Starke" , 0x03E5D7 }, - { "US/Michigan" , 0x03E948 }, - { "US/Mountain" , 0x03EC7F }, - { "US/Pacific" , 0x03EFF8 }, - { "US/Pacific-New" , 0x03F3FD }, - { "US/Samoa" , 0x03F802 }, - { "UTC" , 0x03F88B }, - { "W-SU" , 0x03FB82 }, - { "WET" , 0x03F8CF }, - { "Zulu" , 0x03FDBC }, + { "Antarctica/Troll" , 0x0188EE }, + { "Antarctica/Vostok" , 0x018AC0 }, + { "Arctic/Longyearbyen" , 0x018B31 }, + { "Asia/Aden" , 0x018E63 }, + { "Asia/Almaty" , 0x018EB8 }, + { "Asia/Amman" , 0x019037 }, + { "Asia/Anadyr" , 0x0192ED }, + { "Asia/Aqtau" , 0x0194D2 }, + { "Asia/Aqtobe" , 0x0196D1 }, + { "Asia/Ashgabat" , 0x019889 }, + { "Asia/Ashkhabad" , 0x0199A6 }, + { "Asia/Baghdad" , 0x019AC3 }, + { "Asia/Bahrain" , 0x019C38 }, + { "Asia/Baku" , 0x019C9E }, + { "Asia/Bangkok" , 0x019F86 }, + { "Asia/Beirut" , 0x019FDB }, + { "Asia/Bishkek" , 0x01A2E8 }, + { "Asia/Brunei" , 0x01A494 }, + { "Asia/Calcutta" , 0x01A4F6 }, + { "Asia/Choibalsan" , 0x01A56F }, + { "Asia/Chongqing" , 0x01A6E8 }, + { "Asia/Chungking" , 0x01A7D7 }, + { "Asia/Colombo" , 0x01A886 }, + { "Asia/Dacca" , 0x01A922 }, + { "Asia/Damascus" , 0x01A9C8 }, + { "Asia/Dhaka" , 0x01AD18 }, + { "Asia/Dili" , 0x01ADBE }, + { "Asia/Dubai" , 0x01AE48 }, + { "Asia/Dushanbe" , 0x01AE9D }, + { "Asia/Gaza" , 0x01AFA0 }, + { "Asia/Harbin" , 0x01B2F3 }, + { "Asia/Hebron" , 0x01B3DA }, + { "Asia/Ho_Chi_Minh" , 0x01B736 }, + { "Asia/Hong_Kong" , 0x01B7AE }, + { "Asia/Hovd" , 0x01B970 }, + { "Asia/Irkutsk" , 0x01BAE8 }, + { "Asia/Istanbul" , 0x01BCCE }, + { "Asia/Jakarta" , 0x01C0BB }, + { "Asia/Jayapura" , 0x01C165 }, + { "Asia/Jerusalem" , 0x01C201 }, + { "Asia/Kabul" , 0x01C530 }, + { "Asia/Kamchatka" , 0x01C581 }, + { "Asia/Karachi" , 0x01C75D }, + { "Asia/Kashgar" , 0x01C812 }, + { "Asia/Kathmandu" , 0x01C8E3 }, + { "Asia/Katmandu" , 0x01C949 }, + { "Asia/Khandyga" , 0x01C9AF }, + { "Asia/Kolkata" , 0x01CBD4 }, + { "Asia/Krasnoyarsk" , 0x01CC4D }, + { "Asia/Kuala_Lumpur" , 0x01CE35 }, + { "Asia/Kuching" , 0x01CEF2 }, + { "Asia/Kuwait" , 0x01CFE0 }, + { "Asia/Macao" , 0x01D035 }, + { "Asia/Macau" , 0x01D170 }, + { "Asia/Magadan" , 0x01D2AB }, + { "Asia/Makassar" , 0x01D48D }, + { "Asia/Manila" , 0x01D552 }, + { "Asia/Muscat" , 0x01D5D7 }, + { "Asia/Nicosia" , 0x01D62C }, + { "Asia/Novokuznetsk" , 0x01D914 }, + { "Asia/Novosibirsk" , 0x01DB16 }, + { "Asia/Omsk" , 0x01DD01 }, + { "Asia/Oral" , 0x01DEE8 }, + { "Asia/Phnom_Penh" , 0x01E0B8 }, + { "Asia/Pontianak" , 0x01E130 }, + { "Asia/Pyongyang" , 0x01E1F2 }, + { "Asia/Qatar" , 0x01E25F }, + { "Asia/Qyzylorda" , 0x01E2C5 }, + { "Asia/Rangoon" , 0x01E49B }, + { "Asia/Riyadh" , 0x01E513 }, + { "Asia/Saigon" , 0x01E568 }, + { "Asia/Sakhalin" , 0x01E5E0 }, + { "Asia/Samarkand" , 0x01E7D7 }, + { "Asia/Seoul" , 0x01E90D }, + { "Asia/Shanghai" , 0x01E9B1 }, + { "Asia/Singapore" , 0x01EA91 }, + { "Asia/Taipei" , 0x01EB48 }, + { "Asia/Tashkent" , 0x01EC60 }, + { "Asia/Tbilisi" , 0x01ED91 }, + { "Asia/Tehran" , 0x01EF4B }, + { "Asia/Tel_Aviv" , 0x01F1B9 }, + { "Asia/Thimbu" , 0x01F4E8 }, + { "Asia/Thimphu" , 0x01F54E }, + { "Asia/Tokyo" , 0x01F5B4 }, + { "Asia/Ujung_Pandang" , 0x01F63D }, + { "Asia/Ulaanbaatar" , 0x01F6BA }, + { "Asia/Ulan_Bator" , 0x01F815 }, + { "Asia/Urumqi" , 0x01F962 }, + { "Asia/Ust-Nera" , 0x01FA29 }, + { "Asia/Vientiane" , 0x01FC2E }, + { "Asia/Vladivostok" , 0x01FCA6 }, + { "Asia/Yakutsk" , 0x01FE92 }, + { "Asia/Yekaterinburg" , 0x020077 }, + { "Asia/Yerevan" , 0x020282 }, + { "Atlantic/Azores" , 0x020482 }, + { "Atlantic/Bermuda" , 0x020985 }, + { "Atlantic/Canary" , 0x020C66 }, + { "Atlantic/Cape_Verde" , 0x020F3C }, + { "Atlantic/Faeroe" , 0x020FB5 }, + { "Atlantic/Faroe" , 0x021259 }, + { "Atlantic/Jan_Mayen" , 0x0214FD }, + { "Atlantic/Madeira" , 0x02182F }, + { "Atlantic/Reykjavik" , 0x021D38 }, + { "Atlantic/South_Georgia" , 0x021EF1 }, + { "Atlantic/St_Helena" , 0x022103 }, + { "Atlantic/Stanley" , 0x021F35 }, + { "Australia/ACT" , 0x022158 }, + { "Australia/Adelaide" , 0x022475 }, + { "Australia/Brisbane" , 0x0227A1 }, + { "Australia/Broken_Hill" , 0x022868 }, + { "Australia/Canberra" , 0x022BA6 }, + { "Australia/Currie" , 0x022EC3 }, + { "Australia/Darwin" , 0x0231F6 }, + { "Australia/Eucla" , 0x02327C }, + { "Australia/Hobart" , 0x023351 }, + { "Australia/LHI" , 0x0236AF }, + { "Australia/Lindeman" , 0x02394A }, + { "Australia/Lord_Howe" , 0x023A2B }, + { "Australia/Melbourne" , 0x023CD6 }, + { "Australia/North" , 0x023FFB }, + { "Australia/NSW" , 0x02406F }, + { "Australia/Perth" , 0x02438C }, + { "Australia/Queensland" , 0x024464 }, + { "Australia/South" , 0x024510 }, + { "Australia/Sydney" , 0x02482D }, + { "Australia/Tasmania" , 0x024B6A }, + { "Australia/Victoria" , 0x024EAF }, + { "Australia/West" , 0x0251CC }, + { "Australia/Yancowinna" , 0x025282 }, + { "Brazil/Acre" , 0x0255A4 }, + { "Brazil/DeNoronha" , 0x0256A8 }, + { "Brazil/East" , 0x0257C8 }, + { "Brazil/West" , 0x025AA5 }, + { "Canada/Atlantic" , 0x025B9D }, + { "Canada/Central" , 0x026085 }, + { "Canada/East-Saskatchewan" , 0x02698F }, + { "Canada/Eastern" , 0x02649F }, + { "Canada/Mountain" , 0x026B18 }, + { "Canada/Newfoundland" , 0x026E8E }, + { "Canada/Pacific" , 0x0273B9 }, + { "Canada/Saskatchewan" , 0x0277D2 }, + { "Canada/Yukon" , 0x02795B }, + { "CET" , 0x027C5E }, + { "Chile/Continental" , 0x027F67 }, + { "Chile/EasterIsland" , 0x028302 }, + { "CST6CDT" , 0x028644 }, + { "Cuba" , 0x028995 }, + { "EET" , 0x028D08 }, + { "Egypt" , 0x028FBB }, + { "Eire" , 0x02927E }, + { "EST" , 0x02978F }, + { "EST5EDT" , 0x0297D3 }, + { "Etc/GMT" , 0x029B24 }, + { "Etc/GMT+0" , 0x029BF0 }, + { "Etc/GMT+1" , 0x029C7A }, + { "Etc/GMT+10" , 0x029D07 }, + { "Etc/GMT+11" , 0x029D95 }, + { "Etc/GMT+12" , 0x029E23 }, + { "Etc/GMT+2" , 0x029F3E }, + { "Etc/GMT+3" , 0x029FCA }, + { "Etc/GMT+4" , 0x02A056 }, + { "Etc/GMT+5" , 0x02A0E2 }, + { "Etc/GMT+6" , 0x02A16E }, + { "Etc/GMT+7" , 0x02A1FA }, + { "Etc/GMT+8" , 0x02A286 }, + { "Etc/GMT+9" , 0x02A312 }, + { "Etc/GMT-0" , 0x029BAC }, + { "Etc/GMT-1" , 0x029C34 }, + { "Etc/GMT-10" , 0x029CC0 }, + { "Etc/GMT-11" , 0x029D4E }, + { "Etc/GMT-12" , 0x029DDC }, + { "Etc/GMT-13" , 0x029E6A }, + { "Etc/GMT-14" , 0x029EB1 }, + { "Etc/GMT-2" , 0x029EF8 }, + { "Etc/GMT-3" , 0x029F84 }, + { "Etc/GMT-4" , 0x02A010 }, + { "Etc/GMT-5" , 0x02A09C }, + { "Etc/GMT-6" , 0x02A128 }, + { "Etc/GMT-7" , 0x02A1B4 }, + { "Etc/GMT-8" , 0x02A240 }, + { "Etc/GMT-9" , 0x02A2CC }, + { "Etc/GMT0" , 0x029B68 }, + { "Etc/Greenwich" , 0x02A358 }, + { "Etc/UCT" , 0x02A39C }, + { "Etc/Universal" , 0x02A3E0 }, + { "Etc/UTC" , 0x02A424 }, + { "Etc/Zulu" , 0x02A468 }, + { "Europe/Amsterdam" , 0x02A4AC }, + { "Europe/Andorra" , 0x02A8EA }, + { "Europe/Athens" , 0x02AB66 }, + { "Europe/Belfast" , 0x02AEA9 }, + { "Europe/Belgrade" , 0x02B3E0 }, + { "Europe/Berlin" , 0x02B6A9 }, + { "Europe/Bratislava" , 0x02BA0D }, + { "Europe/Brussels" , 0x02BD3F }, + { "Europe/Bucharest" , 0x02C176 }, + { "Europe/Budapest" , 0x02C4A0 }, + { "Europe/Busingen" , 0x02C813 }, + { "Europe/Chisinau" , 0x02CACA }, + { "Europe/Copenhagen" , 0x02CE58 }, + { "Europe/Dublin" , 0x02D162 }, + { "Europe/Gibraltar" , 0x02D673 }, + { "Europe/Guernsey" , 0x02DACA }, + { "Europe/Helsinki" , 0x02E001 }, + { "Europe/Isle_of_Man" , 0x02E2B7 }, + { "Europe/Istanbul" , 0x02E7EE }, + { "Europe/Jersey" , 0x02EBDB }, + { "Europe/Kaliningrad" , 0x02F112 }, + { "Europe/Kiev" , 0x02F378 }, + { "Europe/Lisbon" , 0x02F694 }, + { "Europe/Ljubljana" , 0x02FB98 }, + { "Europe/London" , 0x02FE61 }, + { "Europe/Luxembourg" , 0x030398 }, + { "Europe/Madrid" , 0x0307EE }, + { "Europe/Malta" , 0x030BB4 }, + { "Europe/Mariehamn" , 0x030F6D }, + { "Europe/Minsk" , 0x031223 }, + { "Europe/Monaco" , 0x031431 }, + { "Europe/Moscow" , 0x03186C }, + { "Europe/Nicosia" , 0x031ABD }, + { "Europe/Oslo" , 0x031DA5 }, + { "Europe/Paris" , 0x0320D7 }, + { "Europe/Podgorica" , 0x03251D }, + { "Europe/Prague" , 0x0327E6 }, + { "Europe/Riga" , 0x032B18 }, + { "Europe/Rome" , 0x032E5D }, + { "Europe/Samara" , 0x033220 }, + { "Europe/San_Marino" , 0x033453 }, + { "Europe/Sarajevo" , 0x033816 }, + { "Europe/Simferopol" , 0x033ADF }, + { "Europe/Skopje" , 0x033D2B }, + { "Europe/Sofia" , 0x033FF4 }, + { "Europe/Stockholm" , 0x0342FC }, + { "Europe/Tallinn" , 0x0345AB }, + { "Europe/Tirane" , 0x0348E5 }, + { "Europe/Tiraspol" , 0x034BEB }, + { "Europe/Uzhgorod" , 0x034F79 }, + { "Europe/Vaduz" , 0x035290 }, + { "Europe/Vatican" , 0x03553F }, + { "Europe/Vienna" , 0x035902 }, + { "Europe/Vilnius" , 0x035C2F }, + { "Europe/Volgograd" , 0x035F6E }, + { "Europe/Warsaw" , 0x03616E }, + { "Europe/Zagreb" , 0x03654F }, + { "Europe/Zaporozhye" , 0x036818 }, + { "Europe/Zurich" , 0x036B59 }, + { "Factory" , 0x036E08 }, + { "GB" , 0x036E79 }, + { "GB-Eire" , 0x0373B0 }, + { "GMT" , 0x0378E7 }, + { "GMT+0" , 0x0379B3 }, + { "GMT-0" , 0x03796F }, + { "GMT0" , 0x03792B }, + { "Greenwich" , 0x0379F7 }, + { "Hongkong" , 0x037A3B }, + { "HST" , 0x037BFD }, + { "Iceland" , 0x037C41 }, + { "Indian/Antananarivo" , 0x037DFA }, + { "Indian/Chagos" , 0x037E6E }, + { "Indian/Christmas" , 0x037ED0 }, + { "Indian/Cocos" , 0x037F14 }, + { "Indian/Comoro" , 0x037F58 }, + { "Indian/Kerguelen" , 0x037FAD }, + { "Indian/Mahe" , 0x038002 }, + { "Indian/Maldives" , 0x038057 }, + { "Indian/Mauritius" , 0x0380AC }, + { "Indian/Mayotte" , 0x038122 }, + { "Indian/Reunion" , 0x038177 }, + { "Iran" , 0x0381CC }, + { "Israel" , 0x03843A }, + { "Jamaica" , 0x038769 }, + { "Japan" , 0x03882E }, + { "Kwajalein" , 0x0388B7 }, + { "Libya" , 0x03891A }, + { "MET" , 0x038A23 }, + { "Mexico/BajaNorte" , 0x038D2C }, + { "Mexico/BajaSur" , 0x039095 }, + { "Mexico/General" , 0x0392DA }, + { "MST" , 0x039538 }, + { "MST7MDT" , 0x03957C }, + { "Navajo" , 0x0398CD }, + { "NZ" , 0x039C46 }, + { "NZ-CHAT" , 0x039FC4 }, + { "Pacific/Apia" , 0x03A2AC }, + { "Pacific/Auckland" , 0x03A448 }, + { "Pacific/Chatham" , 0x03A7D4 }, + { "Pacific/Chuuk" , 0x03AACB }, + { "Pacific/Easter" , 0x03AB24 }, + { "Pacific/Efate" , 0x03AE82 }, + { "Pacific/Enderbury" , 0x03AF48 }, + { "Pacific/Fakaofo" , 0x03AFB6 }, + { "Pacific/Fiji" , 0x03B007 }, + { "Pacific/Funafuti" , 0x03B19A }, + { "Pacific/Galapagos" , 0x03B1DE }, + { "Pacific/Gambier" , 0x03B256 }, + { "Pacific/Guadalcanal" , 0x03B2BB }, + { "Pacific/Guam" , 0x03B310 }, + { "Pacific/Honolulu" , 0x03B366 }, + { "Pacific/Johnston" , 0x03B3DD }, + { "Pacific/Kiritimati" , 0x03B45C }, + { "Pacific/Kosrae" , 0x03B4C7 }, + { "Pacific/Kwajalein" , 0x03B524 }, + { "Pacific/Majuro" , 0x03B590 }, + { "Pacific/Marquesas" , 0x03B5EF }, + { "Pacific/Midway" , 0x03B656 }, + { "Pacific/Nauru" , 0x03B6E0 }, + { "Pacific/Niue" , 0x03B758 }, + { "Pacific/Norfolk" , 0x03B7B6 }, + { "Pacific/Noumea" , 0x03B80B }, + { "Pacific/Pago_Pago" , 0x03B89B }, + { "Pacific/Palau" , 0x03B924 }, + { "Pacific/Pitcairn" , 0x03B968 }, + { "Pacific/Pohnpei" , 0x03B9BD }, + { "Pacific/Ponape" , 0x03BA12 }, + { "Pacific/Port_Moresby" , 0x03BA57 }, + { "Pacific/Rarotonga" , 0x03BA9B }, + { "Pacific/Saipan" , 0x03BB77 }, + { "Pacific/Samoa" , 0x03BBDA }, + { "Pacific/Tahiti" , 0x03BC63 }, + { "Pacific/Tarawa" , 0x03BCC8 }, + { "Pacific/Tongatapu" , 0x03BD1C }, + { "Pacific/Truk" , 0x03BDA8 }, + { "Pacific/Wake" , 0x03BDED }, + { "Pacific/Wallis" , 0x03BE3D }, + { "Pacific/Yap" , 0x03BE81 }, + { "Poland" , 0x03BEC6 }, + { "Portugal" , 0x03C2A7 }, + { "PRC" , 0x03C7A3 }, + { "PST8PDT" , 0x03C854 }, + { "ROC" , 0x03CBA5 }, + { "ROK" , 0x03CCBD }, + { "Singapore" , 0x03CD61 }, + { "Turkey" , 0x03CE18 }, + { "UCT" , 0x03D205 }, + { "Universal" , 0x03D249 }, + { "US/Alaska" , 0x03D28D }, + { "US/Aleutian" , 0x03D5F6 }, + { "US/Arizona" , 0x03D95C }, + { "US/Central" , 0x03D9EA }, + { "US/East-Indiana" , 0x03E3F4 }, + { "US/Eastern" , 0x03DEF5 }, + { "US/Hawaii" , 0x03E65E }, + { "US/Indiana-Starke" , 0x03E6CF }, + { "US/Michigan" , 0x03EA40 }, + { "US/Mountain" , 0x03ED77 }, + { "US/Pacific" , 0x03F0F0 }, + { "US/Pacific-New" , 0x03F4F5 }, + { "US/Samoa" , 0x03F8FA }, + { "UTC" , 0x03F983 }, + { "W-SU" , 0x03FC7A }, + { "WET" , 0x03F9C7 }, + { "Zulu" , 0x03FEB4 }, }; /* This is a generated file, do not modify */ -const unsigned char timelib_timezone_db_data_builtin[261632] = { +const unsigned char timelib_timezone_db_data_builtin[261880] = { /* Africa/Abidjan */ @@ -7452,6 +7453,38 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = { 0x11, 0x58, 0x00, 0x00, 0x00, 0x18, 0x53, 0x79, 0x6F, 0x77, 0x61, 0x20, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2C, 0x20, 0x45, 0x20, 0x4F, 0x6E, 0x67, 0x75, 0x6C, 0x20, 0x49, +/* Antarctica/Troll */ +0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0D, 0x42, 0x0D, 0x47, 0x00, +0x42, 0x46, 0x05, 0x90, 0x43, 0x64, 0x1B, 0x10, 0x44, 0x25, 0xE7, 0x90, 0x45, 0x43, 0xFD, 0x10, +0x46, 0x05, 0xC9, 0x90, 0x47, 0x23, 0xDF, 0x10, 0x47, 0xEE, 0xE6, 0x10, 0x49, 0x03, 0xC1, 0x10, +0x49, 0xCE, 0xC8, 0x10, 0x4A, 0xE3, 0xA3, 0x10, 0x4B, 0xAE, 0xAA, 0x10, 0x4C, 0xCC, 0xBF, 0x90, +0x4D, 0x8E, 0x8C, 0x10, 0x4E, 0xAC, 0xA1, 0x90, 0x4F, 0x6E, 0x6E, 0x10, 0x50, 0x8C, 0x83, 0x90, +0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x37, 0x6C, 0x90, 0x54, 0x4C, 0x47, 0x90, +0x55, 0x17, 0x4E, 0x90, 0x56, 0x2C, 0x29, 0x90, 0x56, 0xF7, 0x30, 0x90, 0x58, 0x15, 0x46, 0x10, +0x58, 0xD7, 0x12, 0x90, 0x59, 0xF5, 0x28, 0x10, 0x5A, 0xB6, 0xF4, 0x90, 0x5B, 0xD5, 0x0A, 0x10, +0x5C, 0xA0, 0x11, 0x10, 0x5D, 0xB4, 0xEC, 0x10, 0x5E, 0x7F, 0xF3, 0x10, 0x5F, 0x94, 0xCE, 0x10, +0x60, 0x5F, 0xD5, 0x10, 0x61, 0x7D, 0xEA, 0x90, 0x62, 0x3F, 0xB7, 0x10, 0x63, 0x5D, 0xCC, 0x90, +0x64, 0x1F, 0x99, 0x10, 0x65, 0x3D, 0xAE, 0x90, 0x66, 0x08, 0xB5, 0x90, 0x67, 0x1D, 0x90, 0x90, +0x67, 0xE8, 0x97, 0x90, 0x68, 0xFD, 0x72, 0x90, 0x69, 0xC8, 0x79, 0x90, 0x6A, 0xDD, 0x54, 0x90, +0x6B, 0xA8, 0x5B, 0x90, 0x6C, 0xC6, 0x71, 0x10, 0x6D, 0x88, 0x3D, 0x90, 0x6E, 0xA6, 0x53, 0x10, +0x6F, 0x68, 0x1F, 0x90, 0x70, 0x86, 0x35, 0x10, 0x71, 0x51, 0x3C, 0x10, 0x72, 0x66, 0x17, 0x10, +0x73, 0x31, 0x1E, 0x10, 0x74, 0x45, 0xF9, 0x10, 0x75, 0x11, 0x00, 0x10, 0x76, 0x2F, 0x15, 0x90, +0x76, 0xF0, 0xE2, 0x10, 0x78, 0x0E, 0xF7, 0x90, 0x78, 0xD0, 0xC4, 0x10, 0x79, 0xEE, 0xD9, 0x90, +0x7A, 0xB0, 0xA6, 0x10, 0x7B, 0xCE, 0xBB, 0x90, 0x7C, 0x99, 0xC2, 0x90, 0x7D, 0xAE, 0x9D, 0x90, +0x7E, 0x79, 0xA4, 0x90, 0x7F, 0x8E, 0x7F, 0x90, 0x03, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, +0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x1C, 0x20, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, +0x00, 0x00, 0x09, 0x7A, 0x7A, 0x7A, 0x00, 0x43, 0x45, 0x53, 0x54, 0x00, 0x55, 0x54, 0x43, 0x00, +0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x1B, 0x72, 0xCD, 0x01, 0x16, 0x86, 0xBC, +0x00, 0x00, 0x00, 0x1E, 0x54, 0x72, 0x6F, 0x6C, 0x6C, 0x20, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6F, +0x6E, 0x2C, 0x20, 0x51, 0x75, 0x65, 0x65, 0x6E, 0x20, 0x4D, 0x61, 0x75, 0x64, 0x20, 0x4C, 0x61, +0x6E, 0x64, + /* Antarctica/Vostok */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, @@ -8126,7 +8159,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = { 0xF9, 0xE1, 0xCA, 0x00, 0xFA, 0xF9, 0x39, 0xF0, 0xFB, 0x27, 0x42, 0x50, 0x08, 0x7C, 0x8B, 0xE0, 0x08, 0xFD, 0xB0, 0xD0, 0x09, 0xF6, 0xEA, 0x60, 0x0A, 0xA6, 0x33, 0xD0, 0x1C, 0xBE, 0xF8, 0xE0, 0x1D, 0x89, 0xF1, 0xD0, 0x1E, 0xCC, 0xFF, 0x60, 0x1F, 0x60, 0x99, 0x50, 0x20, 0x82, 0xB1, 0x60, -0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5D, 0x4D, 0x60, 0x23, 0x1F, 0x0B, 0xD0, 0x24, 0x5A, 0x30, 0x60, +0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5E, 0x9E, 0xE0, 0x23, 0x20, 0x5D, 0x50, 0x24, 0x5A, 0x30, 0x60, 0x25, 0x00, 0x3F, 0x50, 0x26, 0x0B, 0xED, 0xE0, 0x26, 0xD6, 0xE6, 0xD0, 0x27, 0xEB, 0xCF, 0xE0, 0x28, 0xC0, 0x03, 0x50, 0x29, 0xD4, 0xEC, 0x60, 0x2A, 0xA9, 0x1F, 0xD0, 0x2B, 0xBB, 0x65, 0xE0, 0x2C, 0x89, 0x01, 0xD0, 0x2D, 0x9B, 0x47, 0xE0, 0x2E, 0x5F, 0xA9, 0x50, 0x2F, 0x7B, 0x29, 0xE0, @@ -8199,7 +8232,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = { 0xF9, 0xE1, 0xCA, 0x00, 0xFA, 0xF9, 0x39, 0xF0, 0xFB, 0x27, 0x42, 0x50, 0x08, 0x7C, 0x8B, 0xE0, 0x08, 0xFD, 0xB0, 0xD0, 0x09, 0xF6, 0xEA, 0x60, 0x0A, 0xA6, 0x33, 0xD0, 0x1C, 0xBE, 0xF8, 0xE0, 0x1D, 0x89, 0xF1, 0xD0, 0x1E, 0xCC, 0xFF, 0x60, 0x1F, 0x60, 0x99, 0x50, 0x20, 0x82, 0xB1, 0x60, -0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5D, 0x4D, 0x60, 0x23, 0x1F, 0x0B, 0xD0, 0x24, 0x5A, 0x30, 0x60, +0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5E, 0x9E, 0xE0, 0x23, 0x20, 0x5D, 0x50, 0x24, 0x5A, 0x30, 0x60, 0x25, 0x00, 0x3F, 0x50, 0x26, 0x0B, 0xED, 0xE0, 0x26, 0xD6, 0xE6, 0xD0, 0x27, 0xEB, 0xCF, 0xE0, 0x28, 0xC0, 0x03, 0x50, 0x29, 0xD4, 0xEC, 0x60, 0x2A, 0xA9, 0x1F, 0xD0, 0x2B, 0xBB, 0x65, 0xE0, 0x2C, 0x89, 0x01, 0xD0, 0x2D, 0x9B, 0x47, 0xE0, 0x2E, 0x5F, 0xA9, 0x50, 0x2F, 0x7B, 0x29, 0xE0, @@ -8375,7 +8408,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = { 0x46, 0x05, 0xC9, 0x90, 0x47, 0x23, 0xDF, 0x10, 0x47, 0xEE, 0xE6, 0x10, 0x49, 0x03, 0xC1, 0x10, 0x49, 0xCE, 0xC8, 0x10, 0x4A, 0xE3, 0xA3, 0x10, 0x4B, 0xAE, 0xAA, 0x10, 0x4C, 0xCC, 0xBF, 0x90, 0x4D, 0x8F, 0xDD, 0x90, 0x4E, 0xAC, 0xA1, 0x90, 0x4F, 0x6E, 0x6E, 0x10, 0x50, 0x8C, 0x83, 0x90, -0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x37, 0x6C, 0x90, 0x54, 0x4C, 0x47, 0x90, +0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x38, 0xBE, 0x10, 0x54, 0x4C, 0x47, 0x90, 0x55, 0x17, 0x4E, 0x90, 0x56, 0x2C, 0x29, 0x90, 0x56, 0xF7, 0x30, 0x90, 0x58, 0x15, 0x46, 0x10, 0x58, 0xD7, 0x12, 0x90, 0x59, 0xF5, 0x28, 0x10, 0x5A, 0xB6, 0xF4, 0x90, 0x5B, 0xD5, 0x0A, 0x10, 0x5C, 0xA0, 0x11, 0x10, 0x5D, 0xB4, 0xEC, 0x10, 0x5E, 0x7F, 0xF3, 0x10, 0x5F, 0x94, 0xCE, 0x10, @@ -8445,7 +8478,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = { 0xE7, 0x11, 0xD2, 0x80, 0xE8, 0x27, 0xFF, 0x00, 0xE8, 0xE8, 0x4F, 0xD0, 0x08, 0x7C, 0x8B, 0xE0, 0x08, 0xFD, 0xB0, 0xD0, 0x09, 0xF6, 0xEA, 0x60, 0x0A, 0xA6, 0x33, 0xD0, 0x1C, 0xBE, 0xF8, 0xE0, 0x1D, 0x89, 0xF1, 0xD0, 0x1E, 0xCC, 0xFF, 0x60, 0x1F, 0x60, 0x99, 0x50, 0x20, 0x82, 0xB1, 0x60, -0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5D, 0x4D, 0x60, 0x23, 0x1F, 0x0B, 0xD0, 0x24, 0x5A, 0x30, 0x60, +0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5E, 0x9E, 0xE0, 0x23, 0x20, 0x5D, 0x50, 0x24, 0x5A, 0x30, 0x60, 0x25, 0x00, 0x3F, 0x50, 0x26, 0x0B, 0xED, 0xE0, 0x26, 0xD6, 0xE6, 0xD0, 0x27, 0xEB, 0xCF, 0xE0, 0x28, 0xC0, 0x03, 0x50, 0x29, 0xD4, 0xEC, 0x60, 0x2A, 0xA9, 0x1F, 0xD0, 0x2B, 0xBB, 0x65, 0xE0, 0x2C, 0x89, 0x01, 0xD0, 0x2D, 0x9B, 0x47, 0xE0, 0x2E, 0x5F, 0xA9, 0x50, 0x2F, 0x7B, 0x29, 0xE0, @@ -9314,7 +9347,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = { 0xE7, 0x11, 0xD2, 0x80, 0xE8, 0x27, 0xFF, 0x00, 0xE8, 0xE8, 0x4F, 0xD0, 0x08, 0x7C, 0x8B, 0xE0, 0x08, 0xFD, 0xB0, 0xD0, 0x09, 0xF6, 0xEA, 0x60, 0x0A, 0xA6, 0x33, 0xD0, 0x1C, 0xBE, 0xF8, 0xE0, 0x1D, 0x89, 0xF1, 0xD0, 0x1E, 0xCC, 0xFF, 0x60, 0x1F, 0x60, 0x99, 0x50, 0x20, 0x82, 0xB1, 0x60, -0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5D, 0x4D, 0x60, 0x23, 0x1F, 0x0B, 0xD0, 0x24, 0x5A, 0x30, 0x60, +0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5E, 0x9E, 0xE0, 0x23, 0x20, 0x5D, 0x50, 0x24, 0x5A, 0x30, 0x60, 0x25, 0x00, 0x3F, 0x50, 0x26, 0x0B, 0xED, 0xE0, 0x26, 0xD6, 0xE6, 0xD0, 0x27, 0xEB, 0xCF, 0xE0, 0x28, 0xC0, 0x03, 0x50, 0x29, 0xD4, 0xEC, 0x60, 0x2A, 0xA9, 0x1F, 0xD0, 0x2B, 0xBB, 0x65, 0xE0, 0x2C, 0x89, 0x01, 0xD0, 0x2D, 0x9B, 0x47, 0xE0, 0x2E, 0x5F, 0xA9, 0x50, 0x2F, 0x7B, 0x29, 0xE0, @@ -13595,7 +13628,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = { 0x46, 0x05, 0xC9, 0x90, 0x47, 0x23, 0xDF, 0x10, 0x47, 0xEE, 0xE6, 0x10, 0x49, 0x03, 0xC1, 0x10, 0x49, 0xCE, 0xC8, 0x10, 0x4A, 0xE3, 0xA3, 0x10, 0x4B, 0xAE, 0xAA, 0x10, 0x4C, 0xCC, 0xBF, 0x90, 0x4D, 0x8F, 0xDD, 0x90, 0x4E, 0xAC, 0xA1, 0x90, 0x4F, 0x6E, 0x6E, 0x10, 0x50, 0x8C, 0x83, 0x90, -0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x37, 0x6C, 0x90, 0x54, 0x4C, 0x47, 0x90, +0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x38, 0xBE, 0x10, 0x54, 0x4C, 0x47, 0x90, 0x55, 0x17, 0x4E, 0x90, 0x56, 0x2C, 0x29, 0x90, 0x56, 0xF7, 0x30, 0x90, 0x58, 0x15, 0x46, 0x10, 0x58, 0xD7, 0x12, 0x90, 0x59, 0xF5, 0x28, 0x10, 0x5A, 0xB6, 0xF4, 0x90, 0x5B, 0xD5, 0x0A, 0x10, 0x5C, 0xA0, 0x11, 0x10, 0x5D, 0xB4, 0xEC, 0x10, 0x5E, 0x7F, 0xF3, 0x10, 0x5F, 0x94, 0xCE, 0x10, @@ -13756,54 +13789,54 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = { /* Europe/Kiev */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x55, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x1E, 0xAA, 0x19, 0xA7, 0x64, +0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x1E, 0xAA, 0x19, 0xA7, 0x64, 0xB5, 0xA4, 0x19, 0x60, 0xCA, 0xCD, 0x2E, 0xD0, 0xCC, 0xE7, 0x4B, 0x10, 0xCD, 0xA9, 0x17, 0x90, 0xCE, 0xA2, 0x43, 0x10, 0xCE, 0xCD, 0xA8, 0x70, 0x15, 0x27, 0xA7, 0xD0, 0x16, 0x18, 0xDC, 0x40, 0x17, 0x08, 0xDB, 0x50, 0x17, 0xFA, 0x0F, 0xC0, 0x18, 0xEA, 0x0E, 0xD0, 0x19, 0xDB, 0x43, 0x40, 0x1A, 0xCC, 0x93, 0xD0, 0x1B, 0xBC, 0xA0, 0xF0, 0x1C, 0xAC, 0x91, 0xF0, 0x1D, 0x9C, 0x82, 0xF0, 0x1E, 0x8C, 0x73, 0xF0, 0x1F, 0x7C, 0x64, 0xF0, 0x20, 0x6C, 0x55, 0xF0, 0x21, 0x5C, 0x46, 0xF0, 0x22, 0x4C, 0x37, 0xF0, 0x23, 0x3C, 0x28, 0xF0, 0x24, 0x2C, 0x19, 0xF0, 0x25, 0x1C, 0x0A, 0xF0, -0x25, 0x9E, 0x73, 0x50, 0x26, 0x8D, 0x2E, 0xF0, 0x29, 0xD4, 0xEC, 0x60, 0x2A, 0xC4, 0xCF, 0x50, -0x2B, 0xB4, 0xCE, 0x60, 0x2C, 0xA4, 0xB1, 0x50, 0x2D, 0x94, 0xB0, 0x60, 0x2E, 0x84, 0x93, 0x50, -0x2F, 0x74, 0xBC, 0x90, 0x30, 0x64, 0xAD, 0x90, 0x31, 0x5D, 0xD9, 0x10, 0x32, 0x72, 0xB4, 0x10, -0x33, 0x3D, 0xBB, 0x10, 0x34, 0x52, 0x96, 0x10, 0x35, 0x1D, 0x9D, 0x10, 0x36, 0x32, 0x78, 0x10, -0x36, 0xFD, 0x7F, 0x10, 0x38, 0x1B, 0x94, 0x90, 0x38, 0xDD, 0x61, 0x10, 0x39, 0xFB, 0x76, 0x90, -0x3A, 0xBD, 0x43, 0x10, 0x3B, 0xDB, 0x58, 0x90, 0x3C, 0xA6, 0x5F, 0x90, 0x3D, 0xBB, 0x3A, 0x90, -0x3E, 0x86, 0x41, 0x90, 0x3F, 0x9B, 0x1C, 0x90, 0x40, 0x66, 0x23, 0x90, 0x41, 0x84, 0x39, 0x10, -0x42, 0x46, 0x05, 0x90, 0x43, 0x64, 0x1B, 0x10, 0x44, 0x25, 0xE7, 0x90, 0x45, 0x43, 0xFD, 0x10, -0x46, 0x05, 0xC9, 0x90, 0x47, 0x23, 0xDF, 0x10, 0x47, 0xEE, 0xE6, 0x10, 0x49, 0x03, 0xC1, 0x10, -0x49, 0xCE, 0xC8, 0x10, 0x4A, 0xE3, 0xA3, 0x10, 0x4B, 0xAE, 0xAA, 0x10, 0x4C, 0xCC, 0xBF, 0x90, -0x4D, 0x8E, 0x8C, 0x10, 0x4E, 0xAC, 0xA1, 0x90, 0x4F, 0x6E, 0x6E, 0x10, 0x50, 0x8C, 0x83, 0x90, -0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x37, 0x6C, 0x90, 0x54, 0x4C, 0x47, 0x90, -0x55, 0x17, 0x4E, 0x90, 0x56, 0x2C, 0x29, 0x90, 0x56, 0xF7, 0x30, 0x90, 0x58, 0x15, 0x46, 0x10, -0x58, 0xD7, 0x12, 0x90, 0x59, 0xF5, 0x28, 0x10, 0x5A, 0xB6, 0xF4, 0x90, 0x5B, 0xD5, 0x0A, 0x10, -0x5C, 0xA0, 0x11, 0x10, 0x5D, 0xB4, 0xEC, 0x10, 0x5E, 0x7F, 0xF3, 0x10, 0x5F, 0x94, 0xCE, 0x10, -0x60, 0x5F, 0xD5, 0x10, 0x61, 0x7D, 0xEA, 0x90, 0x62, 0x3F, 0xB7, 0x10, 0x63, 0x5D, 0xCC, 0x90, -0x64, 0x1F, 0x99, 0x10, 0x65, 0x3D, 0xAE, 0x90, 0x66, 0x08, 0xB5, 0x90, 0x67, 0x1D, 0x90, 0x90, -0x67, 0xE8, 0x97, 0x90, 0x68, 0xFD, 0x72, 0x90, 0x69, 0xC8, 0x79, 0x90, 0x6A, 0xDD, 0x54, 0x90, -0x6B, 0xA8, 0x5B, 0x90, 0x6C, 0xC6, 0x71, 0x10, 0x6D, 0x88, 0x3D, 0x90, 0x6E, 0xA6, 0x53, 0x10, -0x6F, 0x68, 0x1F, 0x90, 0x70, 0x86, 0x35, 0x10, 0x71, 0x51, 0x3C, 0x10, 0x72, 0x66, 0x17, 0x10, -0x73, 0x31, 0x1E, 0x10, 0x74, 0x45, 0xF9, 0x10, 0x75, 0x11, 0x00, 0x10, 0x76, 0x2F, 0x15, 0x90, -0x76, 0xF0, 0xE2, 0x10, 0x78, 0x0E, 0xF7, 0x90, 0x78, 0xD0, 0xC4, 0x10, 0x79, 0xEE, 0xD9, 0x90, -0x7A, 0xB0, 0xA6, 0x10, 0x7B, 0xCE, 0xBB, 0x90, 0x7C, 0x99, 0xC2, 0x90, 0x7D, 0xAE, 0x9D, 0x90, -0x7E, 0x79, 0xA4, 0x90, 0x7F, 0x8E, 0x7F, 0x90, 0x01, 0x02, 0x05, 0x03, 0x04, 0x03, 0x02, 0x06, -0x02, 0x06, 0x02, 0x06, 0x02, 0x06, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, -0x07, 0x02, 0x01, 0x09, 0x01, 0x09, 0x01, 0x09, 0x01, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, -0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, -0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, -0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, -0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, -0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x00, -0x00, 0x1C, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x00, 0x00, 0x2A, 0x30, 0x00, -0x08, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x1C, 0x20, 0x01, 0x10, 0x00, 0x00, 0x1C, -0x20, 0x01, 0x10, 0x00, 0x00, 0x38, 0x40, 0x01, 0x15, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x08, 0x00, -0x00, 0x38, 0x40, 0x01, 0x15, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x19, 0x00, 0x00, 0x2A, 0x30, 0x01, -0x19, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4B, 0x4D, 0x54, 0x00, 0x45, 0x45, 0x54, 0x00, 0x4D, -0x53, 0x4B, 0x00, 0x43, 0x45, 0x54, 0x00, 0x43, 0x45, 0x53, 0x54, 0x00, 0x4D, 0x53, 0x44, 0x00, -0x45, 0x45, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, -0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0xD6, 0x48, -0xC5, 0x01, 0x41, 0x39, 0x12, 0x00, 0x00, 0x00, 0x0E, 0x6D, 0x6F, 0x73, 0x74, 0x20, 0x6C, 0x6F, -0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, +0x26, 0x0B, 0xFB, 0xF0, 0x26, 0x8D, 0x20, 0xE0, 0x28, 0xE5, 0x17, 0x80, 0x29, 0xD4, 0xEC, 0x60, +0x2A, 0xC4, 0xCF, 0x50, 0x2B, 0xB4, 0xCE, 0x60, 0x2C, 0xA4, 0xB1, 0x50, 0x2D, 0x94, 0xB0, 0x60, +0x2E, 0x84, 0x93, 0x50, 0x2F, 0x74, 0xBC, 0x90, 0x30, 0x64, 0xAD, 0x90, 0x31, 0x5D, 0xD9, 0x10, +0x32, 0x72, 0xB4, 0x10, 0x33, 0x3D, 0xBB, 0x10, 0x34, 0x52, 0x96, 0x10, 0x35, 0x1D, 0x9D, 0x10, +0x36, 0x32, 0x78, 0x10, 0x36, 0xFD, 0x7F, 0x10, 0x38, 0x1B, 0x94, 0x90, 0x38, 0xDD, 0x61, 0x10, +0x39, 0xFB, 0x76, 0x90, 0x3A, 0xBD, 0x43, 0x10, 0x3B, 0xDB, 0x58, 0x90, 0x3C, 0xA6, 0x5F, 0x90, +0x3D, 0xBB, 0x3A, 0x90, 0x3E, 0x86, 0x41, 0x90, 0x3F, 0x9B, 0x1C, 0x90, 0x40, 0x66, 0x23, 0x90, +0x41, 0x84, 0x39, 0x10, 0x42, 0x46, 0x05, 0x90, 0x43, 0x64, 0x1B, 0x10, 0x44, 0x25, 0xE7, 0x90, +0x45, 0x43, 0xFD, 0x10, 0x46, 0x05, 0xC9, 0x90, 0x47, 0x23, 0xDF, 0x10, 0x47, 0xEE, 0xE6, 0x10, +0x49, 0x03, 0xC1, 0x10, 0x49, 0xCE, 0xC8, 0x10, 0x4A, 0xE3, 0xA3, 0x10, 0x4B, 0xAE, 0xAA, 0x10, +0x4C, 0xCC, 0xBF, 0x90, 0x4D, 0x8E, 0x8C, 0x10, 0x4E, 0xAC, 0xA1, 0x90, 0x4F, 0x6E, 0x6E, 0x10, +0x50, 0x8C, 0x83, 0x90, 0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x37, 0x6C, 0x90, +0x54, 0x4C, 0x47, 0x90, 0x55, 0x17, 0x4E, 0x90, 0x56, 0x2C, 0x29, 0x90, 0x56, 0xF7, 0x30, 0x90, +0x58, 0x15, 0x46, 0x10, 0x58, 0xD7, 0x12, 0x90, 0x59, 0xF5, 0x28, 0x10, 0x5A, 0xB6, 0xF4, 0x90, +0x5B, 0xD5, 0x0A, 0x10, 0x5C, 0xA0, 0x11, 0x10, 0x5D, 0xB4, 0xEC, 0x10, 0x5E, 0x7F, 0xF3, 0x10, +0x5F, 0x94, 0xCE, 0x10, 0x60, 0x5F, 0xD5, 0x10, 0x61, 0x7D, 0xEA, 0x90, 0x62, 0x3F, 0xB7, 0x10, +0x63, 0x5D, 0xCC, 0x90, 0x64, 0x1F, 0x99, 0x10, 0x65, 0x3D, 0xAE, 0x90, 0x66, 0x08, 0xB5, 0x90, +0x67, 0x1D, 0x90, 0x90, 0x67, 0xE8, 0x97, 0x90, 0x68, 0xFD, 0x72, 0x90, 0x69, 0xC8, 0x79, 0x90, +0x6A, 0xDD, 0x54, 0x90, 0x6B, 0xA8, 0x5B, 0x90, 0x6C, 0xC6, 0x71, 0x10, 0x6D, 0x88, 0x3D, 0x90, +0x6E, 0xA6, 0x53, 0x10, 0x6F, 0x68, 0x1F, 0x90, 0x70, 0x86, 0x35, 0x10, 0x71, 0x51, 0x3C, 0x10, +0x72, 0x66, 0x17, 0x10, 0x73, 0x31, 0x1E, 0x10, 0x74, 0x45, 0xF9, 0x10, 0x75, 0x11, 0x00, 0x10, +0x76, 0x2F, 0x15, 0x90, 0x76, 0xF0, 0xE2, 0x10, 0x78, 0x0E, 0xF7, 0x90, 0x78, 0xD0, 0xC4, 0x10, +0x79, 0xEE, 0xD9, 0x90, 0x7A, 0xB0, 0xA6, 0x10, 0x7B, 0xCE, 0xBB, 0x90, 0x7C, 0x99, 0xC2, 0x90, +0x7D, 0xAE, 0x9D, 0x90, 0x7E, 0x79, 0xA4, 0x90, 0x7F, 0x8E, 0x7F, 0x90, 0x01, 0x02, 0x05, 0x03, +0x04, 0x03, 0x02, 0x06, 0x02, 0x06, 0x02, 0x06, 0x02, 0x06, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, +0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x09, 0x01, 0x09, 0x01, 0x09, 0x01, 0x09, 0x01, 0x0A, 0x0B, +0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, +0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, +0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, +0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, +0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, +0x0A, 0x0B, 0x0A, 0x0B, 0x00, 0x00, 0x1C, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, +0x00, 0x00, 0x2A, 0x30, 0x00, 0x08, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x1C, 0x20, +0x01, 0x10, 0x00, 0x00, 0x1C, 0x20, 0x01, 0x10, 0x00, 0x00, 0x38, 0x40, 0x01, 0x15, 0x00, 0x00, +0x2A, 0x30, 0x00, 0x08, 0x00, 0x00, 0x38, 0x40, 0x01, 0x15, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x19, +0x00, 0x00, 0x2A, 0x30, 0x01, 0x19, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4B, 0x4D, 0x54, 0x00, +0x45, 0x45, 0x54, 0x00, 0x4D, 0x53, 0x4B, 0x00, 0x43, 0x45, 0x54, 0x00, 0x43, 0x45, 0x53, 0x54, +0x00, 0x4D, 0x53, 0x44, 0x00, 0x45, 0x45, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, +0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0xD6, 0x48, 0xC5, 0x01, 0x41, 0x39, 0x12, 0x00, 0x00, 0x00, 0x0E, 0x6D, 0x6F, +0x73, 0x74, 0x20, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, /* Europe/Lisbon */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -14951,9 +14984,9 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = { 0xAA, 0x01, 0x2E, 0xC2, 0x82, 0x00, 0x00, 0x00, 0x00, /* Europe/Simferopol */ -0x50, 0x48, 0x50, 0x31, 0x01, 0x55, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x7B, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x1E, 0xAA, 0x19, 0xA4, 0x20, +0x50, 0x48, 0x50, 0x31, 0x01, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x1E, 0xAA, 0x19, 0xA4, 0x20, 0xB5, 0xA4, 0x19, 0x60, 0xCB, 0x04, 0x8D, 0xD0, 0xCC, 0xE7, 0x4B, 0x10, 0xCD, 0xA9, 0x17, 0x90, 0xCE, 0xA2, 0x43, 0x10, 0xCF, 0x92, 0x34, 0x10, 0xCF, 0x9F, 0x38, 0xE0, 0x15, 0x27, 0xA7, 0xD0, 0x16, 0x18, 0xDC, 0x40, 0x17, 0x08, 0xDB, 0x50, 0x17, 0xFA, 0x0F, 0xC0, 0x18, 0xEA, 0x0E, 0xD0, @@ -14972,36 +15005,22 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = { 0x46, 0x05, 0xC9, 0x90, 0x47, 0x23, 0xDF, 0x10, 0x47, 0xEE, 0xE6, 0x10, 0x49, 0x03, 0xC1, 0x10, 0x49, 0xCE, 0xC8, 0x10, 0x4A, 0xE3, 0xA3, 0x10, 0x4B, 0xAE, 0xAA, 0x10, 0x4C, 0xCC, 0xBF, 0x90, 0x4D, 0x8E, 0x8C, 0x10, 0x4E, 0xAC, 0xA1, 0x90, 0x4F, 0x6E, 0x6E, 0x10, 0x50, 0x8C, 0x83, 0x90, -0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x37, 0x6C, 0x90, 0x54, 0x4C, 0x47, 0x90, -0x55, 0x17, 0x4E, 0x90, 0x56, 0x2C, 0x29, 0x90, 0x56, 0xF7, 0x30, 0x90, 0x58, 0x15, 0x46, 0x10, -0x58, 0xD7, 0x12, 0x90, 0x59, 0xF5, 0x28, 0x10, 0x5A, 0xB6, 0xF4, 0x90, 0x5B, 0xD5, 0x0A, 0x10, -0x5C, 0xA0, 0x11, 0x10, 0x5D, 0xB4, 0xEC, 0x10, 0x5E, 0x7F, 0xF3, 0x10, 0x5F, 0x94, 0xCE, 0x10, -0x60, 0x5F, 0xD5, 0x10, 0x61, 0x7D, 0xEA, 0x90, 0x62, 0x3F, 0xB7, 0x10, 0x63, 0x5D, 0xCC, 0x90, -0x64, 0x1F, 0x99, 0x10, 0x65, 0x3D, 0xAE, 0x90, 0x66, 0x08, 0xB5, 0x90, 0x67, 0x1D, 0x90, 0x90, -0x67, 0xE8, 0x97, 0x90, 0x68, 0xFD, 0x72, 0x90, 0x69, 0xC8, 0x79, 0x90, 0x6A, 0xDD, 0x54, 0x90, -0x6B, 0xA8, 0x5B, 0x90, 0x6C, 0xC6, 0x71, 0x10, 0x6D, 0x88, 0x3D, 0x90, 0x6E, 0xA6, 0x53, 0x10, -0x6F, 0x68, 0x1F, 0x90, 0x70, 0x86, 0x35, 0x10, 0x71, 0x51, 0x3C, 0x10, 0x72, 0x66, 0x17, 0x10, -0x73, 0x31, 0x1E, 0x10, 0x74, 0x45, 0xF9, 0x10, 0x75, 0x11, 0x00, 0x10, 0x76, 0x2F, 0x15, 0x90, -0x76, 0xF0, 0xE2, 0x10, 0x78, 0x0E, 0xF7, 0x90, 0x78, 0xD0, 0xC4, 0x10, 0x79, 0xEE, 0xD9, 0x90, -0x7A, 0xB0, 0xA6, 0x10, 0x7B, 0xCE, 0xBB, 0x90, 0x7C, 0x99, 0xC2, 0x90, 0x7D, 0xAE, 0x9D, 0x90, -0x7E, 0x79, 0xA4, 0x90, 0x7F, 0x8E, 0x7F, 0x90, 0x01, 0x02, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, -0x06, 0x02, 0x06, 0x02, 0x06, 0x02, 0x06, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x08, 0x07, -0x08, 0x07, 0x02, 0x01, 0x09, 0x01, 0x09, 0x01, 0x09, 0x06, 0x02, 0x06, 0x02, 0x06, 0x08, 0x07, -0x02, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, -0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, -0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, -0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, +0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x37, 0x5E, 0x80, 0x01, 0x02, 0x05, 0x03, +0x04, 0x03, 0x04, 0x02, 0x06, 0x02, 0x06, 0x02, 0x06, 0x02, 0x06, 0x07, 0x08, 0x07, 0x08, 0x07, +0x08, 0x07, 0x08, 0x07, 0x08, 0x07, 0x02, 0x01, 0x09, 0x01, 0x09, 0x01, 0x09, 0x06, 0x02, 0x06, +0x02, 0x06, 0x08, 0x07, 0x02, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, -0x0B, 0x0A, 0x0B, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x00, -0x00, 0x2A, 0x30, 0x00, 0x08, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x1C, 0x20, 0x01, -0x10, 0x00, 0x00, 0x1C, 0x20, 0x01, 0x10, 0x00, 0x00, 0x38, 0x40, 0x01, 0x15, 0x00, 0x00, 0x2A, -0x30, 0x00, 0x08, 0x00, 0x00, 0x38, 0x40, 0x01, 0x15, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x19, 0x00, -0x00, 0x2A, 0x30, 0x01, 0x19, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x53, 0x4D, 0x54, 0x00, 0x45, -0x45, 0x54, 0x00, 0x4D, 0x53, 0x4B, 0x00, 0x43, 0x45, 0x54, 0x00, 0x43, 0x45, 0x53, 0x54, 0x00, -0x4D, 0x53, 0x44, 0x00, 0x45, 0x45, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, -0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -0x01, 0x00, 0xCD, 0xEA, 0xD7, 0x01, 0x46, 0xB0, 0xD0, 0x00, 0x00, 0x00, 0x0E, 0x63, 0x65, 0x6E, -0x74, 0x72, 0x61, 0x6C, 0x20, 0x43, 0x72, 0x69, 0x6D, 0x65, 0x61, +0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0C, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x00, 0x00, +0x1C, 0x20, 0x00, 0x04, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x08, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x0C, +0x00, 0x00, 0x1C, 0x20, 0x01, 0x10, 0x00, 0x00, 0x1C, 0x20, 0x01, 0x10, 0x00, 0x00, 0x38, 0x40, +0x01, 0x15, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x08, 0x00, 0x00, 0x38, 0x40, 0x01, 0x15, 0x00, 0x00, +0x2A, 0x30, 0x01, 0x19, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x19, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, +0x00, 0x00, 0x38, 0x40, 0x00, 0x08, 0x53, 0x4D, 0x54, 0x00, 0x45, 0x45, 0x54, 0x00, 0x4D, 0x53, +0x4B, 0x00, 0x43, 0x45, 0x54, 0x00, 0x43, 0x45, 0x53, 0x54, 0x00, 0x4D, 0x53, 0x44, 0x00, 0x45, +0x45, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0xCD, +0xEA, 0xD7, 0x01, 0x46, 0xB0, 0xD0, 0x00, 0x00, 0x00, 0x12, 0x4D, 0x6F, 0x73, 0x63, 0x6F, 0x77, +0x2B, 0x30, 0x30, 0x20, 0x2D, 0x20, 0x43, 0x72, 0x69, 0x6D, 0x65, 0x61, /* Europe/Skopje */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x4D, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -16255,7 +16274,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = { 0xE7, 0x11, 0xD2, 0x80, 0xE8, 0x27, 0xFF, 0x00, 0xE8, 0xE8, 0x4F, 0xD0, 0x08, 0x7C, 0x8B, 0xE0, 0x08, 0xFD, 0xB0, 0xD0, 0x09, 0xF6, 0xEA, 0x60, 0x0A, 0xA6, 0x33, 0xD0, 0x1C, 0xBE, 0xF8, 0xE0, 0x1D, 0x89, 0xF1, 0xD0, 0x1E, 0xCC, 0xFF, 0x60, 0x1F, 0x60, 0x99, 0x50, 0x20, 0x82, 0xB1, 0x60, -0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5D, 0x4D, 0x60, 0x23, 0x1F, 0x0B, 0xD0, 0x24, 0x5A, 0x30, 0x60, +0x21, 0x49, 0xB5, 0xD0, 0x22, 0x5E, 0x9E, 0xE0, 0x23, 0x20, 0x5D, 0x50, 0x24, 0x5A, 0x30, 0x60, 0x25, 0x00, 0x3F, 0x50, 0x26, 0x0B, 0xED, 0xE0, 0x26, 0xD6, 0xE6, 0xD0, 0x27, 0xEB, 0xCF, 0xE0, 0x28, 0xC0, 0x03, 0x50, 0x29, 0xD4, 0xEC, 0x60, 0x2A, 0xA9, 0x1F, 0xD0, 0x2B, 0xBB, 0x65, 0xE0, 0x2C, 0x89, 0x01, 0xD0, 0x2D, 0x9B, 0x47, 0xE0, 0x2E, 0x5F, 0xA9, 0x50, 0x2F, 0x7B, 0x29, 0xE0, @@ -17003,18 +17022,18 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = { 0x36, 0x3B, 0x17, 0xE0, 0x36, 0xD7, 0xFA, 0x60, 0x38, 0x24, 0x34, 0x60, 0x38, 0xB7, 0xDC, 0x60, 0x4B, 0x11, 0x2C, 0xE0, 0x4B, 0xAE, 0x0F, 0x60, 0x4C, 0xC2, 0xEA, 0x60, 0x4D, 0x72, 0x41, 0xE0, 0x4E, 0xA2, 0xCC, 0x60, 0x4F, 0x1A, 0xC4, 0xE0, 0x50, 0x82, 0xAE, 0x60, 0x50, 0xFA, 0xA6, 0xE0, -0x52, 0x6B, 0xCA, 0xE0, 0x52, 0xDA, 0x88, 0xE0, 0x54, 0x4B, 0xAC, 0xE0, 0x54, 0xBA, 0x6A, 0xE0, -0x56, 0x2B, 0x8E, 0xE0, 0x56, 0xA3, 0x87, 0x60, 0x58, 0x0B, 0x70, 0xE0, 0x58, 0x83, 0x69, 0x60, -0x59, 0xEB, 0x52, 0xE0, 0x5A, 0x63, 0x4B, 0x60, 0x5B, 0xCB, 0x34, 0xE0, 0x5C, 0x43, 0x2D, 0x60, -0x5D, 0xB4, 0x51, 0x60, 0x5E, 0x23, 0x0F, 0x60, 0x5F, 0x94, 0x33, 0x60, 0x60, 0x0C, 0x2B, 0xE0, -0x61, 0x74, 0x15, 0x60, 0x61, 0xEC, 0x0D, 0xE0, 0x63, 0x53, 0xF7, 0x60, 0x63, 0xCB, 0xEF, 0xE0, -0x65, 0x33, 0xD9, 0x60, 0x65, 0xAB, 0xD1, 0xE0, 0x67, 0x1C, 0xF5, 0xE0, 0x67, 0x8B, 0xB3, 0xE0, -0x68, 0xFC, 0xD7, 0xE0, 0x69, 0x6B, 0x95, 0xE0, 0x6A, 0xDC, 0xB9, 0xE0, 0x6B, 0x54, 0xB2, 0x60, -0x6C, 0xBC, 0x9B, 0xE0, 0x6D, 0x34, 0x94, 0x60, 0x6E, 0x9C, 0x7D, 0xE0, 0x6F, 0x14, 0x76, 0x60, -0x70, 0x7C, 0x5F, 0xE0, 0x70, 0xF4, 0x58, 0x60, 0x72, 0x65, 0x7C, 0x60, 0x72, 0xD4, 0x3A, 0x60, -0x74, 0x45, 0x5E, 0x60, 0x74, 0xB4, 0x1C, 0x60, 0x76, 0x25, 0x40, 0x60, 0x76, 0x9D, 0x38, 0xE0, -0x78, 0x05, 0x22, 0x60, 0x78, 0x7D, 0x1A, 0xE0, 0x79, 0xE5, 0x04, 0x60, 0x7A, 0x5C, 0xFC, 0xE0, -0x7B, 0xC4, 0xE6, 0x60, 0x7C, 0x3C, 0xDE, 0xE0, 0x7D, 0xAE, 0x02, 0xE0, 0x7E, 0x1C, 0xC0, 0xE0, +0x52, 0x6B, 0xCA, 0xE0, 0x52, 0xDA, 0x7A, 0xD0, 0x54, 0x4B, 0xAC, 0xE0, 0x54, 0xBA, 0x5C, 0xD0, +0x56, 0x2B, 0x8E, 0xE0, 0x56, 0xA3, 0x79, 0x50, 0x58, 0x0B, 0x70, 0xE0, 0x58, 0x83, 0x5B, 0x50, +0x59, 0xEB, 0x52, 0xE0, 0x5A, 0x63, 0x3D, 0x50, 0x5B, 0xCB, 0x34, 0xE0, 0x5C, 0x43, 0x1F, 0x50, +0x5D, 0xB4, 0x51, 0x60, 0x5E, 0x23, 0x01, 0x50, 0x5F, 0x94, 0x33, 0x60, 0x60, 0x0C, 0x1D, 0xD0, +0x61, 0x74, 0x15, 0x60, 0x61, 0xEB, 0xFF, 0xD0, 0x63, 0x53, 0xF7, 0x60, 0x63, 0xCB, 0xE1, 0xD0, +0x65, 0x33, 0xD9, 0x60, 0x65, 0xAB, 0xC3, 0xD0, 0x67, 0x1C, 0xF5, 0xE0, 0x67, 0x8B, 0xA5, 0xD0, +0x68, 0xFC, 0xD7, 0xE0, 0x69, 0x6B, 0x87, 0xD0, 0x6A, 0xDC, 0xB9, 0xE0, 0x6B, 0x54, 0xA4, 0x50, +0x6C, 0xBC, 0x9B, 0xE0, 0x6D, 0x34, 0x86, 0x50, 0x6E, 0x9C, 0x7D, 0xE0, 0x6F, 0x14, 0x68, 0x50, +0x70, 0x7C, 0x5F, 0xE0, 0x70, 0xF4, 0x4A, 0x50, 0x72, 0x65, 0x7C, 0x60, 0x72, 0xD4, 0x2C, 0x50, +0x74, 0x45, 0x5E, 0x60, 0x74, 0xB4, 0x0E, 0x50, 0x76, 0x25, 0x40, 0x60, 0x76, 0x9D, 0x2A, 0xD0, +0x78, 0x05, 0x22, 0x60, 0x78, 0x7D, 0x0C, 0xD0, 0x79, 0xE5, 0x04, 0x60, 0x7A, 0x5C, 0xEE, 0xD0, +0x7B, 0xC4, 0xE6, 0x60, 0x7C, 0x3C, 0xD0, 0xD0, 0x7D, 0xAE, 0x02, 0xE0, 0x7E, 0x1C, 0xB2, 0xD0, 0x7F, 0x8D, 0xE4, 0xE0, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, @@ -17617,7 +17636,7 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = { 0x46, 0x05, 0xC9, 0x90, 0x47, 0x23, 0xDF, 0x10, 0x47, 0xEE, 0xE6, 0x10, 0x49, 0x03, 0xC1, 0x10, 0x49, 0xCE, 0xC8, 0x10, 0x4A, 0xE3, 0xA3, 0x10, 0x4B, 0xAE, 0xAA, 0x10, 0x4C, 0xCC, 0xBF, 0x90, 0x4D, 0x8F, 0xDD, 0x90, 0x4E, 0xAC, 0xA1, 0x90, 0x4F, 0x6E, 0x6E, 0x10, 0x50, 0x8C, 0x83, 0x90, -0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x37, 0x6C, 0x90, 0x54, 0x4C, 0x47, 0x90, +0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x38, 0xBE, 0x10, 0x54, 0x4C, 0x47, 0x90, 0x55, 0x17, 0x4E, 0x90, 0x56, 0x2C, 0x29, 0x90, 0x56, 0xF7, 0x30, 0x90, 0x58, 0x15, 0x46, 0x10, 0x58, 0xD7, 0x12, 0x90, 0x59, 0xF5, 0x28, 0x10, 0x5A, 0xB6, 0xF4, 0x90, 0x5B, 0xD5, 0x0A, 0x10, 0x5C, 0xA0, 0x11, 0x10, 0x5D, 0xB4, 0xEC, 0x10, 0x5E, 0x7F, 0xF3, 0x10, 0x5F, 0x94, 0xCE, 0x10, @@ -18416,4 +18435,4 @@ const unsigned char timelib_timezone_db_data_builtin[261632] = { 0x00, 0x00, 0x55, 0x54, 0x43, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, }; -const timelib_tzdb timezonedb_builtin = { "2013.9", 579, timezonedb_idx_builtin, timelib_timezone_db_data_builtin }; +const timelib_tzdb timezonedb_builtin = { "2014.2", 580, timezonedb_idx_builtin, timelib_timezone_db_data_builtin }; diff --git a/ext/dom/document.c b/ext/dom/document.c index 73bc8c1c62..095f96dc09 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -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 diff --git a/ext/fileinfo/libmagic.patch b/ext/fileinfo/libmagic.patch index c83e4726e0..a9af5398f5 100644 --- a/ext/fileinfo/libmagic.patch +++ b/ext/fileinfo/libmagic.patch @@ -1,6 +1,6 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c --- libmagic.orig/apprentice.c Tue Nov 19 22:01:12 2013 -+++ libmagic/apprentice.c Fri Feb 21 00:21:27 2014 ++++ libmagic/apprentice.c Mon Mar 31 17:15:53 2014 @@ -29,6 +29,8 @@ * apprentice - make one pass through /etc/magic, learning its secrets. */ @@ -180,7 +180,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c return NULL; } -@@ -505,22 +498,24 @@ +@@ -505,22 +498,26 @@ { if (map == NULL) return; @@ -194,12 +194,14 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c - free(map->p); - free(map); + 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); + } + } @@ -215,7 +217,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c return NULL; } mlist->next = mlist->prev = mlist; -@@ -539,10 +534,10 @@ +@@ -539,10 +536,10 @@ struct mlist *next = ml->next; if (ml->map) apprentice_unmap(ml->map); @@ -228,7 +230,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c } /* const char *fn: list of magic files and directories */ -@@ -555,12 +550,28 @@ +@@ -555,12 +552,28 @@ file_reset(ms); @@ -258,7 +260,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c file_oomem(ms, strlen(fn)); return -1; } -@@ -575,7 +586,7 @@ +@@ -575,7 +588,7 @@ mlist_free(ms->mlist[i]); while (i != 0); } @@ -267,7 +269,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c return -1; } } -@@ -592,7 +603,7 @@ +@@ -592,7 +605,7 @@ fn = p; } @@ -276,7 +278,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c if (errs == -1) { for (i = 0; i < MAGIC_SETS; i++) { -@@ -918,7 +929,7 @@ +@@ -918,7 +931,7 @@ mset[i].max += ALLOC_INCR; if ((mp = CAST(struct magic_entry *, @@ -285,7 +287,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c NULL) { file_oomem(ms, sizeof(*mp) * mset[i].max); return -1; -@@ -939,13 +950,20 @@ +@@ -939,13 +952,20 @@ load_1(struct magic_set *ms, int action, const char *fn, int *errs, struct magic_entry_set *mset) { @@ -310,7 +312,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c if (errno != ENOENT) file_error(ms, errno, "cannot read magic file `%s'", fn); -@@ -955,8 +973,7 @@ +@@ -955,8 +975,7 @@ memset(&me, 0, sizeof(me)); /* read and parse this file */ @@ -320,7 +322,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c if (len == 0) /* null line, garbage, etc */ continue; if (line[len - 1] == '\n') { -@@ -1014,8 +1031,7 @@ +@@ -1014,8 +1033,7 @@ } if (me.mp) (void)addentry(ms, &me, mset); @@ -330,7 +332,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c } /* -@@ -1094,7 +1110,7 @@ +@@ -1094,7 +1112,7 @@ mentrycount += me[i].cont_count; slen = sizeof(**ma) * mentrycount; @@ -339,7 +341,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c file_oomem(ms, slen); return -1; } -@@ -1116,8 +1132,8 @@ +@@ -1116,8 +1134,8 @@ if (me == NULL) return; for (i = 0; i < nme; i++) @@ -350,7 +352,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c } private struct magic_map * -@@ -1126,18 +1142,20 @@ +@@ -1126,18 +1144,20 @@ int errs = 0; uint32_t i, j; size_t files = 0, maxfiles = 0; @@ -375,7 +377,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c { file_oomem(ms, sizeof(*map)); return NULL; -@@ -1148,22 +1166,26 @@ +@@ -1148,22 +1168,26 @@ (void)fprintf(stderr, "%s\n", usg_hdr); /* load directory or file */ @@ -409,7 +411,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c continue; } if (files >= maxfiles) { -@@ -1171,23 +1193,23 @@ +@@ -1171,23 +1195,23 @@ maxfiles = (maxfiles + 1) * 2; mlen = maxfiles * sizeof(*filearr); if ((filearr = CAST(char **, @@ -440,7 +442,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c } else load_1(ms, action, fn, &errs, mset); if (errs) -@@ -1226,9 +1248,9 @@ +@@ -1226,9 +1250,9 @@ if (errs) { for (j = 0; j < MAGIC_SETS; j++) { if (map->magic[j]) @@ -452,7 +454,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c return NULL; } return map; -@@ -1516,7 +1538,7 @@ +@@ -1516,7 +1540,7 @@ if (me->cont_count == me->max_count) { struct magic *nm; size_t cnt = me->max_count + ALLOC_CHUNK; @@ -461,7 +463,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c sizeof(*nm) * cnt))) == NULL) { file_oomem(ms, sizeof(*nm) * cnt); return -1; -@@ -1531,7 +1553,7 @@ +@@ -1531,7 +1555,7 @@ static const size_t len = sizeof(*m) * ALLOC_CHUNK; if (me->mp != NULL) return 1; @@ -470,7 +472,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c file_oomem(ms, len); return -1; } -@@ -1704,7 +1726,7 @@ +@@ -1704,7 +1728,7 @@ m->type = get_standard_integer_type(l, &l); else if (*l == 's' && !isalpha((unsigned char)l[1])) { m->type = FILE_STRING; @@ -479,7 +481,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c } } } -@@ -1717,6 +1739,10 @@ +@@ -1717,6 +1741,10 @@ if (m->type == FILE_INVALID) { if (ms->flags & MAGIC_CHECK) file_magwarn(ms, "type `%s' invalid", l); @@ -490,7 +492,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c return -1; } -@@ -1725,7 +1751,7 @@ +@@ -1725,7 +1753,7 @@ m->mask_op = 0; if (*l == '~') { @@ -499,7 +501,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c m->mask_op |= FILE_OPINVERSE; else if (ms->flags & MAGIC_CHECK) file_magwarn(ms, "'~' invalid for string types"); -@@ -1734,7 +1760,7 @@ +@@ -1734,7 +1762,7 @@ m->str_range = 0; m->str_flags = m->type == FILE_PSTRING ? PSTRING_1_LE : 0; if ((op = get_op(*l)) != -1) { @@ -508,7 +510,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c uint64_t val; ++l; m->mask_op |= op; -@@ -1925,11 +1951,6 @@ +@@ -1925,11 +1953,6 @@ if (check_format(ms, m) == -1) return -1; } @@ -520,7 +522,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c m->mimetype[0] = '\0'; /* initialise MIME type to none */ return 0; } -@@ -2575,59 +2596,76 @@ +@@ -2575,59 +2598,76 @@ private struct magic_map * apprentice_map(struct magic_set *ms, const char *fn) { @@ -618,7 +620,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c if (*ptr != MAGICNO) { if (swap4(*ptr) != MAGICNO) { file_error(ms, 0, "bad magic in `%s'", dbname); -@@ -2641,17 +2679,29 @@ +@@ -2641,17 +2681,29 @@ else version = ptr[1]; if (version != VERSIONNO) { @@ -656,7 +658,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c } map->magic[0] = CAST(struct magic *, map->p) + 1; nentries = 0; -@@ -2664,22 +2714,29 @@ +@@ -2664,22 +2716,29 @@ map->magic[i + 1] = map->magic[i] + map->nmagic[i]; nentries += map->nmagic[i]; } @@ -691,7 +693,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c return NULL; } -@@ -2700,14 +2757,19 @@ +@@ -2700,14 +2759,19 @@ char *dbname; int rv = -1; uint32_t i; @@ -714,7 +716,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c file_error(ms, errno, "cannot open `%s'", dbname); goto out; } -@@ -2717,31 +2779,33 @@ +@@ -2717,31 +2781,33 @@ goto out; } @@ -754,7 +756,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c return rv; } -@@ -2754,6 +2818,7 @@ +@@ -2754,6 +2820,7 @@ { const char *p, *q; char *buf; @@ -762,7 +764,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c if (strip) { if ((p = strrchr(fn, '/')) != NULL) -@@ -2775,16 +2840,18 @@ +@@ -2775,16 +2842,18 @@ q++; /* Compatibility with old code that looked in .mime */ if (ms->flags & MAGIC_MIME) { @@ -787,7 +789,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c /* Compatibility with old code that looked in .mime */ if (strstr(p, ".mime") != NULL) -@@ -2874,7 +2941,7 @@ +@@ -2874,7 +2943,7 @@ m->offset = swap4((uint32_t)m->offset); m->in_offset = swap4((uint32_t)m->in_offset); m->lineno = swap4((uint32_t)m->lineno); @@ -1649,8 +1651,8 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c } diff -u libmagic.orig/funcs.c libmagic/funcs.c --- libmagic.orig/funcs.c Thu Feb 13 00:20:53 2014 -+++ libmagic/funcs.c Fri Feb 28 14:01:53 2014 -@@ -41,79 +41,76 @@ ++++ libmagic/funcs.c Wed Mar 19 13:28:34 2014 +@@ -41,79 +41,79 @@ #if defined(HAVE_WCTYPE_H) #include <wctype.h> #endif @@ -1674,16 +1676,18 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c -{ - int len; - char *buf, *newstr; -+#ifndef PREG_OFFSET_CAPTURE -+# define PREG_OFFSET_CAPTURE (1<<8) -+#endif ++#include "php.h" ++#include "main/php_network.h" - if (ms->event_flags & EVENT_HAD_ERR) - return 0; - len = vasprintf(&buf, fmt, ap); - if (len < 0) - goto out; -- ++#ifndef PREG_OFFSET_CAPTURE ++# define PREG_OFFSET_CAPTURE (1<<8) ++#endif + - if (ms->o.buf != NULL) { - len = asprintf(&newstr, "%s%s", ms->o.buf, buf); - free(buf); @@ -1767,7 +1771,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c ms->event_flags |= EVENT_HAD_ERR; ms->error = error; } -@@ -160,10 +157,9 @@ +@@ -160,10 +160,9 @@ file_error(ms, errno, "error reading"); } @@ -1780,7 +1784,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c { int m = 0, rv = 0, looks_text = 0; int mime = ms->flags & MAGIC_MIME; -@@ -203,10 +199,10 @@ +@@ -203,10 +202,10 @@ } } #endif @@ -1794,7 +1798,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_encoding; -@@ -221,12 +217,17 @@ +@@ -221,12 +220,17 @@ } /* Check if we have a CDF file */ @@ -1804,7 +1808,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c - (void)fprintf(stderr, "cdf %d\n", m); - goto done; + if ((ms->flags & MAGIC_NO_CHECK_CDF) == 0) { -+ int fd; ++ php_socket_t fd; + TSRMLS_FETCH(); + if (stream && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **)&fd, 0)) { + if ((m = file_trycdf(ms, fd, ubuf, nb)) != 0) { @@ -1817,7 +1821,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c /* try soft magic tests */ if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) -@@ -300,7 +301,6 @@ +@@ -300,7 +304,6 @@ return m; } @@ -1825,7 +1829,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c protected int file_reset(struct magic_set *ms) -@@ -310,11 +310,11 @@ +@@ -310,11 +313,11 @@ return -1; } if (ms->o.buf) { @@ -1839,7 +1843,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c ms->o.pbuf = NULL; } ms->event_flags &= ~EVENT_HAD_ERR; -@@ -333,7 +333,7 @@ +@@ -333,7 +336,7 @@ protected const char * file_getbuffer(struct magic_set *ms) { @@ -1848,7 +1852,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c size_t psize, len; if (ms->event_flags & EVENT_HAD_ERR) -@@ -348,15 +348,13 @@ +@@ -348,15 +351,13 @@ /* * 4 is for octal representation, + 1 is for NUL */ len = strlen(ms->o.buf); if (len > (SIZE_MAX - 1) / 4) { @@ -1865,7 +1869,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c #if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH) { -@@ -416,8 +414,8 @@ +@@ -416,8 +417,8 @@ if (level >= ms->c.len) { len = (ms->c.len += 20) * sizeof(*ms->c.li); ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ? @@ -1876,7 +1880,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c if (ms->c.li == NULL) { file_oomem(ms, len); return -1; -@@ -437,32 +435,50 @@ +@@ -437,32 +438,50 @@ return ms->o.buf == NULL ? 0 : strlen(ms->o.buf); } diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index 4196e17afa..ce747378aa 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -499,12 +499,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); } } diff --git a/ext/fileinfo/libmagic/funcs.c b/ext/fileinfo/libmagic/funcs.c index f17f36536d..e1aa7b9c3d 100644 --- a/ext/fileinfo/libmagic/funcs.c +++ b/ext/fileinfo/libmagic/funcs.c @@ -49,6 +49,9 @@ FILE_RCSID("@(#)$File: funcs.c,v 1.67 2014/02/12 23:20:53 christos Exp $") # define SIZE_MAX ((size_t) -1) #endif +#include "php.h" +#include "main/php_network.h" + #ifndef PREG_OFFSET_CAPTURE # define PREG_OFFSET_CAPTURE (1<<8) #endif @@ -218,7 +221,7 @@ file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const /* Check if we have a CDF file */ if ((ms->flags & MAGIC_NO_CHECK_CDF) == 0) { - int fd; + php_socket_t fd; TSRMLS_FETCH(); if (stream && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **)&fd, 0)) { if ((m = file_trycdf(ms, fd, ubuf, nb)) != 0) { diff --git a/ext/fileinfo/magicdata.patch b/ext/fileinfo/magicdata.patch new file mode 100644 index 0000000000..fb34c3c533 --- /dev/null +++ b/ext/fileinfo/magicdata.patch @@ -0,0 +1,4 @@ +Patches applied to file sources tree before generating magic.mgc +and before running create_data_file.php to create data_file.c. + + diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 41c7a70d2b..f14437d96f 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -728,6 +728,46 @@ PHP_FUNCTION(hash_pbkdf2) } /* }}} */ +/* {{{ proto bool hash_equals(string known_string, string user_string) + Compares two strings using the same time whether they're equal or not. + A difference in length will leak */ +PHP_FUNCTION(hash_equals) +{ + zval *known_zval, *user_zval; + char *known_str, *user_str; + int result = 0, j; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &known_zval, &user_zval) == FAILURE) { + return; + } + + /* We only allow comparing string to prevent unexpected results. */ + if (Z_TYPE_P(known_zval) != IS_STRING) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected known_string to be a string, %s given", zend_zval_type_name(known_zval)); + RETURN_FALSE; + } + + if (Z_TYPE_P(user_zval) != IS_STRING) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected user_string to be a string, %s given", zend_zval_type_name(user_zval)); + RETURN_FALSE; + } + + if (Z_STRLEN_P(known_zval) != Z_STRLEN_P(user_zval)) { + RETURN_FALSE; + } + + known_str = Z_STRVAL_P(known_zval); + user_str = Z_STRVAL_P(user_zval); + + /* This is security sensitive code. Do not optimize this for speed. */ + for (j = 0; j < Z_STRLEN_P(known_zval); j++) { + result |= known_str[j] ^ user_str[j]; + } + + RETURN_BOOL(0 == result); +} +/* }}} */ + /* Module Housekeeping */ static void php_hash_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */ @@ -1152,6 +1192,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_pbkdf2, 0, 0, 4) ZEND_ARG_INFO(0, raw_output) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO(arginfo_hash_equals, 0) + ZEND_ARG_INFO(0, known_string) + ZEND_ARG_INFO(0, user_string) +ZEND_END_ARG_INFO() + /* BC Land */ #ifdef PHP_MHASH_BC ZEND_BEGIN_ARG_INFO(arginfo_mhash_get_block_size, 0) @@ -1199,6 +1244,7 @@ const zend_function_entry hash_functions[] = { PHP_FE(hash_algos, arginfo_hash_algos) PHP_FE(hash_pbkdf2, arginfo_hash_pbkdf2) + PHP_FE(hash_equals, arginfo_hash_equals) /* BC Land */ #ifdef PHP_HASH_MD5_NOT_IN_CORE diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h index c5cb6604db..c75b930936 100644 --- a/ext/hash/php_hash.h +++ b/ext/hash/php_hash.h @@ -136,6 +136,7 @@ PHP_FUNCTION(hash_update_file); PHP_FUNCTION(hash_final); PHP_FUNCTION(hash_algos); PHP_FUNCTION(hash_pbkdf2); +PHP_FUNCTION(hash_equals); PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len); PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops *ops); diff --git a/ext/hash/tests/hash_equals.phpt b/ext/hash/tests/hash_equals.phpt new file mode 100644 index 0000000000..8f87985f47 --- /dev/null +++ b/ext/hash/tests/hash_equals.phpt @@ -0,0 +1,43 @@ +--TEST-- +hash_equals() function +--FILE-- +<?php +var_dump(hash_equals("same", "same")); +var_dump(hash_equals("not1same", "not2same")); +var_dump(hash_equals("short", "longer")); +var_dump(hash_equals("longer", "short")); +var_dump(hash_equals("", "notempty")); +var_dump(hash_equals("notempty", "")); +var_dump(hash_equals("", "")); +var_dump(hash_equals(123, "NaN")); +var_dump(hash_equals("NaN", 123)); +var_dump(hash_equals(123, 123)); +var_dump(hash_equals(null, "")); +var_dump(hash_equals(null, 123)); +var_dump(hash_equals(null, null)); +--EXPECTF-- +bool(true) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) + +Warning: hash_equals(): Expected known_string to be a string, integer given in %s on line %d +bool(false) + +Warning: hash_equals(): Expected user_string to be a string, integer given in %s on line %d +bool(false) + +Warning: hash_equals(): Expected known_string to be a string, integer given in %s on line %d +bool(false) + +Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d +bool(false) + +Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d +bool(false) + +Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d +bool(false) diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 87ad5eeaab..2df759f99b 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -226,11 +226,10 @@ static PHP_INI_MH(OnUpdateInputEncoding) if (new_value_length >= ICONV_CSNMAXLEN) { return FAILURE; } - if (new_value_length) { - OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); - } else { - OnUpdateString(entry, PG(input_encoding), strlen(PG(input_encoding))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) { + php_error_docref("ref.iconv" TSRMLS_CC, E_DEPRECATED, "Use of iconv.input_encoding is deprecated"); } + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); return SUCCESS; } @@ -240,11 +239,10 @@ static PHP_INI_MH(OnUpdateOutputEncoding) if(new_value_length >= ICONV_CSNMAXLEN) { return FAILURE; } - if (new_value_length) { - OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); - } else { - OnUpdateString(entry, PG(output_encoding), strlen(PG(output_encoding))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) { + php_error_docref("ref.iconv" TSRMLS_CC, E_DEPRECATED, "Use of iconv.output_encoding is deprecated"); } + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); return SUCCESS; } @@ -254,11 +252,10 @@ static PHP_INI_MH(OnUpdateInternalEncoding) if(new_value_length >= ICONV_CSNMAXLEN) { return FAILURE; } - if (new_value_length) { - OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); - } else { - OnUpdateString(entry, PG(internal_encoding), strlen(PG(internal_encoding))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) { + php_error_docref("ref.iconv" TSRMLS_CC, E_DEPRECATED, "Use of iconv.internal_encoding is deprecated"); } + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); return SUCCESS; } @@ -347,6 +344,40 @@ PHP_MINFO_FUNCTION(miconv) } /* }}} */ +static char *get_internal_encoding(TSRMLS_D) { + if (ICONVG(internal_encoding) && ICONVG(internal_encoding)[0]) { + return ICONVG(internal_encoding); + } else if (PG(internal_encoding) && PG(internal_encoding)[0]) { + return PG(internal_encoding); + } else if (SG(default_charset)) { + return SG(default_charset); + } + return ""; +} + +static char *get_input_encoding(TSRMLS_D) { + if (ICONVG(input_encoding) && ICONVG(input_encoding)[0]) { + return ICONVG(input_encoding); + } else if (PG(input_encoding) && PG(input_encoding)[0]) { + return PG(input_encoding); + } else if (SG(default_charset)) { + return SG(default_charset); + } + return ""; +} + +static char *get_output_encoding(TSRMLS_D) { + if (ICONVG(output_encoding) && ICONVG(output_encoding)[0]) { + return ICONVG(output_encoding); + } else if (PG(output_encoding) && PG(output_encoding)[0]) { + return PG(output_encoding); + } else if (SG(default_charset)) { + return SG(default_charset); + } + return ""; +} + + static int php_iconv_output_conflict(const char *handler_name, size_t handler_name_len TSRMLS_DC) { if (php_output_get_level(TSRMLS_C)) { @@ -388,12 +419,12 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c if (mimetype != NULL && !(output_context->op & PHP_OUTPUT_HANDLER_CLEAN)) { int len; - char *p = strstr(ICONVG(output_encoding), "//"); + char *p = strstr(get_output_encoding(TSRMLS_C), "//"); if (p) { - len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%.*s", mimetype_len ? mimetype_len : (int) strlen(mimetype), mimetype, (int)(p - ICONVG(output_encoding)), ICONVG(output_encoding)); + len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%.*s", mimetype_len ? mimetype_len : (int) strlen(mimetype), mimetype, (int)(p - get_output_encoding(TSRMLS_C)), get_output_encoding(TSRMLS_C)); } else { - len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%s", mimetype_len ? mimetype_len : (int) strlen(mimetype), mimetype, ICONVG(output_encoding)); + len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%s", mimetype_len ? mimetype_len : (int) strlen(mimetype), mimetype, get_output_encoding(TSRMLS_C)); } if (content_type && SUCCESS == sapi_add_header(content_type, len, 0)) { SG(sapi_headers).send_default_content_type = 0; @@ -404,7 +435,7 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c if (output_context->in.used) { output_context->out.free = 1; - _php_iconv_show_error(php_iconv_string(output_context->in.data, output_context->in.used, &output_context->out.data, &output_context->out.used, ICONVG(output_encoding), ICONVG(internal_encoding)), ICONVG(output_encoding), ICONVG(internal_encoding) TSRMLS_CC); + _php_iconv_show_error(php_iconv_string(output_context->in.data, output_context->in.used, &output_context->out.data, &output_context->out.used, get_output_encoding(TSRMLS_C), get_internal_encoding(TSRMLS_C)), get_output_encoding(TSRMLS_C), get_internal_encoding(TSRMLS_C) TSRMLS_CC); } return SUCCESS; @@ -1991,7 +2022,7 @@ static void _php_iconv_show_error(php_iconv_err_t err, const char *out_charset, Returns the character count of str */ PHP_FUNCTION(iconv_strlen) { - char *charset = ICONVG(internal_encoding); + char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; char *str; int str_len; @@ -2024,7 +2055,7 @@ PHP_FUNCTION(iconv_strlen) Returns specified part of a string */ PHP_FUNCTION(iconv_substr) { - char *charset = ICONVG(internal_encoding); + char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; char *str; int str_len; @@ -2064,7 +2095,7 @@ PHP_FUNCTION(iconv_substr) Finds position of first occurrence of needle within part of haystack beginning with offset */ PHP_FUNCTION(iconv_strpos) { - char *charset = ICONVG(internal_encoding); + char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; char *haystk; int haystk_len; @@ -2112,7 +2143,7 @@ PHP_FUNCTION(iconv_strpos) Finds position of last occurrence of needle within part of haystack beginning with offset */ PHP_FUNCTION(iconv_strrpos) { - char *charset = ICONVG(internal_encoding); + char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; char *haystk; int haystk_len; @@ -2163,7 +2194,7 @@ PHP_FUNCTION(iconv_mime_encode) smart_str retval = {0}; php_iconv_err_t err; - const char *in_charset = ICONVG(internal_encoding); + const char *in_charset = get_internal_encoding(TSRMLS_C); const char *out_charset = in_charset; long line_len = 76; const char *lfchars = "\r\n"; @@ -2276,7 +2307,7 @@ PHP_FUNCTION(iconv_mime_decode) { char *encoded_str; int encoded_str_len; - char *charset = ICONVG(internal_encoding); + char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; long mode = 0; @@ -2317,7 +2348,7 @@ PHP_FUNCTION(iconv_mime_decode_headers) { const char *encoded_str; int encoded_str_len; - char *charset = ICONVG(internal_encoding); + char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; long mode = 0; @@ -2485,15 +2516,15 @@ PHP_FUNCTION(iconv_get_encoding) if (!strcasecmp("all", type)) { array_init(return_value); - add_assoc_string(return_value, "input_encoding", ICONVG(input_encoding), 1); - add_assoc_string(return_value, "output_encoding", ICONVG(output_encoding), 1); - add_assoc_string(return_value, "internal_encoding", ICONVG(internal_encoding), 1); + add_assoc_string(return_value, "input_encoding", get_input_encoding(TSRMLS_C), 1); + add_assoc_string(return_value, "output_encoding", get_output_encoding(TSRMLS_C), 1); + add_assoc_string(return_value, "internal_encoding", get_internal_encoding(TSRMLS_C), 1); } else if (!strcasecmp("input_encoding", type)) { - RETVAL_STRING(ICONVG(input_encoding), 1); + RETVAL_STRING(get_input_encoding(TSRMLS_C), 1); } else if (!strcasecmp("output_encoding", type)) { - RETVAL_STRING(ICONVG(output_encoding), 1); + RETVAL_STRING(get_output_encoding(TSRMLS_C), 1); } else if (!strcasecmp("internal_encoding", type)) { - RETVAL_STRING(ICONVG(internal_encoding), 1); + RETVAL_STRING(get_internal_encoding(TSRMLS_C), 1); } else { RETURN_FALSE; } diff --git a/ext/iconv/tests/iconv_default_charset.phpt b/ext/iconv/tests/iconv_default_charset.phpt new file mode 100644 index 0000000000..ebfc7e6ee1 --- /dev/null +++ b/ext/iconv/tests/iconv_default_charset.phpt @@ -0,0 +1,77 @@ +--TEST-- +Test default_charset handling +--SKIPIF-- +<?php +extension_loaded('iconv') or die('skip'); +function_exists('iconv_get_encoding') or die("skip iconv_get_encoding() is not available in this build"); +?> +--INI-- +error_reporting=E_ALL & ~E_DEPRECATED +default_charset=UTF-8 +internal_encoding= +input_encoding= +output_encoding= +iconv.internal_encoding= +iconv.input_encoding= +iconv.output_encoding= +--FILE-- +<?php +echo "*** Testing default_charset handling ***\n"; + +echo "--- Get php.ini values ---\n"; +var_dump(ini_get('default_charset'), + ini_get('internal_encoding'), + ini_get('input_encoding'), + ini_get('output_encoding'), + ini_get('iconv.internal_encoding'), + ini_get('iconv.input_encoding'), + ini_get('iconv.output_encoding')); + +echo "\n--- Altering encodings ---\n"; +var_dump(ini_set('default_charset', 'ISO-8859-1')); + +echo "\n--- results of alterations ---\n"; +var_dump(ini_get('default_charset'), + ini_get('internal_encoding'), + ini_get('input_encoding'), + ini_get('output_encoding'), + ini_get('iconv.internal_encoding'), + ini_get('iconv.input_encoding'), + ini_get('iconv.output_encoding')); + +/* +echo "\n--- Altering encodings ---\n"; +var_dump(ini_set('default_charset', 'ISO-8859-1'), + ini_set('internal_encoding'), + ini_set('input_encoding'), + ini_set('output_encoding'), + ini_set('iconv.internal_encoding'), + ini_set('iconv.input_encoding'), + ini_set('iconv.output_encoding')); +*/ + +echo "Done"; +?> +--EXPECTF-- +*** Testing default_charset handling *** +--- Get php.ini values --- +string(5) "UTF-8" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" + +--- Altering encodings --- +string(5) "UTF-8" + +--- results of alterations --- +string(10) "ISO-8859-1" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +Done diff --git a/ext/iconv/tests/iconv_encoding_basic.phpt b/ext/iconv/tests/iconv_encoding_basic.phpt index 746858161c..35314f1e69 100644 --- a/ext/iconv/tests/iconv_encoding_basic.phpt +++ b/ext/iconv/tests/iconv_encoding_basic.phpt @@ -6,6 +6,7 @@ extension_loaded('iconv') or die('skip'); function_exists('iconv_get_encoding') or die("skip iconv_get_encoding() is not available in this build"); ?> --INI-- +error_reporting=E_ALL & ~E_DEPRECATED iconv.input_encoding=ISO-8859-1 iconv.internal_encoding=ISO-8859-1 iconv.output_encoding=ISO-8859-1 diff --git a/ext/iconv/tests/iconv_get_encoding_basic.phpt b/ext/iconv/tests/iconv_get_encoding_basic.phpt index 83efd1586d..84ee932e10 100644 --- a/ext/iconv/tests/iconv_get_encoding_basic.phpt +++ b/ext/iconv/tests/iconv_get_encoding_basic.phpt @@ -5,6 +5,8 @@ Oystein Rose <orose@redpill-linpro.com> #PHPTestFest2009 Norway 2009-06-09 \o/ --SKIPIF-- <?php if (!extension_loaded("iconv")) { echo 'skip extension not available'; } ?> +--INI-- +error_reporting=E_ALL & ~E_DEPRECATED --FILE-- <?php diff --git a/ext/iconv/tests/iconv_ini_encoding.phpt b/ext/iconv/tests/iconv_ini_encoding.phpt index b9a69824e1..2d02b1c55a 100644 --- a/ext/iconv/tests/iconv_ini_encoding.phpt +++ b/ext/iconv/tests/iconv_ini_encoding.phpt @@ -3,6 +3,7 @@ Encoding INI test --SKIPIF-- <?php extension_loaded('iconv') or die('skip mbstring not available'); ?> --INI-- +error_reporting=E_ALL & ~E_DEPRECATED default_charset=ISO-8859-1 internal_encoding= input_encoding= diff --git a/ext/iconv/tests/iconv_set_encoding_variation.phpt b/ext/iconv/tests/iconv_set_encoding_variation.phpt index e239c6c18b..4e097569fd 100644 --- a/ext/iconv/tests/iconv_set_encoding_variation.phpt +++ b/ext/iconv/tests/iconv_set_encoding_variation.phpt @@ -5,6 +5,8 @@ Test iconv_set_encoding() function : error functionality extension_loaded('iconv') or die('skip'); function_exists('iconv_set_encoding') or die("skip iconv_set_encoding() is not available in this build"); ?> +--INI-- +error_reporting=E_ALL & ~E_DEPRECATED --FILE-- <?php /* Prototype : bool iconv_set_encoding(string type, string charset) diff --git a/ext/iconv/tests/iconv_strpos_basic.phpt b/ext/iconv/tests/iconv_strpos_basic.phpt index 1604465f1d..25f8f1b1fd 100644 --- a/ext/iconv/tests/iconv_strpos_basic.phpt +++ b/ext/iconv/tests/iconv_strpos_basic.phpt @@ -5,6 +5,8 @@ Test iconv_strpos() function : basic functionality extension_loaded('iconv') or die('skip'); function_exists('iconv_strpos') or die("skip iconv_strpos() is not available in this build"); ?> +--INI-- +error_reporting=E_ALL & ~E_DEPRECATED --FILE-- <?php /* Prototype : int iconv_strpos(string haystack, string needle [, int offset [, string charset]]) diff --git a/ext/iconv/tests/iconv_strpos_variation5.phpt b/ext/iconv/tests/iconv_strpos_variation5.phpt index 57a7a90ee4..3db0634215 100644 --- a/ext/iconv/tests/iconv_strpos_variation5.phpt +++ b/ext/iconv/tests/iconv_strpos_variation5.phpt @@ -5,6 +5,8 @@ Test iconv_strpos() function : usage variations - Pass different integers as $of extension_loaded('iconv') or die('skip'); function_exists('iconv_strpos') or die("skip iconv_strpos() is not available in this build"); ?> +--INI-- +error_reporting=E_ALL & ~E_DEPRECATED --FILE-- <?php /* Prototype : int iconv_strpos(string haystack, string needle [, int offset [, string charset]]) diff --git a/ext/iconv/tests/iconv_strrpos_basic.phpt b/ext/iconv/tests/iconv_strrpos_basic.phpt index e275681057..3d34a23f11 100644 --- a/ext/iconv/tests/iconv_strrpos_basic.phpt +++ b/ext/iconv/tests/iconv_strrpos_basic.phpt @@ -5,6 +5,8 @@ Test iconv_strrpos() function : basic functionality extension_loaded('iconv') or die('skip'); function_exists('iconv_strrpos') or die("skip iconv_strrpos() is not available in this build"); ?> +--INI-- +error_reporting=E_ALL & ~E_DEPRECATED --FILE-- <?php /* Prototype : proto int iconv_strrpos(string haystack, string needle [, string charset]) diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c index 5f2d1e7fa7..a3381bf78e 100644 --- a/ext/intl/converter/converter.c +++ b/ext/intl/converter/converter.c @@ -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); } /* }}} */ diff --git a/ext/intl/tests/dateformat_format.phpt b/ext/intl/tests/dateformat_format.phpt index c3f6c297d9..8b410876c0 100644 --- a/ext/intl/tests/dateformat_format.phpt +++ b/ext/intl/tests/dateformat_format.phpt @@ -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 diff --git a/ext/intl/tests/dateformat_format_variant2.phpt b/ext/intl/tests/dateformat_format_variant2.phpt index 7c5bcfcfd4..eb606a53db 100644 --- a/ext/intl/tests/dateformat_format_variant2.phpt +++ b/ext/intl/tests/dateformat_format_variant2.phpt @@ -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 diff --git a/ext/intl/tests/dateformat_format_variant3.phpt b/ext/intl/tests/dateformat_format_variant3.phpt new file mode 100644 index 0000000000..40d49c8dc3 --- /dev/null +++ b/ext/intl/tests/dateformat_format_variant3.phpt @@ -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' diff --git a/ext/intl/tests/timezone_toDateTimeZone_basic.phpt b/ext/intl/tests/timezone_toDateTimeZone_basic.phpt index d22aa689dc..76981a4a91 100644 --- a/ext/intl/tests/timezone_toDateTimeZone_basic.phpt +++ b/ext/intl/tests/timezone_toDateTimeZone_basic.phpt @@ -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) diff --git a/ext/intl/tests/uconverter_bug66873.phpt b/ext/intl/tests/uconverter_bug66873.phpt new file mode 100644 index 0000000000..aa1045ec35 --- /dev/null +++ b/ext/intl/tests/uconverter_bug66873.phpt @@ -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) diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index e7f08a3256..7d4eacf14d 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -601,6 +601,34 @@ static sapi_post_entry php_post_entries[] = { ZEND_GET_MODULE(mbstring) #endif +static char *get_internal_encoding(TSRMLS_D) { + if (PG(internal_encoding) && PG(internal_encoding)[0]) { + return PG(internal_encoding); + } else if (SG(default_charset)) { + return SG(default_charset); + } + return ""; +} + +static char *get_input_encoding(TSRMLS_D) { + if (PG(input_encoding) && PG(input_encoding)[0]) { + return PG(input_encoding); + } else if (SG(default_charset)) { + return SG(default_charset); + } + return ""; +} + +static char *get_output_encoding(TSRMLS_D) { + if (PG(output_encoding) && PG(output_encoding)[0]) { + return PG(output_encoding); + } else if (SG(default_charset)) { + return SG(default_charset); + } + return ""; +} + + /* {{{ allocators */ static void *_php_mb_allocators_malloc(unsigned int sz) { @@ -1236,9 +1264,9 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input) if (MBSTRG(http_input_list)) { pefree(MBSTRG(http_input_list), 1); } - if (SUCCESS == php_mb_parse_encoding_list(PG(input_encoding), strlen(PG(input_encoding))+1, &list, &size, 1 TSRMLS_CC)) { + if (SUCCESS == php_mb_parse_encoding_list(get_input_encoding(TSRMLS_C), strlen(get_input_encoding(TSRMLS_C))+1, &list, &size, 1 TSRMLS_CC)) { MBSTRG(http_input_list) = list; - MBSTRG(http_input_list_size) = 0; + MBSTRG(http_input_list_size) = size; return SUCCESS; } MBSTRG(http_input_list) = NULL; @@ -1256,6 +1284,10 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input) MBSTRG(http_input_list) = list; MBSTRG(http_input_list_size) = size; + if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) { + php_error_docref("ref.mbstring" TSRMLS_CC, E_DEPRECATED, "Use of mbstring.http_input is deprecated"); + } + return SUCCESS; } /* }}} */ @@ -1266,7 +1298,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output) const mbfl_encoding *encoding; if (new_value == NULL || new_value_length == 0) { - encoding = mbfl_name2encoding(PG(output_encoding)); + encoding = mbfl_name2encoding(get_output_encoding(TSRMLS_C)); if (!encoding) { MBSTRG(http_output_encoding) = &mbfl_encoding_pass; MBSTRG(current_http_output_encoding) = &mbfl_encoding_pass; @@ -1282,6 +1314,11 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output) } MBSTRG(http_output_encoding) = encoding; MBSTRG(current_http_output_encoding) = encoding; + + if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) { + php_error_docref("ref.mbstring" TSRMLS_CC, E_DEPRECATED, "Use of mbstring.http_output is deprecated"); + } + return SUCCESS; } /* }}} */ @@ -1315,15 +1352,19 @@ int _php_mb_ini_mbstring_internal_encoding_set(const char *new_value, uint new_v /* {{{ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) */ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) { + if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) { + php_error_docref("ref.mbstring" TSRMLS_CC, E_DEPRECATED, "Use of mbstring.internal_encoding is deprecated"); + } + if (OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) { return FAILURE; } - if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN - || stage == PHP_INI_STAGE_RUNTIME) { + + if (stage & (PHP_INI_STAGE_STARTUP | PHP_INI_STAGE_SHUTDOWN | PHP_INI_STAGE_RUNTIME)) { if (new_value_length) { return _php_mb_ini_mbstring_internal_encoding_set(new_value, new_value_length TSRMLS_CC); } else { - return _php_mb_ini_mbstring_internal_encoding_set(PG(internal_encoding), strlen(PG(internal_encoding))+1 TSRMLS_CC); + return _php_mb_ini_mbstring_internal_encoding_set(get_internal_encoding(TSRMLS_C), strlen(get_internal_encoding(TSRMLS_C))+1 TSRMLS_CC); } } else { /* the corresponding mbstring globals needs to be set according to the diff --git a/ext/mbstring/oniguruma/HISTORY b/ext/mbstring/oniguruma/HISTORY index 7add6f9a90..6b3031bcb6 100644 --- a/ext/mbstring/oniguruma/HISTORY +++ b/ext/mbstring/oniguruma/HISTORY @@ -1,5 +1,24 @@ History +2013/10/21: Version 5.9.5 + +2013/10/21: [impl] escape warnings for -Wall. (regparse.c) +2013/10/21: [bug] fixes an issue on Windows x64. (thanks Anatoliy Belsky) + The issue was discovered in PHP, see https://bugs.php.net/64769. +2013/10/21: [impl] remove unused variable. (regcomp.c) + +2013/04/04: Version 5.9.4 + +2013/04/04: [dev] remove Makefile.in from git repository. +2013/04/04: [dist] add oniguruma.pc.in file. (for pkg-config) + (thanks Giulio Paci) + +2012/10/26: Version 5.9.3 + +2012/10/15: remove warnings "test: =: unary operator expected" in ./configure. + (thanks t_okazaki) +2012/10/15: fix print_tree ENCLOSE_OPTION bug. (thanks Suraj N. Kurapati) + 2010/01/09: Version 5.9.2 2010/01/05: [bug] fix utf16be_code_to_mbc() and utf16le_code_to_mbc(). @@ -878,7 +897,7 @@ History 2004/10/18: [impl] (thanks Imai Yasumasa) enclose #include <sys/types.h> by #ifndef __BORLANDC__. 2004/10/18: [bug] (thanks Imai Yasumasa) - memory access violation in select_opt_exact_info(). + memory acess violation in select_opt_exact_info(). 2004/09/25: [dist] fix doc/API and doc/API.ja. 2004/09/25: [bug] fix OP_SEMI_END_BUF process in match_at() for the case USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE @@ -1812,7 +1831,7 @@ History 2003/01/31: [impl] rename TTRANS() to TOLOWER(). 2003/01/30: [bug] .c.o --> .c.obj in win32\Makefile. 2003/01/30: [impl] add -DNOT_RUBY to Makefile.in. - NOT_RUBY is referred in regint.h for escape double + NOT_RUBY is refered in regint.h for escape double including config.h. 2003/01/30: [impl] when string hasn't case ambiguity, don't compile to ignore case opcode. diff --git a/ext/mbstring/oniguruma/config.h.in b/ext/mbstring/oniguruma/config.h.in index 4a2fc28d82..cd61683314 100644 --- a/ext/mbstring/oniguruma/config.h.in +++ b/ext/mbstring/oniguruma/config.h.in @@ -57,6 +57,10 @@ /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + /* Name of package */ #undef PACKAGE @@ -72,21 +76,24 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME +/* Define to the home page for this package. */ +#undef PACKAGE_URL + /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* The size of a `int', as computed by sizeof. */ +/* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT -/* The size of a `long', as computed by sizeof. */ +/* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG -/* The size of a `short', as computed by sizeof. */ +/* The size of `short', as computed by sizeof. */ #undef SIZEOF_SHORT /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. + automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ @@ -101,8 +108,14 @@ /* Define if combination explosion check */ #undef USE_COMBINATION_EXPLOSION_CHECK +/* Define if enable CR+NL as line terminator */ +#undef USE_CRNL_AS_LINE_TERMINATOR + /* Version number of package */ #undef VERSION /* Define to empty if `const' does not conform to ANSI C. */ #undef const + +/* Define to `unsigned int' if <sys/types.h> does not define. */ +#undef size_t diff --git a/ext/mbstring/oniguruma/index.html b/ext/mbstring/oniguruma/index.html index af3426ce32..9231942b16 100755 --- a/ext/mbstring/oniguruma/index.html +++ b/ext/mbstring/oniguruma/index.html @@ -8,7 +8,7 @@ <h1>Oniguruma</h1> (<a href="index_ja.html">Japanese</a>) <p> -(c) K.Kosako, updated at: 2010/01/09 +(c) K.Kosako, updated at: 2013/10/21 </p> <dl> @@ -16,7 +16,7 @@ <dt><b>What's new</b> </font> <ul> -<li>2010/01/09: Version 5.9.2 released.</li> +<li>2013/10/21: Version 5.9.5 released.</li> <li>2007/08/16: Version 4.7.1 released.</li> <li>2007/06/20: Version 2.5.9 released.</li> <li>2007/06/20: Maintainer of 2.x was changed.</li> @@ -62,8 +62,8 @@ ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16<br> <dt><b>Download:</b> <ul> -<li> <a href="archive/onig-5.9.2.tar.gz">Latest release version 5.9.2</a> (2010/01/09) <a href="HISTORY_5X.txt">Change Log</a> -<li> <a href="archive/onig-5.9.1.tar.gz">5.9.1</a> (2007/12/22) +<li> <a href="archive/onig-5.9.5.tar.gz">Latest release version 5.9.5</a> (2013/10/21) <a href="HISTORY_5X.txt">Change Log</a> +<li> <a href="archive/onig-5.9.4.tar.gz">5.9.4</a> (2013/04/04) <li> <a href="archive/onig-4.7.1.tar.gz">Latest release version 4.7.1</a> (2007/08/16) <a href="HISTORY_4X.txt">Change Log</a> <li> <a href="archive/onig-4.7.0.tar.gz">4.7.0</a> (2007/06/18) <li> <a href="archive/onigd2_5_9.tar.gz">Latest release version 2.5.9</a> (2007/06/20) <a href="HISTORY_2X.txt">Change Log</a> @@ -78,7 +78,7 @@ About 2.x, please contact him.<br> * 2.x supports Ruby1.6/1.8.<br> <br> -<dt><b>Documents:</b> (version 5.9.2) +<dt><b>Documents:</b> (version 5.9.5) <ul> <li> <a href="doc/RE.txt">Regular Expressions</a> <a href="doc/RE.ja.txt">(Japanese: EUC-JP)</a> @@ -103,8 +103,11 @@ About 2.x, please contact him.<br> <br> <dt><b>Links:</b> <ul> +<li> <a href="http://www.perzl.org/aix/index.php?n=Main.Oniguruma">AIX Open Source Packages</a> +<li> <a href="https://aur.archlinux.org/packages/oniguruma/">Arch Linux Package</a> <li> <a href="http://homepage3.nifty.com/k-takata/mysoft/bregonig.html">bregonig.dll (Win32)</a> (Japanese page) <li> <a href="http://www.halbiz.com/osaru/cnregex.html">cnRegex 4D Plugin (Mac OS X)</a> (Japanese page) +<li> <a href="http://limechat.net/cocoaoniguruma/">CocoaOniguruma</a> <li> <a href="http://kmaebashi.com/">crowbar</a> (Japanese page) <li> <a href="http://oniguruma5.darwinports.com">Darwin Ports (Mac OS X)</a> <li> <a href="http://homepage2.nifty.com/Km/onig.htm">Delphi interface (Win32)</a> (Japanese page) @@ -121,7 +124,7 @@ About 2.x, please contact him.<br> <li> <a href="http://mongoose.jp/">mongoose</a> (Japanese page) <li> <a href="http://www.irori.org/tool/mregexp.html">mregexp</a> (Japanese page) <li> <a href="http://ochusha.sourceforge.jp/">Ochusha</a> (Japanese page) -<li> <a href="http://www8.ocn.ne.jp/%7esonoisa/OgreKit/index.html">OgreKit (Mac OS X)</a> Regular Expression Framework for Cocoa (Japanese page) +<li> <a href="http://sonoisa.github.com/ogrekit/About_%28English%29.html">OgreKit (Mac OS X)</a> Regular Expression Framework for Cocoa (Japanese page) <li> <a href="http://www.kanetaka.net/4dapi/wiki4d.dll/4dcgi/wiki.cgi?plugins-oniguruma">OnigRegexp</a> (Japanese page) <li> <a href="http://rubyforge.org/projects/oniguruma">Oniguruma for Ruby</a> <li> <a href="http://openspace.timedia.co.jp/~yasuyuki/wiliki/wiliki.cgi?Oniguruma-mysqld&l=jp">Oniguruma-mysqld</a> @@ -140,6 +143,7 @@ About 2.x, please contact him.<br> <li> <a href="http://sourceforge.jp/projects/ttssh2/">TeraTerm (Win32)</a> <li> <a href="http://www8.ocn.ne.jp/~sonoisa/TiddlyWikiPod/">TiddlyWikiPod (Mac OS X)</a> <li> <a href="http://www.cyanworks.net/mac.html">TunesTEXT (Mac OS X)</a> +<li> <a href="https://code.google.com/p/oniguruma-visualworks/">oniguruma-visualworks</a> <li> <a href="http://sourceforge.jp/projects/frogger/">XML parser</a> <li> <a href="http://www.yokkasoft.net/">YokkaSoft (Win32)</a> (Japanese page) <li> <a href="http://www.hi-ho.ne.jp/kuze/tool.htm">Zed (Win32)</a> (Japanese page) diff --git a/ext/mbstring/oniguruma/index_ja.html b/ext/mbstring/oniguruma/index_ja.html index e03b045b98..4826cbc2e2 100644 --- a/ext/mbstring/oniguruma/index_ja.html +++ b/ext/mbstring/oniguruma/index_ja.html @@ -8,7 +8,7 @@ <h1>鬼車</h1> <p> -(c) K.Kosako, 最終更新: 2010/01/09 +(c) K.Kosako, 最終更新: 2013/04/04 </p> <dl> @@ -16,7 +16,7 @@ <dt><b>更新情報</b> </font> <ul> -<li>2010/01/09: Version 5.9.2 リリース</li> +<li>2013/10/21: Version 5.9.5 リリース</li> <li>2007/08/16: Version 4.7.1 リリース</li> <li>2007/06/20: Version 2.5.9 リリース</li> <li>2007/06/20: 2.xの保守担当者を変更</li> @@ -62,8 +62,8 @@ ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16<br> <dt><b>ダウンロード:</b> <ul> -<li> <a href="archive/onig-5.9.2.tar.gz">5.9.2 最新版</a> (2010/01/09) <a href="HISTORY_5X.txt">更新履歴</a> -<li> <a href="archive/onig-5.9.1.tar.gz">5.9.1</a> (2007/12/22) +<li> <a href="archive/onig-5.9.5.tar.gz">5.9.5 最新版</a> (2013/10/21) <a href="HISTORY_5X.txt">更新履歴</a> +<li> <a href="archive/onig-5.9.4.tar.gz">5.9.4</a> (2013/04/04) <li> <a href="archive/onig-4.7.1.tar.gz">4.7.1 最新版</a> (2007/08/16) <a href="HISTORY_4X.txt">更新履歴</a> <li> <a href="archive/onig-4.7.0.tar.gz">4.7.0</a> (2007/06/18) <li> <a href="archive/onigd2_5_9.tar.gz">2.5.9 最新版</a> (2007/06/20) <a href="HISTORY_2X.txt">更新履歴</a> @@ -78,7 +78,7 @@ ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16<br> * 2.xはRuby1.6/1.8組込みライブラリとして動作する。 (2006年末で保守を終了)<br> <br> -<dt><b>ドキュメント:</b> (version 5.9.2) +<dt><b>ドキュメント:</b> (version 5.9.5) <ul> <li> <a href="doc/RE.txt">正規表現</a> <a href="doc/RE.ja.txt">(日本語: EUC-JP)</a> @@ -103,8 +103,11 @@ ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16<br> <br> <dt><b>リンク:</b> <ul> +<li> <a href="http://www.perzl.org/aix/index.php?n=Main.Oniguruma">AIX Open Source Packages</a> +<li> <a href="https://aur.archlinux.org/packages/oniguruma/">Arch Linux Package</a> <li> <a href="http://homepage3.nifty.com/k-takata/mysoft/bregonig.html">bregonig.dll (Win32)</a> (日本語) <li> <a href="http://www.halbiz.com/osaru/cnregex.html">cnRegex 4D Plugin (Mac OS X)</a> (日本語) +<li> <a href="http://limechat.net/cocoaoniguruma/index_ja.html">CocoaOniguruma</a> (日本語) <li> <a href="http://kmaebashi.com/">crowbar</a> (日本語) <li> <a href="http://oniguruma5.darwinports.com">Darwin Ports (Mac OS X)</a> <li> <a href="http://homepage2.nifty.com/Km/onig.htm">Delphi interface (Win32)</a> (日本語) @@ -121,7 +124,7 @@ ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16<br> <li> <a href="http://mongoose.jp/">mongoose</a> (日本語) <li> <a href="http://www.irori.org/tool/mregexp.html">mregexp</a> (日本語) <li> <a href="http://ochusha.sourceforge.jp/">おちゅ〜しゃ</a> (日本語) -<li> <a href="http://www8.ocn.ne.jp/%7esonoisa/OgreKit/index.html">OgreKit (Mac OS X)</a> Regular Expression Framework for Cocoa (日本語) +<li> <a href="http://sonoisa.github.com/ogrekit/About.html">OgreKit (Mac OS X)</a> Regular Expression Framework for Cocoa (日本語) <li> <a href="http://www.kanetaka.net/4dapi/wiki4d.dll/4dcgi/wiki.cgi?plugins-oniguruma">OnigRegexp</a> (日本語) <li> <a href="http://rubyforge.org/projects/oniguruma">Oniguruma for Ruby</a> <li> <a href="http://openspace.timedia.co.jp/~yasuyuki/wiliki/wiliki.cgi?Oniguruma-mysqld&l=jp">Oniguruma-mysqld</a> @@ -140,6 +143,7 @@ ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16<br> <li> <a href="http://sourceforge.jp/projects/ttssh2/">TeraTerm (Win32)</a> <li> <a href="http://www8.ocn.ne.jp/~sonoisa/TiddlyWikiPod/">TiddlyWikiPod (Mac OS X)</a> <li> <a href="http://www.cyanworks.net/mac.html">TunesTEXT (Mac OS X)</a> +<li> <a href="https://code.google.com/p/oniguruma-visualworks/">oniguruma-visualworks</a> <li> <a href="http://sourceforge.jp/projects/frogger/">XML parser</a> <li> <a href="http://www.yokkasoft.net/">YokkaSoft (Win32)</a> (日本語) <li> <a href="http://www.hi-ho.ne.jp/kuze/tool.htm">Zed (Win32)</a> (日本語) diff --git a/ext/mbstring/oniguruma/onigcmpt200.h b/ext/mbstring/oniguruma/onigcmpt200.h deleted file mode 100644 index d9b1419146..0000000000 --- a/ext/mbstring/oniguruma/onigcmpt200.h +++ /dev/null @@ -1,310 +0,0 @@ -/********************************************************************** - - onigcmpt200.h - Oniguruma (regular expression library) - - Copyright (C) 2004 K.Kosako (kosako@sofnec.co.jp) - -**********************************************************************/ -#ifndef ONIGCMPT200_H -#define ONIGCMPT200_H - -/* constants */ -#define REG_MAX_ERROR_MESSAGE_LEN ONIG_MAX_ERROR_MESSAGE_LEN - -#define RegCharEncoding OnigEncoding - -#define REG_ENCODING_ASCII ONIG_ENCODING_ASCII -#define REG_ENCODING_ISO_8859_1 ONIG_ENCODING_ISO_8859_1 -#define REG_ENCODING_ISO_8859_15 ONIG_ENCODING_ISO_8859_15 -#define REG_ENCODING_UTF8 ONIG_ENCODING_UTF8 -#define REG_ENCODING_EUC_JP ONIG_ENCODING_EUC_JP -#define REG_ENCODING_SJIS ONIG_ENCODING_SJIS -#define REG_ENCODING_BIG5 ONIG_ENCODING_BIG5 -#define REG_ENCODING_UNDEF ONIG_ENCODING_UNDEF - -/* Don't use REGCODE_XXXX. (obsoleted) */ -#define REGCODE_UNDEF REG_ENCODING_UNDEF -#define REGCODE_ASCII REG_ENCODING_ASCII -#define REGCODE_UTF8 REG_ENCODING_UTF8 -#define REGCODE_EUCJP REG_ENCODING_EUC_JP -#define REGCODE_SJIS REG_ENCODING_SJIS - -/* Don't use REGCODE_XXXX. (obsoleted) */ -#define MBCTYPE_ASCII RE_MBCTYPE_ASCII -#define MBCTYPE_EUC RE_MBCTYPE_EUC -#define MBCTYPE_SJIS RE_MBCTYPE_SJIS -#define MBCTYPE_UTF8 RE_MBCTYPE_UTF8 - -typedef unsigned char* RegTransTableType; -#define RegOptionType OnigOptionType -#define RegDistance OnigDistance - -#define REG_OPTION_DEFAULT ONIG_OPTION_DEFAULT - -/* options */ -#define REG_OPTION_NONE ONIG_OPTION_NONE -#define REG_OPTION_SINGLELINE ONIG_OPTION_SINGLELINE -#define REG_OPTION_MULTILINE ONIG_OPTION_MULTILINE -#define REG_OPTION_IGNORECASE ONIG_OPTION_IGNORECASE -#define REG_OPTION_EXTEND ONIG_OPTION_EXTEND -#define REG_OPTION_FIND_LONGEST ONIG_OPTION_FIND_LONGEST -#define REG_OPTION_FIND_NOT_EMPTY ONIG_OPTION_FIND_NOT_EMPTY -#define REG_OPTION_NEGATE_SINGLELINE ONIG_OPTION_NEGATE_SINGLELINE -#define REG_OPTION_DONT_CAPTURE_GROUP ONIG_OPTION_DONT_CAPTURE_GROUP -#define REG_OPTION_CAPTURE_GROUP ONIG_OPTION_CAPTURE_GROUP -#define REG_OPTION_NOTBOL ONIG_OPTION_NOTBOL -#define REG_OPTION_NOTEOL ONIG_OPTION_NOTEOL -#define REG_OPTION_POSIX_REGION ONIG_OPTION_POSIX_REGION - -#define REG_OPTION_ON ONIG_OPTION_ON -#define REG_OPTION_OFF ONIG_OPTION_OFF -#define IS_REG_OPTION_ON ONIG_IS_OPTION_ON - -/* syntax */ -#define RegSyntaxType OnigSyntaxType - -#define RegSyntaxPosixBasic OnigSyntaxPosixBasic -#define RegSyntaxPosixExtended OnigSyntaxPosixExtended -#define RegSyntaxEmacs OnigSyntaxEmacs -#define RegSyntaxGrep OnigSyntaxGrep -#define RegSyntaxGnuRegex OnigSyntaxGnuRegex -#define RegSyntaxJava OnigSyntaxJava -#define RegSyntaxPerl OnigSyntaxPerl -#define RegSyntaxRuby OnigSyntaxRuby - -#define REG_SYNTAX_POSIX_BASIC ONIG_SYNTAX_POSIX_BASIC -#define REG_SYNTAX_POSIX_EXTENDED ONIG_SYNTAX_POSIX_EXTENDED -#define REG_SYNTAX_EMACS ONIG_SYNTAX_EMACS -#define REG_SYNTAX_GREP ONIG_SYNTAX_GREP -#define REG_SYNTAX_GNU_REGEX ONIG_SYNTAX_GNU_REGEX -#define REG_SYNTAX_JAVA ONIG_SYNTAX_JAVA -#define REG_SYNTAX_PERL ONIG_SYNTAX_PERL -#define REG_SYNTAX_RUBY ONIG_SYNTAX_RUBY - -#define REG_SYNTAX_DEFAULT ONIG_SYNTAX_DEFAULT -#define RegDefaultSyntax OnigDefaultSyntax - -/* syntax (operators) */ -#define REG_SYN_OP_VARIABLE_META_CHARACTERS \ - ONIG_SYN_OP_VARIABLE_META_CHARACTERS -#define REG_SYN_OP_DOT_ANYCHAR \ - ONIG_SYN_OP_DOT_ANYCHAR -#define REG_SYN_OP_ASTERISK_ZERO_INF \ - ONIG_SYN_OP_ASTERISK_ZERO_INF -#define REG_SYN_OP_ESC_ASTERISK_ZERO_INF \ - ONIG_SYN_OP_ESC_ASTERISK_ZERO_INF -#define REG_SYN_OP_PLUS_ONE_INF \ - ONIG_SYN_OP_PLUS_ONE_INF -#define REG_SYN_OP_ESC_PLUS_ONE_INF \ - ONIG_SYN_OP_ESC_PLUS_ONE_INF -#define REG_SYN_OP_QMARK_ZERO_ONE \ - ONIG_SYN_OP_QMARK_ZERO_ONE -#define REG_SYN_OP_ESC_QMARK_ZERO_ONE \ - ONIG_SYN_OP_ESC_QMARK_ZERO_ONE -#define REG_SYN_OP_BRACE_INTERVAL \ - ONIG_SYN_OP_BRACE_INTERVAL -#define REG_SYN_OP_ESC_BRACE_INTERVAL \ - ONIG_SYN_OP_ESC_BRACE_INTERVAL -#define REG_SYN_OP_VBAR_ALT \ - ONIG_SYN_OP_VBAR_ALT -#define REG_SYN_OP_ESC_VBAR_ALT \ - ONIG_SYN_OP_ESC_VBAR_ALT -#define REG_SYN_OP_LPAREN_SUBEXP \ - ONIG_SYN_OP_LPAREN_SUBEXP -#define REG_SYN_OP_ESC_LPAREN_SUBEXP \ - ONIG_SYN_OP_ESC_LPAREN_SUBEXP -#define REG_SYN_OP_ESC_AZ_BUF_ANCHOR \ - ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR -#define REG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR \ - ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR -#define REG_SYN_OP_DECIMAL_BACKREF \ - ONIG_SYN_OP_DECIMAL_BACKREF -#define REG_SYN_OP_BRACKET_CC \ - ONIG_SYN_OP_BRACKET_CC -#define REG_SYN_OP_ESC_W_WORD \ - ONIG_SYN_OP_ESC_W_WORD -#define REG_SYN_OP_ESC_LTGT_WORD_BEGIN_END \ - ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END -#define REG_SYN_OP_ESC_B_WORD_BOUND \ - ONIG_SYN_OP_ESC_B_WORD_BOUND -#define REG_SYN_OP_ESC_S_WHITE_SPACE \ - ONIG_SYN_OP_ESC_S_WHITE_SPACE -#define REG_SYN_OP_ESC_D_DIGIT \ - ONIG_SYN_OP_ESC_D_DIGIT -#define REG_SYN_OP_LINE_ANCHOR \ - ONIG_SYN_OP_LINE_ANCHOR -#define REG_SYN_OP_POSIX_BRACKET \ - ONIG_SYN_OP_POSIX_BRACKET -#define REG_SYN_OP_QMARK_NON_GREEDY \ - ONIG_SYN_OP_QMARK_NON_GREEDY -#define REG_SYN_OP_ESC_CONTROL_CHARS \ - ONIG_SYN_OP_ESC_CONTROL_CHARS -#define REG_SYN_OP_ESC_C_CONTROL \ - ONIG_SYN_OP_ESC_C_CONTROL -#define REG_SYN_OP_ESC_OCTAL3 \ - ONIG_SYN_OP_ESC_OCTAL3 -#define REG_SYN_OP_ESC_X_HEX2 \ - ONIG_SYN_OP_ESC_X_HEX2 -#define REG_SYN_OP_ESC_X_BRACE_HEX8 \ - ONIG_SYN_OP_ESC_X_BRACE_HEX8 - -#define REG_SYN_OP2_ESC_CAPITAL_Q_QUOTE \ - ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE -#define REG_SYN_OP2_QMARK_GROUP_EFFECT \ - ONIG_SYN_OP2_QMARK_GROUP_EFFECT -#define REG_SYN_OP2_OPTION_PERL \ - ONIG_SYN_OP2_OPTION_PERL -#define REG_SYN_OP2_OPTION_RUBY \ - ONIG_SYN_OP2_OPTION_RUBY -#define REG_SYN_OP2_PLUS_POSSESSIVE_REPEAT \ - ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT -#define REG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL \ - ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL -#define REG_SYN_OP2_CCLASS_SET_OP \ - ONIG_SYN_OP2_CCLASS_SET_OP -#define REG_SYN_OP2_QMARK_LT_NAMED_GROUP \ - ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP -#define REG_SYN_OP2_ESC_K_NAMED_BACKREF \ - ONIG_SYN_OP2_ESC_K_NAMED_BACKREF -#define REG_SYN_OP2_ESC_G_SUBEXP_CALL \ - ONIG_SYN_OP2_ESC_G_SUBEXP_CALL -#define REG_SYN_OP2_ATMARK_CAPTURE_HISTORY \ - ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY -#define REG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL \ - ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL -#define REG_SYN_OP2_ESC_CAPITAL_M_BAR_META \ - ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META -#define REG_SYN_OP2_ESC_V_VTAB \ - ONIG_SYN_OP2_ESC_V_VTAB -#define REG_SYN_OP2_ESC_U_HEX4 \ - ONIG_SYN_OP2_ESC_U_HEX4 -#define REG_SYN_OP2_ESC_GNU_BUF_ANCHOR \ - ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR - -#define REG_SYN_CONTEXT_INDEP_ANCHORS \ - ONIG_SYN_CONTEXT_INDEP_ANCHORS -#define REG_SYN_CONTEXT_INDEP_REPEAT_OPS \ - ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS -#define REG_SYN_CONTEXT_INVALID_REPEAT_OPS \ - ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS -#define REG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP \ - ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP -#define REG_SYN_ALLOW_INVALID_INTERVAL \ - ONIG_SYN_ALLOW_INVALID_INTERVAL -#define REG_SYN_STRICT_CHECK_BACKREF \ - ONIG_SYN_STRICT_CHECK_BACKREF -#define REG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND \ - ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND -#define REG_SYN_CAPTURE_ONLY_NAMED_GROUP \ - ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP -#define REG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME \ - ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME - -#define REG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC \ - ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC -#define REG_SYN_BACKSLASH_ESCAPE_IN_CC \ - ONIG_SYN_BACKSLASH_ESCAPE_IN_CC -#define REG_SYN_ALLOW_EMPTY_RANGE_IN_CC \ - ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC -#define REG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC \ - ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC -#define REG_SYN_WARN_CC_OP_NOT_ESCAPED \ - ONIG_SYN_WARN_CC_OP_NOT_ESCAPED -#define REG_SYN_WARN_REDUNDANT_NESTED_REPEAT \ - ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT - -/* meta character specifiers (regex_set_meta_char()) */ -#define REG_META_CHAR_ESCAPE ONIG_META_CHAR_ESCAPE -#define REG_META_CHAR_ANYCHAR ONIG_META_CHAR_ANYCHAR -#define REG_META_CHAR_ANYTIME ONIG_META_CHAR_ANYTIME -#define REG_META_CHAR_ZERO_OR_ONE_TIME ONIG_META_CHAR_ZERO_OR_ONE_TIME -#define REG_META_CHAR_ONE_OR_MORE_TIME ONIG_META_CHAR_ONE_OR_MORE_TIME -#define REG_META_CHAR_ANYCHAR_ANYTIME ONIG_META_CHAR_ANYCHAR_ANYTIME - -#define REG_INEFFECTIVE_META_CHAR ONIG_INEFFECTIVE_META_CHAR - -/* error codes */ -#define REG_IS_PATTERN_ERROR ONIG_IS_PATTERN_ERROR -/* normal return */ -#define REG_NORMAL ONIG_NORMAL -#define REG_MISMATCH ONIG_MISMATCH -#define REG_NO_SUPPORT_CONFIG ONIG_NO_SUPPORT_CONFIG -/* internal error */ -#define REGERR_MEMORY ONIGERR_MEMORY -#define REGERR_MATCH_STACK_LIMIT_OVER ONIGERR_MATCH_STACK_LIMIT_OVER -#define REGERR_TYPE_BUG ONIGERR_TYPE_BUG -#define REGERR_PARSER_BUG ONIGERR_PARSER_BUG -#define REGERR_STACK_BUG ONIGERR_STACK_BUG -#define REGERR_UNDEFINED_BYTECODE ONIGERR_UNDEFINED_BYTECODE -#define REGERR_UNEXPECTED_BYTECODE ONIGERR_UNEXPECTED_BYTECODE -#define REGERR_DEFAULT_ENCODING_IS_NOT_SETTED \ - ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED -#define REGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR \ - ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR -/* general error */ -#define REGERR_INVALID_ARGUMENT ONIGERR_INVALID_ARGUMENT -/* errors related to thread */ -#define REGERR_OVER_THREAD_PASS_LIMIT_COUNT \ - ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT - - -/* must be smaller than BIT_STATUS_BITS_NUM (unsigned int * 8) */ -#define REG_MAX_CAPTURE_HISTORY_GROUP ONIG_MAX_CAPTURE_HISTORY_GROUP -#define REG_IS_CAPTURE_HISTORY_GROUP ONIG_IS_CAPTURE_HISTORY_GROUP - -#define REG_REGION_NOTPOS ONIG_REGION_NOTPOS - -#define RegRegion OnigRegion -#define RegErrorInfo OnigErrorInfo -#define RegRepeatRange OnigRepeatRange - -#define RegWarnFunc OnigWarnFunc -#define regex_null_warn onig_null_warn -#define REG_NULL_WARN ONIG_NULL_WARN - -/* regex_t state */ -#define REG_STATE_NORMAL ONIG_STATE_NORMAL -#define REG_STATE_SEARCHING ONIG_STATE_SEARCHING -#define REG_STATE_COMPILING ONIG_STATE_COMPILING -#define REG_STATE_MODIFY ONIG_STATE_MODIFY - -#define REG_STATE ONIG_STATE - -/* Oniguruma Native API */ -#define regex_init onig_init -#define regex_error_code_to_str onig_error_code_to_str -#define regex_set_warn_func onig_set_warn_func -#define regex_set_verb_warn_func onig_set_verb_warn_func -#define regex_new onig_new -#define regex_free onig_free -#define regex_recompile onig_recompile -#define regex_search onig_search -#define regex_match onig_match -#define regex_region_new onig_region_new -#define regex_region_free onig_region_free -#define regex_region_copy onig_region_copy -#define regex_region_clear onig_region_clear -#define regex_region_resize onig_region_resize -#define regex_name_to_group_numbers onig_name_to_group_numbers -#define regex_name_to_backref_number onig_name_to_backref_number -#define regex_foreach_name onig_foreach_name -#define regex_number_of_names onig_number_of_names -#define regex_get_encoding onig_get_encoding -#define regex_get_options onig_get_options -#define regex_get_syntax onig_get_syntax -#define regex_set_default_syntax onig_set_default_syntax -#define regex_copy_syntax onig_copy_syntax -#define regex_set_meta_char onig_set_meta_char -#define regex_end onig_end -#define regex_version onig_version - -/* encoding API */ -#define enc_get_prev_char_head onigenc_get_prev_char_head -#define enc_get_left_adjust_char_head onigenc_get_left_adjust_char_head -#define enc_get_right_adjust_char_head onigenc_get_right_adjust_char_head -/* obsoleted API */ -#define regex_get_prev_char_head onigenc_get_prev_char_head -#define regex_get_left_adjust_char_head onigenc_get_left_adjust_char_head -#define regex_get_right_adjust_char_head onigenc_get_right_adjust_char_head - -#endif /* ONIGCMPT200_H */ diff --git a/ext/mbstring/oniguruma/oniguruma.h b/ext/mbstring/oniguruma/oniguruma.h index bf00e20f63..00f39fe4fe 100644 --- a/ext/mbstring/oniguruma/oniguruma.h +++ b/ext/mbstring/oniguruma/oniguruma.h @@ -36,7 +36,7 @@ extern "C" { #define ONIGURUMA #define ONIGURUMA_VERSION_MAJOR 5 #define ONIGURUMA_VERSION_MINOR 9 -#define ONIGURUMA_VERSION_TEENY 2 +#define ONIGURUMA_VERSION_TEENY 5 #ifdef __cplusplus # ifndef HAVE_PROTOTYPES diff --git a/ext/mbstring/oniguruma/regcomp.c b/ext/mbstring/oniguruma/regcomp.c index f9d99563b3..995e1d8861 100644 --- a/ext/mbstring/oniguruma/regcomp.c +++ b/ext/mbstring/oniguruma/regcomp.c @@ -2399,7 +2399,7 @@ is_not_included(Node* x, Node* y, regex_t* reg) { int i, len; OnigCodePoint code; - UChar *p, c; + UChar *p; int ytype; retry: @@ -2513,51 +2513,51 @@ is_not_included(Node* x, Node* y, regex_t* reg) if (NSTRING_LEN(x) == 0) break; - c = *(xs->s); + //c = *(xs->s); switch (ytype) { case NT_CTYPE: - switch (NCTYPE(y)->ctype) { - case ONIGENC_CTYPE_WORD: - if (ONIGENC_IS_MBC_WORD(reg->enc, xs->s, xs->end)) - return NCTYPE(y)->not; - else - return !(NCTYPE(y)->not); - break; - default: - break; - } - break; + switch (NCTYPE(y)->ctype) { + case ONIGENC_CTYPE_WORD: + if (ONIGENC_IS_MBC_WORD(reg->enc, xs->s, xs->end)) + return NCTYPE(y)->not; + else + return !(NCTYPE(y)->not); + break; + default: + break; + } + break; case NT_CCLASS: - { - CClassNode* cc = NCCLASS(y); + { + CClassNode* cc = NCCLASS(y); - code = ONIGENC_MBC_TO_CODE(reg->enc, xs->s, - xs->s + ONIGENC_MBC_MAXLEN(reg->enc)); - return (onig_is_code_in_cc(reg->enc, code, cc) != 0 ? 0 : 1); - } - break; + code = ONIGENC_MBC_TO_CODE(reg->enc, xs->s, + xs->s + ONIGENC_MBC_MAXLEN(reg->enc)); + return (onig_is_code_in_cc(reg->enc, code, cc) != 0 ? 0 : 1); + } + break; case NT_STR: - { - UChar *q; - StrNode* ys = NSTR(y); - len = NSTRING_LEN(x); - if (len > NSTRING_LEN(y)) len = NSTRING_LEN(y); - if (NSTRING_IS_AMBIG(x) || NSTRING_IS_AMBIG(y)) { + { + UChar *q; + StrNode* ys = NSTR(y); + len = NSTRING_LEN(x); + if (len > NSTRING_LEN(y)) len = NSTRING_LEN(y); + if (NSTRING_IS_AMBIG(x) || NSTRING_IS_AMBIG(y)) { /* tiny version */ return 0; - } - else { - for (i = 0, p = ys->s, q = xs->s; i < len; i++, p++, q++) { - if (*p != *q) return 1; - } - } - } - break; + } + else { + for (i = 0, p = ys->s, q = xs->s; i < len; i++, p++, q++) { + if (*p != *q) return 1; + } + } + } + break; default: - break; + break; } } break; @@ -3189,7 +3189,7 @@ next_setup(Node* node, Node* next_node, regex_t* reg) static int update_string_node_case_fold(regex_t* reg, Node *node) { - UChar *p, *q, *end, buf[ONIGENC_MBC_CASE_FOLD_MAXLEN]; + UChar *p, *end, buf[ONIGENC_MBC_CASE_FOLD_MAXLEN]; UChar *sbuf, *ebuf, *sp; int r, i, len, sbuf_size; StrNode* sn = NSTR(node); @@ -3204,14 +3204,13 @@ update_string_node_case_fold(regex_t* reg, Node *node) p = sn->s; while (p < end) { len = ONIGENC_MBC_CASE_FOLD(reg->enc, reg->case_fold_flag, &p, end, buf); - q = buf; for (i = 0; i < len; i++) { if (sp >= ebuf) { - sbuf = (UChar* )xrealloc(sbuf, sbuf_size * 2); - CHECK_NULL_RETURN_MEMERR(sbuf); - sp = sbuf + sbuf_size; - sbuf_size *= 2; - ebuf = sbuf + sbuf_size; + sbuf = (UChar* )xrealloc(sbuf, sbuf_size * 2); + CHECK_NULL_RETURN_MEMERR(sbuf); + sp = sbuf + sbuf_size; + sbuf_size *= 2; + ebuf = sbuf + sbuf_size; } *sp++ = buf[i]; @@ -3316,29 +3315,29 @@ expand_case_fold_string_alt(int item_num, OnigCaseFoldCodeItem items[], UChar *q = p + items[i].byte_len; if (q < end) { - r = expand_case_fold_make_rem_string(&rem, q, end, reg); - if (r != 0) { - onig_node_free(an); - goto mem_err2; - } + r = expand_case_fold_make_rem_string(&rem, q, end, reg); + if (r != 0) { + onig_node_free(an); + goto mem_err2; + } - xnode = onig_node_list_add(NULL_NODE, snode); - if (IS_NULL(xnode)) { - onig_node_free(an); - onig_node_free(rem); - goto mem_err2; - } - if (IS_NULL(onig_node_list_add(xnode, rem))) { - onig_node_free(an); - onig_node_free(xnode); - onig_node_free(rem); - goto mem_err; - } + xnode = onig_node_list_add(NULL_NODE, snode); + if (IS_NULL(xnode)) { + onig_node_free(an); + onig_node_free(rem); + goto mem_err2; + } + if (IS_NULL(onig_node_list_add(xnode, rem))) { + onig_node_free(an); + onig_node_free(xnode); + onig_node_free(rem); + goto mem_err; + } - NCAR(an) = xnode; + NCAR(an) = xnode; } else { - NCAR(an) = snode; + NCAR(an) = snode; } NCDR(var_anode) = an; @@ -6216,8 +6215,7 @@ print_indent_tree(FILE* f, Node* node, int indent) fprintf(f, "<enclose:%x> ", (int )node); switch (NENCLOSE(node)->type) { case ENCLOSE_OPTION: - fprintf(f, "option:%d\n", NENCLOSE(node)->option); - print_indent_tree(f, NENCLOSE(node)->target, indent + add); + fprintf(f, "option:%d", NENCLOSE(node)->option); break; case ENCLOSE_MEMORY: fprintf(f, "memory:%d", NENCLOSE(node)->regnum); diff --git a/ext/mbstring/oniguruma/regparse.c b/ext/mbstring/oniguruma/regparse.c index 01131300c6..bf72300caa 100644 --- a/ext/mbstring/oniguruma/regparse.c +++ b/ext/mbstring/oniguruma/regparse.c @@ -262,6 +262,14 @@ strdup_with_null(OnigEncoding enc, UChar* s, UChar* end) p += ONIGENC_MBC_ENC_LEN(enc, p); \ } while (0) +#define PINC_S do { \ + p += ONIGENC_MBC_ENC_LEN(enc, p); \ +} while (0) +#define PFETCH_S(c) do { \ + c = ONIGENC_MBC_TO_CODE(enc, p, end); \ + p += ONIGENC_MBC_ENC_LEN(enc, p); \ +} while (0) + #define PPEEK (p < end ? ONIGENC_MBC_TO_CODE(enc, p, end) : PEND_VALUE) #define PPEEK_IS(c) (PPEEK == (OnigCodePoint )c) @@ -2404,22 +2412,21 @@ fetch_escaped_value(UChar** src, UChar* end, ScanEnv* env) OnigCodePoint c; OnigEncoding enc = env->enc; UChar* p = *src; - PFETCH_READY; if (PEND) return ONIGERR_END_PATTERN_AT_ESCAPE; - PFETCH(c); + PFETCH_S(c); switch (c) { case 'M': if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META)) { if (PEND) return ONIGERR_END_PATTERN_AT_META; - PFETCH(c); + PFETCH_S(c); if (c != '-') return ONIGERR_META_CODE_SYNTAX; if (PEND) return ONIGERR_END_PATTERN_AT_META; - PFETCH(c); + PFETCH_S(c); if (c == MC_ESC(env->syntax)) { - v = fetch_escaped_value(&p, end, env); - if (v < 0) return v; + v = fetch_escaped_value(&p, end, env); + if (v < 0) return v; c = (OnigCodePoint )v; } c = ((c & 0xff) | 0x80); @@ -2431,7 +2438,7 @@ fetch_escaped_value(UChar** src, UChar* end, ScanEnv* env) case 'C': if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL)) { if (PEND) return ONIGERR_END_PATTERN_AT_CONTROL; - PFETCH(c); + PFETCH_S(c); if (c != '-') return ONIGERR_CONTROL_CODE_SYNTAX; goto control; } @@ -2442,9 +2449,9 @@ fetch_escaped_value(UChar** src, UChar* end, ScanEnv* env) if (IS_SYNTAX_OP(env->syntax, ONIG_SYN_OP_ESC_C_CONTROL)) { control: if (PEND) return ONIGERR_END_PATTERN_AT_CONTROL; - PFETCH(c); + PFETCH_S(c); if (c == '?') { - c = 0177; + c = 0177; } else { if (c == MC_ESC(env->syntax)) { @@ -2452,7 +2459,7 @@ fetch_escaped_value(UChar** src, UChar* end, ScanEnv* env) if (v < 0) return v; c = (OnigCodePoint )v; } - c &= 0x9f; + c &= 0x9f; } break; } @@ -2546,11 +2553,11 @@ fetch_name_with_level(OnigCodePoint start_code, UChar** src, UChar* end, if (is_num != 0) { if (ONIGENC_IS_CODE_DIGIT(enc, c)) { - is_num = 1; + is_num = 1; } else { - r = ONIGERR_INVALID_GROUP_NAME; - is_num = 0; + r = ONIGERR_INVALID_GROUP_NAME; + is_num = 0; } } else if (!ONIGENC_IS_CODE_WORD(enc, c)) { @@ -2617,7 +2624,6 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end, UChar *name_end; UChar *pnum_head; UChar *p = *src; - PFETCH_READY; *rback_num = 0; @@ -2632,27 +2638,27 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end, return ONIGERR_EMPTY_GROUP_NAME; } else { - PFETCH(c); + PFETCH_S(c); if (c == end_code) return ONIGERR_EMPTY_GROUP_NAME; if (ONIGENC_IS_CODE_DIGIT(enc, c)) { if (ref == 1) - is_num = 1; + is_num = 1; else { - r = ONIGERR_INVALID_GROUP_NAME; - is_num = 0; + r = ONIGERR_INVALID_GROUP_NAME; + is_num = 0; } } else if (c == '-') { if (ref == 1) { - is_num = 2; - sign = -1; - pnum_head = p; + is_num = 2; + sign = -1; + pnum_head = p; } else { - r = ONIGERR_INVALID_GROUP_NAME; - is_num = 0; + r = ONIGERR_INVALID_GROUP_NAME; + is_num = 0; } } else if (!ONIGENC_IS_CODE_WORD(enc, c)) { @@ -2663,29 +2669,28 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end, if (r == 0) { while (!PEND) { name_end = p; - PFETCH(c); + PFETCH_S(c); if (c == end_code || c == ')') { - if (is_num == 2) r = ONIGERR_INVALID_GROUP_NAME; - break; + if (is_num == 2) r = ONIGERR_INVALID_GROUP_NAME; + break; } if (is_num != 0) { - if (ONIGENC_IS_CODE_DIGIT(enc, c)) { - is_num = 1; - } - else { - if (!ONIGENC_IS_CODE_WORD(enc, c)) - r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; - else - r = ONIGERR_INVALID_GROUP_NAME; - - is_num = 0; - } + if (ONIGENC_IS_CODE_DIGIT(enc, c)) { + is_num = 1; + } + else { + if (!ONIGENC_IS_CODE_WORD(enc, c)) + r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; + else + r = ONIGERR_INVALID_GROUP_NAME; + is_num = 0; + } } else { - if (!ONIGENC_IS_CODE_WORD(enc, c)) { - r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; - } + if (!ONIGENC_IS_CODE_WORD(enc, c)) { + r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; + } } } @@ -2698,8 +2703,8 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end, *rback_num = onig_scan_unsigned_number(&pnum_head, name_end, enc); if (*rback_num < 0) return ONIGERR_TOO_BIG_NUMBER; else if (*rback_num == 0) { - r = ONIGERR_INVALID_GROUP_NAME; - goto err; + r = ONIGERR_INVALID_GROUP_NAME; + goto err; } *rback_num *= sign; @@ -2712,9 +2717,9 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end, else { while (!PEND) { name_end = p; - PFETCH(c); + PFETCH_S(c); if (c == end_code || c == ')') - break; + break; } if (PEND) name_end = end; @@ -3935,10 +3940,9 @@ parse_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ScanEnv* env) OnigCodePoint c; OnigEncoding enc = env->enc; UChar *p = *src; - PFETCH_READY; if (PPEEK_IS('^')) { - PINC; + PINC_S; not = 1; } else @@ -3951,12 +3955,12 @@ parse_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ScanEnv* env) if (onigenc_with_ascii_strncmp(enc, p, end, pb->name, pb->len) == 0) { p = (UChar* )onigenc_step(enc, p, end, pb->len); if (onigenc_with_ascii_strncmp(enc, p, end, (UChar* )":]", 2) != 0) - return ONIGERR_INVALID_POSIX_BRACKET_TYPE; + return ONIGERR_INVALID_POSIX_BRACKET_TYPE; r = add_ctype_to_cc(cc, pb->ctype, not, env); if (r != 0) return r; - PINC; PINC; + PINC_S; PINC_S; *src = p; return 0; } @@ -3966,15 +3970,15 @@ parse_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ScanEnv* env) c = 0; i = 0; while (!PEND && ((c = PPEEK) != ':') && c != ']') { - PINC; + PINC_S; if (++i > POSIX_BRACKET_CHECK_LIMIT_LENGTH) break; } if (c == ':' && ! PEND) { - PINC; + PINC_S; if (! PEND) { - PFETCH(c); + PFETCH_S(c); if (c == ']') - return ONIGERR_INVALID_POSIX_BRACKET_TYPE; + return ONIGERR_INVALID_POSIX_BRACKET_TYPE; } } @@ -3988,14 +3992,13 @@ fetch_char_property_to_ctype(UChar** src, UChar* end, ScanEnv* env) OnigCodePoint c; OnigEncoding enc = env->enc; UChar *prev, *start, *p = *src; - PFETCH_READY; r = 0; start = prev = p; while (!PEND) { prev = p; - PFETCH(c); + PFETCH_S(c); if (c == '}') { r = ONIGENC_PROPERTY_NAME_TO_CTYPE(enc, start, prev); if (r < 0) break; @@ -4153,7 +4156,6 @@ code_exist_check(OnigCodePoint c, UChar* from, UChar* end, int ignore_escaped, OnigCodePoint code; OnigEncoding enc = env->enc; UChar* p = from; - PFETCH_READY; in_esc = 0; while (! PEND) { @@ -4161,7 +4163,7 @@ code_exist_check(OnigCodePoint c, UChar* from, UChar* end, int ignore_escaped, in_esc = 0; } else { - PFETCH(code); + PFETCH_S(code); if (code == c) return 1; if (code == MC_ESC(env->syntax)) in_esc = 1; } diff --git a/ext/mbstring/tests/bug48697.phpt b/ext/mbstring/tests/bug48697.phpt index 42bbe9f5a8..93644a5f05 100644 --- a/ext/mbstring/tests/bug48697.phpt +++ b/ext/mbstring/tests/bug48697.phpt @@ -2,6 +2,8 @@ Bug #48697 (mb_internal_encoding() value gets reset by parse_str() or mb_parse_str() --SKIPIF-- <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> +--INI-- +error_reporting=E_ALL & ~E_DEPRECATED --FILE-- <?php ini_set('mbstring.internal_encoding', 'ISO-8859-15'); diff --git a/ext/mbstring/tests/ini_encoding.phpt b/ext/mbstring/tests/ini_encoding.phpt index 79a0f3aad4..b9809b2bfe 100644 --- a/ext/mbstring/tests/ini_encoding.phpt +++ b/ext/mbstring/tests/ini_encoding.phpt @@ -3,6 +3,7 @@ Encoding INI test --SKIPIF-- <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> --INI-- +error_reporting=E_ALL & ~E_DEPRECATED default_charset=Shift_JIS internal_encoding= input_encoding= diff --git a/ext/mbstring/tests/zend_multibyte-07.phpt b/ext/mbstring/tests/zend_multibyte-07.phpt index 08db1d0f70..50d4cd95ed 100644 --- a/ext/mbstring/tests/zend_multibyte-07.phpt +++ b/ext/mbstring/tests/zend_multibyte-07.phpt @@ -4,6 +4,7 @@ zend multibyte (7) --XFAIL-- https://bugs.php.net/bug.php?id=66582 --INI-- +error_reporting=E_ALL & ~E_DEPRECATED zend.multibyte=On zend.script_encoding=ISO-8859-1 mbstring.internal_encoding=EUC-JP diff --git a/ext/mbstring/tests/zend_multibyte-08.phpt b/ext/mbstring/tests/zend_multibyte-08.phpt index 488e2a00ca..9e5b75eadd 100644 --- a/ext/mbstring/tests/zend_multibyte-08.phpt +++ b/ext/mbstring/tests/zend_multibyte-08.phpt @@ -1,6 +1,5 @@ --TEST-- zend multibyte (8) ---SKIPIF-- --INI-- zend.multibyte=On zend.script_encoding=ISO-8859-1 diff --git a/ext/mbstring/tests/zend_multibyte-09.phpt b/ext/mbstring/tests/zend_multibyte-09.phpt index 8ad00b4e1e..7b0015c6c1 100644 --- a/ext/mbstring/tests/zend_multibyte-09.phpt +++ b/ext/mbstring/tests/zend_multibyte-09.phpt @@ -4,6 +4,7 @@ zend multibyte (9) --XFAIL-- https://bugs.php.net/bug.php?id=66582 --INI-- +error_reporting=E_ALL & ~E_DEPRECATED zend.multibyte=On zend.script_encoding=cp1251 mbstring.internal_encoding=UTF-8 diff --git a/ext/mbstring/tests/zend_multibyte-10.phpt b/ext/mbstring/tests/zend_multibyte-10.phpt index 139d973b95..138b4899fe 100644 --- a/ext/mbstring/tests/zend_multibyte-10.phpt +++ b/ext/mbstring/tests/zend_multibyte-10.phpt @@ -1,6 +1,5 @@ --TEST-- zend multibyte (10) ---SKIPIF-- --INI-- zend.multibyte=1 --FILE-- diff --git a/ext/mbstring/tests/zend_multibyte-11.phpt b/ext/mbstring/tests/zend_multibyte-11.phpt index c6e45fa5cd..6844d06370 100644 --- a/ext/mbstring/tests/zend_multibyte-11.phpt +++ b/ext/mbstring/tests/zend_multibyte-11.phpt @@ -1,6 +1,5 @@ --TEST-- zend multibyte (11) ---SKIPIF-- --INI-- zend.multibyte=1 --FILE-- diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index ff4de0f5a8..56e48a0a67 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -2173,19 +2173,12 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, fci.symbol_table = NULL; fci.object_ptr = return_value; fci.retval_ptr_ptr = &retval_ptr; + fci.params = NULL; + fci.param_count = 0; + fci.no_separation = 1; + if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) { - if (Z_TYPE_P(ctor_params) == IS_ARRAY) { - HashTable *htl = Z_ARRVAL_P(ctor_params); - Bucket *p; - - fci.param_count = 0; - fci.params = safe_emalloc(sizeof(zval*), htl->nNumOfElements, 0); - p = htl->pListHead; - while (p != NULL) { - fci.params[fci.param_count++] = (zval**)p->pData; - p = p->pListNext; - } - } else { + if (zend_fcall_info_args(&fci, ctor_params TSRMLS_CC) == FAILURE) { /* Two problems why we throw exceptions here: PHP is typeless * and hence passing one argument that's not an array could be * by mistake and the other way round is possible, too. The @@ -2195,11 +2188,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Parameter ctor_params must be an array", 0 TSRMLS_CC); return; } - } else { - fci.param_count = 0; - fci.params = NULL; } - fci.no_separation = 1; fcc.initialized = 1; fcc.function_handler = ce->constructor; diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 120c194964..b23d7e3139 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -1297,19 +1297,12 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags fci.symbol_table = NULL; fci.object_ptr = return_value; fci.retval_ptr_ptr = &retval_ptr; + fci.params = NULL; + fci.param_count = 0; + fci.no_separation = 1; + if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) { - if (Z_TYPE_P(ctor_params) == IS_ARRAY) { - HashTable *params_ht = Z_ARRVAL_P(ctor_params); - Bucket *p; - - fci.param_count = 0; - fci.params = safe_emalloc(sizeof(zval*), params_ht->nNumOfElements, 0); - p = params_ht->pListHead; - while (p != NULL) { - fci.params[fci.param_count++] = (zval**)p->pData; - p = p->pListNext; - } - } else { + if (zend_fcall_info_args(&fci, ctor_params TSRMLS_CC) == FAILURE) { /* Two problems why we throw exceptions here: PHP is typeless * and hence passing one argument that's not an array could be * by mistake and the other way round is possible, too. The @@ -1319,11 +1312,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Parameter ctor_params must be an array", 0 TSRMLS_CC); return; } - } else { - fci.param_count = 0; - fci.params = NULL; } - fci.no_separation = 1; fcc.initialized = 1; fcc.function_handler = ce->constructor; diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index d14625e0f7..309d9b9f06 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -34,30 +34,31 @@ #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, " ", 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); } @@ -66,8 +67,50 @@ static void mysqli_tx_cor_options_to_string(const MYSQL * const conn, smart_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) +/* {{{ 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; +} +/* }}} */ + + +/* {{{ 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}; @@ -75,23 +118,27 @@ static int mysqli_commit_or_rollback_libmysql(MYSQL * conn, zend_bool commit, co 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:""); + 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); - if (commented_name) { - efree(commented_name); - } } + return ret; } /* }}} */ #endif + /* {{{ proto mixed mysqli_affected_rows(object link) Get number of affected rows in previous MySQL operation */ PHP_FUNCTION(mysqli_affected_rows) @@ -660,7 +707,7 @@ void php_mysqli_close(MY_MYSQL * mysql, int close_type, int resource_status TSRM if (MyG(rollback_on_cached_plink) && #if !defined(MYSQLI_USE_MYSQLND) - mysqli_commit_or_rollback_libmysql(mysql->mysql, FALSE, TRANS_COR_NO_OPT, NULL)) + mysqli_commit_or_rollback_libmysql(mysql->mysql, FALSE, TRANS_COR_NO_OPT, NULL TSRMLS_CC)) #else FAIL == mysqlnd_rollback(mysql->mysql, TRANS_COR_NO_OPT, NULL)) #endif @@ -704,7 +751,8 @@ PHP_FUNCTION(mysqli_close) } /* }}} */ -/* {{{ 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) { @@ -720,7 +768,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 @@ -1970,7 +2018,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 diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index 25a88c0984..00cbcf204c 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -1051,12 +1051,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) { @@ -1064,33 +1066,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); - } - 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); + 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 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; } @@ -1125,7 +1131,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 diff --git a/ext/mysqli/tests/mysqli_begin_transaction.phpt b/ext/mysqli/tests/mysqli_begin_transaction.phpt index 7e708316b4..c92e718d57 100644 --- a/ext/mysqli/tests/mysqli_begin_transaction.phpt +++ b/ext/mysqli/tests/mysqli_begin_transaction.phpt @@ -67,61 +67,50 @@ if (!have_innodb($link)) var_dump($res->fetch_assoc()); /* valid flags */ - $flags = array( - MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT, - MYSQLI_TRANS_START_READ_WRITE, - MYSQLI_TRANS_START_READ_ONLY, - MYSQLI_TRANS_COR_AND_CHAIN, - MYSQLI_TRANS_COR_AND_NO_CHAIN, - MYSQLI_TRANS_COR_RELEASE, - MYSQLI_TRANS_COR_NO_RELEASE); + $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)) { + 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) >= 50600) { + 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)") || - !mysqli_commit($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"); - var_dump($res->fetch_assoc()); } } - - /* invalid flag */ - do { - $invalid_flag = mt_rand(0, 10000); - } while (isset(array_flip($flags)[$invalid_flag])); - /* we may or may not hit an invalid combination provoking a SQL error */ - if (!mysqli_begin_transaction($link, $invalid_flag, sprintf("flag %d", $invalid_flag))) { - printf("[018] invalid_flag = %d [%d] %s\n", $invalid_flag, mysqli_errno($link), mysqli_error($link)); - } else { - printf("[018] invalid_flag = %d [%d] %s\n", $invalid_flag, mysqli_errno($link), mysqli_error($link)); - } + if (!mysqli_begin_transaction($link, -1)) { printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } - /* 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)); + 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)); + /* 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!"; ?> @@ -131,10 +120,16 @@ if (!have_innodb($link)) ?> --EXPECTF-- NULL +<<<<<<< HEAD [017] [1792] %s [018] invalid_flag = %d [%d]%A Warning: mysqli_begin_transaction(): Invalid value for parameter flags (-1) in %s on line %d [019] [%d]%A [020] [%d]%A +======= + +Warning: mysqli_begin_transaction(): Invalid value for parameter flags (-1) in %s on line %d +[019] [%d]%A +>>>>>>> 3204ad5858a5abc50b11b8527d22c82eb07a80cc done!
\ No newline at end of file diff --git a/ext/mysqli/tests/mysqli_commit_oo.phpt b/ext/mysqli/tests/mysqli_commit_oo.phpt index e19f698e81..77bcf412e7 100644 --- a/ext/mysqli/tests/mysqli_commit_oo.phpt +++ b/ext/mysqli/tests/mysqli_commit_oo.phpt @@ -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!
\ No newline at end of file diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index e64efe9122..893a144c4b 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -2670,24 +2670,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); } @@ -2696,6 +2696,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) @@ -2710,23 +2753,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:""); + 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); @@ -2754,36 +2800,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); - } - 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); + 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 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); diff --git a/ext/mysqlnd/mysqlnd_reverse_api.c b/ext/mysqlnd/mysqlnd_reverse_api.c index 669b99bf0e..d8b1a41511 100644 --- a/ext/mysqlnd/mysqlnd_reverse_api.c +++ b/ext/mysqlnd/mysqlnd_reverse_api.c @@ -61,7 +61,7 @@ PHPAPI void mysqlnd_reverse_api_register_api(MYSQLND_REVERSE_API * apiext TSRMLS_DC) { zend_hash_add(&mysqlnd_api_ext_ht, apiext->module->name, strlen(apiext->module->name) + 1, &apiext, - sizeof(MYSQLND_REVERSE_API), NULL); + sizeof(MYSQLND_REVERSE_API *), NULL); } /* }}} */ diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c index 913574e2e9..34447a36c3 100644 --- a/ext/mysqlnd/php_mysqlnd.c +++ b/ext/mysqlnd/php_mysqlnd.c @@ -107,17 +107,17 @@ static void mysqlnd_minfo_dump_api_plugins(smart_str * buffer TSRMLS_DC) { HashTable *ht = mysqlnd_reverse_api_get_api_list(TSRMLS_C); - Bucket *p; + HashPosition pos; + MYSQLND_REVERSE_API **ext; - p = ht->pListHead; - while(p != NULL) { - MYSQLND_REVERSE_API * ext = *(MYSQLND_REVERSE_API **) p->pData; + for (zend_hash_internal_pointer_reset_ex(ht, &pos); + zend_hash_get_current_data_ex(ht, (void **) &ext, &pos); + zend_hash_move_forward_ex(ht, &pos) + ) { if (buffer->len) { smart_str_appendc(buffer, ','); } - smart_str_appends(buffer, ext->module->name); - - p = p->pListNext; + smart_str_appends(buffer, (*ext)->module->name); } } /* }}} */ diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 03927e6eed..74e302c766 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -290,7 +290,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_field_name, 0, 0, 2) ZEND_ARG_INFO(0, statement_resource) - ZEND_ARG_INFO(0, column_number) + ZEND_ARG_INFO(0, column_number_or_name) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_field_size, 0, 0, 2) @@ -300,22 +300,22 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_field_scale, 0, 0, 2) ZEND_ARG_INFO(0, statement_resource) - ZEND_ARG_INFO(0, column_number) + ZEND_ARG_INFO(0, column_number_or_name) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_field_precision, 0, 0, 2) ZEND_ARG_INFO(0, statement_resource) - ZEND_ARG_INFO(0, column_number) + ZEND_ARG_INFO(0, column_number_or_name) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_field_type, 0, 0, 2) ZEND_ARG_INFO(0, statement_resource) - ZEND_ARG_INFO(0, column_number) + ZEND_ARG_INFO(0, column_number_or_name) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_field_type_raw, 0, 0, 2) ZEND_ARG_INFO(0, statement_resource) - ZEND_ARG_INFO(0, column_number) + ZEND_ARG_INFO(0, column_number_or_name) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_field_is_null, 0, 0, 2) diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index d6a62325f3..ca69febb2a 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -1139,7 +1139,7 @@ PHP_FUNCTION(oci_commit) } /* }}} */ -/* {{{ proto string oci_field_name(resource stmt, int col) +/* {{{ proto string oci_field_name(resource stmt, mixed col) Tell the name of a column */ PHP_FUNCTION(oci_field_name) { @@ -1152,7 +1152,7 @@ PHP_FUNCTION(oci_field_name) } /* }}} */ -/* {{{ proto int oci_field_size(resource stmt, int col) +/* {{{ proto int oci_field_size(resource stmt, mixed col) Tell the maximum data size of a column */ PHP_FUNCTION(oci_field_size) { @@ -1169,7 +1169,7 @@ PHP_FUNCTION(oci_field_size) } /* }}} */ -/* {{{ proto int oci_field_scale(resource stmt, int col) +/* {{{ proto int oci_field_scale(resource stmt, mixed col) Tell the scale of a column */ PHP_FUNCTION(oci_field_scale) { @@ -1182,7 +1182,7 @@ PHP_FUNCTION(oci_field_scale) } /* }}} */ -/* {{{ proto int oci_field_precision(resource stmt, int col) +/* {{{ proto int oci_field_precision(resource stmt, mixed col) Tell the precision of a column */ PHP_FUNCTION(oci_field_precision) { @@ -1195,7 +1195,7 @@ PHP_FUNCTION(oci_field_precision) } /* }}} */ -/* {{{ proto mixed oci_field_type(resource stmt, int col) +/* {{{ proto mixed oci_field_type(resource stmt, mixed col) Tell the data type of a column */ PHP_FUNCTION(oci_field_type) { @@ -1275,7 +1275,7 @@ PHP_FUNCTION(oci_field_type) } /* }}} */ -/* {{{ proto int oci_field_type_raw(resource stmt, int col) +/* {{{ proto int oci_field_type_raw(resource stmt, mixed col) Tell the raw oracle data type of a column */ PHP_FUNCTION(oci_field_type_raw) { @@ -1289,8 +1289,8 @@ PHP_FUNCTION(oci_field_type_raw) } /* }}} */ -/* {{{ proto bool oci_field_is_null(resource stmt, int col) - Tell whether a column is NULL */ +/* {{{ proto bool oci_field_is_null(resource stmt, mixed col) + Tell whether a field in the current row is NULL */ PHP_FUNCTION(oci_field_is_null) { php_oci_out_column *column; diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml index c4530bdef0..e5839f1399 100644 --- a/ext/oci8/package.xml +++ b/ext/oci8/package.xml @@ -45,12 +45,12 @@ libraries are available. <active>no</active> </lead> - <date>2014-03-11</date> + <date>2014-03-19</date> <time>12:00:00</time> <version> - <release>2.0.8</release> - <api>2.0.8</api> + <release>2.0.9</release> + <api>2.0.9</api> </version> <stability> <release>stable</release> @@ -58,7 +58,7 @@ libraries are available. </stability> <license uri="http://www.php.net/license">PHP</license> <notes> -Enhancement - Improve performance of multi-row OCI_RETURN_LOB queries (Bug #66875) +Fixed oci_field_* reflection: $field can be a column name or index </notes> <contents> <dir name="/"> @@ -463,6 +463,21 @@ Enhancement - Improve performance of multi-row OCI_RETURN_LOB queries (Bug #6687 <release> <version> + <release>2.0.8</release> + <api>2.0.8</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://www.php.net/license">PHP</license> + <notes> +Enhancement - Improve performance of multi-row OCI_RETURN_LOB queries (Bug #66875) + </notes> + </release> + +<release> + <version> <release>2.0.7</release> <api>2.0.7</api> </version> diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h index 5c78faaa64..066812edad 100644 --- a/ext/oci8/php_oci8.h +++ b/ext/oci8/php_oci8.h @@ -45,7 +45,7 @@ */ #undef PHP_OCI8_VERSION #endif -#define PHP_OCI8_VERSION "2.0.8" +#define PHP_OCI8_VERSION "2.0.9" extern zend_module_entry oci8_module_entry; #define phpext_oci8_ptr &oci8_module_entry diff --git a/ext/oci8/tests/array_bind_001.phpt b/ext/oci8/tests/array_bind_001.phpt index 6a3746c2d5..0c1644152c 100644 --- a/ext/oci8/tests/array_bind_001.phpt +++ b/ext/oci8/tests/array_bind_001.phpt @@ -16,15 +16,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_001_PKG AS TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_001_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_001_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -42,11 +42,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_001_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_001_pkg.iobind(:c1); END;"); $array = ""; diff --git a/ext/oci8/tests/array_bind_002.phpt b/ext/oci8/tests/array_bind_002.phpt index 82b57dc731..d2b520c78e 100644 --- a/ext/oci8/tests/array_bind_002.phpt +++ b/ext/oci8/tests/array_bind_002.phpt @@ -16,15 +16,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_002_PKG AS TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_002_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_002_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -42,11 +42,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_002_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_002_pkg.iobind(:c1); END;"); $array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17","05-NOV-05"); diff --git a/ext/oci8/tests/array_bind_003.phpt b/ext/oci8/tests/array_bind_003.phpt index 0875c694f5..eee1500202 100644 --- a/ext/oci8/tests/array_bind_003.phpt +++ b/ext/oci8/tests/array_bind_003.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_003_PKG AS TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_003_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_003_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -45,11 +45,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_003_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_003_pkg.iobind(:c1); END;"); $array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17"); @@ -63,7 +63,7 @@ echo "Done\n"; ?> --EXPECTF-- Warning: oci_execute(): ORA-01403: %s -ORA-06512: at "SYSTEM.ARRAYBINDPKG1", line %d +ORA-06512: at "SYSTEM.ARRAY_BIND_003_PKG", line %d ORA-06512: at line %d in %sarray_bind_003.php on line %d array(4) { [0]=> diff --git a/ext/oci8/tests/array_bind_004.phpt b/ext/oci8/tests/array_bind_004.phpt index df74025d70..a998a2225b 100644 --- a/ext/oci8/tests/array_bind_004.phpt +++ b/ext/oci8/tests/array_bind_004.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_004_PKG AS TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_004_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_004_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -45,11 +45,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_004_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_004_pkg.iobind(:c1); END;"); $array = Array(); @@ -63,7 +63,7 @@ echo "Done\n"; ?> --EXPECTF-- Warning: oci_execute(): ORA-01403: %s -ORA-06512: at "SYSTEM.ARRAYBINDPKG1", line %d +ORA-06512: at "SYSTEM.ARRAY_BIND_004_PKG", line %d ORA-06512: at line %d in %sarray_bind_004.php on line %d array(0) { } diff --git a/ext/oci8/tests/array_bind_005.phpt b/ext/oci8/tests/array_bind_005.phpt index eaa3c4ea2e..4a73e0ffc8 100644 --- a/ext/oci8/tests/array_bind_005.phpt +++ b/ext/oci8/tests/array_bind_005.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_005_PKG AS TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_005_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_005_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -45,11 +45,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_005_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_005_pkg.iobind(:c1); END;"); $array = Array("", "", "", "", ""); diff --git a/ext/oci8/tests/array_bind_006.phpt b/ext/oci8/tests/array_bind_006.phpt index f13aca3997..cc24c2bd80 100644 --- a/ext/oci8/tests/array_bind_006.phpt +++ b/ext/oci8/tests/array_bind_006.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_006_PKG AS TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_006_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_006_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -45,11 +45,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_006_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_006_pkg.iobind(:c1); END;"); $array = array("one", "two", "three", "four", "five"); diff --git a/ext/oci8/tests/array_bind_007.phpt b/ext/oci8/tests/array_bind_007.phpt index c926bc0abd..6c9101b685 100644 --- a/ext/oci8/tests/array_bind_007.phpt +++ b/ext/oci8/tests/array_bind_007.phpt @@ -16,15 +16,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_007_PKG AS TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_007_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_007_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -42,11 +42,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_007_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_007_pkg.iobind(:c1); END;"); $array = Array(1,2,3,4,5); diff --git a/ext/oci8/tests/array_bind_008.phpt b/ext/oci8/tests/array_bind_008.phpt index df2c35ccb2..393316c22b 100644 --- a/ext/oci8/tests/array_bind_008.phpt +++ b/ext/oci8/tests/array_bind_008.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_008_PKG AS TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_008_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_008_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -45,11 +45,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_008_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_008_pkg.iobind(:c1); END;"); $array = Array(1,2,3,4,5); diff --git a/ext/oci8/tests/array_bind_011.phpt b/ext/oci8/tests/array_bind_011.phpt index 9f43d1ac9c..4c27bd06e2 100644 --- a/ext/oci8/tests/array_bind_011.phpt +++ b/ext/oci8/tests/array_bind_011.phpt @@ -16,15 +16,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_011_PKG AS TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_011_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_011_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -42,11 +42,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_011_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_011_pkg.iobind(:c1); END;"); $array = array(); diff --git a/ext/oci8/tests/array_bind_014.phpt b/ext/oci8/tests/array_bind_014.phpt index 9ab0236359..8d9a21b697 100644 --- a/ext/oci8/tests/array_bind_014.phpt +++ b/ext/oci8/tests/array_bind_014.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_014_PKG AS TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_014_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_014_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -42,7 +42,7 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_014_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); @@ -51,7 +51,7 @@ for ($i = 1; $i < 6; $i++) { oci_execute($statement); } -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_014_pkg.iobind(:c1); END;"); $array = Array(); oci_bind_array_by_name($statement, ":c1", $array, 5, -1, SQLT_INT); oci_execute($statement); diff --git a/ext/oci8/tests/array_bind_bdouble.phpt b/ext/oci8/tests/array_bind_bdouble.phpt index fb173654bf..ba8ffe978e 100644 --- a/ext/oci8/tests/array_bind_bdouble.phpt +++ b/ext/oci8/tests/array_bind_bdouble.phpt @@ -11,7 +11,7 @@ if (!defined('SQLT_BDOUBLE')) die('skip SQLT_BDOUBLE type not available on older require dirname(__FILE__).'/connect.inc'; -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_bdouble_pkg.iobind(:c1); END;"); $array = Array(1.243,2.5658,3.4234,4.2123,5.9999); oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_BDOUBLE); diff --git a/ext/oci8/tests/array_bind_bfloat.phpt b/ext/oci8/tests/array_bind_bfloat.phpt index fdd43958cd..afbcce38dc 100644 --- a/ext/oci8/tests/array_bind_bfloat.phpt +++ b/ext/oci8/tests/array_bind_bfloat.phpt @@ -11,7 +11,7 @@ if (!defined('SQLT_BFLOAT')) die('skip SQLT_BFLOAT type not available on older O require dirname(__FILE__).'/connect.inc'; -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_bfloat_pkg.iobind(:c1); END;"); $array = Array(1.243,2.5658,3.4234,4.2123,5.9999); oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_BFLOAT); diff --git a/ext/oci8/tests/array_bind_date.phpt b/ext/oci8/tests/array_bind_date.phpt index 926d7cfaba..6a077b10b7 100644 --- a/ext/oci8/tests/array_bind_date.phpt +++ b/ext/oci8/tests/array_bind_date.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_DATE_PKG AS TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_DATE_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_DATE_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -45,11 +45,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_DATE_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_date_pkg.iobind(:c1); END;"); $array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17","05-NOV-05"); diff --git a/ext/oci8/tests/array_bind_date1.phpt b/ext/oci8/tests/array_bind_date1.phpt index c8c1f1a5e9..d8ecdb5a40 100644 --- a/ext/oci8/tests/array_bind_date1.phpt +++ b/ext/oci8/tests/array_bind_date1.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_DATE1_PKG AS TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_DATE1_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_DATE1_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -45,11 +45,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_DATE1_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_date1_pkg.iobind(:c1); END;"); $array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17","05-NOV-05"); diff --git a/ext/oci8/tests/array_bind_float.phpt b/ext/oci8/tests/array_bind_float.phpt index 5246f63805..b35ca3de0e 100644 --- a/ext/oci8/tests/array_bind_float.phpt +++ b/ext/oci8/tests/array_bind_float.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_FLOAT_PKG AS TYPE ARRTYPE IS TABLE OF FLOAT INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_FLOAT_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_FLOAT_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -45,11 +45,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_FLOAT_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_float_pkg.iobind(:c1); END;"); $array = Array(1.243,2.5658,3.4234,4.2123,5.9999); diff --git a/ext/oci8/tests/array_bind_float1.phpt b/ext/oci8/tests/array_bind_float1.phpt index 53b551f1c1..7f755aa846 100644 --- a/ext/oci8/tests/array_bind_float1.phpt +++ b/ext/oci8/tests/array_bind_float1.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_FLOAT1_PKG AS TYPE ARRTYPE IS TABLE OF FLOAT INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_FLOAT1_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_FLOAT1_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -45,11 +45,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_FLOAT1_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_float1_pkg.iobind(:c1); END;"); $array = Array(1.243,2.5658,3.4234,4.2123,5.9999); diff --git a/ext/oci8/tests/array_bind_int.phpt b/ext/oci8/tests/array_bind_int.phpt index 2f34979f23..e4fc6676d0 100644 --- a/ext/oci8/tests/array_bind_int.phpt +++ b/ext/oci8/tests/array_bind_int.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_INT_PKG AS TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_INT_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_INT_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -45,11 +45,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_INT_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_int_pkg.iobind(:c1); END;"); $array = Array(1,2,3,4,5); diff --git a/ext/oci8/tests/array_bind_int1.phpt b/ext/oci8/tests/array_bind_int1.phpt index 49fea2aa03..6590e2fb3f 100644 --- a/ext/oci8/tests/array_bind_int1.phpt +++ b/ext/oci8/tests/array_bind_int1.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_INT1_PKG AS TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_INT1_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_INT1_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -45,11 +45,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_INT1_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_int1_pkg.iobind(:c1); END;"); $array = Array(1,2,3,4,5); diff --git a/ext/oci8/tests/array_bind_str.phpt b/ext/oci8/tests/array_bind_str.phpt index 87291bd172..84bcb48750 100644 --- a/ext/oci8/tests/array_bind_str.phpt +++ b/ext/oci8/tests/array_bind_str.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_STR_PKG AS TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_STR_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_STR_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -45,11 +45,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_STR_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_str_pkg.iobind(:c1); END;"); $array = Array("one", "two", "three", "four", "five"); diff --git a/ext/oci8/tests/array_bind_str1.phpt b/ext/oci8/tests/array_bind_str1.phpt index 3f60ee8c28..ab35ad79bd 100644 --- a/ext/oci8/tests/array_bind_str1.phpt +++ b/ext/oci8/tests/array_bind_str1.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE ARRAY_BIND_STR1_PKG AS TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END ARRAY_BIND_STR1_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_STR1_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -45,11 +45,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END ARRAY_BIND_STR1_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_str1_pkg.iobind(:c1); END;"); $array = Array("one", "two", "three", "four", "five"); diff --git a/ext/oci8/tests/array_bind_uin.phpt b/ext/oci8/tests/array_bind_uin.phpt index 3ce039e0d0..0b9e982590 100644 --- a/ext/oci8/tests/array_bind_uin.phpt +++ b/ext/oci8/tests/array_bind_uin.phpt @@ -10,7 +10,7 @@ require(dirname(__FILE__).'/skipif.inc'); require dirname(__FILE__).'/connect.inc'; -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN array_bind_uin_pkg.iobind(:c1); END;"); $array = Array(1.243,2.5658,3.4234,4.2123,5.9999); oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_UIN); diff --git a/ext/oci8/tests/bug37581.phpt b/ext/oci8/tests/bug37581.phpt index 1c00f68d31..a1eeafc761 100644 --- a/ext/oci8/tests/bug37581.phpt +++ b/ext/oci8/tests/bug37581.phpt @@ -10,19 +10,19 @@ require(dirname(__FILE__).'/skipif.inc'); require dirname(__FILE__)."/connect.inc"; -$p1 = "create or replace package ARRAYBINDPKG1 as +$p1 = "create or replace package BUG37581_PKG as type str_array is table of char(2) index by binary_integer; procedure array_bind(in_str in str_array, out_str out string); -end ARRAYBINDPKG1;"; +end BUG37581_PKG;"; -$p2 = "create or replace package body ARRAYBINDPKG1 as +$p2 = "create or replace package body BUG37581_PKG as procedure array_bind(in_str in str_array, out_str out string) is begin for i in 1 .. in_str.count loop out_str := in_str(i); end loop; end array_bind; -end ARRAYBINDPKG1;"; +end BUG37581_PKG;"; $s1 = oci_parse($c, $p1); $s2 = oci_parse($c, $p2); @@ -30,7 +30,7 @@ oci_execute($s1); oci_execute($s2); -$stmt = oci_parse($c,'begin ARRAYBINDPKG1.array_bind(:in_arr, :out_str); end;'); +$stmt = oci_parse($c,'begin bug37581_pkg.array_bind(:in_arr, :out_str); end;'); $strings = array('A','B','C','D','E'); oci_bind_array_by_name($stmt,':in_arr',$strings,5,1,SQLT_AFC); diff --git a/ext/oci8/tests/bug40078.phpt b/ext/oci8/tests/bug40078.phpt index 4070221ee9..d9b54e295f 100644 --- a/ext/oci8/tests/bug40078.phpt +++ b/ext/oci8/tests/bug40078.phpt @@ -11,15 +11,15 @@ require(dirname(__FILE__).'/skipif.inc'); require dirname(__FILE__).'/connect.inc'; $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BUG40078_PKG AS TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER; PROCEDURE nullbind(c1 OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END BUG40078_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY BUG40078_PKG AS PROCEDURE nullbind(c1 OUT ARRTYPE) IS BEGIN c1(1) := 'one'; @@ -28,11 +28,11 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS c1(4) := 'four'; c1(5) := 'five'; END nullbind; -END ARRAYBINDPKG1;"; +END BUG40078_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.nullbind(:c1); END;"); +$statement = oci_parse($c, "BEGIN bug40078_pkg.nullbind(:c1); END;"); oci_bind_array_by_name($statement, ":c1", $array, 5, 20, SQLT_CHR); diff --git a/ext/oci8/tests/bug51253.phpt b/ext/oci8/tests/bug51253.phpt index a97272f65f..111da929bb 100644 --- a/ext/oci8/tests/bug51253.phpt +++ b/ext/oci8/tests/bug51253.phpt @@ -19,15 +19,15 @@ $statement = oci_parse($c, $create); oci_execute($statement); $create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BUG51253_PKG AS TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER; PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; +END BUG51253_PKG;"; $statement = oci_parse($c, $create_pkg); oci_execute($statement); $create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS +CREATE OR REPLACE PACKAGE BODY BUG51253_PKG AS CURSOR CUR IS SELECT name FROM bind_test; PROCEDURE iobind(c1 IN OUT ARRTYPE) IS BEGIN @@ -45,12 +45,12 @@ CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS END IF; END LOOP; END iobind; -END ARRAYBINDPKG1;"; +END BUG51253_PKG;"; $statement = oci_parse($c, $create_pkg_body); oci_execute($statement); echo "Test 1\n"; -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN bug51253_pkg.iobind(:c1); END;"); $array1 = array("one", "two", "three", "four", "five"); $array2 = $array1; oci_bind_array_by_name($statement, ":c1", $array2, 5, -1, SQLT_CHR); @@ -61,7 +61,7 @@ var_dump($array2); echo "Test 2\n"; -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN bug51253_pkg.iobind(:c1); END;"); $array1 = array("one", "two", "three", "four", "five"); $array2 = &$array1; oci_bind_array_by_name($statement, ":c1", $array2, 5, -1, SQLT_CHR); @@ -72,7 +72,7 @@ var_dump($array2); echo "Test 3\n"; -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); +$statement = oci_parse($c, "BEGIN bug51253_pkg.iobind(:c1); END;"); $array1 = array("one", "two", "three", "four", "five"); $array2 = &$array1; oci_bind_array_by_name($statement, ":c1", $array1, 5, -1, SQLT_CHR); @@ -82,7 +82,7 @@ var_dump($array1); var_dump($array2); // Cleanup -$statement = oci_parse($c, "DROP PACKAGE ARRAYBINDPKG1"); +$statement = oci_parse($c, "DROP PACKAGE BUG51253_PKG"); @oci_execute($statement); $statement = oci_parse($c, "DROP TABLE BIND_TEST"); @oci_execute($statement); diff --git a/ext/oci8/tests/reflection1.phpt b/ext/oci8/tests/reflection1.phpt index f76d7261aa..2cf3e4055b 100644 --- a/ext/oci8/tests/reflection1.phpt +++ b/ext/oci8/tests/reflection1.phpt @@ -177,7 +177,7 @@ Function [ <internal%s> function oci_field_name ] { - Parameters [2] { Parameter #0 [ <required> $statement_resource ] - Parameter #1 [ <required> $column_number ] + Parameter #1 [ <required> $column_number_or_name ] } } @@ -193,7 +193,7 @@ Function [ <internal%s> function oci_field_scale ] { - Parameters [2] { Parameter #0 [ <required> $statement_resource ] - Parameter #1 [ <required> $column_number ] + Parameter #1 [ <required> $column_number_or_name ] } } @@ -201,7 +201,7 @@ Function [ <internal%s> function oci_field_precision ] { - Parameters [2] { Parameter #0 [ <required> $statement_resource ] - Parameter #1 [ <required> $column_number ] + Parameter #1 [ <required> $column_number_or_name ] } } @@ -209,7 +209,7 @@ Function [ <internal%s> function oci_field_type ] { - Parameters [2] { Parameter #0 [ <required> $statement_resource ] - Parameter #1 [ <required> $column_number ] + Parameter #1 [ <required> $column_number_or_name ] } } @@ -217,7 +217,7 @@ Function [ <internal%s> function oci_field_type_raw ] { - Parameters [2] { Parameter #0 [ <required> $statement_resource ] - Parameter #1 [ <required> $column_number ] + Parameter #1 [ <required> $column_number_or_name ] } } @@ -722,7 +722,7 @@ Function [ <internal%s> function ocicolumnname ] { - Parameters [2] { Parameter #0 [ <required> $statement_resource ] - Parameter #1 [ <required> $column_number ] + Parameter #1 [ <required> $column_number_or_name ] } } @@ -738,7 +738,7 @@ Function [ <internal%s> function ocicolumnscale ] { - Parameters [2] { Parameter #0 [ <required> $statement_resource ] - Parameter #1 [ <required> $column_number ] + Parameter #1 [ <required> $column_number_or_name ] } } @@ -746,7 +746,7 @@ Function [ <internal%s> function ocicolumnprecision ] { - Parameters [2] { Parameter #0 [ <required> $statement_resource ] - Parameter #1 [ <required> $column_number ] + Parameter #1 [ <required> $column_number_or_name ] } } @@ -754,7 +754,7 @@ Function [ <internal%s> function ocicolumntype ] { - Parameters [2] { Parameter #0 [ <required> $statement_resource ] - Parameter #1 [ <required> $column_number ] + Parameter #1 [ <required> $column_number_or_name ] } } @@ -762,7 +762,7 @@ Function [ <internal%s> function ocicolumntyperaw ] { - Parameters [2] { Parameter #0 [ <required> $statement_resource ] - Parameter #1 [ <required> $column_number ] + Parameter #1 [ <required> $column_number_or_name ] } } diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32 index 280ce228c6..af160b207c 100644 --- a/ext/opcache/config.w32 +++ b/ext/opcache/config.w32 @@ -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 \ diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 97740d361e..1781cc1776 100755 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -918,7 +918,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); @@ -5310,7 +5310,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; diff --git a/ext/openssl/tests/openssl.cnf b/ext/openssl/tests/openssl.cnf index 6ba37cb953..4ed40fdc8a 100644 --- a/ext/openssl/tests/openssl.cnf +++ b/ext/openssl/tests/openssl.cnf @@ -3,7 +3,6 @@ default_bits = 1024 default_keyfile = privkey.pem distinguished_name = req_distinguished_name attributes = req_attributes -default_md = sha1 x509_extensions = v3_ca # The extensions to add to the self signed cert string_mask = MASK:4294967295 diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 84ad12311d..52d43ced30 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -577,6 +577,8 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec int i, rc; int subpats_order; /* Order of subpattern matches */ int offset_capture; /* Capture match offsets: yes/no */ + unsigned char *mark = NULL; /* Target for MARK name */ + zval *marks = NULL; /* Array of marks for PREG_PATTERN_ORDER */ /* Overwrite the passed-in value for subpatterns with an empty array. */ if (subpats != NULL) { @@ -619,6 +621,10 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec } extra->match_limit = PCRE_G(backtrack_limit); extra->match_limit_recursion = PCRE_G(recursion_limit); +#ifdef PCRE_EXTRA_MARK + extra->mark = &mark; + extra->flags |= PCRE_EXTRA_MARK; +#endif /* Calculate the size of the offsets array, and allocate memory for it. */ rc = pcre_fullinfo(pce->re, extra, PCRE_INFO_CAPTURECOUNT, &num_subpats); @@ -695,6 +701,14 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec offsets[(i<<1)+1] - offsets[i<<1], 1); } } + /* Add MARK, if available */ + if (mark) { + if (!marks) { + MAKE_STD_ZVAL(marks); + array_init(marks); + } + add_index_string(marks, matched - 1, (char *) mark, 1); + } /* * If the number of captured subpatterns on this run is * less than the total possible number, pad the result @@ -725,6 +739,10 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec offsets[(i<<1)+1] - offsets[i<<1], 1); } } + /* Add MARK, if available */ + if (mark) { + add_assoc_string(result_set, "MARK", (char *) mark, 1); + } /* And add it to the output array */ zend_hash_next_index_insert(Z_ARRVAL_P(subpats), &result_set, sizeof(zval *), NULL); } @@ -744,6 +762,10 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec offsets[(i<<1)+1] - offsets[i<<1], 1); } } + /* Add MARK, if available */ + if (mark) { + add_assoc_string(subpats, "MARK", (char *) mark, 1); + } } pcre_free((void *) stringlist); @@ -784,6 +806,10 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec zend_hash_next_index_insert(Z_ARRVAL_P(subpats), &match_sets[i], sizeof(zval *), NULL); } efree(match_sets); + + if (marks) { + add_assoc_zval(subpats, "MARK", marks); + } } efree(offsets); @@ -855,7 +881,7 @@ static int preg_get_backref(char **str, int *backref) /* {{{ preg_do_repl_func */ -static int preg_do_repl_func(zval *function, char *subject, int *offsets, char **subpat_names, int count, char **result TSRMLS_DC) +static int preg_do_repl_func(zval *function, char *subject, int *offsets, char **subpat_names, int count, unsigned char *mark, char **result TSRMLS_DC) { zval *retval_ptr; /* Function return value */ zval **args[1]; /* Argument to pass to function */ @@ -871,6 +897,9 @@ static int preg_do_repl_func(zval *function, char *subject, int *offsets, char * } add_next_index_stringl(subpats, &subject[offsets[i<<1]], offsets[(i<<1)+1] - offsets[i<<1], 1); } + if (mark) { + add_assoc_string(subpats, "MARK", (char *) mark, 1); + } args[0] = &subpats; if (call_user_function_ex(EG(function_table), NULL, function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) { @@ -1032,6 +1061,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub *eval_result, /* Result of eval or custom function */ walk_last; /* Last walked character */ int rc; + unsigned char *mark = NULL; /* Target for MARK name */ if (extra == NULL) { extra_data.flags = PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION; @@ -1039,6 +1069,10 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub } extra->match_limit = PCRE_G(backtrack_limit); extra->match_limit_recursion = PCRE_G(recursion_limit); +#ifdef PCRE_EXTRA_MARK + extra->mark = &mark; + extra->flags |= PCRE_EXTRA_MARK; +#endif eval = pce->preg_options & PREG_REPLACE_EVAL; if (is_callable_replace) { @@ -1118,7 +1152,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub new_len += eval_result_len; } else if (is_callable_replace) { /* Use custom function to get replacement string and its length. */ - eval_result_len = preg_do_repl_func(replace_val, subject, offsets, subpat_names, count, &eval_result TSRMLS_CC); + eval_result_len = preg_do_repl_func(replace_val, subject, offsets, subpat_names, count, mark, &eval_result TSRMLS_CC); new_len += eval_result_len; } else { /* do regular substitution */ walk = replace; @@ -1517,6 +1551,9 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec } extra->match_limit = PCRE_G(backtrack_limit); extra->match_limit_recursion = PCRE_G(recursion_limit); +#ifdef PCRE_EXTRA_MARK + extra->flags &= ~PCRE_EXTRA_MARK; +#endif /* Initialize return value */ array_init(return_value); @@ -1785,6 +1822,9 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return } extra->match_limit = PCRE_G(backtrack_limit); extra->match_limit_recursion = PCRE_G(recursion_limit); +#ifdef PCRE_EXTRA_MARK + extra->flags &= ~PCRE_EXTRA_MARK; +#endif /* Calculate the size of the offsets array, and allocate memory for it. */ rc = pcre_fullinfo(pce->re, extra, PCRE_INFO_CAPTURECOUNT, &size_offsets); diff --git a/ext/pcre/tests/marks.phpt b/ext/pcre/tests/marks.phpt new file mode 100644 index 0000000000..8838a00500 --- /dev/null +++ b/ext/pcre/tests/marks.phpt @@ -0,0 +1,202 @@ +--TEST-- +Test support for PCRE marks +--SKIPIF-- +<?php +if (version_compare(PCRE_VERSION, '8.1', '<')) { + die('skip PCRE_VERSION >= 8.1 is required for MARK support'); +} +?> +--FILE-- +<?php + +$regex = <<<'REGEX' +/ + _ (a) (*MARK:A_MARK) _ + | _ (b) _ + | _ (c) (*MARK:C_MARK) _ + | _ (d) _ +/x +REGEX; + +var_dump(preg_match($regex, '_c_', $matches)); +var_dump($matches); + +var_dump(preg_match_all($regex, '_a__b__c__d_', $matches, PREG_PATTERN_ORDER)); +var_dump($matches); + +var_dump(preg_match_all($regex, '_a__b__c__d_', $matches, PREG_SET_ORDER)); +var_dump($matches); + +var_dump(preg_replace_callback($regex, function($matches) { + var_dump($matches); + return $matches[0]; +}, '_a__b__c__d_')); + +?> +--EXPECTF-- +int(1) +array(5) { + [0]=> + string(3) "_c_" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(1) "c" + ["MARK"]=> + string(6) "C_MARK" +} +int(4) +array(6) { + [0]=> + array(4) { + [0]=> + string(3) "_a_" + [1]=> + string(3) "_b_" + [2]=> + string(3) "_c_" + [3]=> + string(3) "_d_" + } + [1]=> + array(4) { + [0]=> + string(1) "a" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(0) "" + } + [2]=> + array(4) { + [0]=> + string(0) "" + [1]=> + string(1) "b" + [2]=> + string(0) "" + [3]=> + string(0) "" + } + [3]=> + array(4) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + string(1) "c" + [3]=> + string(0) "" + } + [4]=> + array(4) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(1) "d" + } + ["MARK"]=> + array(2) { + [0]=> + string(6) "A_MARK" + [2]=> + string(6) "C_MARK" + } +} +int(4) +array(4) { + [0]=> + array(3) { + [0]=> + string(3) "_a_" + [1]=> + string(1) "a" + ["MARK"]=> + string(6) "A_MARK" + } + [1]=> + array(3) { + [0]=> + string(3) "_b_" + [1]=> + string(0) "" + [2]=> + string(1) "b" + } + [2]=> + array(5) { + [0]=> + string(3) "_c_" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(1) "c" + ["MARK"]=> + string(6) "C_MARK" + } + [3]=> + array(5) { + [0]=> + string(3) "_d_" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(1) "d" + } +} +array(3) { + [0]=> + string(3) "_a_" + [1]=> + string(1) "a" + ["MARK"]=> + string(6) "A_MARK" +} +array(3) { + [0]=> + string(3) "_b_" + [1]=> + string(0) "" + [2]=> + string(1) "b" +} +array(5) { + [0]=> + string(3) "_c_" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(1) "c" + ["MARK"]=> + string(6) "C_MARK" +} +array(5) { + [0]=> + string(3) "_d_" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(1) "d" +} +string(12) "_a__b__c__d_" diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index d17867d1f9..32e6e1bdd0 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -468,23 +468,11 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry fci.object_ptr = object; fci.symbol_table = NULL; fci.retval_ptr_ptr = &retval; - if (ctor_args) { - HashTable *ht = Z_ARRVAL_P(ctor_args); - Bucket *p; - - fci.param_count = 0; - fci.params = safe_emalloc(sizeof(zval*), ht->nNumOfElements, 0); - p = ht->pListHead; - while (p != NULL) { - fci.params[fci.param_count++] = (zval**)p->pData; - p = p->pListNext; - } - } else { - fci.param_count = 0; - fci.params = NULL; - } + fci.params = NULL; fci.no_separation = 1; + zend_fcall_info_args(&fci, ctor_args TSRMLS_CC); + fcc.initialized = 1; fcc.function_handler = dbstmt_ce->constructor; fcc.calling_scope = EG(scope); diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 2735aede41..2593d02e96 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -757,23 +757,11 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ fci->function_name = NULL; fci->symbol_table = NULL; fci->retval_ptr_ptr = &stmt->fetch.cls.retval_ptr; - if (stmt->fetch.cls.ctor_args) { - HashTable *ht = Z_ARRVAL_P(stmt->fetch.cls.ctor_args); - Bucket *p; - - fci->param_count = 0; - fci->params = safe_emalloc(sizeof(zval**), ht->nNumOfElements, 0); - p = ht->pListHead; - while (p != NULL) { - fci->params[fci->param_count++] = (zval**)p->pData; - p = p->pListNext; - } - } else { - fci->param_count = 0; - fci->params = NULL; - } + fci->params = NULL; fci->no_separation = 1; + zend_fcall_info_args(fci, stmt->fetch.cls.ctor_args TSRMLS_CC); + fcc->initialized = 1; fcc->function_handler = ce->constructor; fcc->calling_scope = EG(scope); diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index aa5e795594..72595de9f1 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -607,14 +607,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 +697,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); } diff --git a/ext/pdo_firebird/pdo_firebird.c b/ext/pdo_firebird/pdo_firebird.c index c512004b2c..9de9048859 100644 --- a/ext/pdo_firebird/pdo_firebird.c +++ b/ext/pdo_firebird/pdo_firebird.c @@ -91,7 +91,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(); } /* }}} */ diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index bd9a3f6f11..d36901d8c1 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -115,6 +115,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_pconnect, 0, 0, 1) ZEND_ARG_INFO(0, database) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_connect_poll, 0, 0, 0) + ZEND_ARG_INFO(0, connection) +ZEND_END_ARG_INFO() + #if HAVE_PQPARAMETERSTATUS ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_parameter_status, 0, 0, 1) ZEND_ARG_INFO(0, connection) @@ -526,6 +530,18 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_get_pid, 0, 0, 0) ZEND_ARG_INFO(0, connection) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_socket, 0, 0, 1) + ZEND_ARG_INFO(0, connection) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_consume_input, 0, 0, 1) + ZEND_ARG_INFO(0, connection) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_flush, 0, 0, 1) + ZEND_ARG_INFO(0, connection) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_meta_data, 0, 0, 2) ZEND_ARG_INFO(0, db) ZEND_ARG_INFO(0, table) @@ -574,6 +590,7 @@ const zend_function_entry pgsql_functions[] = { /* connection functions */ PHP_FE(pg_connect, arginfo_pg_connect) PHP_FE(pg_pconnect, arginfo_pg_pconnect) + PHP_FE(pg_connect_poll, arginfo_pg_connect_poll) PHP_FE(pg_close, arginfo_pg_close) PHP_FE(pg_connection_status, arginfo_pg_connection_status) PHP_FE(pg_connection_busy, arginfo_pg_connection_busy) @@ -643,6 +660,9 @@ const zend_function_entry pgsql_functions[] = { #endif /* async message function */ PHP_FE(pg_get_notify, arginfo_pg_get_notify) + PHP_FE(pg_socket, arginfo_pg_socket) + PHP_FE(pg_consume_input,arginfo_pg_consume_input) + PHP_FE(pg_flush, arginfo_pg_flush) PHP_FE(pg_get_pid, arginfo_pg_get_pid) /* error message functions */ PHP_FE(pg_result_error, arginfo_pg_result_error) @@ -1095,6 +1115,7 @@ PHP_MINIT_FUNCTION(pgsql) #endif /* For connection option */ REGISTER_LONG_CONSTANT("PGSQL_CONNECT_FORCE_NEW", PGSQL_CONNECT_FORCE_NEW, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECT_ASYNC", PGSQL_CONNECT_ASYNC, CONST_CS | CONST_PERSISTENT); /* For pg_fetch_array() */ REGISTER_LONG_CONSTANT("PGSQL_ASSOC", PGSQL_ASSOC, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PGSQL_NUM", PGSQL_NUM, CONST_CS | CONST_PERSISTENT); @@ -1102,6 +1123,18 @@ PHP_MINIT_FUNCTION(pgsql) /* For pg_connection_status() */ REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_BAD", CONNECTION_BAD, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_OK", CONNECTION_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_STARTED", CONNECTION_STARTED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_MADE", CONNECTION_MADE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_AWAITING_RESPONSE", CONNECTION_AWAITING_RESPONSE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_AUTH_OK", CONNECTION_AUTH_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_SSL_STARTUP", CONNECTION_SSL_STARTUP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_SETENV", CONNECTION_SETENV, CONST_CS | CONST_PERSISTENT); + /* For pg_connect_poll() */ + REGISTER_LONG_CONSTANT("PGSQL_POLLING_FAILED", PGRES_POLLING_FAILED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_POLLING_READING", PGRES_POLLING_READING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_POLLING_WRITING", PGRES_POLLING_WRITING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_POLLING_OK", PGRES_POLLING_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_POLLING_ACTIVE", PGRES_POLLING_ACTIVE, CONST_CS | CONST_PERSISTENT); #if HAVE_PGTRANSACTIONSTATUS /* For pg_transaction_status() */ REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_IDLE", PQTRANS_IDLE, CONST_CS | CONST_PERSISTENT); @@ -1401,17 +1434,35 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create new link. Too many open links (%ld)", PGG(num_links)); goto err; } - if (connstring) { - pgsql = PQconnectdb(connstring); + + /* Non-blocking connect */ + if (connect_type & PGSQL_CONNECT_ASYNC) { + if (connstring) { + pgsql = PQconnectStart(connstring); + if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) { + PHP_PQ_ERROR("Unable to connect to PostgreSQL server: %s", pgsql); + if (pgsql) { + PQfinish(pgsql); + } + goto err; + } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Connection string required for async connections"); + goto err; + } } else { - pgsql = PQsetdb(host,port,options,tty,dbname); - } - if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) { - PHP_PQ_ERROR("Unable to connect to PostgreSQL server: %s", pgsql); - if (pgsql) { - PQfinish(pgsql); + if (connstring) { + pgsql = PQconnectdb(connstring); + } else { + pgsql = PQsetdb(host,port,options,tty,dbname); + } + if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) { + PHP_PQ_ERROR("Unable to connect to PostgreSQL server: %s", pgsql); + if (pgsql) { + PQfinish(pgsql); + } + goto err; } - goto err; } /* add it to the list */ @@ -1463,6 +1514,31 @@ PHP_FUNCTION(pg_connect) } /* }}} */ +/* {{{ proto resource pg_connect_poll(resource connection) + Poll the status of an in-progress async PostgreSQL connection attempt*/ +PHP_FUNCTION(pg_connect_poll) +{ + zval *pgsql_link; + int id = -1; + PGconn *pgsql; + int ret; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_link) == FAILURE) { + return; + } + + if (pgsql_link == NULL && id == -1) { + RETURN_FALSE; + } + + ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); + + ret = PQconnectPoll(pgsql); + + RETURN_LONG(ret); +} +/* }}} */ + /* {{{ proto resource pg_pconnect(string connection_string | [string host, string port [, string options [, string tty,]]] string database) Open a persistent PostgreSQL connection */ PHP_FUNCTION(pg_pconnect) @@ -2717,33 +2793,22 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, fci.symbol_table = NULL; fci.object_ptr = return_value; fci.retval_ptr_ptr = &retval_ptr; + fci.params = NULL; + fci.param_count = 0; + fci.no_separation = 1; + if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) { - if (Z_TYPE_P(ctor_params) == IS_ARRAY) { - HashTable *ht = Z_ARRVAL_P(ctor_params); - Bucket *p; - - fci.param_count = 0; - fci.params = safe_emalloc(sizeof(zval***), ht->nNumOfElements, 0); - p = ht->pListHead; - while (p != NULL) { - fci.params[fci.param_count++] = (zval**)p->pData; - p = p->pListNext; - } - } else { + if (zend_fcall_info_args(&fci, ctor_params TSRMLS_CC) == FAILURE) { /* Two problems why we throw exceptions here: PHP is typeless * and hence passing one argument that's not an array could be - * by mistake and the other way round is possible, too. The + * by mistake and the other way round is possible, too. The * single value is an array. Also we'd have to make that one * argument passed by reference. */ zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Parameter ctor_params must be an array", 0 TSRMLS_CC); return; } - } else { - fci.param_count = 0; - fci.params = NULL; } - fci.no_separation = 1; fcc.initialized = 1; fcc.function_handler = ce->constructor; @@ -4724,6 +4789,16 @@ PHP_FUNCTION(pg_connection_busy) } /* }}} */ +static int _php_pgsql_link_has_results(PGconn *pgsql) +{ + PGresult *result; + while ((result = PQgetResult(pgsql))) { + PQclear(result); + return 1; + } + return 0; +} + /* {{{ proto bool pg_send_query(resource connection, string query) Send asynchronous query */ PHP_FUNCTION(pg_send_query) @@ -4733,48 +4808,63 @@ PHP_FUNCTION(pg_send_query) int len; int id = -1; PGconn *pgsql; - PGresult *res; - int leftover = 0; + int is_non_blocking; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", - &pgsql_link, &query, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pgsql_link, &query, &len) == FAILURE) { return; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); - if (PQ_SETNONBLOCKING(pgsql, 1)) { + is_non_blocking = PQisnonblocking(pgsql); + + if (is_non_blocking == 0 && PQ_SETNONBLOCKING(pgsql, 1) == -1) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode"); RETURN_FALSE; } - while ((res = PQgetResult(pgsql))) { - PQclear(res); - leftover = 1; - } - if (leftover) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "There are results on this connection. Call pg_get_result() until it returns FALSE"); + + if (_php_pgsql_link_has_results(pgsql)) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, + "There are results on this connection. Call pg_get_result() until it returns FALSE"); } - if (!PQsendQuery(pgsql, query)) { - if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) { - PQreset(pgsql); - } + + if (is_non_blocking) { if (!PQsendQuery(pgsql, query)) { RETURN_FALSE; } - } - /* Wait to finish sending buffer */ - while ((ret = PQflush(pgsql))) { - if (ret == -1) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty PostgreSQL send buffer"); - break; + ret = PQflush(pgsql); + } else { + if (!PQsendQuery(pgsql, query)) { + if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) { + PQreset(pgsql); + } + if (!PQsendQuery(pgsql, query)) { + RETURN_FALSE; + } + } + + /* Wait to finish sending buffer */ + while ((ret = PQflush(pgsql))) { + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty PostgreSQL send buffer"); + break; + } + usleep(10000); + } + + if (PQ_SETNONBLOCKING(pgsql, 0)) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode"); } - usleep(10000); } - if (PQ_SETNONBLOCKING(pgsql, 0)) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode"); + + if (ret == 0) { + RETURN_TRUE; + } else if (ret == -1) { + RETURN_FALSE; + } else { + RETURN_LONG(0); } - RETURN_TRUE; } /* }}} */ @@ -4789,8 +4879,7 @@ PHP_FUNCTION(pg_send_query_params) char *query; int query_len, id = -1; PGconn *pgsql; - PGresult *res; - int leftover = 0; + int is_non_blocking; int ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsa/", &pgsql_link, &query, &query_len, &pv_param_arr) == FAILURE) { @@ -4803,16 +4892,16 @@ PHP_FUNCTION(pg_send_query_params) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); - if (PQ_SETNONBLOCKING(pgsql, 1)) { + is_non_blocking = PQisnonblocking(pgsql); + + if (is_non_blocking == 0 && PQ_SETNONBLOCKING(pgsql, 1) == -1) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode"); RETURN_FALSE; } - while ((res = PQgetResult(pgsql))) { - PQclear(res); - leftover = 1; - } - if (leftover) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "There are results on this connection. Call pg_get_result() until it returns FALSE"); + + if (_php_pgsql_link_has_results(pgsql)) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, + "There are results on this connection. Call pg_get_result() until it returns FALSE"); } zend_hash_internal_pointer_reset(Z_ARRVAL_P(pv_param_arr)); @@ -4848,7 +4937,12 @@ PHP_FUNCTION(pg_send_query_params) } } - if (!PQsendQueryParams(pgsql, query, num_params, NULL, (const char * const *)params, NULL, NULL, 0)) { + if (PQsendQueryParams(pgsql, query, num_params, NULL, (const char * const *)params, NULL, NULL, 0)) { + _php_pgsql_free_params(params, num_params); + } else if (is_non_blocking) { + _php_pgsql_free_params(params, num_params); + RETURN_FALSE; + } else { if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) { PQreset(pgsql); } @@ -4857,19 +4951,31 @@ PHP_FUNCTION(pg_send_query_params) RETURN_FALSE; } } - _php_pgsql_free_params(params, num_params); - /* Wait to finish sending buffer */ - while ((ret = PQflush(pgsql))) { - if (ret == -1) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty PostgreSQL send buffer"); - break; + + if (is_non_blocking) { + ret = PQflush(pgsql); + } else { + /* Wait to finish sending buffer */ + while ((ret = PQflush(pgsql))) { + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty PostgreSQL send buffer"); + break; + } + usleep(10000); + } + + if (PQ_SETNONBLOCKING(pgsql, 0) != 0) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode"); } - usleep(10000); } - if (PQ_SETNONBLOCKING(pgsql, 0)) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode"); + + if (ret == 0) { + RETURN_TRUE; + } else if (ret == -1) { + RETURN_FALSE; + } else { + RETURN_LONG(0); } - RETURN_TRUE; } /* }}} */ #endif @@ -4883,8 +4989,7 @@ PHP_FUNCTION(pg_send_prepare) char *query, *stmtname; int stmtname_len, query_len, id = -1; PGconn *pgsql; - PGresult *res; - int leftover = 0; + int is_non_blocking; int ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &pgsql_link, &stmtname, &stmtname_len, &query, &query_len) == FAILURE) { @@ -4897,37 +5002,54 @@ PHP_FUNCTION(pg_send_prepare) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); - if (PQ_SETNONBLOCKING(pgsql, 1)) { + is_non_blocking = PQisnonblocking(pgsql); + + if (is_non_blocking == 0 && PQ_SETNONBLOCKING(pgsql, 1) == -1) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode"); RETURN_FALSE; } - while ((res = PQgetResult(pgsql))) { - PQclear(res); - leftover = 1; - } - if (leftover) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "There are results on this connection. Call pg_get_result() until it returns FALSE"); + + if (_php_pgsql_link_has_results(pgsql)) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, + "There are results on this connection. Call pg_get_result() until it returns FALSE"); } + if (!PQsendPrepare(pgsql, stmtname, query, 0, NULL)) { - if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) { - PQreset(pgsql); - } - if (!PQsendPrepare(pgsql, stmtname, query, 0, NULL)) { + if (is_non_blocking) { RETURN_FALSE; + } else { + if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) { + PQreset(pgsql); + } + if (!PQsendPrepare(pgsql, stmtname, query, 0, NULL)) { + RETURN_FALSE; + } } } - /* Wait to finish sending buffer */ - while ((ret = PQflush(pgsql))) { - if (ret == -1) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty postgres send buffer"); - break; + + if (is_non_blocking) { + ret = PQflush(pgsql); + } else { + /* Wait to finish sending buffer */ + while ((ret = PQflush(pgsql))) { + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty PostgreSQL send buffer"); + break; + } + usleep(10000); + } + if (PQ_SETNONBLOCKING(pgsql, 0) != 0) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode"); } - usleep(10000); } - if (PQ_SETNONBLOCKING(pgsql, 0)) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode"); + + if (ret == 0) { + RETURN_TRUE; + } else if (ret == -1) { + RETURN_FALSE; + } else { + RETURN_LONG(0); } - RETURN_TRUE; } /* }}} */ #endif @@ -4944,8 +5066,7 @@ PHP_FUNCTION(pg_send_execute) char *stmtname; int stmtname_len, id = -1; PGconn *pgsql; - PGresult *res; - int leftover = 0; + int is_non_blocking; int ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsa", &pgsql_link, &stmtname, &stmtname_len, &pv_param_arr) == FAILURE) { @@ -4958,16 +5079,16 @@ PHP_FUNCTION(pg_send_execute) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); - if (PQ_SETNONBLOCKING(pgsql, 1)) { + is_non_blocking = PQisnonblocking(pgsql); + + if (is_non_blocking == 0 && PQ_SETNONBLOCKING(pgsql, 1) == -1) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode"); RETURN_FALSE; } - while ((res = PQgetResult(pgsql))) { - PQclear(res); - leftover = 1; - } - if (leftover) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "There are results on this connection. Call pg_get_result() until it returns FALSE"); + + if (_php_pgsql_link_has_results(pgsql)) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, + "There are results on this connection. Call pg_get_result() until it returns FALSE"); } zend_hash_internal_pointer_reset(Z_ARRVAL_P(pv_param_arr)); @@ -4975,8 +5096,8 @@ PHP_FUNCTION(pg_send_execute) if (num_params > 0) { int i = 0; params = (char **)safe_emalloc(sizeof(char *), num_params, 0); - - for(i = 0; i < num_params; i++) { + + for (i = 0; i < num_params; i++) { if (zend_hash_get_current_data(Z_ARRVAL_P(pv_param_arr), (void **) &tmp) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error getting parameter"); _php_pgsql_free_params(params, num_params); @@ -5003,7 +5124,12 @@ PHP_FUNCTION(pg_send_execute) } } - if (!PQsendQueryPrepared(pgsql, stmtname, num_params, (const char * const *)params, NULL, NULL, 0)) { + if (PQsendQueryPrepared(pgsql, stmtname, num_params, (const char * const *)params, NULL, NULL, 0)) { + _php_pgsql_free_params(params, num_params); + } else if (is_non_blocking) { + _php_pgsql_free_params(params, num_params); + RETURN_FALSE; + } else { if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) { PQreset(pgsql); } @@ -5012,19 +5138,30 @@ PHP_FUNCTION(pg_send_execute) RETURN_FALSE; } } - _php_pgsql_free_params(params, num_params); - /* Wait to finish sending buffer */ - while ((ret = PQflush(pgsql))) { - if (ret == -1) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty postgres send buffer"); - break; + + if (is_non_blocking) { + ret = PQflush(pgsql); + } else { + /* Wait to finish sending buffer */ + while ((ret = PQflush(pgsql))) { + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty PostgreSQL send buffer"); + break; + } + usleep(10000); + } + if (PQ_SETNONBLOCKING(pgsql, 0) != 0) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode"); } - usleep(10000); } - if (PQ_SETNONBLOCKING(pgsql, 0)) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode"); + + if (ret == 0) { + RETURN_TRUE; + } else if (ret == -1) { + RETURN_FALSE; + } else { + RETURN_LONG(0); } - RETURN_TRUE; } /* }}} */ #endif @@ -5169,6 +5306,141 @@ PHP_FUNCTION(pg_get_pid) } /* }}} */ +static size_t php_pgsql_fd_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) +{ + return 0; +} + +static size_t php_pgsql_fd_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) +{ + return 0; +} + +static int php_pgsql_fd_close(php_stream *stream, int close_handle TSRMLS_DC) +{ + return EOF; +} + +static int php_pgsql_fd_flush(php_stream *stream TSRMLS_DC) +{ + return FAILURE; +} + +static int php_pgsql_fd_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) +{ + PGconn *pgsql = (PGconn *) stream->abstract; + switch (option) { + case PHP_STREAM_OPTION_BLOCKING: + return PQ_SETNONBLOCKING(pgsql, value); + default: + return FAILURE; + } +} + +static int php_pgsql_fd_cast(php_stream *stream, int cast_as, void **ret TSRMLS_DC) +{ + PGconn *pgsql = (PGconn *) stream->abstract; + int fd_number; + + switch (cast_as) { + case PHP_STREAM_AS_FD_FOR_SELECT: + case PHP_STREAM_AS_FD: + case PHP_STREAM_AS_SOCKETD: + if (ret) { + fd_number = PQsocket(pgsql); + if (fd_number == -1) { + return FAILURE; + } + + *(php_socket_t *)ret = fd_number; + return SUCCESS; + } + default: + return FAILURE; + } +} + +/* {{{ proto resource pg_socket(resource) + Get a read-only handle to the socket underlying the pgsql connection */ +PHP_FUNCTION(pg_socket) +{ + zval *pgsql_link; + php_stream *stream; + PGconn *pgsql; + int id = -1; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_link) == FAILURE) { + return; + } + + ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); + + stream = php_stream_alloc(&php_stream_pgsql_fd_ops, pgsql, NULL, "r"); + + if (stream) { + php_stream_to_zval(stream, return_value); + return; + } + + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto bool pg_consume_input(resource) + Reads input on the connection */ +PHP_FUNCTION(pg_consume_input) +{ + zval *pgsql_link; + int id = -1; + PGconn *pgsql; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_link) == FAILURE) { + return; + } + + ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); + + RETURN_BOOL(PQconsumeInput(pgsql)); +} +/* }}} */ + +/* {{{ proto mixed pg_flush(resource) + Flush outbound query data on the connection */ +PHP_FUNCTION(pg_flush) +{ + zval *pgsql_link; + int id = -1; + PGconn *pgsql; + int ret; + int is_non_blocking; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_link) == FAILURE) { + return; + } + + ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); + + is_non_blocking = PQisnonblocking(pgsql); + + if (is_non_blocking == 0 && PQ_SETNONBLOCKING(pgsql, 1) == -1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode"); + RETURN_FALSE; + } + + ret = PQflush(pgsql); + + if (is_non_blocking == 0 && PQ_SETNONBLOCKING(pgsql, 0) == -1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Failed resetting connection to blocking mode"); + } + + switch (ret) { + case 0: RETURN_TRUE; break; + case 1: RETURN_LONG(0); break; + default: RETURN_FALSE; + } +} +/* }}} */ + /* {{{ php_pgsql_meta_data * TODO: Add meta_data cache for better performance */ diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h index b6caf9d201..62f20dad57 100644 --- a/ext/pgsql/php_pgsql.h +++ b/ext/pgsql/php_pgsql.h @@ -67,6 +67,7 @@ PHP_MINFO_FUNCTION(pgsql); /* connection functions */ PHP_FUNCTION(pg_connect); PHP_FUNCTION(pg_pconnect); +PHP_FUNCTION(pg_connect_poll); PHP_FUNCTION(pg_close); PHP_FUNCTION(pg_connection_reset); PHP_FUNCTION(pg_connection_status); @@ -134,6 +135,9 @@ PHP_FUNCTION(pg_field_is_null); PHP_FUNCTION(pg_field_table); /* async message functions */ PHP_FUNCTION(pg_get_notify); +PHP_FUNCTION(pg_socket); +PHP_FUNCTION(pg_consume_input); +PHP_FUNCTION(pg_flush); PHP_FUNCTION(pg_get_pid); /* error message functions */ PHP_FUNCTION(pg_result_error); @@ -191,6 +195,7 @@ PHP_FUNCTION(pg_select); /* connection options - ToDo: Add async connection option */ #define PGSQL_CONNECT_FORCE_NEW (1<<1) +#define PGSQL_CONNECT_ASYNC (1<<2) /* php_pgsql_convert options */ #define PGSQL_CONV_IGNORE_DEFAULT (1<<1) /* Do not use DEAFULT value by removing field from returned array */ #define PGSQL_CONV_FORCE_NULL (1<<2) /* Convert to NULL if string is null string */ @@ -222,6 +227,13 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type); static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS,int entry_type); +static size_t php_pgsql_fd_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC); +static size_t php_pgsql_fd_read(php_stream *stream, char *buf, size_t count TSRMLS_DC); +static int php_pgsql_fd_close(php_stream *stream, int close_handle TSRMLS_DC); +static int php_pgsql_fd_flush(php_stream *stream TSRMLS_DC); +static int php_pgsql_fd_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC); +static int php_pgsql_fd_cast(php_stream *stream, int cast_as, void **ret TSRMLS_DC); + typedef enum _php_pgsql_data_type { /* boolean */ PG_BOOL, @@ -284,6 +296,18 @@ typedef struct _php_pgsql_notice { size_t len; } php_pgsql_notice; +static php_stream_ops php_stream_pgsql_fd_ops = { + php_pgsql_fd_write, + php_pgsql_fd_read, + php_pgsql_fd_close, + php_pgsql_fd_flush, + "PostgreSQL link", + NULL, /* seek */ + php_pgsql_fd_cast, /* cast */ + NULL, /* stat */ + php_pgsql_fd_set_option +}; + ZEND_BEGIN_MODULE_GLOBALS(pgsql) long default_link; /* default link when connection is omitted */ long num_links,num_persistent; diff --git a/ext/pgsql/tests/29nb_async_connect.phpt b/ext/pgsql/tests/29nb_async_connect.phpt new file mode 100755 index 0000000000..fc3868a26d --- /dev/null +++ b/ext/pgsql/tests/29nb_async_connect.phpt @@ -0,0 +1,44 @@ +--TEST-- +PostgreSQL non-blocking async connect +--SKIPIF-- +<?php +include("skipif.inc"); +?> +--FILE-- +<?php + +include('config.inc'); +include('nonblocking.inc'); + +if (!$db = pg_connect($conn_str, PGSQL_CONNECT_ASYNC)) { + die("pg_connect() error"); +} elseif (pg_connection_status($db) === PGSQL_CONNECTION_BAD) { + die("pg_connect() error"); +} elseif ($db_socket = pg_socket($db)) { + stream_set_blocking($db_socket, FALSE); +} else { + die("pg_socket() error"); +} + +while (TRUE) { + switch ($status = pg_connect_poll($db)) { + case PGSQL_POLLING_READING: + if (nb_is_readable($db_socket)) { break 2; } + break; + case PGSQL_POLLING_WRITING: + if (nb_is_writable($db_socket)) { break 2; } + break; + case PGSQL_POLLING_FAILED: + die("async connection failed"); + case PGSQL_POLLING_OK: + break 2; + } +} +assert(pg_connection_status($db) === PGSQL_CONNECTION_MADE); +echo "OK"; + +pg_close($db); + +?> +--EXPECT-- +OK diff --git a/ext/pgsql/tests/30nb_async_query_params.phpt b/ext/pgsql/tests/30nb_async_query_params.phpt new file mode 100755 index 0000000000..a88769b038 --- /dev/null +++ b/ext/pgsql/tests/30nb_async_query_params.phpt @@ -0,0 +1,78 @@ +--TEST--
+PostgreSQL non-blocking async query params
+--SKIPIF--
+<?php
+include("skipif.inc");
+if (!function_exists('pg_send_query_params')) die('skip function pg_send_query_params() does not exist');
+?>
+--FILE--
+<?php
+
+include('config.inc');
+include('nonblocking.inc');
+
+$db = pg_connect($conn_str);
+
+$version = pg_version($db);
+if ($version['protocol'] < 3) {
+ echo "OK";
+ exit(0);
+}
+
+$db_socket = pg_socket($db);
+stream_set_blocking($db_socket, false);
+
+$sent = pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
+if ($sent === FALSE) {
+ echo "pg_send_query_params() error\n";
+} elseif ($sent === 0) {
+ nb_flush($db, $db_socket);
+}
+
+nb_consume($db, $db_socket);
+
+if (!($result = pg_get_result($db))) {
+ echo "pg_get_result() error\n";
+}
+if (!($rows = pg_num_rows($result))) {
+ echo "pg_num_rows() error\n";
+}
+for ($i=0; $i < $rows; $i++) {
+ pg_fetch_array($result, $i, PGSQL_NUM);
+}
+for ($i=0; $i < $rows; $i++) {
+ pg_fetch_object($result);
+}
+for ($i=0; $i < $rows; $i++) {
+ pg_fetch_row($result, $i);
+}
+for ($i=0; $i < $rows; $i++) {
+ pg_fetch_result($result, $i, 0);
+}
+
+pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+pg_field_name($result, 0);
+pg_field_num($result, $field_name);
+pg_field_size($result, 0);
+pg_field_type($result, 0);
+pg_field_prtlen($result, 0);
+pg_field_is_null($result, 0);
+
+$sent = pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
+
+if ($sent === FALSE) {
+ echo "pg_send_query_params() error\n";
+} elseif ($sent === 0) {
+ nb_flush($db, $db_socket);
+}
+
+pg_last_oid($result);
+pg_free_result($result);
+
+pg_close($db);
+
+echo "OK";
+?>
+--EXPECT--
+OK
diff --git a/ext/pgsql/tests/31nb_async_query_prepared.phpt b/ext/pgsql/tests/31nb_async_query_prepared.phpt new file mode 100755 index 0000000000..d82ae798e8 --- /dev/null +++ b/ext/pgsql/tests/31nb_async_query_prepared.phpt @@ -0,0 +1,112 @@ +--TEST-- +PostgreSQL non-blocking async prepared queries +--SKIPIF-- +<?php +include("skipif.inc"); +if (!function_exists('pg_send_prepare')) die('skip function pg_send_prepare() does not exist'); +?> +--FILE-- +<?php + +include('config.inc'); +include('nonblocking.inc'); + +$db = pg_connect($conn_str); + +$version = pg_version($db); +if ($version['protocol'] < 3) { + echo "OK"; + exit(0); +} + +$db_socket = pg_socket($db); +stream_set_blocking($db_socket, false); + +$nb_send = pg_send_prepare($db, 'php_test', "SELECT * FROM ".$table_name." WHERE num > \$1;"); +if ($nb_send === FALSE) { + echo "pg_send_prepare() error\n"; +} elseif ($nb_send === 0) { + nb_flush($db, $db_socket); +} + +nb_consume($db, $db_socket); + +if (!($result = pg_get_result($db))) { + echo "pg_get_result() error\n"; +} +pg_free_result($result); + +$nb_send = pg_send_execute($db, 'php_test', array(100)); +if ($nb_send === FALSE) { + echo "pg_send_execute() error\n"; +} elseif ($nb_send === 0) { + nb_flush($db, $db_socket); +} + +nb_consume($db, $db_socket); + +if (!($result = pg_get_result($db))) { + echo "pg_get_result() error\n"; +} + +if (!($rows = pg_num_rows($result))) { + echo "pg_num_rows() error\n"; +} +for ($i=0; $i < $rows; $i++) { + pg_fetch_array($result, $i, PGSQL_NUM); +} +for ($i=0; $i < $rows; $i++) { + pg_fetch_object($result); +} +for ($i=0; $i < $rows; $i++) { + pg_fetch_row($result, $i); +} +for ($i=0; $i < $rows; $i++) { + pg_fetch_result($result, $i, 0); +} + +pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); +pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); +pg_field_name($result, 0); +pg_field_num($result, $field_name); +pg_field_size($result, 0); +pg_field_type($result, 0); +pg_field_prtlen($result, 0); +pg_field_is_null($result, 0); + +$nb_send = pg_send_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);"); +if ($nb_send === FALSE) { + echo "pg_send_prepare() error\n"; +} elseif ($nb_send === 0) { + nb_flush($db, $db_socket); +} + +nb_consume($db, $db_socket); + +if (!($result = pg_get_result($db))) { + echo "pg_get_result() error\n"; +} +pg_free_result($result); + +$nb_send = pg_send_execute($db, "php_test2", array(9999, "A'BC")); +if ($nb_send === FALSE) { + echo "pg_send_execute() error\n"; +} elseif ($nb_send === 0) { + nb_flush($db, $db_socket); +} + +nb_consume($db, $db_socket); + +if (!($result = pg_get_result($db))) { + echo "pg_get_result() error\n"; +} + +pg_last_oid($result); +pg_free_result($result); +pg_close($db); + +echo "OK"; +?> +--EXPECT-- +OK + diff --git a/ext/pgsql/tests/32nb_async_query.phpt b/ext/pgsql/tests/32nb_async_query.phpt new file mode 100644 index 0000000000..7858a60eea --- /dev/null +++ b/ext/pgsql/tests/32nb_async_query.phpt @@ -0,0 +1,84 @@ +--TEST-- +PostgreSQL non-blocking async queries +--SKIPIF-- +<?php +include("skipif.inc"); +if (!function_exists('pg_send_prepare')) die('skip function pg_send_prepare() does not exist'); +?> +--FILE-- +<?php + +include('config.inc'); +include('nonblocking.inc'); + +$db = pg_connect($conn_str); + +$version = pg_version($db); +if ($version['protocol'] < 3) { + echo "OK"; + exit(0); +} + +$db_socket = pg_socket($db); +stream_set_blocking($db_socket, false); + +$nb_send = pg_send_query($db, "SELECT * FROM ".$table_name.";"); +if ($nb_send === FALSE) { + echo "pg_send_query() error\n"; +} elseif ($nb_send === 0) { + nb_flush($db, $db_socket); +} + +nb_consume($db, $db_socket); + +if (!($result = pg_get_result($db))) { + echo "pg_get_result() error\n"; +} + +if (!($rows = pg_num_rows($result))) { + echo "pg_num_rows() error\n"; +} +for ($i=0; $i < $rows; $i++) { + pg_fetch_array($result, $i, PGSQL_NUM); +} +for ($i=0; $i < $rows; $i++) { + pg_fetch_object($result); +} +for ($i=0; $i < $rows; $i++) { + pg_fetch_row($result, $i); +} +for ($i=0; $i < $rows; $i++) { + pg_fetch_result($result, $i, 0); +} + +pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";")); +pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";")); +pg_field_name($result, 0); +pg_field_num($result, $field_name); +pg_field_size($result, 0); +pg_field_type($result, 0); +pg_field_prtlen($result, 0); +pg_field_is_null($result, 0); + +$nb_send = pg_send_query($db, "INSERT INTO ".$table_name." VALUES (8888, 'GGG');"); +if ($nb_send === FALSE) { + echo "pg_send_query() error\n"; +} elseif ($nb_send === 0) { + nb_flush($db, $db_socket); +} + +nb_consume($db, $db_socket); + +if (!($result = pg_get_result($db))) { + echo "pg_get_result() error\n"; +} + +pg_last_oid($result); +pg_free_result($result); +pg_close($db); + +echo "OK"; +?> +--EXPECT-- +OK + diff --git a/ext/pgsql/tests/nonblocking.inc b/ext/pgsql/tests/nonblocking.inc new file mode 100644 index 0000000000..4cf7c09a51 --- /dev/null +++ b/ext/pgsql/tests/nonblocking.inc @@ -0,0 +1,38 @@ +<?php + +function nb_is_readable($stream, $timeout = 1) { + $r = [$stream]; $w = []; $e = []; + return (bool) stream_select($r, $w, $e, $timeout, 0); +}; +function nb_is_writable($stream, $timeout = 1) { + $r = []; $w = [$stream]; $e = []; + return (bool) stream_select($r, $w, $e, $timeout, 0); +}; +function nb_flush($db, $db_socket) { + while (TRUE) { + if (! nb_is_writable($db_socket)) { + continue; + } + $flush = pg_flush($db); + if ($flush === TRUE) { + break; // All data flushed + } elseif ($flush === FALSE) { + echo "pg_flush() error\n"; + break; + } + } +}; +function nb_consume($db, $db_socket) { + while (TRUE) { + if (!nb_is_readable($db_socket)) { + continue; + } elseif (!pg_consume_input($db)) { + echo "pg_consume_input() error\n"; + break; + } elseif (!pg_connection_busy($db)) { + break; // All data consumed + } + + } +}; + diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 363ea1fc44..f84e1e014d 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1129,7 +1129,7 @@ static HashTable * sxe_get_prop_hash(zval *object, int is_debug TSRMLS_DC) /* {{ node = NULL; } else if (sxe->iter.type != SXE_ITER_CHILD) { - if ( !node->children || !node->parent || node->children->next || node->children->children || node->parent->children == node->parent->last ) { + if ( !node->children || !node->parent || !node->next || node->children->next || node->children->children || node->parent->children == node->parent->last ) { node = node->children; } else { iter_data = sxe->iter.data; diff --git a/ext/simplexml/tests/bug66084_0.phpt b/ext/simplexml/tests/bug66084_0.phpt new file mode 100644 index 0000000000..35f4daf876 --- /dev/null +++ b/ext/simplexml/tests/bug66084_0.phpt @@ -0,0 +1,68 @@ +--TEST-- +Bug #66084 simplexml_load_string() mangles empty node name, var_dump variant +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip simplexml not available"; ?> +--FILE-- +<?php +echo var_dump(simplexml_load_string('<a><b/><c><x/></c></a>')), "\n"; +echo var_dump(simplexml_load_string('<a><b/><d/><c><x/></c></a>')), "\n"; +echo var_dump(simplexml_load_string('<a><b/><c><d/><x/></c></a>')), "\n"; +echo var_dump(simplexml_load_string('<a><b/><c><d><x/></d></c></a>')), "\n"; +?> +--EXPECT-- +object(SimpleXMLElement)#1 (2) { + ["b"]=> + object(SimpleXMLElement)#2 (0) { + } + ["c"]=> + object(SimpleXMLElement)#3 (1) { + ["x"]=> + object(SimpleXMLElement)#4 (0) { + } + } +} + +object(SimpleXMLElement)#1 (3) { + ["b"]=> + object(SimpleXMLElement)#3 (0) { + } + ["d"]=> + object(SimpleXMLElement)#2 (0) { + } + ["c"]=> + object(SimpleXMLElement)#4 (1) { + ["x"]=> + object(SimpleXMLElement)#5 (0) { + } + } +} + +object(SimpleXMLElement)#1 (2) { + ["b"]=> + object(SimpleXMLElement)#4 (0) { + } + ["c"]=> + object(SimpleXMLElement)#2 (2) { + ["d"]=> + object(SimpleXMLElement)#3 (0) { + } + ["x"]=> + object(SimpleXMLElement)#5 (0) { + } + } +} + +object(SimpleXMLElement)#1 (2) { + ["b"]=> + object(SimpleXMLElement)#2 (0) { + } + ["c"]=> + object(SimpleXMLElement)#4 (1) { + ["d"]=> + object(SimpleXMLElement)#5 (1) { + ["x"]=> + object(SimpleXMLElement)#3 (0) { + } + } + } +} diff --git a/ext/simplexml/tests/bug66084_1.phpt b/ext/simplexml/tests/bug66084_1.phpt new file mode 100644 index 0000000000..80e91df7c6 --- /dev/null +++ b/ext/simplexml/tests/bug66084_1.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #66084 simplexml_load_string() mangles empty node name, json variant +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip simplexml not available"; ?> +<?php if (!extension_loaded("json")) print "skip json not available"; ?> +--FILE-- +<?php +echo json_encode(simplexml_load_string('<a><b/><c><x/></c></a>')), "\n"; +echo json_encode(simplexml_load_string('<a><b/><d/><c><x/></c></a>')), "\n"; +echo json_encode(simplexml_load_string('<a><b/><c><d/><x/></c></a>')), "\n"; +echo json_encode(simplexml_load_string('<a><b/><c><d><x/></d></c></a>')), "\n"; +?> +--EXPECT-- +{"b":{},"c":{"x":{}}} +{"b":{},"d":{},"c":{"x":{}}} +{"b":{},"c":{"d":{},"x":{}}} +{"b":{},"c":{"d":{"x":{}}}} diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index f41d0fb9cd..0611cfe38f 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -593,64 +593,80 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); long index; - zval *rv, **tmp; + zval *rv, *value = NULL, **tmp; if (check_inherited && intern->fptr_offset_has) { - SEPARATE_ARG_IF_REF(offset); - zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_has, "offsetExists", &rv, offset); - zval_ptr_dtor(&offset); + zval *offset_tmp = offset; + SEPARATE_ARG_IF_REF(offset_tmp); + zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_has, "offsetExists", &rv, offset_tmp); + zval_ptr_dtor(&offset_tmp); + if (rv && zend_is_true(rv)) { zval_ptr_dtor(&rv); - return 1; - } - if (rv) { - zval_ptr_dtor(&rv); + if (check_empty == 2) { + return 1; + } else if (intern->fptr_offset_get) { + value = spl_array_read_dimension_ex(1, object, offset, BP_VAR_R TSRMLS_CC); + } + } else { + if (rv) { + zval_ptr_dtor(&rv); + } + return 0; } - return 0; } - switch(Z_TYPE_P(offset)) { - case IS_STRING: - { - HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); + if (!value) { + HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); + + switch(Z_TYPE_P(offset)) { + case IS_STRING: if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &tmp) != FAILURE) { - switch (check_empty) { - case 0: - return Z_TYPE_PP(tmp) != IS_NULL; - case 2: - return 1; - default: - return zend_is_true(*tmp); + if (check_empty == 2) { + return 1; } + } else { + return 0; } - } - return 0; - case IS_DOUBLE: - case IS_RESOURCE: - case IS_BOOL: - case IS_LONG: - { - HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); + break; + case IS_DOUBLE: + case IS_RESOURCE: + case IS_BOOL: + case IS_LONG: if (offset->type == IS_DOUBLE) { index = (long)Z_DVAL_P(offset); } else { index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **)&tmp) != FAILURE) { - switch (check_empty) { - case 0: - return Z_TYPE_PP(tmp) != IS_NULL; - case 2: - return 1; - default: - return zend_is_true(*tmp); + if (check_empty == 2) { + return 1; } + } else { + return 0; } + break; + default: + zend_error(E_WARNING, "Illegal offset type"); return 0; - } - default: - zend_error(E_WARNING, "Illegal offset type"); + } + + if (check_inherited && intern->fptr_offset_get) { + value = spl_array_read_dimension_ex(1, object, offset, BP_VAR_R TSRMLS_CC); + } else { + value = *tmp; + } + } + + switch (check_empty) { + case 0: + return Z_TYPE_P(value) != IS_NULL; + case 2: + return 1; + case 1: + return zend_is_true(value); } + return 0; } /* }}} */ diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index a89fd548c5..679fc85af1 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -2055,7 +2055,7 @@ SPL_METHOD(RegexIterator, accept) } if (intern->u.regex.flags & REGIT_INVERTED) { - RETVAL_BOOL(Z_LVAL_P(return_value)); + RETVAL_BOOL(! Z_LVAL_P(return_value)); } if (use_copy) { @@ -3692,6 +3692,7 @@ PHP_MINIT_FUNCTION(spl_iterators) #if HAVE_PCRE || HAVE_BUNDLED_PCRE REGISTER_SPL_SUB_CLASS_EX(RegexIterator, FilterIterator, spl_dual_it_new, spl_funcs_RegexIterator); REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "USE_KEY", REGIT_USE_KEY); + REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "INVERT_MATCH",REGIT_INVERTED); REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "MATCH", REGIT_MODE_MATCH); REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "GET_MATCH", REGIT_MODE_GET_MATCH); REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "ALL_MATCHES", REGIT_MODE_ALL_MATCHES); diff --git a/ext/spl/tests/bug66702.phpt b/ext/spl/tests/bug66702.phpt new file mode 100644 index 0000000000..fedfc869a8 --- /dev/null +++ b/ext/spl/tests/bug66702.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #66702 (RegexIterator inverted result works as expected) +--FILE-- +<?php +/** + * @author Joshua Thijssen <jthijssen+php@noxlogic.nl> + */ + +$it = new \ArrayIterator(array("foo", "bar", "baz")); +$it2 = new \RegexIterator($it, "/^ba/", \RegexIterator::MATCH); +print_r(iterator_to_array($it2)); +$it2 = new \RegexIterator($it, "/^ba/", \RegexIterator::MATCH, \RegexIterator::INVERT_MATCH); +print_r(iterator_to_array($it2)); + +$it = new \ArrayIterator(array("foo" => 1, "bar" => 2, "baz" => 3)); +$it2 = new \RegexIterator($it, "/^ba/", \RegexIterator::MATCH, \RegexIterator::USE_KEY); +print_r(iterator_to_array($it2)); +$it2 = new \RegexIterator($it, "/^ba/", \RegexIterator::MATCH, \RegexIterator::USE_KEY | \RegexIterator::INVERT_MATCH); +print_r(iterator_to_array($it2)); + +--EXPECTF-- +Array +( + [1] => bar + [2] => baz +) +Array +( + [0] => foo +) +Array +( + [bar] => 2 + [baz] => 3 +) +Array +( + [foo] => 1 +) + diff --git a/ext/spl/tests/bug66834.phpt b/ext/spl/tests/bug66834.phpt new file mode 100644 index 0000000000..6d944b274a --- /dev/null +++ b/ext/spl/tests/bug66834.phpt @@ -0,0 +1,163 @@ +--TEST-- +SPL: Bug #66834 +--FILE-- +<?php + +// overrides both offsetExists and offsetGet +class ArrayObjectBoth extends ArrayObject +{ + public function offsetExists($offset) { + var_dump('Called: '.__METHOD__); + return parent::offsetExists($offset); + } + + public function offsetGet($offset) { + var_dump('Called: '.__METHOD__); + return parent::offsetGet($offset); + } +} + +// overrides only offsetExists +class ArrayObjectExists extends ArrayObject +{ + public function offsetExists($offset) { + var_dump('Called: '.__METHOD__); + return parent::offsetExists($offset); + } +} + +// overrides only offsetGet +class ArrayObjectGet extends ArrayObject +{ + public function offsetGet($offset) { + var_dump('Called: '.__METHOD__); + return parent::offsetGet($offset); + } +} + +// overrides only offsetGet and offsetSet +class ArrayObjectGetSet extends ArrayObject +{ + public function offsetGet($offset) + { + return parent::offsetGet(str_rot13($offset)); + } + + public function offsetSet($offset, $value) + { + return parent::offsetSet(str_rot13($offset), $value); + } +} + +$values = ['foo' => '', 'bar' => null, 'baz' => 42]; + +echo "==== class with offsetExists() and offsetGet() ====\n"; +$object = new ArrayObjectBoth($values); +var_dump($object->offsetExists('foo'), isset($object['foo']), empty($object['foo'])); +var_dump($object->offsetExists('bar'), isset($object['bar']), empty($object['bar'])); +var_dump($object->offsetexists('baz'), isset($object['baz']), empty($object['baz'])); +var_dump($object->offsetexists('qux'), isset($object['qux']), empty($object['qux'])); + +echo "==== class with offsetExists() ====\n"; +$object = new ArrayObjectExists($values); +var_dump($object->offsetExists('foo'), isset($object['foo']), empty($object['foo'])); +var_dump($object->offsetExists('bar'), isset($object['bar']), empty($object['bar'])); +var_dump($object->offsetexists('baz'), isset($object['baz']), empty($object['baz'])); +var_dump($object->offsetexists('qux'), isset($object['qux']), empty($object['qux'])); + +echo "==== class with offsetGet() ====\n"; +$object = new ArrayObjectGet($values); +var_dump($object->offsetExists('foo'), isset($object['foo']), empty($object['foo'])); +var_dump($object->offsetExists('bar'), isset($object['bar']), empty($object['bar'])); +var_dump($object->offsetexists('baz'), isset($object['baz']), empty($object['baz'])); +var_dump($object->offsetexists('qux'), isset($object['qux']), empty($object['qux'])); + +echo "==== class with offsetGet() and offsetSet() ====\n"; +$object = new ArrayObjectGetSet; +$object['foo'] = 42; +var_dump($object->offsetExists('foo'), $object->offsetExists('sbb'), isset($object['foo']), isset($object['sbb'])); + +?> +--EXPECTF-- +==== class with offsetExists() and offsetGet() ==== +string(37) "Called: ArrayObjectBoth::offsetExists" +string(37) "Called: ArrayObjectBoth::offsetExists" +string(34) "Called: ArrayObjectBoth::offsetGet" +string(37) "Called: ArrayObjectBoth::offsetExists" +string(34) "Called: ArrayObjectBoth::offsetGet" +bool(true) +bool(true) +bool(true) +string(37) "Called: ArrayObjectBoth::offsetExists" +string(37) "Called: ArrayObjectBoth::offsetExists" +string(34) "Called: ArrayObjectBoth::offsetGet" +string(37) "Called: ArrayObjectBoth::offsetExists" +string(34) "Called: ArrayObjectBoth::offsetGet" +bool(true) +bool(false) +bool(true) +string(37) "Called: ArrayObjectBoth::offsetExists" +string(37) "Called: ArrayObjectBoth::offsetExists" +string(34) "Called: ArrayObjectBoth::offsetGet" +string(37) "Called: ArrayObjectBoth::offsetExists" +string(34) "Called: ArrayObjectBoth::offsetGet" +bool(true) +bool(true) +bool(false) +string(37) "Called: ArrayObjectBoth::offsetExists" +string(37) "Called: ArrayObjectBoth::offsetExists" +string(37) "Called: ArrayObjectBoth::offsetExists" +bool(false) +bool(false) +bool(true) +==== class with offsetExists() ==== +string(39) "Called: ArrayObjectExists::offsetExists" +string(39) "Called: ArrayObjectExists::offsetExists" +string(39) "Called: ArrayObjectExists::offsetExists" +bool(true) +bool(true) +bool(true) +string(39) "Called: ArrayObjectExists::offsetExists" +string(39) "Called: ArrayObjectExists::offsetExists" +string(39) "Called: ArrayObjectExists::offsetExists" +bool(true) +bool(false) +bool(true) +string(39) "Called: ArrayObjectExists::offsetExists" +string(39) "Called: ArrayObjectExists::offsetExists" +string(39) "Called: ArrayObjectExists::offsetExists" +bool(true) +bool(true) +bool(false) +string(39) "Called: ArrayObjectExists::offsetExists" +string(39) "Called: ArrayObjectExists::offsetExists" +string(39) "Called: ArrayObjectExists::offsetExists" +bool(false) +bool(false) +bool(true) +==== class with offsetGet() ==== +string(33) "Called: ArrayObjectGet::offsetGet" +string(33) "Called: ArrayObjectGet::offsetGet" +bool(true) +bool(true) +bool(true) +string(33) "Called: ArrayObjectGet::offsetGet" +string(33) "Called: ArrayObjectGet::offsetGet" +bool(true) +bool(false) +bool(true) +string(33) "Called: ArrayObjectGet::offsetGet" +string(33) "Called: ArrayObjectGet::offsetGet" +bool(true) +bool(true) +bool(false) +bool(false) +bool(false) +bool(true) +==== class with offsetGet() and offsetSet() ==== + +Notice: Undefined index: foo in %s on line %d +bool(false) +bool(true) +bool(false) +bool(false) diff --git a/ext/standard/array.c b/ext/standard/array.c index e84e019690..6c3be814cb 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1786,13 +1786,7 @@ static void php_array_data_shuffle(zval *array TSRMLS_DC) /* {{{ */ } temp = hash->pListHead; j = 0; - while (temp != NULL) { - temp->nKeyLength = 0; - temp->h = j++; - temp = temp->pListNext; - } - hash->nNextFreeElement = n_elems; - zend_hash_rehash(hash); + zend_hash_reindex(hash, 0); HANDLE_UNBLOCK_INTERRUPTIONS(); efree(elems); @@ -1815,93 +1809,15 @@ PHP_FUNCTION(shuffle) } /* }}} */ -PHPAPI HashTable* php_splice(HashTable *in_hash, int offset, int length, zval ***list, int list_count, HashTable **removed) /* {{{ */ +PHPAPI void php_splice(HashTable *ht, zend_uint offset, zend_uint length, zval ***list, zend_uint list_count, HashTable *removed TSRMLS_DC) /* {{{ */ { - HashTable *out_hash = NULL; /* Output hashtable */ - int num_in, /* Number of entries in the input hashtable */ - pos, /* Current position in the hashtable */ - i; /* Loop counter */ - Bucket *p; /* Pointer to hash bucket */ - zval *entry; /* Hash entry */ - - /* If input hash doesn't exist, we have nothing to do */ - if (!in_hash) { - return NULL; - } - - /* Get number of entries in the input hash */ - num_in = zend_hash_num_elements(in_hash); + zend_hash_splice(ht, sizeof(zval *), (copy_ctor_func_t) zval_add_ref, offset, length, (void **) list, list_count, removed); - /* Clamp the offset.. */ - if (offset > num_in) { - offset = num_in; - } else if (offset < 0 && (offset = (num_in + offset)) < 0) { - offset = 0; - } - - /* ..and the length */ - if (length < 0) { - length = num_in - offset + length; - } else if (((unsigned)offset + (unsigned)length) > (unsigned)num_in) { - length = num_in - offset; - } - - /* Create and initialize output hash */ - ALLOC_HASHTABLE(out_hash); - zend_hash_init(out_hash, (length > 0 ? num_in - length : 0) + list_count, NULL, ZVAL_PTR_DTOR, 0); - - /* Start at the beginning of the input hash and copy entries to output hash until offset is reached */ - for (pos = 0, p = in_hash->pListHead; pos < offset && p ; pos++, p = p->pListNext) { - /* Get entry and increase reference count */ - entry = *((zval **)p->pData); - Z_ADDREF_P(entry); - - /* Update output hash depending on key type */ - if (p->nKeyLength == 0) { - zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL); - } else { - zend_hash_quick_update(out_hash, p->arKey, p->nKeyLength, p->h, &entry, sizeof(zval *), NULL); - } - } - - /* If hash for removed entries exists, go until offset+length and copy the entries to it */ - if (removed != NULL) { - for ( ; pos < offset + length && p; pos++, p = p->pListNext) { - entry = *((zval **)p->pData); - Z_ADDREF_P(entry); - if (p->nKeyLength == 0) { - zend_hash_next_index_insert(*removed, &entry, sizeof(zval *), NULL); - } else { - zend_hash_quick_update(*removed, p->arKey, p->nKeyLength, p->h, &entry, sizeof(zval *), NULL); - } - } - } else { /* otherwise just skip those entries */ - for ( ; pos < offset + length && p; pos++, p = p->pListNext); - } - - /* If there are entries to insert.. */ - if (list != NULL) { - /* ..for each one, create a new zval, copy entry into it and copy it into the output hash */ - for (i = 0; i < list_count; i++) { - entry = *list[i]; - Z_ADDREF_P(entry); - zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL); - } - } + zend_hash_internal_pointer_reset(ht); - /* Copy the remaining input hash entries to the output hash */ - for ( ; p ; p = p->pListNext) { - entry = *((zval **)p->pData); - Z_ADDREF_P(entry); - if (p->nKeyLength == 0) { - zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL); - } else { - zend_hash_quick_update(out_hash, p->arKey, p->nKeyLength, p->h, &entry, sizeof(zval *), NULL); - } + if (ht == &EG(symbol_table)) { + zend_reset_all_cv(&EG(symbol_table) TSRMLS_CC); } - - zend_hash_internal_pointer_reset(out_hash); - return out_hash; } /* }}} */ @@ -1975,24 +1891,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) /* If we did a shift... re-index like it did before */ if (!off_the_end) { - unsigned int k = 0; - int should_rehash = 0; - Bucket *p = Z_ARRVAL_P(stack)->pListHead; - while (p != NULL) { - if (p->nKeyLength == 0) { - if (p->h != k) { - p->h = k++; - should_rehash = 1; - } else { - k++; - } - } - p = p->pListNext; - } - Z_ARRVAL_P(stack)->nNextFreeElement = k; - if (should_rehash) { - zend_hash_rehash(Z_ARRVAL_P(stack)); - } + zend_hash_reindex(Z_ARRVAL_P(stack), 1); } else if (!key_len && index >= Z_ARRVAL_P(stack)->nNextFreeElement - 1) { Z_ARRVAL_P(stack)->nNextFreeElement = Z_ARRVAL_P(stack)->nNextFreeElement - 1; } @@ -2023,24 +1922,14 @@ PHP_FUNCTION(array_unshift) { zval ***args, /* Function arguments array */ *stack; /* Input stack */ - HashTable *new_hash; /* New hashtable for the stack */ - HashTable old_hash; int argc; /* Number of function arguments */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a+", &stack, &args, &argc) == FAILURE) { return; } - /* Use splice to insert the elements at the beginning. Destroy old - * hashtable and replace it with new one */ - new_hash = php_splice(Z_ARRVAL_P(stack), 0, 0, &args[0], argc, NULL); - old_hash = *Z_ARRVAL_P(stack); - if (Z_ARRVAL_P(stack) == &EG(symbol_table)) { - zend_reset_all_cv(&EG(symbol_table) TSRMLS_CC); - } - *Z_ARRVAL_P(stack) = *new_hash; - FREE_HASHTABLE(new_hash); - zend_hash_destroy(&old_hash); + /* Use splice to insert the elements at the beginning. */ + php_splice(Z_ARRVAL_P(stack), 0, 0, args, argc, NULL TSRMLS_CC); /* Clean up and return the number of elements in the stack */ efree(args); @@ -2053,11 +1942,9 @@ PHP_FUNCTION(array_unshift) PHP_FUNCTION(array_splice) { zval *array, /* Input array */ - *repl_array = NULL, /* Replacement array */ + **repl_array = NULL, /* Replacement array */ ***repl = NULL; /* Replacement elements */ - HashTable *new_hash = NULL, /* Output array's hash */ - **rem_hash = NULL; /* Removed elements' hash */ - HashTable old_hash; + HashTable *rem_hash = NULL; /* Removed elements' hash */ Bucket *p; /* Bucket used for traversing hash */ long i, offset, @@ -2065,7 +1952,7 @@ PHP_FUNCTION(array_splice) repl_num = 0; /* Number of replacement elements */ int num_in; /* Number of elements in the input array */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|lz/", &array, &offset, &length, &repl_array) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|lZ", &array, &offset, &length, &repl_array) == FAILURE) { return; } @@ -2075,56 +1962,44 @@ PHP_FUNCTION(array_splice) length = num_in; } - if (ZEND_NUM_ARGS() == 4) { + if (repl_array) { /* Make sure the last argument, if passed, is an array */ - convert_to_array(repl_array); + convert_to_array_ex(repl_array); /* Create the array of replacement elements */ - repl_num = zend_hash_num_elements(Z_ARRVAL_P(repl_array)); + repl_num = zend_hash_num_elements(Z_ARRVAL_PP(repl_array)); repl = (zval ***)safe_emalloc(repl_num, sizeof(zval **), 0); - for (p = Z_ARRVAL_P(repl_array)->pListHead, i = 0; p; p = p->pListNext, i++) { + for (p = Z_ARRVAL_PP(repl_array)->pListHead, i = 0; p; p = p->pListNext, i++) { repl[i] = ((zval **)p->pData); } } + /* Clamp the offset */ + if (offset < 0 && (offset = num_in + offset) < 0) { + offset = 0; + } else if (offset > num_in) { + offset = num_in; + } + + /* Clamp the length */ + if (length < 0 && (length = num_in - offset + length) < 0) { + length = 0; + } else if ((unsigned long) offset + (unsigned long) length > (unsigned) num_in) { + length = num_in - offset; + } + /* Don't create the array of removed elements if it's not going * to be used; e.g. only removing and/or replacing elements */ if (return_value_used) { - int size = length; - - /* Clamp the offset.. */ - if (offset > num_in) { - offset = num_in; - } else if (offset < 0 && (offset = (num_in + offset)) < 0) { - offset = 0; - } - - /* ..and the length */ - if (length < 0) { - size = num_in - offset + length; - } else if (((unsigned long) offset + (unsigned long) length) > (unsigned) num_in) { - size = num_in - offset; - } - - /* Initialize return value */ - array_init_size(return_value, size > 0 ? size : 0); - rem_hash = &Z_ARRVAL_P(return_value); + array_init_size(return_value, length); + rem_hash = Z_ARRVAL_P(return_value); } /* Perform splice */ - new_hash = php_splice(Z_ARRVAL_P(array), offset, length, repl, repl_num, rem_hash); - - /* Replace input array's hashtable with the new one */ - old_hash = *Z_ARRVAL_P(array); - if (Z_ARRVAL_P(array) == &EG(symbol_table)) { - zend_reset_all_cv(&EG(symbol_table) TSRMLS_CC); - } - *Z_ARRVAL_P(array) = *new_hash; - FREE_HASHTABLE(new_hash); - zend_hash_destroy(&old_hash); + php_splice(Z_ARRVAL_P(array), offset, length, repl, repl_num, rem_hash TSRMLS_CC); /* Clean up */ - if (ZEND_NUM_ARGS() == 4) { + if (repl) { efree(repl); } } @@ -2686,8 +2561,6 @@ PHP_FUNCTION(array_pad) zval *input; /* Input array */ zval *pad_value; /* Padding value obviously */ zval ***pads; /* Array to pass to splice */ - HashTable *new_hash;/* Return value from splice */ - HashTable old_hash; long pad_size; /* Size to pad to */ long pad_size_abs; /* Absolute value of pad_size */ int input_size; /* Size of the input array */ @@ -2731,19 +2604,10 @@ PHP_FUNCTION(array_pad) /* Pad on the right or on the left */ if (pad_size > 0) { - new_hash = php_splice(Z_ARRVAL_P(return_value), input_size, 0, pads, num_pads, NULL); + php_splice(Z_ARRVAL_P(return_value), input_size, 0, pads, num_pads, NULL TSRMLS_CC); } else { - new_hash = php_splice(Z_ARRVAL_P(return_value), 0, 0, pads, num_pads, NULL); - } - - /* Copy the result hash into return value */ - old_hash = *Z_ARRVAL_P(return_value); - if (Z_ARRVAL_P(return_value) == &EG(symbol_table)) { - zend_reset_all_cv(&EG(symbol_table) TSRMLS_CC); + php_splice(Z_ARRVAL_P(return_value), 0, 0, pads, num_pads, NULL TSRMLS_CC); } - *Z_ARRVAL_P(return_value) = *new_hash; - FREE_HASHTABLE(new_hash); - zend_hash_destroy(&old_hash); /* Clean up */ efree(pads); @@ -3978,15 +3842,7 @@ PHP_FUNCTION(array_multisort) hash->pListTail = indirect[k][i]; } - p = hash->pListHead; - k = 0; - while (p != NULL) { - if (p->nKeyLength == 0) - p->h = k++; - p = p->pListNext; - } - hash->nNextFreeElement = array_size; - zend_hash_rehash(hash); + zend_hash_reindex(hash, 1); } HANDLE_UNBLOCK_INTERRUPTIONS(); diff --git a/ext/standard/html.c b/ext/standard/html.c index 075a4d2ff9..5bbe39ccbb 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -84,6 +84,18 @@ #define sjis_lead(c) ((c) != 0x80 && (c) != 0xA0 && (c) < 0xFD) #define sjis_trail(c) ((c) >= 0x40 && (c) != 0x7F && (c) < 0xFD) +/* {{{ get_default_charset + */ +static char *get_default_charset(TSRMLS_D) { + if (PG(internal_encoding) && PG(internal_encoding)[0]) { + return PG(internal_encoding); + } else if (SG(default_charset) && SG(default_charset)[0] ) { + return SG(default_charset); + } + return NULL; +} +/* }}} */ + /* {{{ get_next_char */ static inline unsigned int get_next_char( @@ -1432,8 +1444,8 @@ encode_amp: */ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) { - char *str, *hint_charset = PHP_DEFAULT_CHARSET; - int str_len, hint_charset_len = sizeof(PHP_DEFAULT_CHARSET)-1; + char *str, *hint_charset = NULL; + int str_len, hint_charset_len = 0; size_t new_len; long flags = ENT_COMPAT; char *replaced; @@ -1443,7 +1455,11 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) return; } + if (!hint_charset) { + hint_charset = get_default_charset(TSRMLS_C); + } replaced = php_escape_html_entities_ex(str, str_len, &new_len, all, (int) flags, hint_charset, double_encode TSRMLS_CC); + RETVAL_STRINGL(replaced, (int)new_len, 0); } /* }}} */ @@ -1504,8 +1520,8 @@ PHP_FUNCTION(htmlspecialchars_decode) Convert all HTML entities to their applicable characters */ PHP_FUNCTION(html_entity_decode) { - char *str, *hint_charset = PHP_DEFAULT_CHARSET; - int str_len, hint_charset_len = sizeof(PHP_DEFAULT_CHARSET)-1; + char *str, *hint_charset = NULL; + int str_len, hint_charset_len; size_t new_len = 0; long quote_style = ENT_COMPAT; char *replaced; @@ -1515,7 +1531,11 @@ PHP_FUNCTION(html_entity_decode) return; } + if (!hint_charset) { + hint_charset = get_default_charset(TSRMLS_C); + } replaced = php_unescape_html_entities(str, str_len, &new_len, 1 /*all*/, quote_style, hint_charset TSRMLS_CC); + if (replaced) { RETURN_STRINGL(replaced, (int)new_len, 0); } diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h index c4389dd92a..deddeb4871 100644 --- a/ext/standard/php_array.h +++ b/ext/standard/php_array.h @@ -103,7 +103,7 @@ PHP_FUNCTION(array_key_exists); PHP_FUNCTION(array_chunk); PHP_FUNCTION(array_combine); -PHPAPI HashTable* php_splice(HashTable *, int, int, zval ***, int, HashTable **); +PHPAPI void php_splice(HashTable *ht, zend_uint offset, zend_uint length, zval ***list, zend_uint list_count, HashTable *removed TSRMLS_DC); PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS_DC); PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC); PHPAPI int php_multisort_compare(const void *a, const void *b TSRMLS_DC); diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index f4c3b4738c..50ceb605ed 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -34,6 +34,7 @@ #include "exec.h" #include "php_globals.h" #include "SAPI.h" +#include "main/php_network.h" #ifdef NETWARE #include <proc.h> @@ -556,7 +557,7 @@ PHP_FUNCTION(proc_open) if (Z_TYPE_PP(descitem) == IS_RESOURCE) { /* should be a stream - try and dup the descriptor */ php_stream *stream; - int fd; + php_socket_t fd; php_stream_from_zval(stream, descitem); @@ -629,7 +630,7 @@ PHP_FUNCTION(proc_open) } else if (strcmp(Z_STRVAL_PP(ztype), "file") == 0) { zval **zfile, **zmode; - int fd; + php_socket_t fd; php_stream *stream; descriptors[ndesc].mode = DESC_FILE; diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index b623447651..8d42a51af6 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -610,10 +610,7 @@ static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) &elem) == SUCCESS; zend_hash_move_forward(Z_ARRVAL_P(stream_array))) { - /* Temporary int fd is needed for the STREAM data type on windows, passing this_fd directly to php_stream_cast() - would eventually bring a wrong result on x64. php_stream_cast() casts to int internally, and this will leave - the higher bits of a SOCKET variable uninitialized on systems with little endian. */ - int tmp_fd; + php_socket_t this_fd; php_stream_from_zval_no_verify(stream, elem); if (stream == NULL) { @@ -624,9 +621,7 @@ static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t * when casting. It is only used here so that the buffered data warning * is not displayed. * */ - if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&tmp_fd, 1) && tmp_fd != -1) { - - php_socket_t this_fd = (php_socket_t)tmp_fd; + if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd != -1) { PHP_SAFE_FD_SET(this_fd, fds); @@ -660,10 +655,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) char *key; uint key_len; ulong num_ind; - /* Temporary int fd is needed for the STREAM data type on windows, passing this_fd directly to php_stream_cast() - would eventually bring a wrong result on x64. php_stream_cast() casts to int internally, and this will leave - the higher bits of a SOCKET variable uninitialized on systems with little endian. */ - int tmp_fd; + php_socket_t this_fd; type = zend_hash_get_current_key_ex(Z_ARRVAL_P(stream_array), @@ -682,10 +674,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) * when casting. It is only used here so that the buffered data warning * is not displayed. */ - if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&tmp_fd, 1) && tmp_fd != -1) { - - php_socket_t this_fd = (php_socket_t)tmp_fd; - + if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd != SOCK_ERR) { if (PHP_SAFE_FD_ISSET(this_fd, fds)) { if (type == HASH_KEY_IS_LONG) { zend_hash_index_update(new_hash, num_ind, (void *)elem, sizeof(zval *), (void **)&dest_elem); diff --git a/ext/standard/string.c b/ext/standard/string.c index eafa6cf2a0..9139906653 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -5585,14 +5585,19 @@ PHP_FUNCTION(substr_compare) int s1_len, s2_len; long offset, len=0; zend_bool cs=0; + uint cmp_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl|lb", &s1, &s1_len, &s2, &s2_len, &offset, &len, &cs) == FAILURE) { RETURN_FALSE; } - if (ZEND_NUM_ARGS() >= 4 && len < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length must be greater than or equal to zero"); - RETURN_FALSE; + if (ZEND_NUM_ARGS() >= 4 && len <= 0) { + if (len == 0) { + RETURN_LONG(0L); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length must be greater than or equal to zero"); + RETURN_FALSE; + } } if (offset < 0) { @@ -5605,10 +5610,12 @@ PHP_FUNCTION(substr_compare) RETURN_FALSE; } + cmp_len = (uint) (len ? len : MAX(s2_len, (s1_len - offset))); + if (!cs) { - RETURN_LONG(zend_binary_strncmp(s1 + offset, (s1_len - offset), s2, s2_len, (uint)len)); + RETURN_LONG(zend_binary_strncmp(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); } else { - RETURN_LONG(zend_binary_strncasecmp_l(s1 + offset, (s1_len - offset), s2, s2_len, (uint)len)); + RETURN_LONG(zend_binary_strncasecmp_l(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); } } /* }}} */ diff --git a/ext/standard/tests/network/bug64330.phpt b/ext/standard/tests/network/bug64330.phpt new file mode 100644 index 0000000000..e5653e7459 --- /dev/null +++ b/ext/standard/tests/network/bug64330.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #64330 (stream_socket_server() creates wrong Abstract Namespace UNIX sockets) +--SKIPIF-- +<?php +if (!in_array("unix", stream_get_transports())) die("SKIP unix domain sockets unavailable"); +if (!stristr(PHP_OS, "Linux")) die('skip abstract namespace is a Linux-only feature'); +?> +--FILE-- +<?php +echo "Test\n"; +$server = stream_socket_server("unix://\x00/MyBindName"); +$client = stream_socket_client("unix://\x00/MyBindName"); +if ($client) { + echo "ok\n"; +} +?> +===DONE=== +--EXPECT-- +Test +ok +===DONE=== diff --git a/ext/standard/tests/streams/bug61019.phpt b/ext/standard/tests/streams/bug61019.phpt new file mode 100644 index 0000000000..45b207ea9e --- /dev/null +++ b/ext/standard/tests/streams/bug61019.phpt @@ -0,0 +1,78 @@ +--TEST-- +Bug #61019 (Out of memory on command stream_get_contents) +--FILE-- +<?php + +echo "Test\n"; + +$descriptorspec = array( + 0 => array("pipe", "r"), // stdin is a pipe that the child will read from + 1 => array("pipe", "w"), // stdout is a pipe that the child will write to + 2 => array("pipe", "w") // stderr is a pipe that the child will write to +); + +$process=proc_open("echo testtext",$descriptorspec,$pipes); +if(is_resource($process)) +{ + stream_set_blocking($pipes[0],false); + stream_set_blocking($pipes[1],false); + stream_set_blocking($pipes[2],false); + stream_set_write_buffer($pipes[0],0); + stream_set_read_buffer($pipes[1],0); + stream_set_read_buffer($pipes[2],0); + $stdin_stream=""; + $stderr_stream=""; + + echo "External command executed\n"; + do + { + $process_state=proc_get_status($process); + $tmp_stdin=stream_get_contents($pipes[1]); + if($tmp_stdin) + { + $stdin_stream=$stdin_stream.$tmp_stdin; + } + $tmp_stderr=stream_get_contents($pipes[2]); + if($tmp_stderr) + { + $stderr_stream=$stderr_stream.$tmp_stderr; + } + } while($process_state['running']); + + echo "External command exit: ".$process_state['exitcode']."\n"; + + //read outstanding data + $tmp_stdin=stream_get_contents($pipes[1]); + if($tmp_stdin) + { + $stdin_stream=$stdin_stream.$tmp_stdin; + } + $tmp_stderr=stream_get_contents($pipes[2]); + if($tmp_stderr) + { + $stderr_stream=$stderr_stream.$tmp_stderr; + } + + fclose ($pipes[0]); + fclose ($pipes[1]); + fclose ($pipes[2]); + + proc_close($process); + + echo "STDOUT: ".$stdin_stream."\n"; + echo "STDERR: ".$stderr_stream."\n"; +} +else +{ + echo "Can't start external command\n"; +} +?> +===DONE=== +--EXPECT-- +Test +External command executed +External command exit: 0 +STDOUT: testtext + +STDERR: +===DONE=== diff --git a/ext/standard/tests/strings/default_charset.phpt b/ext/standard/tests/strings/default_charset.phpt new file mode 100644 index 0000000000..3665132413 --- /dev/null +++ b/ext/standard/tests/strings/default_charset.phpt @@ -0,0 +1,104 @@ +--TEST-- +default_charset and htmlentities/htmlspecialchars/html_entity_decode +--INI-- +default_charset=UTF-8 +internal_encoding= +input_encoding= +output_encoding= +--FILE-- +<?php +echo "*** Default php.ini value ***\n"; +var_dump(ini_get('default_charset'), + ini_get('internal_encoding'), + ini_get('input_encoding'), + ini_get('output_encoding') + ); + + +echo "*** Runtime change of default_charset ***\n"; +var_dump(ini_set('default_charset', 'cp1252')); + +echo "*** Test with updated default_charset ***\n"; +var_dump(ini_get('default_charset'), + ini_get('internal_encoding'), + ini_get('input_encoding'), + ini_get('output_encoding') + ); + +var_dump(htmlentities("\xA3", ENT_HTML5)); +var_dump(htmlentities("\xA3", ENT_HTML5, 'cp1252')); + +var_dump(bin2hex(html_entity_decode("£", ENT_HTML5))); +var_dump(bin2hex(html_entity_decode("£", ENT_HTML5, 'cp1252'))); + +// Set internal_encoding to empty and try again +echo "*** Change internal_encoding to empty ***\n"; +var_dump(ini_set('internal_encoding', '')); +var_dump(ini_get('default_charset'), + ini_get('internal_encoding'), + ini_get('input_encoding'), + ini_get('output_encoding') + ); + +var_dump(htmlentities("\xA3", ENT_HTML5)); +var_dump(htmlentities("\xA3", ENT_HTML5, 'cp1252')); +var_dump(bin2hex(html_entity_decode("£", ENT_HTML5))); +var_dump(bin2hex(html_entity_decode("£", ENT_HTML5, 'cp1252'))); + +echo "*** Update input/output_encoding ***\n"; +var_dump(ini_set('input_encoding', 'ISO-8859-1')); +var_dump(ini_set('output_encoding', 'ISO-8859-1')); +var_dump(ini_get('default_charset'), + ini_get('internal_encoding'), + ini_get('input_encoding'), + ini_get('output_encoding') + ); + +// Should not be affected +var_dump(htmlentities("\xA3", ENT_HTML5)); +var_dump(htmlentities("\xA3", ENT_HTML5, 'cp1252')); +var_dump(bin2hex(html_entity_decode("£", ENT_HTML5))); +var_dump(bin2hex(html_entity_decode("£", ENT_HTML5, 'cp1252'))); + +echo "Done\n"; + +?> +--EXPECT-- +*** Default php.ini value *** +string(5) "UTF-8" +string(0) "" +string(0) "" +string(0) "" +*** Runtime change of default_charset *** +string(5) "UTF-8" +*** Test with updated default_charset *** +string(6) "cp1252" +string(0) "" +string(0) "" +string(0) "" +string(7) "£" +string(7) "£" +string(2) "a3" +string(2) "a3" +*** Change internal_encoding to empty *** +string(0) "" +string(6) "cp1252" +string(0) "" +string(0) "" +string(0) "" +string(7) "£" +string(7) "£" +string(2) "a3" +string(2) "a3" +*** Update input/output_encoding *** +string(0) "" +string(0) "" +string(6) "cp1252" +string(0) "" +string(10) "ISO-8859-1" +string(10) "ISO-8859-1" +string(7) "£" +string(7) "£" +string(2) "a3" +string(2) "a3" +Done diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt index 84777711e6..1896f3cacc 100644 --- a/ext/standard/tests/strings/substr_compare.phpt +++ b/ext/standard/tests/strings/substr_compare.phpt @@ -3,6 +3,7 @@ substr_compare() --FILE-- <?php +var_dump(substr_compare("abcde", "df", -2) < 0); var_dump(substr_compare("abcde", "bc", 1, 2)); var_dump(substr_compare("abcde", "bcg", 1, 2)); var_dump(substr_compare("abcde", "BC", 1, 2, true)); @@ -20,6 +21,7 @@ var_dump(substr_compare("abcde", -1, 0, "str", new stdClass)); echo "Done\n"; ?> --EXPECTF-- +bool(true) int(0) int(0) int(0) diff --git a/ext/standard/url.c b/ext/standard/url.c index e4eb9c48b9..d8271a18ed 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -266,8 +266,8 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) p = s; } else { /* memrchr is a GNU specific extension - Emulate for wide compatibility */ - for(p = e; *p != ':' && p >= s; p--); + Emulate for wide compatability */ + for(p = e; p >= s && *p != ':'; p--); } if (p >= s && *p == ':') { diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index ef80f2b290..1f745b574a 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -180,6 +180,11 @@ php_stream_filter_status_t userfilter_filter( zval zpropname; int call_result; + /* the userfilter object probably doesn't exist anymore */ + if (CG(unclean_shutdown)) { + return ret; + } + if (FAILURE == zend_hash_find(Z_OBJPROP_P(obj), "stream", sizeof("stream"), (void**)&zstream)) { /* Give the userfilter class a hook back to the stream */ ALLOC_INIT_ZVAL(zstream); diff --git a/ext/xsl/tests/53965/collection.xml b/ext/xsl/tests/53965/collection.xml new file mode 100644 index 0000000000..a3039cd101 --- /dev/null +++ b/ext/xsl/tests/53965/collection.xml @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<collection> + <cd> + <title>Fight for your mind</title> + <artist>Ben Harper</artist> + <year>1995</year> + </cd> + <cd> + <title>Electric Ladyland</title> + <artist>Jimi Hendrix</artist> + <year>1997</year> + </cd> +</collection>
\ No newline at end of file diff --git a/ext/xsl/tests/53965/collection.xsl b/ext/xsl/tests/53965/collection.xsl new file mode 100644 index 0000000000..5474f863ec --- /dev/null +++ b/ext/xsl/tests/53965/collection.xsl @@ -0,0 +1,11 @@ +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + + <xsl:include href="include.xsl"/> + + <xsl:param name="owner" select="'Nicolas Eliaszewicz'"/> + <xsl:output method="html" encoding="iso-8859-1" indent="no"/> + <xsl:template match="collection"> + Hey! Welcome to <xsl:value-of select="$owner"/>'s sweet CD collection! + <xsl:apply-templates/> + </xsl:template> +</xsl:stylesheet>
\ No newline at end of file diff --git a/ext/xsl/tests/53965/include.xsl b/ext/xsl/tests/53965/include.xsl new file mode 100644 index 0000000000..4a01296705 --- /dev/null +++ b/ext/xsl/tests/53965/include.xsl @@ -0,0 +1,7 @@ +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:template match="cd"> + <h1><xsl:value-of select="title"/></h1> + <h2>by <xsl:value-of select="artist"/> - <xsl:value-of select="year"/></h2> + <hr /> + </xsl:template> +</xsl:stylesheet>
\ No newline at end of file diff --git a/ext/xsl/tests/bug53965.phpt b/ext/xsl/tests/bug53965.phpt new file mode 100644 index 0000000000..8de777ed63 --- /dev/null +++ b/ext/xsl/tests/bug53965.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #53965 (<xsl:include> cannot find files with relative paths when loaded with "file://") +--SKIPIF-- +<?php +if (!extension_loaded('xsl')) die("skip Extension XSL is required\n"); +?> +--FILE-- +<?php + +$base = 'file://' . dirname(__FILE__) . DIRECTORY_SEPARATOR . '53965'; + +$xml = new DOMDocument(); +$xml->load($base . DIRECTORY_SEPARATOR . 'collection.xml'); + +$xsl = new DOMDocument(); +$xsl->load($base . DIRECTORY_SEPARATOR . 'collection.xsl'); + +$proc = new XSLTProcessor; +$proc->importStyleSheet($xsl); + +echo $proc->transformToXML($xml); +?> +--EXPECTF-- +Hey! Welcome to Nicolas Eliaszewicz's sweet CD collection! + + <h1>Fight for your mind</h1><h2>by Ben Harper - 1995</h2><hr> + <h1>Electric Ladyland</h1><h2>by Jimi Hendrix - 1997</h2><hr> diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c index d381f5f5da..be0ebd4382 100644 --- a/ext/zlib/zlib_fopen_wrapper.c +++ b/ext/zlib/zlib_fopen_wrapper.c @@ -25,6 +25,8 @@ #include "php_zlib.h" #include "fopen_wrappers.h" +#include "main/php_network.h" + struct php_gz_stream_data_t { gzFile gz_file; php_stream *stream; @@ -129,7 +131,7 @@ php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, const char *path, con innerstream = php_stream_open_wrapper_ex(path, mode, STREAM_MUST_SEEK | options | STREAM_WILL_CAST, opened_path, context); if (innerstream) { - int fd; + php_socket_t fd; if (SUCCESS == php_stream_cast(innerstream, PHP_STREAM_AS_FD, (void **) &fd, REPORT_ERRORS)) { self = emalloc(sizeof(*self)); diff --git a/main/main.c b/main/main.c index abe032af70..60f5a16c4b 100644 --- a/main/main.c +++ b/main/main.c @@ -419,7 +419,7 @@ static PHP_INI_DISP(display_errors_mode) */ static PHP_INI_MH(OnUpdateInternalEncoding) { - if (new_value_length) { + if (new_value) { OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); } else { OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); @@ -432,7 +432,7 @@ static PHP_INI_MH(OnUpdateInternalEncoding) */ static PHP_INI_MH(OnUpdateInputEncoding) { - if (new_value_length) { + if (new_value) { OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); } else { OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); @@ -445,7 +445,7 @@ static PHP_INI_MH(OnUpdateInputEncoding) */ static PHP_INI_MH(OnUpdateOutputEncoding) { - if (new_value_length) { + if (new_value) { OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); } else { OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); @@ -597,9 +597,9 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root, php_core_globals, core_globals) STD_PHP_INI_ENTRY("default_charset", PHP_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct, sapi_globals) STD_PHP_INI_ENTRY("default_mimetype", SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct, sapi_globals) - STD_PHP_INI_ENTRY("internal_encoding", "", PHP_INI_ALL, OnUpdateInternalEncoding, internal_encoding, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("input_encoding", "", PHP_INI_ALL, OnUpdateInputEncoding, input_encoding, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("output_encoding", "", PHP_INI_ALL, OnUpdateOutputEncoding, output_encoding, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("internal_encoding", NULL, PHP_INI_ALL, OnUpdateInternalEncoding, internal_encoding, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("input_encoding", NULL, PHP_INI_ALL, OnUpdateInputEncoding, input_encoding, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("output_encoding", NULL, PHP_INI_ALL, OnUpdateOutputEncoding, output_encoding, php_core_globals, core_globals) STD_PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateErrorLog, error_log, php_core_globals, core_globals) STD_PHP_INI_ENTRY("extension_dir", PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals) STD_PHP_INI_ENTRY("sys_temp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, sys_temp_dir, php_core_globals, core_globals) diff --git a/main/output.c b/main/output.c index 72092e9561..1dac7179b8 100644 --- a/main/output.c +++ b/main/output.c @@ -234,6 +234,13 @@ PHPAPI int php_output_get_status(TSRMLS_D) * Unbuffered write */ PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC) { +#if PHP_DEBUG + if (len > UINT_MAX) { + php_error(E_WARNING, "Attempt to output more than UINT_MAX bytes at once; " + "output will be truncated %lu => %lu", + (unsigned long) len, (unsigned long) (len % UINT_MAX)); + } +#endif if (OG(flags) & PHP_OUTPUT_DISABLED) { return 0; } @@ -248,6 +255,13 @@ PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC) * Buffered write */ PHPAPI int php_output_write(const char *str, size_t len TSRMLS_DC) { +#if PHP_DEBUG + if (len > UINT_MAX) { + php_error(E_WARNING, "Attempt to output more than UINT_MAX bytes at once; " + "output will be truncated %lu => %lu", + (unsigned long) len, (unsigned long) (len % UINT_MAX)); + } +#endif if (OG(flags) & PHP_OUTPUT_DISABLED) { return 0; } diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 6ddfc74a11..5e9e5c7ace 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -482,7 +482,7 @@ static int php_stdiop_seek(php_stream *stream, off_t offset, int whence, off_t * static int php_stdiop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC) { - int fd; + php_socket_t fd; php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract; assert(data != NULL); @@ -506,31 +506,31 @@ static int php_stdiop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC) } *(FILE**)ret = data->file; - data->fd = -1; + data->fd = SOCK_ERR; } return SUCCESS; case PHP_STREAM_AS_FD_FOR_SELECT: PHP_STDIOP_GET_FD(fd, data); - if (fd < 0) { + if (SOCK_ERR == fd) { return FAILURE; } if (ret) { - *(int*)ret = fd; + *(php_socket_t *)ret = fd; } return SUCCESS; case PHP_STREAM_AS_FD: PHP_STDIOP_GET_FD(fd, data); - if (fd < 0) { + if (SOCK_ERR == fd) { return FAILURE; } if (data->file) { fflush(data->file); } if (ret) { - *(int*)ret = fd; + *(php_socket_t *)ret = fd; } return SUCCESS; default: diff --git a/main/streams/streams.c b/main/streams/streams.c index 4713db151b..9f9661dbfd 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -731,6 +731,10 @@ PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t size TSRMLS if (!stream->readfilters.head && (stream->flags & PHP_STREAM_FLAG_NO_BUFFER || stream->chunk_size == 1)) { toread = stream->ops->read(stream, buf, size TSRMLS_CC); + if (toread == (size_t) -1) { + /* e.g. underlying read(2) returned -1 */ + break; + } } else { php_stream_fill_read_buffer(stream, size TSRMLS_CC); @@ -1396,11 +1400,16 @@ PHPAPI size_t _php_stream_passthru(php_stream * stream STREAMS_DC TSRMLS_DC) p = php_stream_mmap_range(stream, php_stream_tell(stream), PHP_STREAM_MMAP_ALL, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped); if (p) { - PHPWRITE(p, mapped); + do { + /* output functions return int, so pass in int max */ + if (0 < (b = PHPWRITE(p, MIN(mapped - bcount, INT_MAX)))) { + bcount += b; + } + } while (b > 0 && mapped > bcount); php_stream_mmap_unmap_ex(stream, mapped); - return mapped; + return bcount; } } diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 9cef91cbb4..a6dc115962 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -588,7 +588,8 @@ static inline int php_tcp_sockop_bind(php_stream *stream, php_netstream_data_t * parse_unix_address(xparam, &unix_addr TSRMLS_CC); - return bind(sock->socket, (struct sockaddr *)&unix_addr, sizeof(unix_addr)); + return bind(sock->socket, (const struct sockaddr *)&unix_addr, + (socklen_t) XtOffsetOf(struct sockaddr_un, sun_path) + xparam->inputs.namelen); } #endif diff --git a/php.ini-development b/php.ini-development index c5196b4c87..ac60db901f 100644 --- a/php.ini-development +++ b/php.ini-development @@ -950,15 +950,20 @@ cli_server.color = On [iconv] ; Use of this INI entry is deprecated, use global input_encoding instead. -; If empty, input_encoding is used. +; If empty, default_charset or input_encoding or iconv.input_encoding is used. +; The precedence is: default_charset < intput_encoding < iconv.input_encoding ;iconv.input_encoding = ; Use of this INI entry is deprecated, use global internal_encoding instead. -; If empty, internal_encoding is used. +; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. +; The precedence is: default_charset < internal_encoding < iconv.internal_encoding ;iconv.internal_encoding = ; Use of this INI entry is deprecated, use global output_encoding instead. -; If empty, output_encoding is used. +; If empty, default_charset or output_encoding or iconv.output_encoding is used. +; The precedence is: default_charset < output_encoding < iconv.output_encoding +; To use an output encoding conversion, iconv's output handler must be set +; otherwise output encoding conversion cannot be performed. ;iconv.output_encoding = [intl] @@ -1729,21 +1734,25 @@ mssql.secure_connection = Off ; Use of this INI entry is deprecated, use global internal_encoding instead. ; internal/script encoding. ; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*) -; If empty, default_charset or internal_encoding is used in order. -; http://php.net/mbstring.internal-encoding +; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. +; The precedence is: default_charset < internal_encoding < iconv.internal_encoding ;mbstring.internal_encoding = ; Use of this INI entry is deprecated, use global input_encoding instead. ; http input encoding. -; If empty, input_encoding is used. ; mbstring.encoding_traslation = On is needed to use this setting. +; If empty, default_charset or input_encoding or mbstring.input is used. +; The precedence is: default_charset < intput_encoding < mbsting.http_input ; http://php.net/mbstring.http-input ;mbstring.http_input = ; Use of this INI entry is deprecated, use global output_encoding instead. ; http output encoding. ; mb_output_handler must be registered as output buffer to function. -; If empty, output_encoding is used. +; If empty, default_charset or output_encoding or mbstring.http_output is used. +; The precedence is: default_charset < output_encoding < mbstring.http_output +; To use an output encoding conversion, mbstring's output handler must be set +; otherwise output encoding conversion cannot be performed. ; http://php.net/mbstring.http-output ;mbstring.http_output = diff --git a/php.ini-production b/php.ini-production index 38c74155dd..c5853ca566 100644 --- a/php.ini-production +++ b/php.ini-production @@ -948,15 +948,20 @@ cli_server.color = On [iconv] ; Use of this INI entry is deprecated, use global input_encoding instead. -; If empty, input_encoding is used. +; If empty, default_charset or input_encoding or iconv.input_encoding is used. +; The precedence is: default_charset < intput_encoding < iconv.input_encoding ;iconv.input_encoding = ; Use of this INI entry is deprecated, use global internal_encoding instead. -; If empty, internal_encoding is used. +; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. +; The precedence is: default_charset < internal_encoding < iconv.internal_encoding ;iconv.internal_encoding = ; Use of this INI entry is deprecated, use global output_encoding instead. -; If empty, output_encoding is used. +; If empty, default_charset or output_encoding or iconv.output_encoding is used. +; The precedence is: default_charset < output_encoding < iconv.output_encoding +; To use an output encoding conversion, iconv's output handler must be set +; otherwise output encoding conversion cannot be performed. ;iconv.output_encoding = [intl] @@ -1727,21 +1732,25 @@ mssql.secure_connection = Off ; Use of this INI entry is deprecated, use global internal_encoding instead. ; internal/script encoding. ; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*) -; If empty, default_charset or internal_encoding is used in order. -; http://php.net/mbstring.internal-encoding +; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. +; The precedence is: default_charset < internal_encoding < iconv.internal_encoding ;mbstring.internal_encoding = ; Use of this INI entry is deprecated, use global input_encoding instead. ; http input encoding. -; If empty, input_encoding is used. ; mbstring.encoding_traslation = On is needed to use this setting. +; If empty, default_charset or input_encoding or mbstring.input is used. +; The precedence is: default_charset < intput_encoding < mbsting.http_input ; http://php.net/mbstring.http-input ;mbstring.http_input = ; Use of this INI entry is deprecated, use global output_encoding instead. ; http output encoding. ; mb_output_handler must be registered as output buffer to function. -; If empty, output_encoding is used. +; If empty, default_charset or output_encoding or mbstring.http_output is used. +; The precedence is: default_charset < output_encoding < mbstring.http_output +; To use an output encoding conversion, mbstring's output handler must be set +; otherwise output encoding conversion cannot be performed. ; http://php.net/mbstring.http-output ;mbstring.http_output = diff --git a/sapi/apache2filter/php_apache.h b/sapi/apache2filter/php_apache.h index 47fe98b5fd..8410414dc0 100644 --- a/sapi/apache2filter/php_apache.h +++ b/sapi/apache2filter/php_apache.h @@ -36,14 +36,10 @@ typedef struct php_struct { int state; request_rec *r; ap_filter_t *f; /* downstream output filters after the PHP filter. */ - /* Length of post_data buffer */ - int post_len; - /* Index for reading from buffer */ - int post_idx; /* stat structure of the current file */ struct stat finfo; - /* Buffer for request body filter */ - char *post_data; + /* Set-aside request body bucket brigade */ + apr_bucket_brigade *post_data; /* Whether or not we've processed PHP in the output filters yet. */ int request_processed; } php_struct; diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index da920f818c..d5bf0d8646 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -94,11 +94,9 @@ static int php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC) { php_struct *ctx; - ap_filter_t *f; char *val, *ptr; ctx = SG(server_context); - f = ctx->r->output_filters; switch(op) { case SAPI_HEADER_DELETE: @@ -155,24 +153,29 @@ php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) static int php_apache_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC) { - int n; - int to_read; + apr_size_t len; php_struct *ctx = SG(server_context); - - to_read = ctx->post_len - ctx->post_idx; - n = MIN(to_read, count_bytes); - - if (n > 0) { - memcpy(buf, ctx->post_data + ctx->post_idx, n); - ctx->post_idx += n; - } else { - if (ctx->post_data) free(ctx->post_data); - ctx->post_data = NULL; + apr_bucket_brigade *brigade; + apr_bucket *partition; + + brigade = ctx->post_data; + len = count_bytes; + + switch (apr_brigade_partition(ctx->post_data, count_bytes, &partition)) { + case APR_SUCCESS: + apr_brigade_flatten(ctx->post_data, buf, &len); + brigade = apr_brigade_split(ctx->post_data, partition); + apr_brigade_destroy(ctx->post_data); + ctx->post_data = brigade; + break; + case APR_INCOMPLETE: + apr_brigade_flatten(ctx->post_data, buf, &len); + apr_brigade_cleanup(ctx->post_data); + break; } - return n; + return len; } - static struct stat* php_apache_sapi_get_stat(TSRMLS_D) { @@ -360,10 +363,6 @@ static int php_input_filter(ap_filter_t *f, apr_bucket_brigade *bb, ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes) { php_struct *ctx; - long old_index; - apr_bucket *b; - const char *str; - apr_size_t n; apr_status_t rv; TSRMLS_FETCH(); @@ -382,15 +381,15 @@ static int php_input_filter(ap_filter_t *f, apr_bucket_brigade *bb, return rv; } - for (b = APR_BRIGADE_FIRST(bb); b != APR_BRIGADE_SENTINEL(bb); b = APR_BUCKET_NEXT(b)) { - apr_bucket_read(b, &str, &n, APR_NONBLOCK_READ); - if (n > 0) { - old_index = ctx->post_len; - ctx->post_len += n; - ctx->post_data = realloc(ctx->post_data, ctx->post_len + 1); - memcpy(ctx->post_data + old_index, str, n); - } + if (!ctx->post_data) { + ctx->post_data = apr_brigade_create(f->r->pool, f->c->bucket_alloc); + } + if ((rv = ap_save_brigade(f, &ctx->post_data, &bb, f->r->pool)) != APR_SUCCESS) { + return rv; } + apr_brigade_cleanup(bb); + APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_eos_create(bb->bucket_alloc)); + return APR_SUCCESS; } @@ -413,8 +412,6 @@ static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx TSRMLS_DC) f->r->no_local_copy = 1; content_type = sapi_get_default_content_type(TSRMLS_C); f->r->content_type = apr_pstrdup(f->r->pool, content_type); - SG(request_info).post_data = ctx->post_data; - SG(request_info).post_data_length = ctx->post_len; efree(content_type); @@ -551,7 +548,7 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) php_execute_script(&zfd TSRMLS_CC); apr_table_set(ctx->r->notes, "mod_php_memory_usage", - apr_psprintf(ctx->r->pool, "%u", zend_memory_peak_usage(1 TSRMLS_CC))); + apr_psprintf(ctx->r->pool, "%lu", (unsigned long) zend_memory_peak_usage(1 TSRMLS_CC))); php_apache_request_dtor(f TSRMLS_CC); diff --git a/sapi/cli/tests/upload_2G.phpt b/sapi/cli/tests/upload_2G.phpt index 707eddbad3..313dcd5ac1 100644 --- a/sapi/cli/tests/upload_2G.phpt +++ b/sapi/cli/tests/upload_2G.phpt @@ -19,7 +19,7 @@ if ($f = fopen("/proc/meminfo","r")) { } if (empty($enough_free_ram)) { - die("need +3G free RAM"); + die("skip need +3G free RAM"); } ?> --FILE-- diff --git a/sapi/embed/config.w32 b/sapi/embed/config.w32 index f3cc60d600..64e44bdd94 100644 --- a/sapi/embed/config.w32 +++ b/sapi/embed/config.w32 @@ -3,6 +3,8 @@ ARG_ENABLE('embed', 'Embedded SAPI library', 'no'); +var PHP_EMBED_PGO = false; + if (PHP_EMBED != "no") { SAPI('embed', 'php_embed.c', 'php' + PHP_VERSION + 'embed.lib'); PHP_INSTALL_HEADERS("sapi/embed", "php_embed.h"); diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index 6cb1645e65..51a328d0b5 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -35,6 +35,7 @@ # include <sys/select.h> # include <sys/time.h> # include <sys/types.h> +# include <netinet/in.h> # include <unistd.h> # include <arpa/inet.h> #endif /* }}} */ diff --git a/win32/build/config.w32 b/win32/build/config.w32 index 4d2451b5af..3fe8469a90 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -255,13 +255,11 @@ if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") { // CFLAGS, LDFLAGS and BUILD_DIR are defined // Add compiler and link flags if PGO options are selected if (PHP_DEBUG != "yes" && PHP_PGI == "yes") { - ADD_FLAG('CFLAGS', "/GL /O2"); - ADD_FLAG('LDFLAGS', "/LTCG:PGINSTRUMENT"); + ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2"); DEFINE("PGOPGD_DIR", "$(BUILD_DIR)"); } else if (PHP_DEBUG != "yes" && PHP_PGO != "no") { - ADD_FLAG('CFLAGS', "/GL /O2"); - ADD_FLAG('LDFLAGS', "/LTCG:PGUPDATE"); + ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2"); DEFINE("PGOPGD_DIR", ((PHP_PGO.length == 0 || PHP_PGO == "yes") ? "$(BUILD_DIR)" : PHP_PGO)); } diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 68aae6e397..1dbc75b280 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -1017,6 +1017,21 @@ function generate_version_info_resource(makefiletarget, basename, creditspath, s return resname;
}
+/* Check if PGO is enabled for given module. To disable PGO for a particular module,
+define a global variable by the following name scheme before SAPI() or EXTENSION() call
+ var PHP_MYMODULE_PGO = false; */
+function is_pgo_desired(mod)
+{
+ var varname = "PHP_" + mod.toUpperCase() + "_PGO";
+
+ /* don't disable if there's no mention of the varname */
+ if (eval("typeof " + varname + " == 'undefined'")) {
+ return true;
+ }
+
+ return eval("!!" + varname);
+}
+
function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
{
var SAPI = sapiname.toUpperCase();
@@ -1068,7 +1083,17 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir) manifest = "-@$(_VC_MANIFEST_EMBED_EXE)";
}
- if(PHP_PGI == "yes" || PHP_PGO != "no") {
+ if(is_pgo_desired(sapiname) && (PHP_PGI == "yes" || PHP_PGO != "no")) {
+ // Add compiler and link flags if PGO options are selected
+ if (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
+ ADD_FLAG('CFLAGS_' + SAPI, "/GL /O2");
+ ADD_FLAG('LDFLAGS_' + SAPI, "/LTCG:PGINSTRUMENT");
+ }
+ else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
+ ADD_FLAG('CFLAGS_' + SAPI, "/GL /O2");
+ ADD_FLAG('LDFLAGS_' + SAPI, "/LTCG:PGUPDATE");
+ }
+
ldflags += " /PGD:$(PGOPGD_DIR)\\" + makefiletarget.substring(0, makefiletarget.indexOf(".")) + ".pgd";
}
@@ -1205,6 +1230,8 @@ function ADD_EXTENSION_DEP(extname, dependson, optional) return true;
}
+var static_pgo_enabled = false;
+
function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
{
var objs = null;
@@ -1254,7 +1281,17 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) var ld = "@$(CC)";
ldflags = "";
- if (PHP_PGI == "yes" || PHP_PGO != "no") {
+ if (is_pgo_desired(extname) && (PHP_PGI == "yes" || PHP_PGO != "no")) {
+ // Add compiler and link flags if PGO options are selected
+ if (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
+ ADD_FLAG('LDFLAGS_' + EXT, "/LTCG:PGINSTRUMENT");
+ }
+ else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
+ ADD_FLAG('LDFLAGS_' + EXT, "/LTCG:PGUPDATE");
+ }
+
+ ADD_FLAG('CFLAGS_' + EXT, "/GL /O2");
+
ldflags = " /PGD:$(PGOPGD_DIR)\\" + dllname.substring(0, dllname.indexOf(".")) + ".pgd";
}
@@ -1285,6 +1322,19 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) ADD_FLAG("STATIC_EXT_LIBS", "$(LIBS_" + EXT + ")");
ADD_FLAG("STATIC_EXT_LDFLAGS", "$(LDFLAGS_" + EXT + ")");
ADD_FLAG("STATIC_EXT_CFLAGS", "$(CFLAGS_" + EXT + ")");
+ if (is_pgo_desired(extname) && (PHP_PGI == "yes" || PHP_PGO != "no")) {
+ if (!static_pgo_enabled) {
+ if (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
+ ADD_FLAG('STATIC_EXT_LDFLAGS', "/LTCG:PGINSTRUMENT");
+ }
+ else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
+ ADD_FLAG('STATIC_EXT_LDFLAGS', "/LTCG:PGUPDATE");
+ }
+
+ ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2");
+ static_pgo_enabled = true;
+ }
+ }
/* find the header that declares the module pointer,
* so we can include it in internal_functions.c */
diff --git a/win32/build/libs_version.txt b/win32/build/libs_version.txt index 2ab585063b..71af7a1a0d 100644 --- a/win32/build/libs_version.txt +++ b/win32/build/libs_version.txt @@ -1,16 +1,16 @@ bz2-1.0.6 cclient-2007f -freetype-2.4.10 +freetype-2.5.3 icu-52.1 -jpeglib-9 -libcurl-7.35.0 +jpeglib-9a +libcurl-7.36.0 libiconv-1.14 libmcrypt-2.5.8 libmpir-2.6.0 -libpng-1.5.14 +libpng-1.5.18 libpq-9.3.2 libssh2-1.4.3 libtidy-20090406 libxslt-1.1.27 libxml-2.9.1 -openssl-1.0.1f +openssl-1.0.1g |