Compare commits

...
153 Commits
Author SHA1 Message Date
Anatol Belski a4c0b7a254 updated libmagic.patch for 5.4+ 2014-05-27 13:53:09 -07:00
Stanislav Malyshev 5b0b760f1f add CVEs 2014-05-27 12:22:21 -07:00
Stanislav Malyshev 2396ed466a 5.4.29 2014-05-27 12:18:35 -07:00
Stanislav Malyshev 37a4ebaa34 update NEWS 2014-05-27 12:18:07 -07:00
Stanislav Malyshev 22736b7c56 Fix bug #67327: fileinfo: CDF infinite loop in nelements DoS
Upstream fix: https://github.com/file/file/commit/f97486ef5dc3e8735440edc4fc8808c63e1a3ef0
2014-05-27 12:16:30 -07:00
Stanislav Malyshev 68ce2d0ea6 Fix bug #67328 (fileinfo: numerous file_printf calls resulting in performance degradation)
Upstream patch: https://github.com/file/file/commit/b8acc83781d5a24cc5101e525d15efe0482c280d
2014-05-27 12:16:16 -07:00
Anatol Belski 41f01c28bc backport this piece from 5.6, related to the #66307 fix 2014-05-27 12:16:06 -07:00
Anatol Belski 4dbe191b61 Fixed bug #66307 Fileinfo crashes with powerpoint files 2014-05-27 12:15:54 -07:00
Stanislav Malyshev 41cc924083 Fix bug #67249: printf out-of-bounds read 2014-05-27 12:15:34 -07:00
Stanislav Malyshev 6e49313d72 5.4.29 rc1 2014-05-13 21:44:00 -07:00
Stanislav Malyshev ffd74a0a29 update NEWS 2014-05-13 17:07:35 -07:00
Stanislav Malyshev dc92e81922 Merge branch 'bug67251' into PHP-5.4
* bug67251:
  Fix bug #67251 - date_parse_from_format out-of-bounds read

Conflicts:
	ext/date/lib/parse_date.c
2014-05-13 16:52:45 -07:00
Stanislav Malyshev 0094fd0969 Merge branch 'bug67252' into PHP-5.4
* bug67252:
  fix bug #67253: timelib_meridian_with_check out-of-bounds read
  Fix bug #67252: convert_uudecode out-of-bounds read
2014-05-13 16:47:27 -07:00
Stanislav Malyshev 9103c9eb4f Merge branch 'bug67250' into PHP-5.4
* bug67250:
  Fix bug #67250 (iptcparse out-of-bounds read)
2014-05-13 16:43:10 -07:00
Derick Rethans 3e276d6728 - Updated to version 2014.3 (2014c) 2014-05-13 16:36:58 +01:00
Stanislav Malyshev 6ef8e0f088 fix test - output can be chunked 2014-05-12 10:54:16 -07:00
Stanislav Malyshev 466b8aa444 fix bug #67253: timelib_meridian_with_check out-of-bounds read 2014-05-11 21:09:11 -07:00
Stanislav Malyshev 1e2818b143 Fix bug #67252: convert_uudecode out-of-bounds read 2014-05-11 20:29:27 -07:00
Stanislav Malyshev 0a80849250 Fix bug #67251 - date_parse_from_format out-of-bounds read 2014-05-11 19:34:21 -07:00
Stanislav Malyshev 3e9cb6a4a5 Fix bug #67250 (iptcparse out-of-bounds read) 2014-05-11 19:09:19 -07:00
Stanislav Malyshev 2b475eebbe Fix bug #67247 spl_fixedarray_resize integer overflow 2014-05-11 17:54:27 -07:00
Stanislav Malyshev 14dd6c2d54 fix news 2014-05-11 17:43:28 -07:00
Bob Weinand 62b2eb666d Updated NEWS 2014-05-11 15:13:40 +02:00
Bob Weinand 5bf6a093ad Fix Linux specific fail in error traces (cherry-picked and fix for bug #67245)
Linux apparently does not like memcpy in overlapping regions...
2014-05-11 15:11:03 +02:00
Felipe Pena fb3b8de98d - Fixed off-by-one in phar_build (patch by crrodriguez at opensuse dot org) 2014-05-11 09:45:17 -03:00
Felipe Pena c575ab0c88 - Move checking 2014-05-10 11:55:42 -03:00
Felipe Pena 345f6d90d5 - Fixed missing NULL check in SimpleXMLElement::xpath() 2014-05-10 11:53:40 -03:00
Felipe Pena 5bd443a452 - Fixed missing NULL check 2014-05-10 11:39:08 -03:00
Stanislav Malyshev 4392339c3e oops, 5.4 and 5.5 use malloc in TSRM 2014-05-08 01:59:39 -07:00
Stanislav Malyshev 0cc18fdfba Fix memory leak in TSRM 2014-05-08 01:00:34 -07:00
Dmitry Stogov 8517001b25 Fixed test (it requires ext/hash) 2014-05-07 00:52:49 +02:00
Dmitry Stogov f880013c4d Fixed tests (they might fail from time to time because of session GC) 2014-05-07 00:37:56 +02:00
Adam Harvey f7cb87f333 Fix author name on the #63228 patch. 2014-05-02 10:23:09 -07:00
Adam Harvey 941c39bd06 Use the right path for the suggested PHP invocation in ext_skel.
Fixes bug #67160 (ext_skel outputs incorrect information).
2014-05-01 11:22:20 -07:00
Ferenc Kovacs 1c13ad7c0e add missing NEWS entry to the correct release where it was added 2014-05-01 10:50:08 +02:00
Stanislav Malyshev 35ceea928b Fix bug #67060: use default mode of 660 2014-04-29 09:14:11 -07:00
Anatol Belski 2d625b5f81 Fixed bug #66431 Special Character via COM Interface (CP_UTF8) 2014-04-29 13:40:44 +02:00
Popa Adrian Marius bb422cb60e Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Cleanup ZEND_MODULE_API_NO => 20050922
2014-04-28 12:13:11 +03:00
Popa Adrian Marius dbcd6304bb Cleanup ZEND_MODULE_API_NO => 20050922 2014-04-28 12:12:52 +03:00
Anatol Belski d3dcd61623 fixed test 2014-04-25 17:39:53 +02:00
Anatol Belski c1aa9baf29 Fixed bug #67118 DateTime constructor crash with invalid data 2014-04-25 17:23:26 +02:00
Stanislav Malyshev 03c703b8bd add a test case previously broken by a bad fix 2014-04-24 23:58:38 -07:00
Stanislav Malyshev a328803803 Revert "Fixed bug #64604"
This reverts commit b05c088a3a.
Breaks parsing urls where query has : in it, like: /foo/bar?baz=goo:boo
2014-04-24 23:50:45 -07:00
Anatol Belski 03be983398 fix dll export 2014-04-24 10:51:42 +02:00
Jakub Zelenka 61499bf282 Fix accepting ill-formed UTF-8 characters
Conflicts:
	ext/phar/phar_path_check.c
2014-04-22 16:55:58 -07:00
Danack ea4cee93c8 Allow valid multi-byte utf-8 characters to be allowed as file names in phar archives. 2014-04-20 17:19:20 -07:00
Rouven Weßling 68283c9f4a Fix a compiler warning in php_rand.h 2014-04-20 16:35:36 -07:00
Julio Pintos 49341e992a Fix #66908: php-fpm reload leaks epoll_create() file descriptor
This patch fixes descriptor leak which could lead to DoS once Max open files is reached
2014-04-20 16:21:49 -07:00
Boro Sitnikovski a18cec1b86 Fix bug #65701: Do not use cache for file file copy 2014-04-20 15:22:44 -07:00
Anatol Belski 53c68811ba UPGRADING note about bug #67072 2014-04-18 15:43:05 +02:00
Anatol Belski c2acdbdd3d Improved the fix for bug #67072, thanks Nikita 2014-04-18 15:13:32 +02:00
Levi Morrison 6e1e98d7b8 These links to ~helly don't work anymore. 2014-04-17 17:20:24 +02:00
Anatol Belski 5328d42899 Fixed bug #67072 Echoing unserialized "SplFileObject" crash
The actual issue lays in the unserializer code which doesn't honor
the unserialize callback. By contrast, the serialize callback is
respected. This leads to the situation that even if a class has
disabled the serialization explicitly, user could still construct
a vulnerable string which would result bad things when trying
to unserialize.

This conserns also the classes implementing Serializable as well
as some core classes disabling serialize/unserialize callbacks
explicitly (PDO, SimpleXML, SplFileInfo and co). As of now, the
flow is first to call the unserialize callback (if available),
then call __wakeup. If the unserialize callback returns with no
success, no object is instantiated. This makes the scheme used
by internal classes effective, to disable unserialize just assign
zend_class_unserialize_deny as callback.
2014-04-17 10:48:14 +02:00
Anatol Belski 7a5f1663c6 correct the bug #67081 fix 2014-04-16 15:06:57 +02:00
Anatol Belski 5224614f23 Fixed bug #67081 DOMDocumentType->internalSubset returns entire DOCTYPE tag, not only the subset 2014-04-16 14:13:45 +02:00
Stanislav Malyshev 1d34d82231 5.4.29 is next 2014-04-15 16:51:38 -07:00
Stanislav Malyshev eea75e7146 Fix test - on CI somebody could create a process in the meantime 2014-04-14 15:44:23 -07:00
Anatol Belski 24b72e7a27 fix windows build 2014-04-14 23:29:38 +02:00
Chuan Ma a186312832 Fix #66942: openssl_seal() memory leak
Fix #66952: memory leak in openssl_open()
2014-04-14 13:24:14 -07:00
Stanislav Malyshev 56f9727305 ws fix 2014-04-14 13:16:53 -07:00
Stanislav Malyshev ad1b9eef98 Fix null byte in LDAP bindings 2014-04-14 10:44:53 -07:00
Stanislav Malyshev 40a9316dff Fix bug #66171: better handling of symlinks 2014-04-14 10:44:53 -07:00
Anatol Belski 4268504084 backported some ext/intl tests from 5.6 into 5.4 2014-04-14 16:31:18 +02:00
Anatol Belski 95c57bb646 Fixed bug #67033 Remove reference to Windows 95 2014-04-14 09:32:31 +02:00
Stanislav Malyshev b80243aece fix NEWS 2014-04-13 20:16:27 -07:00
Stanislav Malyshev 5e66ce9293 Merge branch 'pull-request/518' into PHP-5.4
* pull-request/518:
  Fix #66021 (Blank line inside empty array/object)
2014-04-13 18:50:39 -07:00
Ingo Walz b05c088a3a Fixed bug #64604 2014-04-13 18:37:40 -07:00
Freek 5558d0db9b Fix #66562: Consistency bug where curl_multi_getcontent behaves different from curl_exec
curl_exec returns an empty string when data is received from a domain that returns zero content. curl_multi_getcontent
returned null. Now it returns an empty string fixing the incosistency
2014-04-13 18:12:17 -07:00
itxx00 636adf251c Fix bug #66482, replace wrong item name 'priority' with 'process.priority' in php-fpm.conf 2014-04-13 17:30:50 -07:00
Stanislav Malyshev 3a2660b302 Fix windows build 2014-04-13 17:02:21 -07:00
Boro Sitnikovski 8c88b6e81c Fix bug #66721
Add NULL check to php_date_parse_tzfile's retval
2014-04-13 15:51:55 -07:00
Jeff Trawick 442264ffd6 fix apr_psprintf format string from e0df4e3dba 2014-04-13 15:36:43 -07:00
Gabor Buella 1010200da5 Fixed bug #67024 - getimagesize should recognize BMP files with negative height 2014-04-13 15:17:04 -07:00
Bob Weinand beda5093b4 Reverted to 5a0da281e5
Discussion: http://news.php.net/php.cvs/76836
2014-04-13 23:01:31 +02:00
Bob Weinand f07e37c96d Forgot title in phpt for bug #67064 2014-04-13 19:34:17 +02:00
Bob Weinand 2f3056fecc Updated NEWS 2014-04-13 19:32:51 +02:00
Bob Weinand 1a4a9eede5 Fix bug #67064 in a BC safe way
You can use an optional parameter now when implementing the Countable interface
to get the $mode passed to count().
2014-04-13 19:24:12 +02:00
Ferenc Kovacs 5a0da281e5 fix typo 2014-04-13 01:55:55 +02:00
Bob Weinand edd90e5ae3 Made usage of php_hash_environment useful by updating instead of just adding argc 2014-04-12 23:53:21 +02:00
Popa Adrian Marius 1c3ed86211 Cleanup $ is not needed for git 2014-04-10 17:42:32 +03:00
Ferenc Kovacs 9540ced221 fix typo 2014-04-10 07:05:07 +02:00
Ferenc Kovacs 2c8aeda6dc abstract namespace for unix sockets is a linux only feature 2014-04-09 19:01:01 +02:00
Popa Adrian Marius 0ea731fc83 cleanup 2014-04-08 17:51:06 +03:00
Popa Adrian Marius cc20351134 Fixes bug #66071: isc_interprete is unsafe and deprecated , it is replaced with fb_iterpret 2014-04-08 17:50:41 +03:00
Anatol Belski a0beddf5e9 Fixed bug #66084 simplexml_load_string() mangles empty node name 2014-04-05 09:46:24 +02:00
Stanislav Malyshev 7e5de3a1ce cleanup NEWS 2014-04-03 15:54:00 -07:00
Michael Wallner d08b4dbf23 Fix Bug #66736 fpassthru broken 2014-04-03 10:40:06 +02:00
Michael Wallner 7ab5c593f7 Fix bug #66182 exit in stream filter produces segfault
Unfortunately, a segv caused by exit cannot be tested reliably.
2014-04-03 09:07:35 +02:00
Michael Wallner 1ec83d44a1 Fixed bug #61019 (Out of memory on command stream_get_contents) 2014-04-02 15:36:39 +02:00
Michael Wallner 91a9d24aa3 Fix bug #64330
stream_socket_server() creates wrong Abstract Namespace UNIX sockets
2014-04-02 11:09:26 +02:00
Anatol Belski f244513fc0 updated NEWS 2014-04-01 10:11:40 +02:00
Anatol Belski fca1501ed6 added test for bug #53965 2014-04-01 10:08:08 +02:00
Anatol Belski 3cb056f523 Fixed bug #53965 <xsl:include> cannot find files w/ relative paths when loaded w/ "file://" 2014-04-01 10:07:18 +02:00
Remi Collet fca331cae9 NEWS 2014-03-31 16:57:02 +02:00
Remi Collet 2c204a55af Fixed Bug #66987 Memory corruption in fileinfo ext (bigendian)
On little endian:
	map->p == php_magic_database
	map->magic[i] = pointer into the map

	map->p == NULL
	map->magic[i] = pointer to allocated memory

On big endian (ppc64, s390x, ...):
	map->p != php_magic_database and map->p != NULL
        map->magic[i] = pointer into a copy of the map

Trying to efree pointer in the later cause memory corruption
Thanks to dkatulek / Red Hat for the report.
2014-03-31 16:50:47 +02:00
Anatol Belski 1283722589 update lib versions 2014-03-27 18:18:06 +01:00
Derick Rethans 170cf3ec00 - Updated to version 2014.2 (2014b) 2014-03-25 12:17:14 +00:00
Remi Collet 3616db6d38 NEWS 2014-03-25 11:00:47 +01:00
Remi Collet 4374a52e9d Fixed bug #66946 extensive backtracking in awk rule regular expression
CVE-2013-7345

Applied upstream patch:
https://github.com/file/file/commit/ef2329cf71acb59204dd981e2c6cce6c81fe467c

Add the magicdata.patch to track patches applied to upstream data file.
2014-03-25 11:00:33 +01:00
Remi Collet 1df558c6a0 Fixed bug #66946 extensive backtracking in awk rule regular expression
CVE-2013-7345

Applied upstream patch:
https://github.com/file/file/commit/ef2329cf71acb59204dd981e2c6cce6c81fe467c

Add the magicdata.patch to track patches applied to upstream data file.
2014-03-25 10:58:50 +01:00
Anatol Belski 6612e1ba6a more fixes related to bug #65715 2014-03-24 19:15:02 +01:00
Anatol Belski 5efda763be updated NEWS 2014-03-24 10:28:21 +01:00
Anatol Belski 17a57ad980 Fixed bug #65715 php5embed.lib isn't provided anymore 2014-03-24 10:24:37 +01:00
Stanislav Malyshev 9b88bc494e prep for 5.4.27 rc1 2014-03-18 23:19:09 -07:00
Derick Rethans b30304fb78 - Updated to version 2014.1 (2014a) 2014-03-18 14:48:55 +00:00
Mateusz Kocielski 497b918e62 Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Fixed off-by-one in php_url_parse_ex

Conflicts:
	ext/standard/url.c
2014-03-18 08:54:57 +01:00
Mateusz Kocielski 46566b78c9 Fixed off-by-one in php_url_parse_ex
Change order of condition, previously pointer could be derefrenced before
bound check was done.
2014-03-18 08:48:41 +01:00
Remi Collet 87a87c6682 NEWS 2014-03-14 09:51:53 +01:00
Remi Collet 17f6391bf8 Fixed Bug #66833 Default digest algo is still MD5
Switch to SHA1, which match internal openssl hardcoded algo.

In most case, won't even be noticed
- priority on user input (default_md)
- fallback on system config
- fallback on this default value

Recent system reject MD5 digest, noticed in bug36732.phpt failure.

While SHA1 is better than MD5, SHA256 is recommenced,
and defined as default algo in provided configuration on
recent system (Fedora 21, RHEL-7, ...). But the idea is to
keep in sync with openssl internal value for PHP internal value.
2014-03-14 09:50:15 +01:00
Michael Meyer 737c187013 Typo fix: sicret -> secret 2014-03-13 12:37:25 +02:00
Tjerk Meesters ddd7ed9b24 Removed bogus loops 2014-03-11 19:08:18 +08:00
Anatol Belski 1a624e27a6 restored the old code in 5.4/5 related to bug #66872
The crash is reproducable in 5.6+ only, so 5.4 and 5.5 are fine
with the old code.
2014-03-11 11:50:14 +01:00
Christopher Jones 4dc8610d34 Merge branch 'PHP-5.4' of https://git.php.net/repository/php-src into PHP-5.4
# By Pierre Joye
# Via Pierre Joye
* 'PHP-5.4' of https://git.php.net/repository/php-src:
  fix #66872, invalid argument crashes gmp_testbit
  fix #66872, invalid argument crashes gmp_testbit
  add vc12 (2013)
2014-03-10 16:46:39 -07:00
Pierre Joye 8391277fb8 Merge branch 'PHP-5.4' of git.php.net:php-src into PHP-5.4
# By Anatol Belski
# Via Anatol Belski
* 'PHP-5.4' of git.php.net:php-src:
  updated libmagic.patch
2014-03-10 16:31:09 +01:00
Anatol Belski b9d494a33b updated libmagic.patch 2014-03-10 14:12:20 +01:00
Pierre Joye 28fa31d6e5 fix #66872, invalid argument crashes gmp_testbit 2014-03-10 12:07:58 +01:00
Pierre Joye af41914e15 fix #66872, invalid argument crashes gmp_testbit 2014-03-10 12:06:40 +01:00
Pierre Joye cedc718f73 Merge branch 'PHP-5.4' of git.php.net:php-src into PHP-5.4
# By Dmitry Panin (1) and Remi Collet (1)
# Via Nikita Popov
* 'PHP-5.4' of git.php.net:php-src:
  Fix HTML entity table generation
  Set default Digest Message to use SHA1 instead of MD5 in openssl tests as MD5 signature are now rejected by newer openssl Version.
2014-03-10 12:04:04 +01:00
Dmitry Panin e2fc6b52f0 Fix HTML entity table generation 2014-03-06 23:10:31 +01:00
Remi Collet 721b9a7c8d Set default Digest Message to use SHA1 instead of MD5 in openssl tests
as MD5 signature are now rejected by newer openssl Version.

Noticed in RHEL-7 and Fedora 21 build.
2014-03-06 10:14:08 +01:00
Pierre Joye e590aceb5a Merge branch 'PHP-5.4' of git.php.net:php-src into PHP-5.4
# By Anatol Belski (22) and others
# Via Derick Rethans (5) and others
* 'PHP-5.4' of git.php.net:php-src: (176 commits)
  NEWS
  Fixed Bug #66820 out-of-bounds memory access in fileinfo
  Improves fix for memory leak, keep in sync with upstream.
  Updated news for #60602
  proc_open(): separate environment values that aren't strings
  Updated NEWS for #66535
  Fixed test case title
  [bug 66535] X-PHP-Originating-Script adds newline if no custom headers are given
  man page: long option name is --strip, not --stripped
  --global have be removed in 5.2
  NEWS
  test for bug #66762
  Fixed Bug #66762 Segfault in mysqli_stmt::bind_result() when link closed
  fix tests broken by 633f898f15
  add news entry
  add clear_env option to FPM config
  Reduce test noise on cross Oracle client <-> server version tests. This fix is already in PHP 5.6+
  Reduce test noise in cross Oracle client <-> server version testing. This change is already in PHP 5.6+
  fixed macro
  Make sure value is initialized
  ...
2014-03-05 10:32:42 +01:00
Remi Collet c2a9f73c99 NEWS 2014-03-04 20:35:56 +01:00
Remi Collet a33759fd27 Fixed Bug #66820 out-of-bounds memory access in fileinfo
Upstream fix:
https://github.com/glensc/file/commit/447558595a3650db2886cd2f416ad0beba965801

Notice, test changed, with upstream agreement:
-define OFFSET_OOB(n, o, i)	((n) < (o) || (i) >= ((n) - (o)))
+define OFFSET_OOB(n, o, i)	((n) < (o) || (i) >  ((n) - (o)))
2014-03-04 20:32:52 +01:00
Remi Collet 731013ee8e Improves fix for memory leak, keep in sync with upstream.
Previous fix:
http://git.php.net/?p=php-src.git;a=commitdiff;h=10eb0070700382f966bf260e44135e1f724a15d2

Upstream fix:
https://github.com/glensc/file/commit/c0c0032b9e9eb57b91fefef905a3b018bab492d9
2014-03-04 13:41:37 +01:00
Tjerk Meesters 1533f98afd Updated news for #60602 2014-03-03 05:54:09 +08:00
Tjerk Meesters e73c05b75e proc_open(): separate environment values that aren't strings
Added a test case
2014-03-03 05:49:52 +08:00
Tjerk Meesters 362b70a32c Updated NEWS for #66535 2014-03-01 08:47:32 +08:00
Tjerk Meesters eca13f7909 Fixed test case title 2014-02-28 22:27:32 +08:00
Tjerk Meesters 79b3c2a744 [bug 66535] X-PHP-Originating-Script adds newline if no custom headers are given
A newline is added to the mail headers when mail.add_x_header is used and no other headers are passed to mail().

The scenario in which custom headers are used was already fixed in #48620, back in 2009.
2014-02-28 22:22:07 +08:00
Remi Collet b1df743b7a man page: long option name is --strip, not --stripped 2014-02-28 08:12:03 +01:00
Remi Collet c73b0543f1 --global have be removed in 5.2 2014-02-28 08:10:01 +01:00
Remi Collet 33d372a45f NEWS 2014-02-27 08:49:08 +01:00
Remi Collet 816a5d2072 test for bug #66762 2014-02-27 08:48:01 +01:00
Remi Collet 9137acc7ec Fixed Bug #66762 Segfault in mysqli_stmt::bind_result() when link closed
Each new mysqli_stmt now increase the refcount of the link object.
So the link is really destroy after all statements.

Only implemented with libmysqlclient, as mysqlnd already implement
this internally.

So, libmysqlclient and mysqlnd have the same behavior.
2014-02-27 08:45:16 +01:00
Ferenc Kovacs bd961f3e87 fix tests broken by 633f898f15 2014-02-27 02:31:42 +01:00
Antony Dovgal 4d9c556b5d add news entry 2014-02-25 12:14:50 +04:00
Paul Annesley eb6941e902 add clear_env option to FPM config
This makes it possible to leave the envoronment as is on startup and
pass all the variables to the workers.
The default value of clear_env is "yes", preserving previous behaviour.
Patch by Paul Annesley.
2014-02-25 12:12:09 +04:00
Christopher Jones ee7671afb5 Reduce test noise on cross Oracle client <-> server version tests.
This fix is already in PHP 5.6+
2014-02-24 17:01:30 -08:00
Christopher Jones 8cdefd3d10 Reduce test noise in cross Oracle client <-> server version testing.
This change is already in PHP 5.6+
2014-02-24 16:33:41 -08:00
Anatol Belski c6a4a7cad6 fixed macro 2014-02-24 10:12:18 +01:00
Johannes Schlüter 3f258e6b46 Make sure value is initialized 2014-02-23 14:55:29 +01:00
Johannes Schlüter 756ee95605 We can't dereference dbh if it is NULL 2014-02-23 14:18:24 +01:00
Anatol Belski ce1fd72776 updated libmagic.patch in 5.4/5 2014-02-20 19:00:05 +01:00
Anatol Belski 10eb007070 fixed leak introduced after CVE/upgrade 2014-02-20 18:53:53 +01:00
Bob Weinand afa03a470e Use nicer output for characters < 32 and > 126 in exception strings
Using question marks might confuse more than it helps.
Users are wondering what happened to their string...
2014-02-20 17:39:58 +01:00
Daniel Lowrey 633f898f15 Skip failing tests when EC unavailable (RHEL) 2014-02-19 03:57:37 -07:00
Anatol Belski a289b37f48 updated libmagic.patch 2014-02-18 19:08:16 +01:00
Stanislav Malyshev ee4b3892f8 update news with CVE 2014-02-18 08:36:51 -08:00
Remi Collet 9f449df1e4 NEWS 2014-02-18 13:56:58 +01:00
Remi Collet 89f864c547 Fixed Bug #66731 file: infinite recursion
Upstream commit (available in file-5.17)

https://github.com/glensc/file/commit/3c081560c23f20b2985c285338b52c7aae9fdb0f
https://github.com/glensc/file/commit/cc9e74dfeca5265ad725acc926ef0b8d2a18ee70
2014-02-18 13:54:33 +01:00
Stanislav Malyshev c612440e0f 5.4.27 now 2014-02-17 21:19:25 -08:00
Pierre Joye 9b54901ffb add vc12 (2013) 2013-11-04 22:19:02 +01:00
Kevin Israel 82a4f1a1a2 Fix #66021 (Blank line inside empty array/object)
Changed json_encode() so that when the JSON_PRETTY_PRINT option is specified,
the pair of linefeeds immediately after an opening bracket and before the
corresponding closing bracket is omitted when the array or object contains no
elements or accessible properties (and hence would have a blank line between
the brackets).
2013-11-02 15:59:11 -04:00
204 changed files with 28033 additions and 22581 deletions

No files matched your search

+130 -3
View File
@@ -1,13 +1,139 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2014, PHP 5.4.26
29 May 2014, PHP 5.4.29
?? ??? 2014, PHP 5.4.26
- COM:
. Fixed bug #66431 (Special Character via COM Interface (CP_UTF8)). (Anatol)
- Core:
. Fixed bug #65701 (copy() doesn't work when destination filename is created
by tempnam()). (Boro Sitnikovski)
. Fixed bug #67072 (Echoing unserialized "SplFileObject" crash). (Anatol)
. Fixed bug #67245 (usage of memcpy() with overlapping src and dst in
zend_exceptions.c). (Bob)
. Fixed bug #67247 (spl_fixedarray_resize integer overflow). (Stas)
. Fixed bug #67249 (printf out-of-bounds read). (Stas)
. Fixed bug #67250 (iptcparse out-of-bounds read). (Stas)
. Fixed bug #67252 (convert_uudecode out-of-bounds read). (Stas)
- Date:
. Fixed bug #67118 (DateTime constructor crash with invalid data). (Anatol)
. Fixed bug #67251 (date_parse_from_format out-of-bounds read). (Stas)
. Fixed bug #67253 (timelib_meridian_with_check out-of-bounds read). (Stas)
- DOM:
. Fixed bug #67081 (DOMDocumentType->internalSubset returns entire DOCTYPE tag,
not only the subset). (Anatol)
- Fileinfo:
. Fixed bug #66307 (Fileinfo crashes with powerpoint files). (Anatol)
. Fixed bug #67327 (fileinfo: CDF infinite loop in nelements DoS).
(CVE-2014-0238)
. Fixed bug #67328 (fileinfo: fileinfo: numerous file_printf calls resulting in
performance degradation). (CVE-2014-0237)
- FPM:
. Fixed bug #66908 (php-fpm reload leaks epoll_create() file descriptor).
(Julio Pintos)
- Phar:
. Fix bug #64498 ($phar->buildFromDirectory can't compress file with an accent
in its name). (PR #588)
01 May 2014, PHP 5.4.28
- Core:
. Fixed bug #61019 (Out of memory on command stream_get_contents). (Mike)
. Fixed bug #64330 (stream_socket_server() creates wrong Abstract Namespace
UNIX sockets). (Mike)
. Fixed bug #66171 (Symlinks and session handler allow open_basedir bypass).
(Jann Horn, Stas)
. Fixed bug #66182 (exit in stream filter produces segfault). (Mike)
. Fixed bug #66736 (fpassthru broken). (Mike)
. Fixed bug #67024 (getimagesize should recognize BMP files with negative
height). (Gabor Buella)
. Fixed bug #67033 (Remove reference to Windows 95). (Anatol)
- cURL:
. Fixed bug #66562 (curl_exec returns differently than curl_multi_getcontent).
(Freek Lijten)
- Date:
. Fixed bug #66721 (__wakeup of DateTime segfaults when invalid object data is
supplied). (Boro Sitnikovski)
- Embed:
. Fixed bug #65715 (php5embed.lib isn't provided anymore). (Anatol)
- Fileinfo:
. Fixed bug #66987 (Memory corruption in fileinfo ext / bigendian).
(Remi)
- FPM:
. Fixed bug #66482 (unknown entry 'priority' in php-fpm.conf).
. Fixed bug #67060 (sapi/fpm: possible privilege escalation due to insecure
default configuration) (CVE-2014-0185). (Stas)
- JSON:
. Fixed bug #66021 (Blank line inside empty array/object when
JSON_PRETTY_PRINT is set). (Kevin Israel)
- LDAP:
. Fixed issue with null bytes in LDAP bindings. (Matthew Daley)
- OpenSSL:
. Fix bug #66942 (memory leak in openssl_seal()). (Chuan Ma)
. Fix bug #66952 (memory leak in openssl_open()). (Chuan Ma)
- SimpleXML:
. Fixed bug #66084 (simplexml_load_string() mangles empty node name)
(Anatol)
- XSL:
. Fixed bug #53965 (<xsl:include> cannot find files with relative paths
when loaded with "file://"). (Anatol)
- Apache2 Handler SAPI:
. Fixed Apache log issue caused by APR's lack of support for %zu
(APR issue https://issues.apache.org/bugzilla/show_bug.cgi?id=56120).
(Jeff Trawick)
03 Apr 2014, PHP 5.4.27
- Core:
. Fixed bug #60602 (proc_open() changes environment array) (Tjerk)
- Fileinfo:
. Fixed bug #66946 (fileinfo: extensive backtracking in awk rule regular
expression). (CVE-2013-7345) (Remi)
- FPM:
. Added clear_env configuration directive to disable clearenv() call.
(Github PR# 598, Paul Annesley)
- GMP
. Fixed bug #66872 (invalid argument crashes gmp_testbit) (Pierre)
- Mail:
. Fixed bug #66535 (Don't add newline after X-PHP-Originating-Script) (Tjerk)
- MySQLi:
. Fixed bug #66762 (Segfault in mysqli_stmt::bind_result() when link closed)
(Remi)
- Openssl:
. Fixed bug #66833 (Default disgest algo is still MD5, switch to SHA1). (Remi)
06 Mar 2014, PHP 5.4.26
- JSON:
. Fixed bug #65753 (JsonSerializeable couldn't implement on module extension)
(chobieeee@php.net)
- Fileinfo:
. Fixed bug #66731 (file: infinite recursion). (CVE-2014-1943) (Remi)
. Fixed bug #66820 (out-of-bounds memory access in fileinfo). (Remi)
- LDAP:
. Implemented ldap_modify_batch (https://wiki.php.net/rfc/ldap_modify_batch).
(Ondřej Hošek)
@@ -609,7 +735,8 @@ PHP NEWS
. Fixed bug #63999 (php with fpm fails to build on Solaris 10 or 11). (Adam)
- Litespeed:
. Fixed bug #63228 (-Werror=format-security error in lsapi code). (George)
. Fixed bug #63228 (-Werror=format-security error in lsapi code).
(Elan Ruusamäe, George)
- ext/sqlite3:
. Fixed bug #63921 (sqlite3::bindvalue and relative PHP functions aren't
+1 -1
View File
@@ -2,7 +2,7 @@
#define TSRM_CONFIG_COMMON_H
#ifndef __CYGWIN__
# if WINNT|WIN32
# ifdef _WIN32
# define TSRM_WIN32
# endif
#endif
+3
View File
@@ -350,6 +350,9 @@ PHP 5.4 UPGRADE NOTES
- Since 5.4.7, ctor is always called when new user stream wrapper object is created.
Before, it was called only when stream_open was called.
- Manipulated serialization strings for objects implementing Serializable by
replacing "C:" with "O:" at the start will now produce an error.
==============================
5. Changes to existing classes
==============================
+15
View File
@@ -12,6 +12,7 @@ UPGRADE NOTES - PHP X.Y
g. leak_variable
h. API Signature changes
i. new TSRM function expand_filepath_with_mode
j. unserialization of manipulated object strings
2. Build system changes
a. Unix build system changes
@@ -189,6 +190,20 @@ it increments the refcounts of those objects instead.
PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, const char *relative_to, size_t relative_to_len, int realpath_mode TSRMLS_DC);
expand_filepath_with_mode lets define how realpath will behave, using one of the existing mode: CWD_EXPAND , CWD_FILEPATH or CWD_REALPATH.
j.
Strings requiring unserialization of objects are now explicitly checked
whether the object they contain implements the Serializable interface.
This solves the situation where manipulated strings could be passed for
objects using Serializable to disallow serialization. An object
implementing Serializable will always start with "C:" in the serialized
string, all other objects are represented with starting "O:". Objects
implementing Serializable to disable serialization using
zend_class_unserialize_deny and zend_class_serialize_deny, when
instantiated from the serializer with a manipulated "O:" string at the
start, will most likely be defectively initialized. This is now
fixed at the appropriate place by checking for the presence of the
serialize callback in the class entry.
========================
2. Build system changes
========================
+58 -3
View File
@@ -360,6 +360,11 @@ ZEND_METHOD(error_exception, getSeverity)
} \
}
#define TRACE_ARG_APPEND(vallen) \
*str = (char*)erealloc(*str, *len + 1 + vallen); \
memmove((*str) + *len - l_added + 1 + vallen, (*str) + *len - l_added + 1, l_added);
/* }}} */
static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
@@ -371,7 +376,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
len = va_arg(args, int*);
/* the trivial way would be to do:
* conver_to_string_ex(arg);
* convert_to_string_ex(arg);
* append it and kill the now tmp arg.
* but that could cause some E_NOTICE and also damn long lines.
*/
@@ -394,8 +399,58 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
l_added += 3 + 1;
}
while (--l_added) {
if ((*str)[*len - l_added] < 32) {
(*str)[*len - l_added] = '?';
unsigned char chr = (*str)[*len - l_added];
if (chr < 32 || chr == '\\' || chr > 126) {
(*str)[*len - l_added] = '\\';
switch (chr) {
case '\n':
TRACE_ARG_APPEND(1);
(*str)[++(*len) - l_added] = 'n';
break;
case '\r':
TRACE_ARG_APPEND(1);
(*str)[++(*len) - l_added] = 'r';
break;
case '\t':
TRACE_ARG_APPEND(1);
(*str)[++(*len) - l_added] = 't';
break;
case '\f':
TRACE_ARG_APPEND(1);
(*str)[++(*len) - l_added] = 'f';
break;
case '\v':
TRACE_ARG_APPEND(1);
(*str)[++(*len) - l_added] = 'v';
break;
#ifndef PHP_WIN32
case '\e':
#else
case VK_ESCAPE:
#endif
TRACE_ARG_APPEND(1);
(*str)[++(*len) - l_added] = 'e';
break;
case '\\':
TRACE_ARG_APPEND(1);
(*str)[++(*len) - l_added] = '\\';
break;
default:
TRACE_ARG_APPEND(3);
(*str)[*len - l_added + 1] = 'x';
if ((chr >> 4) < 10) {
(*str)[*len - l_added + 2] = (chr >> 4) + '0';
} else {
(*str)[*len - l_added + 2] = (chr >> 4) + 'A' - 10;
}
if (chr % 16 < 10) {
(*str)[*len - l_added + 3] = chr % 16 + '0';
} else {
(*str)[*len - l_added + 3] = chr % 16 + 'A' - 10;
}
*len += 3;
}
}
}
break;
+1 -1
View File
@@ -57,7 +57,7 @@ ZEND_API void zend_html_putc(char c)
ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC)
{
const unsigned char *ptr = (const unsigned char*)s, *end = ptr + len;
unsigned char *filtered;
unsigned char *filtered = NULL;
size_t filtered_len;
if (LANG_SCNG(output_filter)) {
+2 -2
View File
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=5
PHP_MINOR_VERSION=4
PHP_RELEASE_VERSION=26
PHP_EXTRA_VERSION="-dev"
PHP_RELEASE_VERSION=29
PHP_EXTRA_VERSION=""
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
+6
View File
@@ -229,6 +229,9 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
#endif
if (php_check_open_basedir(path_copy TSRMLS_CC)) {
#ifdef VIRTUAL_DIR
free(path_copy);
#endif
return NULL;
}
@@ -238,6 +241,9 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
if (opened_path && bz_file) {
*opened_path = estrdup(path_copy);
}
#ifdef VIRTUAL_DIR
free(path_copy);
#endif
path_copy = NULL;
if (bz_file == NULL) {
+6
View File
@@ -46,7 +46,13 @@ PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string, uint strin
if (string_len > 0) {
olestring = (OLECHAR*)safe_emalloc(string_len, sizeof(OLECHAR), 0);
/* XXX if that's a real multibyte string, olestring is obviously allocated excessively.
This should be fixed by reallocating the olestring, but as emalloc is used, that doesn't
matter much. */
ok = MultiByteToWideChar(codepage, flags, string, string_len, olestring, string_len);
if (ok > 0 && ok < string_len) {
olestring[ok] = '\0';
}
} else {
ok = FALSE;
olestring = (OLECHAR*)emalloc(sizeof(OLECHAR));
+5 -1
View File
@@ -154,7 +154,11 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep
case IS_STRING:
V_VT(v) = VT_BSTR;
olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRLEN_P(z), codepage TSRMLS_CC);
V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRLEN_P(z) * sizeof(OLECHAR));
if (CP_UTF8 == codepage) {
V_BSTR(v) = SysAllocStringByteLen((char*)olestring, wcslen(olestring) * sizeof(OLECHAR));
} else {
V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRLEN_P(z) * sizeof(OLECHAR));
}
efree(olestring);
break;
+42
View File
@@ -0,0 +1,42 @@
--TEST--
Bug #66431 Special Character via COM Interface (CP_UTF8), Scripting.FileSystemObject
--SKIPIF--
<?php
if (!extension_loaded("com_dotnet")){ echo "skip COM/.Net support not present"; }
?>
--FILE--
<?php
$text= "Xin chào cộng đồng PHP";
$fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.txt");
$fso = new COM("Scripting.FileSystemObject");
$fh = $fso->OpenTextFile($fpath, 2, true);
$fh->Write($text);
$fh->Close();
$check_text = file_get_contents($fpath);
$result = ($check_text == $text);
var_dump($result);
if (!$result) {
echo "Expected: '$check_text'\n";
echo "Have: '$text'\n";
}
?>
===DONE===
--CLEAN--
<?php
$fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.txt");
if (file_exists($fpath)) {
unlink($fpath);
}
?>
--EXPECT--
bool(true)
===DONE===
+60
View File
@@ -0,0 +1,60 @@
--TEST--
Bug #66431 Special Character via COM Interface (CP_UTF8), Application.Word
--SKIPIF--
<?php
if (!extension_loaded("com_dotnet")){ echo "skip COM/.Net support not present"; }
try {
new COM("word.application", NULL, CP_UTF8);
} catch (Exception $e) {
die('skip ' . $e->getMessage();
}
?>
--FILE--
<?php
$text= "Xin chào cộng đồng PHP";
$fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.docx");
com_load_typelib('Word.Application');
$Wrd = new COM("word.application", NULL, CP_UTF8);
$Wrd->Documents->Add();
$Wrd->Selection->TypeText($text);
$Wrd->ActiveDocument->SaveAs($fpath);
$Wrd->ActiveDocument->Close(false);
$Wrd->Application->Quit();
unset($Wrd);
$Wrd = new COM("word.application", NULL, CP_UTF8);
$Wrd->Documents->Open($fpath, NULL, false);
$check_text = $Wrd->ActiveDocument->Range($Wrd->ActiveDocument->Sentences(1)->Start, $Wrd->ActiveDocument->Sentences(1)->End)->Text;
$Wrd->ActiveDocument->Close(false);
$Wrd->Application->Quit();
unset($Wrd);
/* trim the returned text as we'll get windows eol from a word doc. */
$result = (trim($check_text) == $text);
var_dump($result);
if (!$result) {
echo "Expected: '$check_text'\n";
echo "Have: '$text'\n";
}
?>
===DONE===
--CLEAN--
<?php
$fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.docx");
if (file_exists($fpath)) {
unlink($fpath);
}
?>
--EXPECT--
bool(true)
===DONE===
+2
View File
@@ -253,6 +253,8 @@ PHP_FUNCTION(curl_multi_getcontent)
smart_str_0(&ch->handlers->write->buf);
RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 1);
}
RETURN_EMPTY_STRING();
}
/* }}} */
+5 -3
View File
@@ -23,16 +23,18 @@ if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_R
$url = "{$host}/get.php?test=get";
$ch = curl_init();
$alldata = '';
ob_start(); // start output buffering
curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
curl_setopt($ch, CURLOPT_WRITEFUNCTION, function ($ch, $data) {
echo 'Data: '.$data;
$GLOBALS['alldata'] .= $data;
return strlen ($data);
});
curl_exec($ch);
curl_close($ch);
ob_end_flush();
echo "Data: $alldata";
?>
===DONE===
--EXPECTF--
+106 -99
View File
@@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 on Sat Jan 25 15:48:30 2014 */
/* Generated by re2c 0.13.5 on Tue May 13 16:52:44 2014 */
#line 1 "ext/date/lib/parse_date.re"
/*
+----------------------------------------------------------------------+
@@ -403,9 +403,12 @@ static timelib_sll timelib_meridian_with_check(char **ptr, timelib_sll h)
{
timelib_sll retval = 0;
while (!strchr("AaPp", **ptr)) {
while (**ptr && !strchr("AaPp", **ptr)) {
++*ptr;
}
if(!**ptr) {
return TIMELIB_UNSET;
}
if (**ptr == 'a' || **ptr == 'A') {
if (h == 12) {
retval = -12;
@@ -872,11 +875,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
std:
s->tok = cursor;
s->len = 0;
#line 998 "ext/date/lib/parse_date.re"
#line 1001 "ext/date/lib/parse_date.re"
#line 880 "ext/date/lib/parse_date.c"
#line 883 "ext/date/lib/parse_date.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -996,7 +999,7 @@ std:
}
yy2:
YYDEBUG(2, *YYCURSOR);
#line 1084 "ext/date/lib/parse_date.re"
#line 1087 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@@ -1012,7 +1015,7 @@ yy2:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 1016 "ext/date/lib/parse_date.c"
#line 1019 "ext/date/lib/parse_date.c"
yy3:
YYDEBUG(3, *YYCURSOR);
++YYCURSOR;
@@ -1035,7 +1038,7 @@ yy3:
}
yy4:
YYDEBUG(4, *YYCURSOR);
#line 1678 "ext/date/lib/parse_date.re"
#line 1681 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@@ -1048,7 +1051,7 @@ yy4:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
#line 1052 "ext/date/lib/parse_date.c"
#line 1055 "ext/date/lib/parse_date.c"
yy5:
YYDEBUG(5, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1359,12 +1362,12 @@ yy12:
if (yych <= '9') goto yy1385;
yy13:
YYDEBUG(13, *YYCURSOR);
#line 1773 "ext/date/lib/parse_date.re"
#line 1776 "ext/date/lib/parse_date.re"
{
add_error(s, "Unexpected character");
goto std;
}
#line 1368 "ext/date/lib/parse_date.c"
#line 1371 "ext/date/lib/parse_date.c"
yy14:
YYDEBUG(14, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2421,11 +2424,11 @@ yy49:
if (yych <= '9') goto yy55;
yy50:
YYDEBUG(50, *YYCURSOR);
#line 1762 "ext/date/lib/parse_date.re"
#line 1765 "ext/date/lib/parse_date.re"
{
goto std;
}
#line 2429 "ext/date/lib/parse_date.c"
#line 2432 "ext/date/lib/parse_date.c"
yy51:
YYDEBUG(51, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2434,12 +2437,12 @@ yy52:
YYDEBUG(52, *YYCURSOR);
++YYCURSOR;
YYDEBUG(53, *YYCURSOR);
#line 1767 "ext/date/lib/parse_date.re"
#line 1770 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 2443 "ext/date/lib/parse_date.c"
#line 2446 "ext/date/lib/parse_date.c"
yy54:
YYDEBUG(54, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2826,7 +2829,7 @@ yy72:
if (yych == 's') goto yy74;
yy73:
YYDEBUG(73, *YYCURSOR);
#line 1746 "ext/date/lib/parse_date.re"
#line 1749 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@@ -2841,7 +2844,7 @@ yy73:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 2845 "ext/date/lib/parse_date.c"
#line 2848 "ext/date/lib/parse_date.c"
yy74:
YYDEBUG(74, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3603,7 +3606,7 @@ yy166:
}
yy167:
YYDEBUG(167, *YYCURSOR);
#line 1609 "ext/date/lib/parse_date.re"
#line 1612 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@@ -3620,7 +3623,7 @@ yy167:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
#line 3624 "ext/date/lib/parse_date.c"
#line 3627 "ext/date/lib/parse_date.c"
yy168:
YYDEBUG(168, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4140,7 +4143,7 @@ yy193:
}
yy194:
YYDEBUG(194, *YYCURSOR);
#line 1668 "ext/date/lib/parse_date.re"
#line 1671 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@@ -4149,7 +4152,7 @@ yy194:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4153 "ext/date/lib/parse_date.c"
#line 4156 "ext/date/lib/parse_date.c"
yy195:
YYDEBUG(195, *YYCURSOR);
++YYCURSOR;
@@ -4200,7 +4203,7 @@ yy198:
}
yy199:
YYDEBUG(199, *YYCURSOR);
#line 1414 "ext/date/lib/parse_date.re"
#line 1417 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@@ -4213,7 +4216,7 @@ yy199:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4217 "ext/date/lib/parse_date.c"
#line 4220 "ext/date/lib/parse_date.c"
yy200:
YYDEBUG(200, *YYCURSOR);
yyaccept = 6;
@@ -4482,7 +4485,7 @@ yy222:
}
yy223:
YYDEBUG(223, *YYCURSOR);
#line 1716 "ext/date/lib/parse_date.re"
#line 1719 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@@ -4511,7 +4514,7 @@ yy223:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 4515 "ext/date/lib/parse_date.c"
#line 4518 "ext/date/lib/parse_date.c"
yy224:
YYDEBUG(224, *YYCURSOR);
yyaccept = 7;
@@ -5209,7 +5212,7 @@ yy278:
YYDEBUG(278, *YYCURSOR);
++YYCURSOR;
YYDEBUG(279, *YYCURSOR);
#line 1692 "ext/date/lib/parse_date.re"
#line 1695 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@@ -5232,7 +5235,7 @@ yy278:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 5236 "ext/date/lib/parse_date.c"
#line 5239 "ext/date/lib/parse_date.c"
yy280:
YYDEBUG(280, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5410,7 +5413,7 @@ yy294:
++YYCURSOR;
yy295:
YYDEBUG(295, *YYCURSOR);
#line 1386 "ext/date/lib/parse_date.re"
#line 1389 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@@ -5423,7 +5426,7 @@ yy295:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 5427 "ext/date/lib/parse_date.c"
#line 5430 "ext/date/lib/parse_date.c"
yy296:
YYDEBUG(296, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6643,7 +6646,7 @@ yy362:
if (yych <= '9') goto yy365;
yy364:
YYDEBUG(364, *YYCURSOR);
#line 1530 "ext/date/lib/parse_date.re"
#line 1533 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@@ -6656,7 +6659,7 @@ yy364:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 6660 "ext/date/lib/parse_date.c"
#line 6663 "ext/date/lib/parse_date.c"
yy365:
YYDEBUG(365, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7294,7 +7297,7 @@ yy392:
}
yy393:
YYDEBUG(393, *YYCURSOR);
#line 1588 "ext/date/lib/parse_date.re"
#line 1591 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@@ -7314,7 +7317,7 @@ yy393:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
#line 7318 "ext/date/lib/parse_date.c"
#line 7321 "ext/date/lib/parse_date.c"
yy394:
YYDEBUG(394, *YYCURSOR);
yyaccept = 5;
@@ -9064,7 +9067,7 @@ yy454:
++YYCURSOR;
yy455:
YYDEBUG(455, *YYCURSOR);
#line 1291 "ext/date/lib/parse_date.re"
#line 1294 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@@ -9075,7 +9078,7 @@ yy455:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 9079 "ext/date/lib/parse_date.c"
#line 9082 "ext/date/lib/parse_date.c"
yy456:
YYDEBUG(456, *YYCURSOR);
yyaccept = 0;
@@ -9635,7 +9638,7 @@ yy475:
}
yy476:
YYDEBUG(476, *YYCURSOR);
#line 1428 "ext/date/lib/parse_date.re"
#line 1431 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@@ -9646,7 +9649,7 @@ yy476:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 9650 "ext/date/lib/parse_date.c"
#line 9653 "ext/date/lib/parse_date.c"
yy477:
YYDEBUG(477, *YYCURSOR);
yyaccept = 10;
@@ -9787,7 +9790,7 @@ yy488:
YYDEBUG(488, *YYCURSOR);
++YYCURSOR;
YYDEBUG(489, *YYCURSOR);
#line 1146 "ext/date/lib/parse_date.re"
#line 1149 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@@ -9803,7 +9806,7 @@ yy488:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
#line 9807 "ext/date/lib/parse_date.c"
#line 9810 "ext/date/lib/parse_date.c"
yy490:
YYDEBUG(490, *YYCURSOR);
yyaccept = 11;
@@ -9816,7 +9819,7 @@ yy490:
}
yy491:
YYDEBUG(491, *YYCURSOR);
#line 1183 "ext/date/lib/parse_date.re"
#line 1186 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
@@ -9841,7 +9844,7 @@ yy491:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 9845 "ext/date/lib/parse_date.c"
#line 9848 "ext/date/lib/parse_date.c"
yy492:
YYDEBUG(492, *YYCURSOR);
yyaccept = 11;
@@ -10151,7 +10154,7 @@ yy523:
YYDEBUG(523, *YYCURSOR);
++YYCURSOR;
YYDEBUG(524, *YYCURSOR);
#line 1163 "ext/date/lib/parse_date.re"
#line 1166 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@@ -10170,7 +10173,7 @@ yy523:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 10174 "ext/date/lib/parse_date.c"
#line 10177 "ext/date/lib/parse_date.c"
yy525:
YYDEBUG(525, *YYCURSOR);
yyaccept = 11;
@@ -10276,7 +10279,7 @@ yy534:
if (yych <= '9') goto yy541;
yy535:
YYDEBUG(535, *YYCURSOR);
#line 1345 "ext/date/lib/parse_date.re"
#line 1348 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@@ -10290,7 +10293,7 @@ yy535:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
#line 10294 "ext/date/lib/parse_date.c"
#line 10297 "ext/date/lib/parse_date.c"
yy536:
YYDEBUG(536, *YYCURSOR);
yych = *++YYCURSOR;
@@ -11027,7 +11030,7 @@ yy605:
YYDEBUG(606, *YYCURSOR);
++YYCURSOR;
YYDEBUG(607, *YYCURSOR);
#line 1360 "ext/date/lib/parse_date.re"
#line 1363 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@@ -11038,7 +11041,7 @@ yy605:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 11042 "ext/date/lib/parse_date.c"
#line 11045 "ext/date/lib/parse_date.c"
yy608:
YYDEBUG(608, *YYCURSOR);
yyaccept = 11;
@@ -11074,7 +11077,7 @@ yy611:
if (yych <= '9') goto yy605;
yy612:
YYDEBUG(612, *YYCURSOR);
#line 1372 "ext/date/lib/parse_date.re"
#line 1375 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@@ -11087,7 +11090,7 @@ yy612:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 11091 "ext/date/lib/parse_date.c"
#line 11094 "ext/date/lib/parse_date.c"
yy613:
YYDEBUG(613, *YYCURSOR);
yyaccept = 11;
@@ -11728,7 +11731,7 @@ yy656:
}
yy657:
YYDEBUG(657, *YYCURSOR);
#line 1331 "ext/date/lib/parse_date.re"
#line 1334 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@@ -11741,7 +11744,7 @@ yy657:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 11745 "ext/date/lib/parse_date.c"
#line 11748 "ext/date/lib/parse_date.c"
yy658:
YYDEBUG(658, *YYCURSOR);
yyaccept = 13;
@@ -11847,7 +11850,7 @@ yy666:
}
yy667:
YYDEBUG(667, *YYCURSOR);
#line 1275 "ext/date/lib/parse_date.re"
#line 1278 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@@ -11862,7 +11865,7 @@ yy667:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
#line 11866 "ext/date/lib/parse_date.c"
#line 11869 "ext/date/lib/parse_date.c"
yy668:
YYDEBUG(668, *YYCURSOR);
yyaccept = 14;
@@ -12095,7 +12098,7 @@ yy700:
if (yych <= ':') goto yy704;
yy701:
YYDEBUG(701, *YYCURSOR);
#line 1558 "ext/date/lib/parse_date.re"
#line 1561 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@@ -12115,7 +12118,7 @@ yy701:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12119 "ext/date/lib/parse_date.c"
#line 12122 "ext/date/lib/parse_date.c"
yy702:
YYDEBUG(702, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12667,7 +12670,7 @@ yy763:
}
yy764:
YYDEBUG(764, *YYCURSOR);
#line 1303 "ext/date/lib/parse_date.re"
#line 1306 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@@ -12680,7 +12683,7 @@ yy764:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 12684 "ext/date/lib/parse_date.c"
#line 12687 "ext/date/lib/parse_date.c"
yy765:
YYDEBUG(765, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12719,7 +12722,7 @@ yy771:
YYDEBUG(771, *YYCURSOR);
++YYCURSOR;
YYDEBUG(772, *YYCURSOR);
#line 1544 "ext/date/lib/parse_date.re"
#line 1547 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@@ -12732,7 +12735,7 @@ yy771:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 12736 "ext/date/lib/parse_date.c"
#line 12739 "ext/date/lib/parse_date.c"
yy773:
YYDEBUG(773, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12870,7 +12873,7 @@ yy783:
}
yy784:
YYDEBUG(784, *YYCURSOR);
#line 1579 "ext/date/lib/parse_date.re"
#line 1582 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@@ -12878,7 +12881,7 @@ yy784:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12882 "ext/date/lib/parse_date.c"
#line 12885 "ext/date/lib/parse_date.c"
yy785:
YYDEBUG(785, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13029,7 +13032,7 @@ yy793:
}
yy794:
YYDEBUG(794, *YYCURSOR);
#line 1400 "ext/date/lib/parse_date.re"
#line 1403 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@@ -13042,7 +13045,7 @@ yy794:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 13046 "ext/date/lib/parse_date.c"
#line 13049 "ext/date/lib/parse_date.c"
yy795:
YYDEBUG(795, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13257,7 +13260,7 @@ yy814:
if (yych <= '7') goto yy817;
yy815:
YYDEBUG(815, *YYCURSOR);
#line 1511 "ext/date/lib/parse_date.re"
#line 1514 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@@ -13275,7 +13278,7 @@ yy815:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13279 "ext/date/lib/parse_date.c"
#line 13282 "ext/date/lib/parse_date.c"
yy816:
YYDEBUG(816, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13285,7 +13288,7 @@ yy817:
YYDEBUG(817, *YYCURSOR);
++YYCURSOR;
YYDEBUG(818, *YYCURSOR);
#line 1492 "ext/date/lib/parse_date.re"
#line 1495 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@@ -13303,7 +13306,7 @@ yy817:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13307 "ext/date/lib/parse_date.c"
#line 13310 "ext/date/lib/parse_date.c"
yy819:
YYDEBUG(819, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13367,7 +13370,7 @@ yy821:
}
yy822:
YYDEBUG(822, *YYCURSOR);
#line 1478 "ext/date/lib/parse_date.re"
#line 1481 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@@ -13380,7 +13383,7 @@ yy822:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
#line 13384 "ext/date/lib/parse_date.c"
#line 13387 "ext/date/lib/parse_date.c"
yy823:
YYDEBUG(823, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13483,7 +13486,7 @@ yy842:
++YYCURSOR;
yy843:
YYDEBUG(843, *YYCURSOR);
#line 1452 "ext/date/lib/parse_date.re"
#line 1455 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@@ -13508,7 +13511,7 @@ yy843:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
#line 13512 "ext/date/lib/parse_date.c"
#line 13515 "ext/date/lib/parse_date.c"
yy844:
YYDEBUG(844, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13770,7 +13773,7 @@ yy848:
}
yy849:
YYDEBUG(849, *YYCURSOR);
#line 1440 "ext/date/lib/parse_date.re"
#line 1443 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@@ -13781,7 +13784,7 @@ yy849:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
#line 13785 "ext/date/lib/parse_date.c"
#line 13788 "ext/date/lib/parse_date.c"
yy850:
YYDEBUG(850, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14701,7 +14704,7 @@ yy973:
if (yych <= '9') goto yy996;
yy974:
YYDEBUG(974, *YYCURSOR);
#line 1317 "ext/date/lib/parse_date.re"
#line 1320 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@@ -14714,7 +14717,7 @@ yy974:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 14718 "ext/date/lib/parse_date.c"
#line 14721 "ext/date/lib/parse_date.c"
yy975:
YYDEBUG(975, *YYCURSOR);
yyaccept = 22;
@@ -15723,7 +15726,7 @@ yy1066:
}
yy1068:
YYDEBUG(1068, *YYCURSOR);
#line 1209 "ext/date/lib/parse_date.re"
#line 1212 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@@ -15745,7 +15748,7 @@ yy1068:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
#line 15749 "ext/date/lib/parse_date.c"
#line 15752 "ext/date/lib/parse_date.c"
yy1069:
YYDEBUG(1069, *YYCURSOR);
yych = *++YYCURSOR;
@@ -15837,7 +15840,7 @@ yy1075:
}
yy1076:
YYDEBUG(1076, *YYCURSOR);
#line 1255 "ext/date/lib/parse_date.re"
#line 1258 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@@ -15856,7 +15859,7 @@ yy1076:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
#line 15860 "ext/date/lib/parse_date.c"
#line 15863 "ext/date/lib/parse_date.c"
yy1077:
YYDEBUG(1077, *YYCURSOR);
yyaccept = 25;
@@ -16754,7 +16757,7 @@ yy1117:
}
yy1118:
YYDEBUG(1118, *YYCURSOR);
#line 1651 "ext/date/lib/parse_date.re"
#line 1654 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16770,7 +16773,7 @@ yy1118:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 16774 "ext/date/lib/parse_date.c"
#line 16777 "ext/date/lib/parse_date.c"
yy1119:
YYDEBUG(1119, *YYCURSOR);
++YYCURSOR;
@@ -16821,7 +16824,7 @@ yy1126:
YYDEBUG(1126, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1127, *YYCURSOR);
#line 1124 "ext/date/lib/parse_date.re"
#line 1127 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16842,7 +16845,7 @@ yy1126:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
#line 16846 "ext/date/lib/parse_date.c"
#line 16849 "ext/date/lib/parse_date.c"
yy1128:
YYDEBUG(1128, *YYCURSOR);
yyaccept = 26;
@@ -16950,7 +16953,7 @@ yy1141:
}
yy1142:
YYDEBUG(1142, *YYCURSOR);
#line 1627 "ext/date/lib/parse_date.re"
#line 1630 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16973,7 +16976,7 @@ yy1142:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 16977 "ext/date/lib/parse_date.c"
#line 16980 "ext/date/lib/parse_date.c"
yy1143:
YYDEBUG(1143, *YYCURSOR);
yych = *++YYCURSOR;
@@ -19650,7 +19653,7 @@ yy1294:
goto yy1298;
yy1295:
YYDEBUG(1295, *YYCURSOR);
#line 1101 "ext/date/lib/parse_date.re"
#line 1104 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@@ -19672,7 +19675,7 @@ yy1295:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 19676 "ext/date/lib/parse_date.c"
#line 19679 "ext/date/lib/parse_date.c"
yy1296:
YYDEBUG(1296, *YYCURSOR);
yyaccept = 28;
@@ -21363,7 +21366,7 @@ yy1385:
if (yych <= '9') goto yy1385;
yy1387:
YYDEBUG(1387, *YYCURSOR);
#line 1058 "ext/date/lib/parse_date.re"
#line 1061 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@@ -21388,7 +21391,7 @@ yy1387:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21392 "ext/date/lib/parse_date.c"
#line 21395 "ext/date/lib/parse_date.c"
yy1388:
YYDEBUG(1388, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21824,7 +21827,7 @@ yy1416:
++YYCURSOR;
yy1417:
YYDEBUG(1417, *YYCURSOR);
#line 1046 "ext/date/lib/parse_date.re"
#line 1049 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@@ -21835,7 +21838,7 @@ yy1417:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21839 "ext/date/lib/parse_date.c"
#line 21842 "ext/date/lib/parse_date.c"
yy1418:
YYDEBUG(1418, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21870,7 +21873,7 @@ yy1419:
}
yy1420:
YYDEBUG(1420, *YYCURSOR);
#line 1036 "ext/date/lib/parse_date.re"
#line 1039 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@@ -21879,7 +21882,7 @@ yy1420:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21883 "ext/date/lib/parse_date.c"
#line 21886 "ext/date/lib/parse_date.c"
yy1421:
YYDEBUG(1421, *YYCURSOR);
yych = *++YYCURSOR;
@@ -23891,7 +23894,7 @@ yy1499:
}
yy1500:
YYDEBUG(1500, *YYCURSOR);
#line 1015 "ext/date/lib/parse_date.re"
#line 1018 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@@ -23899,7 +23902,7 @@ yy1500:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 23903 "ext/date/lib/parse_date.c"
#line 23906 "ext/date/lib/parse_date.c"
yy1501:
YYDEBUG(1501, *YYCURSOR);
yych = *++YYCURSOR;
@@ -24038,7 +24041,7 @@ yy1507:
}
yy1508:
YYDEBUG(1508, *YYCURSOR);
#line 1024 "ext/date/lib/parse_date.re"
#line 1027 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@@ -24049,7 +24052,7 @@ yy1508:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 24053 "ext/date/lib/parse_date.c"
#line 24056 "ext/date/lib/parse_date.c"
yy1509:
YYDEBUG(1509, *YYCURSOR);
yyaccept = 0;
@@ -24582,7 +24585,7 @@ yy1530:
++YYCURSOR;
yy1531:
YYDEBUG(1531, *YYCURSOR);
#line 1003 "ext/date/lib/parse_date.re"
#line 1006 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@@ -24593,7 +24596,7 @@ yy1531:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 24597 "ext/date/lib/parse_date.c"
#line 24600 "ext/date/lib/parse_date.c"
yy1532:
YYDEBUG(1532, *YYCURSOR);
yyaccept = 0;
@@ -24766,7 +24769,7 @@ yy1537:
goto yy1531;
}
}
#line 1777 "ext/date/lib/parse_date.re"
#line 1780 "ext/date/lib/parse_date.re"
}
@@ -25124,6 +25127,10 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
break;
case '\\': /* escaped char */
if(!fptr[1]) {
add_pbf_error(s, "Escaped character expected", string, begin);
break;
}
fptr++;
if (*ptr == *fptr) {
++ptr;
+8 -1
View File
@@ -401,9 +401,12 @@ static timelib_sll timelib_meridian_with_check(char **ptr, timelib_sll h)
{
timelib_sll retval = 0;
while (!strchr("AaPp", **ptr)) {
while (**ptr && !strchr("AaPp", **ptr)) {
++*ptr;
}
if(!**ptr) {
return TIMELIB_UNSET;
}
if (**ptr == 'a' || **ptr == 'A') {
if (h == 12) {
retval = -12;
@@ -2131,6 +2134,10 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
break;
case '\\': /* escaped char */
if(!fptr[1]) {
add_pbf_error(s, "Escaped character expected", string, begin);
break;
}
fptr++;
if (*ptr == *fptr) {
++ptr;
+731 -676
View File
File diff suppressed because it is too large. Load diff
+11 -12
View File
@@ -28,7 +28,7 @@ static int month_tab[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 24
static int days_in_month_leap[13] = { 31, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
static int days_in_month[13] = { 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
static int do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, timelib_sll *a, timelib_sll *b)
static void do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, timelib_sll *a, timelib_sll *b)
{
if (*a < start) {
*b -= (start - *a - 1) / adj + 1;
@@ -38,7 +38,6 @@ static int do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, t
*b += *a / adj;
*a -= adj * (*a / adj);
}
return 0;
}
static void inc_month(timelib_sll *y, timelib_sll *m)
@@ -170,24 +169,24 @@ static void do_adjust_for_weekday(timelib_time* time)
void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt)
{
do {} while (do_range_limit(0, 60, 60, &rt->s, &rt->i));
do {} while (do_range_limit(0, 60, 60, &rt->i, &rt->h));
do {} while (do_range_limit(0, 24, 24, &rt->h, &rt->d));
do {} while (do_range_limit(0, 12, 12, &rt->m, &rt->y));
do_range_limit(0, 60, 60, &rt->s, &rt->i);
do_range_limit(0, 60, 60, &rt->i, &rt->h);
do_range_limit(0, 24, 24, &rt->h, &rt->d);
do_range_limit(0, 12, 12, &rt->m, &rt->y);
do_range_limit_days_relative(&base->y, &base->m, &rt->y, &rt->m, &rt->d, rt->invert);
do {} while (do_range_limit(0, 12, 12, &rt->m, &rt->y));
do_range_limit(0, 12, 12, &rt->m, &rt->y);
}
void timelib_do_normalize(timelib_time* time)
{
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 60, 60, &time->s, &time->i));
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 60, 60, &time->i, &time->h));
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 24, 24, &time->h, &time->d));
do {} while (do_range_limit(1, 13, 12, &time->m, &time->y));
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->s, &time->i);
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->i, &time->h);
if (time->s != TIMELIB_UNSET) do_range_limit(0, 24, 24, &time->h, &time->d);
do_range_limit(1, 13, 12, &time->m, &time->y);
do {} while (do_range_limit_days(&time->y, &time->m, &time->d));
do {} while (do_range_limit(1, 13, 12, &time->m, &time->y));
do_range_limit(1, 13, 12, &time->m, &time->y);
}
static void do_adjust_relative(timelib_time* time)
+7 -1
View File
@@ -2548,7 +2548,9 @@ PHP_METHOD(DateTime, __construct)
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) {
php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC);
if (!php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC)) {
ZVAL_NULL(getThis());
}
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
}
@@ -2587,6 +2589,10 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
tzi = php_date_parse_tzfile(Z_STRVAL_PP(z_timezone), DATE_TIMEZONEDB TSRMLS_CC);
if (tzi == NULL) {
return 0;
}
ALLOC_INIT_ZVAL(tmp_obj);
tzobj = zend_object_store_get_object(php_date_instantiate(date_ce_timezone, tmp_obj TSRMLS_CC) TSRMLS_CC);
tzobj->type = TIMELIB_ZONETYPE_ID;
+11
View File
@@ -0,0 +1,11 @@
--TEST--
Test for bug #66721: __wakeup of DateTime segfaults when invalid object data is supplied
--CREDITS--
Boro Sitnikovski <buritomath@yahoo.com>
--FILE--
<?php
$y = 'O:8:"DateTime":3:{s:4:"date";s:19:"2014-02-15 02:00:51";s:13:"timezone_type";i:3;s:8:"timezone";s:10:"1234567890";}';
var_dump(unserialize($y));
?>
--EXPECTF--
Fatal error: Invalid serialization data for DateTime object in %s on line %d
+27
View File
@@ -0,0 +1,27 @@
--TEST--
Bug #67118 php-cgi crashes regularly on IIS 7
--INI--
date.timezone=Europe/Berlin
--FILE--
<?php
class mydt extends datetime
{
public function __construct($time = 'now', $tz = NULL, $format = NULL)
{
if (!empty($tz) && !is_object($tz)) {
$tz = new DateTimeZone($tz);
}
@parent::__construct($time, $tz);
}
};
new mydt("Funktionsansvarig rådgivning och juridik", "UTC");
--EXPECTF--
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Funktionsansvarig rådgivning och juridik) at position 0 (F): The timezone could not be found in the database' in %sbug67118.php:%d
Stack trace:
#0 %sbug67118.php(%d): DateTime->__construct('Funktionsansvar...', Object(DateTimeZone))
#1 %sbug67118.php(%d): mydt->__construct('Funktionsansvar...', 'UTC')
#2 {main}
thrown in %sbug67118.php on line %d
+38
View File
@@ -0,0 +1,38 @@
--TEST--
Bug #67251 (date_parse_from_format out-of-bounds read)
--INI--
date.timezone=Europe/Berlin
--FILE--
<?php
var_dump(date_parse_from_format("\\","AAAABBBB"));
--EXPECT--
array(12) {
["year"]=>
bool(false)
["month"]=>
bool(false)
["day"]=>
bool(false)
["hour"]=>
bool(false)
["minute"]=>
bool(false)
["second"]=>
bool(false)
["fraction"]=>
bool(false)
["warning_count"]=>
int(0)
["warnings"]=>
array(0) {
}
["error_count"]=>
int(2)
["errors"]=>
array(1) {
[0]=>
string(13) "Trailing data"
}
["is_localtime"]=>
bool(false)
}
+44
View File
@@ -0,0 +1,44 @@
--TEST--
Bug #67253 (timelib_meridian_with_check out-of-bounds read)
--INI--
date.timezone=Europe/Berlin
--FILE--
<?php
$z = '';
var_dump(date_parse_from_format("aHa0", "0=G{$z}9UCNnF"));
--EXPECT--
array(12) {
["year"]=>
bool(false)
["month"]=>
bool(false)
["day"]=>
bool(false)
["hour"]=>
int(0)
["minute"]=>
int(0)
["second"]=>
int(0)
["fraction"]=>
bool(false)
["warning_count"]=>
int(0)
["warnings"]=>
array(0) {
}
["error_count"]=>
int(3)
["errors"]=>
array(3) {
[0]=>
string(51) "Meridian can only come after an hour has been found"
[1]=>
string(29) "A meridian could not be found"
[9]=>
string(12) "Data missing"
}
["is_localtime"]=>
bool(false)
}
+6
View File
@@ -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
+25 -11
View File
@@ -188,8 +188,7 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval **retval TSRMLS_
{
xmlDtdPtr dtdptr;
xmlDtd *intsubset;
xmlOutputBuffer *buff = NULL;
xmlDtdPtr intsubset;
dtdptr = (xmlDtdPtr) dom_object_get_node(obj);
@@ -200,22 +199,37 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval **retval TSRMLS_
ALLOC_ZVAL(*retval);
if (dtdptr->doc != NULL && ((intsubset = dtdptr->doc->intSubset) != NULL)) {
buff = xmlAllocOutputBuffer(NULL);
if (buff != NULL) {
xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
xmlOutputBufferFlush(buff);
if (dtdptr->doc != NULL && ((intsubset = xmlGetIntSubset(dtdptr->doc)) != NULL) && intsubset->children != NULL) {
smart_str ret_buf = {0};
xmlNodePtr cur = intsubset->children;
while (cur != NULL) {
xmlOutputBuffer *buff = xmlAllocOutputBuffer(NULL);
if (buff != NULL) {
xmlNodeDumpOutput (buff, NULL, cur, 0, 0, NULL);
xmlOutputBufferFlush(buff);
#ifdef LIBXML2_NEW_BUFFER
ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff), 1);
smart_str_appendl(&ret_buf, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff));
#else
ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1);
smart_str_appendl(&ret_buf, buff->buffer->content, buff->buffer->use);
#endif
(void)xmlOutputBufferClose(buff);
(void)xmlOutputBufferClose(buff);
}
cur = cur->next;
}
if (ret_buf.len) {
ZVAL_STRINGL(*retval, ret_buf.c, ret_buf.len, 1);
smart_str_free(&ret_buf);
return SUCCESS;
}
}
ZVAL_EMPTY_STRING(*retval);
ZVAL_NULL(*retval);
return SUCCESS;
+2 -2
View File
@@ -43,6 +43,6 @@ print 'notation: '.$notation->nodeName."\n";
publicId: -//OASIS//DTD DocBook XML//EN
systemId: docbookx.dtd
name: chapter
internalSubset: <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML//EN" "docbookx.dtd">
internalSubset:
entity: logo
notation: gif
notation: gif
+43
View File
@@ -0,0 +1,43 @@
--TEST--
Bug #67081 DOMDocumentType->internalSubset returns entire DOCTYPE tag, not only the subset
--SKIPIF--
<?php
require_once('skipif.inc');
?>
--FILE--
<?php
$domDocument = new DOMDocument();
$domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug67081_0.xml");
var_dump($domDocument->doctype->internalSubset);
$domDocument = new DOMDocument();
$domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug67081_1.xml");
var_dump($domDocument->doctype->internalSubset);
$domDocument = new DOMDocument();
$domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug67081_2.xml");
var_dump($domDocument->doctype->internalSubset);
$domDocument = new DOMDocument();
$domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "dom.xml");
var_dump($domDocument->doctype->internalSubset);
?>
===DONE===
--EXPECT--
string(19) "<!ELEMENT a EMPTY>
"
string(38) "<!ELEMENT a EMPTY>
<!ELEMENT b EMPTY>
"
NULL
string(277) "<!ENTITY % incent SYSTEM "dom.ent">
<!ENTITY amp "&#38;#38;">
<!ENTITY gt "&#62;">
<!ENTITY % coreattrs "title CDATA #IMPLIED">
<!ENTITY % attrs "%coreattrs;">
<!ATTLIST foo bar CDATA #IMPLIED>
<!ELEMENT foo (#PCDATA)>
<!ELEMENT root (foo)+>
<!ATTLIST th title CDATA #IMPLIED>
"
===DONE===
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE a [
<!ELEMENT a EMPTY>
]>
<a></a>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE a [
<!ELEMENT a EMPTY>
<!ELEMENT b EMPTY>
]>
<a></a>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<a></a>
+1 -1
View File
@@ -288,7 +288,7 @@ To use your new extension, you will have to execute the following steps:
3. $ ./buildconf
4. $ ./configure --[with|enable]-$extname
5. $ make
6. $ ./php -f ext/$extname/$extname.php
6. $ ./sapi/cli/php -f ext/$extname/$extname.php
7. $ vi ext/$extname/$extname.c
8. $ make
+21281 -21281
View File
File diff suppressed because it is too large. Load diff
+370 -101
View File
@@ -1,6 +1,6 @@
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
--- libmagic.orig/apprentice.c 2013-03-21 18:45:14.000000000 +0100
+++ libmagic/apprentice.c 2013-04-27 13:53:32.175250261 +0200
--- libmagic.orig/apprentice.c Thu Mar 21 18:45:14 2013
+++ libmagic/apprentice.c Fri Apr 11 12:36:52 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;
}
@@ -499,22 +492,24 @@
@@ -499,22 +492,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;
@@ -533,10 +528,10 @@
@@ -533,10 +530,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 */
@@ -546,13 +541,28 @@
@@ -546,13 +543,28 @@
char *p, *mfn;
int file_err, errs = -1;
size_t i;
@@ -259,7 +261,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
file_oomem(ms, strlen(fn));
return -1;
}
@@ -567,7 +577,7 @@
@@ -567,7 +579,7 @@
mlist_free(ms->mlist[i]);
while (i != 0);
}
@@ -268,7 +270,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
return -1;
}
}
@@ -584,7 +594,7 @@
@@ -584,7 +596,7 @@
fn = p;
}
@@ -277,7 +279,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
if (errs == -1) {
for (i = 0; i < MAGIC_SETS; i++) {
@@ -904,7 +914,7 @@
@@ -904,7 +916,7 @@
maxmagic[i] += ALLOC_INCR;
if ((mp = CAST(struct magic_entry *,
@@ -286,7 +288,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
NULL) {
file_oomem(ms, sizeof(*mp) * maxmagic[i]);
return -1;
@@ -925,13 +935,24 @@
@@ -925,13 +937,24 @@
load_1(struct magic_set *ms, int action, const char *fn, int *errs,
struct magic_entry **mentry, uint32_t *mentrycount)
{
@@ -315,7 +317,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
if (errno != ENOENT)
file_error(ms, errno, "cannot read magic file `%s'",
fn);
@@ -941,8 +962,7 @@
@@ -941,8 +964,7 @@
memset(&me, 0, sizeof(me));
/* read and parse this file */
@@ -325,7 +327,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
if (len == 0) /* null line, garbage, etc */
continue;
if (line[len - 1] == '\n') {
@@ -994,14 +1014,13 @@
@@ -994,14 +1016,13 @@
goto again;
default:
(*errs)++;
@@ -343,7 +345,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
}
/*
@@ -1080,7 +1099,7 @@
@@ -1080,7 +1101,7 @@
mentrycount += me[i].cont_count;
slen = sizeof(**ma) * mentrycount;
@@ -352,7 +354,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
file_oomem(ms, slen);
return -1;
}
@@ -1102,27 +1121,29 @@
@@ -1102,27 +1123,29 @@
if (me == NULL)
return;
for (i = 0; i < nme; i++)
@@ -389,7 +391,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
file_oomem(ms, sizeof(*map));
return NULL;
}
@@ -1131,23 +1152,37 @@
@@ -1131,23 +1154,37 @@
if (action == FILE_CHECK)
(void)fprintf(stderr, "%s\n", usg_hdr);
@@ -434,7 +436,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
continue;
}
if (files >= maxfiles) {
@@ -1155,24 +1190,23 @@
@@ -1155,24 +1192,23 @@
maxfiles = (maxfiles + 1) * 2;
mlen = maxfiles * sizeof(*filearr);
if ((filearr = CAST(char **,
@@ -465,7 +467,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
} else
load_1(ms, action, fn, &errs, mentry, mentrycount);
if (errs)
@@ -1211,9 +1245,9 @@
@@ -1211,9 +1247,9 @@
if (errs) {
for (j = 0; j < MAGIC_SETS; j++) {
if (map->magic[j])
@@ -477,7 +479,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
return NULL;
}
return map;
@@ -1500,7 +1534,7 @@
@@ -1500,7 +1536,7 @@
if (me->cont_count == me->max_count) {
struct magic *nm;
size_t cnt = me->max_count + ALLOC_CHUNK;
@@ -486,7 +488,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
sizeof(*nm) * cnt))) == NULL) {
file_oomem(ms, sizeof(*nm) * cnt);
return -1;
@@ -1515,7 +1549,7 @@
@@ -1515,7 +1551,7 @@
static const size_t len = sizeof(*m) * ALLOC_CHUNK;
if (me->mp != NULL)
return 1;
@@ -495,7 +497,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
file_oomem(ms, len);
return -1;
}
@@ -1688,7 +1722,7 @@
@@ -1688,7 +1724,7 @@
m->type = get_standard_integer_type(l, &l);
else if (*l == 's' && !isalpha((unsigned char)l[1])) {
m->type = FILE_STRING;
@@ -504,7 +506,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
}
}
}
@@ -1701,6 +1735,10 @@
@@ -1701,6 +1737,10 @@
if (m->type == FILE_INVALID) {
if (ms->flags & MAGIC_CHECK)
file_magwarn(ms, "type `%s' invalid", l);
@@ -515,7 +517,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
return -1;
}
@@ -1709,7 +1747,7 @@
@@ -1709,7 +1749,7 @@
m->mask_op = 0;
if (*l == '~') {
@@ -524,7 +526,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");
@@ -1718,7 +1756,7 @@
@@ -1718,7 +1758,7 @@
m->str_range = 0;
m->str_flags = m->type == FILE_PSTRING ? PSTRING_1_LE : 0;
if ((op = get_op(*l)) != -1) {
@@ -533,7 +535,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
uint64_t val;
++l;
m->mask_op |= op;
@@ -1909,11 +1947,6 @@
@@ -1909,11 +1949,6 @@
if (check_format(ms, m) == -1)
return -1;
}
@@ -545,7 +547,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
m->mimetype[0] = '\0'; /* initialise MIME type to none */
return 0;
}
@@ -2554,59 +2587,80 @@
@@ -2554,59 +2589,80 @@
private struct magic_map *
apprentice_map(struct magic_set *ms, const char *fn)
{
@@ -559,10 +561,10 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
size_t i;
+ php_stream *stream = NULL;
+ php_stream_statbuf st;
+
- fd = -1;
- if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
+
+ TSRMLS_FETCH();
+
+ if ((map = CAST(struct magic_map *, ecalloc(1, sizeof(*map)))) == NULL) {
@@ -647,7 +649,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);
@@ -2620,17 +2674,29 @@
@@ -2620,17 +2676,29 @@
else
version = ptr[1];
if (version != VERSIONNO) {
@@ -685,7 +687,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
}
map->magic[0] = CAST(struct magic *, map->p) + 1;
nentries = 0;
@@ -2643,22 +2709,29 @@
@@ -2643,22 +2711,29 @@
map->magic[i + 1] = map->magic[i] + map->nmagic[i];
nentries += map->nmagic[i];
}
@@ -720,7 +722,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
return NULL;
}
@@ -2679,14 +2752,23 @@
@@ -2679,14 +2754,23 @@
char *dbname;
int rv = -1;
uint32_t i;
@@ -747,7 +749,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
file_error(ms, errno, "cannot open `%s'", dbname);
goto out;
}
@@ -2696,31 +2778,33 @@
@@ -2696,31 +2780,33 @@
goto out;
}
@@ -787,7 +789,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
return rv;
}
@@ -2733,6 +2817,7 @@
@@ -2733,6 +2819,7 @@
{
const char *p, *q;
char *buf;
@@ -795,7 +797,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
if (strip) {
if ((p = strrchr(fn, '/')) != NULL)
@@ -2754,16 +2839,18 @@
@@ -2754,16 +2841,18 @@
q++;
/* Compatibility with old code that looked in .mime */
if (ms->flags & MAGIC_MIME) {
@@ -820,7 +822,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
/* Compatibility with old code that looked in .mime */
if (strstr(p, ".mime") != NULL)
@@ -2853,7 +2940,7 @@
@@ -2853,7 +2942,7 @@
m->offset = swap4((uint32_t)m->offset);
m->in_offset = swap4((uint32_t)m->in_offset);
m->lineno = swap4((uint32_t)m->lineno);
@@ -830,8 +832,8 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
m->str_flags = swap4(m->str_flags);
}
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
--- libmagic.orig/ascmagic.c 2012-10-31 18:03:01.000000000 +0100
+++ libmagic/ascmagic.c 2013-04-08 15:42:57.328298809 +0200
--- libmagic.orig/ascmagic.c Wed Oct 31 18:03:01 2012
+++ libmagic/ascmagic.c Mon Mar 10 16:40:55 2014
@@ -139,7 +139,7 @@
/* malloc size is a conservative overestimate; could be
improved, or at least realloced after conversion. */
@@ -841,6 +843,15 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
file_oomem(ms, mlen);
goto done;
}
@@ -147,7 +147,7 @@
== NULL)
goto done;
if ((rv = file_softmagic(ms, utf8_buf,
- (size_t)(utf8_end - utf8_buf), TEXTTEST, text)) == 0)
+ (size_t)(utf8_end - utf8_buf), 0, TEXTTEST, text)) == 0)
rv = -1;
}
@@ -211,6 +211,7 @@
case 0:
if (file_printf(ms, ", ") == -1)
@@ -860,8 +871,8 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
return rv;
}
diff -u libmagic.orig/cdf.c libmagic/cdf.c
--- libmagic.orig/cdf.c 2013-03-21 18:45:14.000000000 +0100
+++ libmagic/cdf.c 2013-04-08 15:42:57.328298809 +0200
--- libmagic.orig/cdf.c Thu Mar 21 18:45:14 2013
+++ libmagic/cdf.c Tue May 27 22:22:35 2014
@@ -43,7 +43,17 @@
#include <err.h>
#endif
@@ -892,7 +903,63 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
return -1;
return (ssize_t)len;
@@ -1132,7 +1145,7 @@
@@ -810,6 +823,10 @@
i, inp[i].pi_id, inp[i].pi_type, q - p, offs));
if (inp[i].pi_type & CDF_VECTOR) {
nelements = CDF_GETUINT32(q, 1);
+ if (nelements == 0) {
+ DPRINTF(("CDF_VECTOR with nelements == 0\n"));
+ goto out;
+ }
o = 2;
} else {
nelements = 1;
@@ -884,7 +901,9 @@
}
DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
nelements));
- for (j = 0; j < nelements; j++, i++) {
+ for (j = 0; j < nelements && i < sh.sh_properties;
+ j++, i++)
+ {
uint32_t l = CDF_GETUINT32(q, o);
inp[i].pi_str.s_len = l;
inp[i].pi_str.s_buf = (const char *)
@@ -929,7 +948,7 @@
cdf_unpack_summary_info(const cdf_stream_t *sst, const cdf_header_t *h,
cdf_summary_info_header_t *ssi, cdf_property_info_t **info, size_t *count)
{
- size_t i, maxcount;
+ size_t maxcount;
const cdf_summary_info_header_t *si =
CAST(const cdf_summary_info_header_t *, sst->sst_tab);
const cdf_section_declaration_t *sd =
@@ -944,21 +963,13 @@
ssi->si_os = CDF_TOLE2(si->si_os);
ssi->si_class = si->si_class;
cdf_swap_class(&ssi->si_class);
- ssi->si_count = CDF_TOLE2(si->si_count);
+ ssi->si_count = CDF_TOLE4(si->si_count);
*count = 0;
maxcount = 0;
*info = NULL;
- for (i = 0; i < CDF_TOLE4(si->si_count); i++) {
- if (i >= CDF_LOOP_LIMIT) {
- DPRINTF(("Unpack summary info loop limit"));
- errno = EFTYPE;
- return -1;
- }
- if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset),
- info, count, &maxcount) == -1) {
+ if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset), info,
+ count, &maxcount) == -1)
return -1;
- }
- }
return 0;
}
@@ -1132,7 +1143,7 @@
cdf_directory_t *d;
char name[__arraycount(d->d_name)];
cdf_stream_t scn;
@@ -901,7 +968,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
static const char *types[] = { "empty", "user storage",
"user stream", "lockbytes", "property", "root storage" };
@@ -1185,7 +1198,7 @@
@@ -1185,7 +1196,7 @@
cdf_dump_property_info(const cdf_property_info_t *info, size_t count)
{
cdf_timestamp_t tp;
@@ -910,7 +977,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
char buf[64];
size_t i, j;
@@ -1229,7 +1242,11 @@
@@ -1229,7 +1240,11 @@
break;
case CDF_FILETIME:
tp = info[i].pi_tp;
@@ -923,8 +990,8 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
(void)fprintf(stderr, "timestamp %s\n", buf);
} else {
diff -u libmagic.orig/cdf.h libmagic/cdf.h
--- libmagic.orig/cdf.h 2012-10-31 18:03:01.000000000 +0100
+++ libmagic/cdf.h 2013-04-08 15:42:57.328298809 +0200
--- libmagic.orig/cdf.h Wed Oct 31 18:03:01 2012
+++ libmagic/cdf.h Mon Dec 2 15:25:29 2013
@@ -35,10 +35,12 @@
#ifndef _H_CDF_
#define _H_CDF_
@@ -966,8 +1033,8 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
void cdf_swap_header(cdf_header_t *);
void cdf_unpack_header(cdf_header_t *, char *);
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
--- libmagic.orig/cdf_time.c 2012-10-31 18:03:01.000000000 +0100
+++ libmagic/cdf_time.c 2013-04-08 15:42:57.328298809 +0200
--- libmagic.orig/cdf_time.c Wed Oct 31 18:03:01 2012
+++ libmagic/cdf_time.c Mon Dec 2 15:25:29 2013
@@ -96,7 +96,7 @@
}
@@ -1026,8 +1093,8 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
static const cdf_timestamp_t tst = 0x01A5E403C2D59C00ULL;
static const char *ref = "Sat Apr 23 01:30:00 1977";
diff -u libmagic.orig/compress.c libmagic/compress.c
--- libmagic.orig/compress.c 2013-01-06 21:35:43.000000000 +0100
+++ libmagic/compress.c 2013-04-08 15:42:57.328298809 +0200
--- libmagic.orig/compress.c Sun Jan 6 21:35:43 2013
+++ libmagic/compress.c Mon Dec 2 15:25:29 2013
@@ -32,6 +32,7 @@
* uncompress(method, old, n, newch) - uncompress old into new,
* using method, return sizeof new
@@ -1189,8 +1256,8 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
-#endif
+#endif /* if PHP_FILEINFO_UNCOMPRESS */
diff -u libmagic.orig/file.h libmagic/file.h
--- libmagic.orig/file.h 2013-02-18 16:40:59.000000000 +0100
+++ libmagic/file.h 2013-04-08 15:42:57.328298809 +0200
--- libmagic.orig/file.h Mon Feb 18 16:40:59 2013
+++ libmagic/file.h Mon Mar 10 16:40:55 2014
@@ -33,11 +33,9 @@
#ifndef __file_h__
#define __file_h__
@@ -1303,7 +1370,13 @@ diff -u libmagic.orig/file.h libmagic/file.h
protected int file_zmagic(struct magic_set *, int, const char *,
const unsigned char *, size_t);
#endif
@@ -443,16 +442,13 @@
@@ -438,21 +437,18 @@
unichar **, size_t *, const char **, const char **, const char **);
protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
- int, int);
+ size_t, int, int);
protected int file_apprentice(struct magic_set *, const char *, int);
protected int file_magicfind(struct magic_set *, const char *, struct mlist *);
protected uint64_t file_signextend(struct magic_set *, struct magic *,
uint64_t);
@@ -1377,22 +1450,24 @@ diff -u libmagic.orig/file.h libmagic/file.h
#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H) && !defined(QUICK)
#define QUICK
@@ -533,4 +511,12 @@
#define FILE_RCSID(id)
@@ -531,6 +509,14 @@
#endif
#else
#define FILE_RCSID(id)
+#endif
+
+#ifdef PHP_WIN32
+#define FINFO_LSEEK_FUNC _lseek
+#define FINFO_READ_FUNC _read
+#else
+#define FINFO_LSEEK_FUNC lseek
+#define FINFO_READ_FUNC read
+#endif
+
#endif
#endif /* __file_h__ */
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
--- libmagic.orig/fsmagic.c 2013-03-21 18:45:14.000000000 +0100
+++ libmagic/fsmagic.c 2013-04-08 15:42:57.328298809 +0200
--- libmagic.orig/fsmagic.c Thu Mar 21 18:45:14 2013
+++ libmagic/fsmagic.c Mon Dec 2 15:25:29 2013
@@ -59,27 +59,21 @@
# define minor(dev) ((dev) & 0xff)
#endif
@@ -1758,8 +1833,8 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
return ret;
}
diff -u libmagic.orig/funcs.c libmagic/funcs.c
--- libmagic.orig/funcs.c 2012-10-31 18:03:01.000000000 +0100
+++ libmagic/funcs.c 2013-04-08 15:42:57.328298809 +0200
--- libmagic.orig/funcs.c Wed Oct 31 18:03:01 2012
+++ libmagic/funcs.c Mon Mar 10 16:40:55 2014
@@ -41,52 +41,42 @@
#if defined(HAVE_WCTYPE_H)
#include <wctype.h>
@@ -1896,7 +1971,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
if ((ms->flags & MAGIC_DEBUG) != 0)
(void)fprintf(stderr, "zmagic %d\n", m);
goto done;
@@ -219,12 +221,17 @@
@@ -219,16 +221,21 @@
}
/* Check if we have a CDF file */
@@ -1919,6 +1994,11 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
/* try soft magic tests */
if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
- if ((m = file_softmagic(ms, ubuf, nb, BINTEST,
+ if ((m = file_softmagic(ms, ubuf, nb, 0, BINTEST,
looks_text)) != 0) {
if ((ms->flags & MAGIC_DEBUG) != 0)
(void)fprintf(stderr, "softmagic %d\n", m);
@@ -296,7 +303,6 @@
return m;
@@ -2047,8 +2127,8 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
}
+
diff -u libmagic.orig/magic.c libmagic/magic.c
--- libmagic.orig/magic.c 2013-01-11 17:43:09.000000000 +0100
+++ libmagic/magic.c 2013-04-27 13:53:32.175250261 +0200
--- libmagic.orig/magic.c Fri Jan 11 17:43:09 2013
+++ libmagic/magic.c Mon Dec 2 15:29:02 2013
@@ -25,11 +25,6 @@
* SUCH DAMAGE.
*/
@@ -2391,8 +2471,8 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
public const char *
magic_error(struct magic_set *ms)
diff -u libmagic.orig/magic.h libmagic/magic.h
--- libmagic.orig/magic.h 2013-03-21 18:52:42.000000000 +0100
+++ libmagic/magic.h 2013-04-08 15:42:57.328298809 +0200
--- libmagic.orig/magic.h Thu Mar 21 18:52:42 2013
+++ libmagic/magic.h Mon Dec 2 15:25:29 2013
@@ -87,6 +87,7 @@
const char *magic_getpath(const char *, int);
@@ -2410,8 +2490,8 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
int magic_errno(magic_t);
diff -u libmagic.orig/print.c libmagic/print.c
--- libmagic.orig/print.c 2013-03-21 18:45:14.000000000 +0100
+++ libmagic/print.c 2013-04-27 13:53:32.175250261 +0200
--- libmagic.orig/print.c Thu Mar 21 18:45:14 2013
+++ libmagic/print.c Mon Dec 2 15:29:02 2013
@@ -28,13 +28,17 @@
/*
* print.c - debugging printout routines
@@ -2641,8 +2721,8 @@ diff -u libmagic.orig/print.c libmagic/print.c
t = ts.tv_sec;
}
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
--- libmagic.orig/readcdf.c 2012-10-31 18:03:01.000000000 +0100
+++ libmagic/readcdf.c 2013-04-08 15:42:57.328298809 +0200
--- libmagic.orig/readcdf.c Wed Oct 31 18:03:01 2012
+++ libmagic/readcdf.c Thu Apr 24 19:54:40 2014
@@ -30,7 +30,11 @@
#endif
@@ -2655,7 +2735,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
#include <string.h>
#include <time.h>
#include <ctype.h>
@@ -46,7 +50,7 @@
@@ -46,12 +50,14 @@
{
size_t i;
cdf_timestamp_t tp;
@@ -2664,7 +2744,14 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
char buf[64];
const char *str = NULL;
const char *s;
@@ -125,8 +129,12 @@
int len;
+ memset(&ts, 0, sizeof(ts));
+
for (i = 0; i < count; i++) {
cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
switch (info[i].pi_type) {
@@ -125,8 +131,12 @@
case CDF_FILETIME:
tp = info[i].pi_tp;
if (tp != 0) {
@@ -2679,18 +2766,24 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
cdf_print_elapsed_time(tbuf,
sizeof(tbuf), tp);
if (NOTMIME(ms) && file_printf(ms,
@@ -134,7 +142,9 @@
@@ -134,9 +144,13 @@
return -1;
} else {
char *c, *ec;
- cdf_timestamp_to_timespec(&ts, tp);
- c = cdf_ctime(&ts.tv_sec, tbuf);
- if ((ec = strchr(c, '\n')) != NULL)
+ const time_t sec = ts.tv_sec;
+ if (cdf_timestamp_to_timespec(&ts, tp) == -1) {
+ return -1;
+ }
c = cdf_ctime(&ts.tv_sec, tbuf);
if ((ec = strchr(c, '\n')) != NULL)
+ c = cdf_ctime(&sec, tbuf);
+ if (c != NULL &&
+ (ec = strchr(c, '\n')) != NULL)
*ec = '\0';
@@ -314,9 +324,9 @@
if (NOTMIME(ms) && file_printf(ms,
@@ -314,9 +328,9 @@
if (file_printf(ms,
"Composite Document File V2 Document") == -1)
return -1;
@@ -2704,8 +2797,8 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
if (file_printf(ms, "application/CDFV2-corrupt") == -1)
return -1;
diff -u libmagic.orig/readelf.c libmagic/readelf.c
--- libmagic.orig/readelf.c 2013-03-21 18:45:14.000000000 +0100
+++ libmagic/readelf.c 2013-04-08 15:42:57.328298809 +0200
--- libmagic.orig/readelf.c Thu Mar 21 18:45:14 2013
+++ libmagic/readelf.c Mon Dec 2 15:25:29 2013
@@ -48,8 +48,8 @@
private int dophn_exec(struct magic_set *, int, int, int, off_t, int, size_t,
off_t, int *, int);
@@ -2956,8 +3049,8 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
if (fstat(fd, &st) == -1) {
diff -u libmagic.orig/readelf.h libmagic/readelf.h
--- libmagic.orig/readelf.h 2013-03-21 18:45:14.000000000 +0100
+++ libmagic/readelf.h 2013-03-31 16:57:18.499744030 +0200
--- libmagic.orig/readelf.h Thu Mar 21 18:45:14 2013
+++ libmagic/readelf.h Mon Dec 2 15:25:29 2013
@@ -44,9 +44,17 @@
typedef uint32_t Elf32_Word;
typedef uint8_t Elf32_Char;
@@ -2977,8 +3070,8 @@ diff -u libmagic.orig/readelf.h libmagic/readelf.h
typedef uint32_t Elf64_Word;
typedef uint8_t Elf64_Char;
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
--- libmagic.orig/softmagic.c 2013-03-21 18:45:14.000000000 +0100
+++ libmagic/softmagic.c 2013-05-14 11:00:07.044745939 +0200
--- libmagic.orig/softmagic.c Thu Mar 21 18:45:14 2013
+++ libmagic/softmagic.c Mon Mar 10 16:40:55 2014
@@ -41,6 +41,11 @@
#include <stdlib.h>
#include <time.h>
@@ -2991,7 +3084,32 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
private int match(struct magic_set *, struct magic *, uint32_t,
const unsigned char *, size_t, size_t, int, int, int, int, int *, int *,
@@ -132,7 +137,7 @@
@@ -62,6 +67,8 @@
private void cvt_32(union VALUETYPE *, const struct magic *);
private void cvt_64(union VALUETYPE *, const struct magic *);
+#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o)))
+
/*
* softmagic - lookup one file in parsed, in-memory copy of database
* Passed the name and FILE * of one file to be typed.
@@ -69,13 +76,13 @@
/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */
protected int
file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
- int mode, int text)
+ size_t level, int mode, int text)
{
struct mlist *ml;
int rv, printed_something = 0, need_separator = 0;
for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
- text, 0, 0, &printed_something, &need_separator,
+ text, 0, level, &printed_something, &need_separator,
NULL)) != 0)
return rv;
@@ -132,7 +139,7 @@
struct magic *m = &magic[magindex];
if (m->type != FILE_NAME)
@@ -3000,7 +3118,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
#define FLT (STRING_BINTEST | STRING_TEXTTEST)
((text && (m->str_flags & FLT) == STRING_BINTEST) ||
(!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
@@ -209,8 +214,8 @@
@@ -209,8 +216,8 @@
if (file_check_mem(ms, ++cont_level) == -1)
return -1;
@@ -3011,7 +3129,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
m = &magic[magindex];
ms->line = m->lineno; /* for messages */
@@ -335,44 +340,22 @@
@@ -335,44 +342,22 @@
private int
check_fmt(struct magic_set *ms, struct magic *m)
{
@@ -3066,7 +3184,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
private int32_t
mprint(struct magic_set *ms, struct magic *m)
{
@@ -583,13 +566,13 @@
@@ -583,13 +568,13 @@
char *cp;
int rval;
@@ -3082,7 +3200,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
if (rval == -1)
return -1;
@@ -835,16 +818,16 @@
@@ -835,16 +820,16 @@
if (m->num_mask) \
switch (m->mask_op & FILE_OPS_MASK) { \
case FILE_OPADD: \
@@ -3103,7 +3221,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
break; \
} \
@@ -1145,9 +1128,6 @@
@@ -1145,9 +1130,6 @@
"nbytes=%zu, count=%u)\n", m->type, m->flag, offset, o,
nbytes, count);
mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE));
@@ -3113,7 +3231,79 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
}
if (m->flag & INDIR) {
@@ -1644,9 +1624,6 @@
@@ -1191,7 +1173,7 @@
}
switch (cvt_flip(m->in_type, flip)) {
case FILE_BYTE:
- if (nbytes < (offset + 1))
+ if (OFFSET_OOB(nbytes, offset, 1))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1226,7 +1208,7 @@
offset = ~offset;
break;
case FILE_BESHORT:
- if (nbytes < (offset + 2))
+ if (OFFSET_OOB(nbytes, offset, 2))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1278,7 +1260,7 @@
offset = ~offset;
break;
case FILE_LESHORT:
- if (nbytes < (offset + 2))
+ if (OFFSET_OOB(nbytes, offset, 2))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1330,7 +1312,7 @@
offset = ~offset;
break;
case FILE_SHORT:
- if (nbytes < (offset + 2))
+ if (OFFSET_OOB(nbytes, offset, 2))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1367,7 +1349,7 @@
break;
case FILE_BELONG:
case FILE_BEID3:
- if (nbytes < (offset + 4))
+ if (OFFSET_OOB(nbytes, offset, 4))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1438,7 +1420,7 @@
break;
case FILE_LELONG:
case FILE_LEID3:
- if (nbytes < (offset + 4))
+ if (OFFSET_OOB(nbytes, offset, 4))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1508,7 +1490,7 @@
offset = ~offset;
break;
case FILE_MELONG:
- if (nbytes < (offset + 4))
+ if (OFFSET_OOB(nbytes, offset, 4))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1578,7 +1560,7 @@
offset = ~offset;
break;
case FILE_LONG:
- if (nbytes < (offset + 4))
+ if (OFFSET_OOB(nbytes, offset, 4))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1644,23 +1626,20 @@
if ((ms->flags & MAGIC_DEBUG) != 0) {
mdebug(offset, (char *)(void *)p,
sizeof(union VALUETYPE));
@@ -3123,23 +3313,101 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
}
}
@@ -1717,12 +1694,12 @@
ms->o.buf = sbuf;
/* Verify we have enough data to match magic type */
switch (m->type) {
case FILE_BYTE:
- if (nbytes < (offset + 1)) /* should alway be true */
+ if (OFFSET_OOB(nbytes, offset, 1))
return 0;
break;
case FILE_SHORT:
case FILE_BESHORT:
case FILE_LESHORT:
- if (nbytes < (offset + 2))
+ if (OFFSET_OOB(nbytes, offset, 2))
return 0;
break;
@@ -1679,38 +1658,40 @@
case FILE_FLOAT:
case FILE_BEFLOAT:
case FILE_LEFLOAT:
- if (nbytes < (offset + 4))
+ if (OFFSET_OOB(nbytes, offset, 4))
return 0;
break;
case FILE_DOUBLE:
case FILE_BEDOUBLE:
case FILE_LEDOUBLE:
- if (nbytes < (offset + 8))
+ if (OFFSET_OOB(nbytes, offset, 8))
return 0;
break;
case FILE_STRING:
case FILE_PSTRING:
case FILE_SEARCH:
- if (nbytes < (offset + m->vallen))
+ if (OFFSET_OOB(nbytes, offset, m->vallen))
return 0;
break;
case FILE_REGEX:
- if (nbytes < offset)
+ if (OFFSET_OOB(nbytes, offset, 0))
return 0;
break;
case FILE_INDIRECT:
- if (nbytes < offset)
+ if (offset == 0)
+ return 0;
+ if (OFFSET_OOB(nbytes, offset, 0))
return 0;
sbuf = ms->o.buf;
soffset = ms->offset;
ms->o.buf = NULL;
ms->offset = 0;
rv = file_softmagic(ms, s + offset, nbytes - offset,
- BINTEST, text);
+ recursion_level, BINTEST, text);
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
rbuf = ms->o.buf;
@@ -1718,16 +1699,26 @@
ms->offset = soffset;
if (rv == 1) {
- if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
+ if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
file_printf(ms, m->desc, offset) == -1)
- return -1;
+ return -1;
if (file_printf(ms, "%s", rbuf) == -1)
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
- file_printf(ms, m->desc, offset) == -1)
+ file_printf(ms, m->desc, offset) == -1) {
+ if (rbuf) {
+ efree(rbuf);
+ }
return -1;
- if (file_printf(ms, "%s", rbuf) == -1)
+ }
+ if (file_printf(ms, "%s", rbuf) == -1) {
+ if (rbuf) {
+ efree(rbuf);
+ }
return -1;
- free(rbuf);
+ }
+ }
+ if (rbuf) {
+ efree(rbuf);
}
return rv;
@@ -1837,6 +1814,42 @@
case FILE_USE:
- if (nbytes < offset)
+ if (OFFSET_OOB(nbytes, offset, 0))
return 0;
sbuf = m->value.s;
if (*sbuf == '^') {
@@ -1837,6 +1828,42 @@
return file_strncmp(a, b, len, flags);
}
@@ -3182,7 +3450,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
private int
magiccheck(struct magic_set *ms, struct magic *m)
{
@@ -1996,69 +2009,157 @@
@@ -1996,69 +2023,157 @@
break;
}
case FILE_REGEX: {
@@ -3395,3 +3663,4 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
default:
file_magerror(ms, "invalid type %d in magiccheck()", m->type);
return -1;
+8 -6
View File
@@ -493,12 +493,14 @@ apprentice_unmap(struct magic_map *map)
if (map == NULL)
return;
if (map->p != php_magic_database) {
int j;
for (j = 0; j < MAGIC_SETS; j++) {
if (map->magic[j])
efree(map->magic[j]);
}
if (map->p != NULL) {
if (map->p == NULL) {
int j;
for (j = 0; j < MAGIC_SETS; j++) {
if (map->magic[j]) {
efree(map->magic[j]);
}
}
} else {
efree(map->p);
}
}
+1 -1
View File
@@ -147,7 +147,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
== NULL)
goto done;
if ((rv = file_softmagic(ms, utf8_buf,
(size_t)(utf8_end - utf8_buf), TEXTTEST, text)) == 0)
(size_t)(utf8_end - utf8_buf), 0, TEXTTEST, text)) == 0)
rv = -1;
}
+11 -13
View File
@@ -823,6 +823,10 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
i, inp[i].pi_id, inp[i].pi_type, q - p, offs));
if (inp[i].pi_type & CDF_VECTOR) {
nelements = CDF_GETUINT32(q, 1);
if (nelements == 0) {
DPRINTF(("CDF_VECTOR with nelements == 0\n"));
goto out;
}
o = 2;
} else {
nelements = 1;
@@ -897,7 +901,9 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
}
DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
nelements));
for (j = 0; j < nelements; j++, i++) {
for (j = 0; j < nelements && i < sh.sh_properties;
j++, i++)
{
uint32_t l = CDF_GETUINT32(q, o);
inp[i].pi_str.s_len = l;
inp[i].pi_str.s_buf = (const char *)
@@ -942,7 +948,7 @@ int
cdf_unpack_summary_info(const cdf_stream_t *sst, const cdf_header_t *h,
cdf_summary_info_header_t *ssi, cdf_property_info_t **info, size_t *count)
{
size_t i, maxcount;
size_t maxcount;
const cdf_summary_info_header_t *si =
CAST(const cdf_summary_info_header_t *, sst->sst_tab);
const cdf_section_declaration_t *sd =
@@ -957,21 +963,13 @@ cdf_unpack_summary_info(const cdf_stream_t *sst, const cdf_header_t *h,
ssi->si_os = CDF_TOLE2(si->si_os);
ssi->si_class = si->si_class;
cdf_swap_class(&ssi->si_class);
ssi->si_count = CDF_TOLE2(si->si_count);
ssi->si_count = CDF_TOLE4(si->si_count);
*count = 0;
maxcount = 0;
*info = NULL;
for (i = 0; i < CDF_TOLE4(si->si_count); i++) {
if (i >= CDF_LOOP_LIMIT) {
DPRINTF(("Unpack summary info loop limit"));
errno = EFTYPE;
if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset), info,
count, &maxcount) == -1)
return -1;
}
if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset),
info, count, &maxcount) == -1) {
return -1;
}
}
return 0;
}
+1 -1
View File
@@ -437,7 +437,7 @@ protected int file_encoding(struct magic_set *, const unsigned char *, size_t,
unichar **, size_t *, const char **, const char **, const char **);
protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
int, int);
size_t, int, int);
protected int file_apprentice(struct magic_set *, const char *, int);
protected int file_magicfind(struct magic_set *, const char *, struct mlist *);
protected uint64_t file_signextend(struct magic_set *, struct magic *,
+1 -1
View File
@@ -235,7 +235,7 @@ file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const
/* try soft magic tests */
if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
if ((m = file_softmagic(ms, ubuf, nb, BINTEST,
if ((m = file_softmagic(ms, ubuf, nb, 0, BINTEST,
looks_text)) != 0) {
if ((ms->flags & MAGIC_DEBUG) != 0)
(void)fprintf(stderr, "softmagic %d\n", m);
+6 -2
View File
@@ -56,6 +56,8 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
const char *s;
int len;
memset(&ts, 0, sizeof(ts));
for (i = 0; i < count; i++) {
cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
switch (info[i].pi_type) {
@@ -142,11 +144,13 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
return -1;
} else {
char *c, *ec;
const time_t sec = ts.tv_sec;
if (cdf_timestamp_to_timespec(&ts, tp) == -1) {
return -1;
}
c = cdf_ctime(&ts.tv_sec, tbuf);
if ((ec = strchr(c, '\n')) != NULL)
c = cdf_ctime(&sec, tbuf);
if (c != NULL &&
(ec = strchr(c, '\n')) != NULL)
*ec = '\0';
if (NOTMIME(ms) && file_printf(ms,
+37 -23
View File
@@ -67,6 +67,8 @@ private void cvt_16(union VALUETYPE *, const struct magic *);
private void cvt_32(union VALUETYPE *, const struct magic *);
private void cvt_64(union VALUETYPE *, const struct magic *);
#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o)))
/*
* softmagic - lookup one file in parsed, in-memory copy of database
* Passed the name and FILE * of one file to be typed.
@@ -74,13 +76,13 @@ private void cvt_64(union VALUETYPE *, const struct magic *);
/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */
protected int
file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
int mode, int text)
size_t level, int mode, int text)
{
struct mlist *ml;
int rv, printed_something = 0, need_separator = 0;
for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
text, 0, 0, &printed_something, &need_separator,
text, 0, level, &printed_something, &need_separator,
NULL)) != 0)
return rv;
@@ -1171,7 +1173,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
}
switch (cvt_flip(m->in_type, flip)) {
case FILE_BYTE:
if (nbytes < (offset + 1))
if (OFFSET_OOB(nbytes, offset, 1))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1206,7 +1208,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
offset = ~offset;
break;
case FILE_BESHORT:
if (nbytes < (offset + 2))
if (OFFSET_OOB(nbytes, offset, 2))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1258,7 +1260,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
offset = ~offset;
break;
case FILE_LESHORT:
if (nbytes < (offset + 2))
if (OFFSET_OOB(nbytes, offset, 2))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1310,7 +1312,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
offset = ~offset;
break;
case FILE_SHORT:
if (nbytes < (offset + 2))
if (OFFSET_OOB(nbytes, offset, 2))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1347,7 +1349,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
break;
case FILE_BELONG:
case FILE_BEID3:
if (nbytes < (offset + 4))
if (OFFSET_OOB(nbytes, offset, 4))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1418,7 +1420,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
break;
case FILE_LELONG:
case FILE_LEID3:
if (nbytes < (offset + 4))
if (OFFSET_OOB(nbytes, offset, 4))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1488,7 +1490,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
offset = ~offset;
break;
case FILE_MELONG:
if (nbytes < (offset + 4))
if (OFFSET_OOB(nbytes, offset, 4))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1558,7 +1560,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
offset = ~offset;
break;
case FILE_LONG:
if (nbytes < (offset + 4))
if (OFFSET_OOB(nbytes, offset, 4))
return 0;
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
@@ -1630,14 +1632,14 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
/* Verify we have enough data to match magic type */
switch (m->type) {
case FILE_BYTE:
if (nbytes < (offset + 1)) /* should always be true */
if (OFFSET_OOB(nbytes, offset, 1))
return 0;
break;
case FILE_SHORT:
case FILE_BESHORT:
case FILE_LESHORT:
if (nbytes < (offset + 2))
if (OFFSET_OOB(nbytes, offset, 2))
return 0;
break;
@@ -1656,55 +1658,67 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
case FILE_FLOAT:
case FILE_BEFLOAT:
case FILE_LEFLOAT:
if (nbytes < (offset + 4))
if (OFFSET_OOB(nbytes, offset, 4))
return 0;
break;
case FILE_DOUBLE:
case FILE_BEDOUBLE:
case FILE_LEDOUBLE:
if (nbytes < (offset + 8))
if (OFFSET_OOB(nbytes, offset, 8))
return 0;
break;
case FILE_STRING:
case FILE_PSTRING:
case FILE_SEARCH:
if (nbytes < (offset + m->vallen))
if (OFFSET_OOB(nbytes, offset, m->vallen))
return 0;
break;
case FILE_REGEX:
if (nbytes < offset)
if (OFFSET_OOB(nbytes, offset, 0))
return 0;
break;
case FILE_INDIRECT:
if (nbytes < offset)
if (offset == 0)
return 0;
if (OFFSET_OOB(nbytes, offset, 0))
return 0;
sbuf = ms->o.buf;
soffset = ms->offset;
ms->o.buf = NULL;
ms->offset = 0;
rv = file_softmagic(ms, s + offset, nbytes - offset,
BINTEST, text);
recursion_level, BINTEST, text);
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
rbuf = ms->o.buf;
ms->o.buf = sbuf;
ms->offset = soffset;
if (rv == 1) {
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
file_printf(ms, m->desc, offset) == -1)
return -1;
if (file_printf(ms, "%s", rbuf) == -1)
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
file_printf(ms, m->desc, offset) == -1) {
if (rbuf) {
efree(rbuf);
}
return -1;
}
if (file_printf(ms, "%s", rbuf) == -1) {
if (rbuf) {
efree(rbuf);
}
return -1;
}
}
if (rbuf) {
efree(rbuf);
}
return rv;
case FILE_USE:
if (nbytes < offset)
if (OFFSET_OOB(nbytes, offset, 0))
return 0;
sbuf = m->value.s;
if (*sbuf == '^') {
+39
View File
@@ -0,0 +1,39 @@
Patches applied to file sources tree before generating magic.mgc
and before running create_data_file.php to create data_file.c.
From ef2329cf71acb59204dd981e2c6cce6c81fe467c Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Mon, 25 Mar 2013 14:06:55 +0000
Subject: [PATCH] limit to 100 repetitions to avoid excessive backtracking
Carsten Wolff
---
magic/Magdir/commands | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/magic/Magdir/commands b/magic/Magdir/commands
index 67c3eee..4a7d8dd 100644
--- a/magic/Magdir/commands
+++ b/magic/Magdir/commands
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: commands,v 1.44 2013/02/05 15:20:47 christos Exp $
+# $File: commands,v 1.45 2013/02/06 14:18:52 christos Exp $
# commands: file(1) magic for various shells and interpreters
#
#0 string/w : shell archive or script for antique kernel text
@@ -49,7 +49,7 @@
!:mime text/x-awk
0 string/wt #!\ /usr/bin/awk awk script text executable
!:mime text/x-awk
-0 regex =^\\s*BEGIN\\s*[{] awk script text
+0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text
# AT&T Bell Labs' Plan 9 shell
0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable
--
1.8.5.5
+39
View File
@@ -0,0 +1,39 @@
--TEST--
Bug #66731: file: infinite recursion
--SKIPIF--
<?php
if (!class_exists('finfo'))
die('skip no fileinfo extension');
--FILE--
<?php
$fd = __DIR__.'/cve-2014-1943.data';
$fm = __DIR__.'/cve-2014-1943.magic';
$a = "\105\122\000\000\000\000\000";
$b = str_repeat("\001", 250000);
$m = "0 byte x\n".
">(1.b) indirect x\n";
file_put_contents($fd, $a);
$fi = finfo_open(FILEINFO_NONE);
var_dump(finfo_file($fi, $fd));
finfo_close($fi);
file_put_contents($fd, $b);
file_put_contents($fm, $m);
$fi = finfo_open(FILEINFO_NONE, $fm);
var_dump(finfo_file($fi, $fd));
finfo_close($fi);
?>
Done
--CLEAN--
<?php
@unlink(__DIR__.'/cve-2014-1943.data');
@unlink(__DIR__.'/cve-2014-1943.magic');
?>
--EXPECTF--
string(%d) "%s"
Warning: finfo_file(): Failed identify data 0:(null) in %s on line %d
bool(false)
Done
+3 -1
View File
@@ -18,7 +18,7 @@ ksort($results);
var_dump($results);
?>
--EXPECTF--
array(8) {
array(9) {
["%s/resources/dir.zip"]=>
string(15) "application/zip"
["%s/resources/test.awk"]=>
@@ -35,4 +35,6 @@ array(8) {
string(15) "application/pdf"
["%s/resources/test.png"]=>
string(9) "image/png"
["%s/resources/test.ppt"]=>
string(29) "application/vnd.ms-powerpoint"
}
Binary file not shown.
+1
View File
@@ -1529,6 +1529,7 @@ ZEND_FUNCTION(gmp_testbit)
if (mpz_tstbit(*gmpnum_a, index)) {
RETURN_TRUE;
}
RETURN_FALSE;
}
/* }}} */
-4
View File
@@ -1,7 +1,3 @@
dnl
dnl $Id$
dnl
PHP_ARG_WITH(interbase,for InterBase support,
[ --with-interbase[=DIR] Include InterBase support. DIR is the InterBase base
install directory [/usr/interbase]])
-1
View File
@@ -1,4 +1,3 @@
// $Id$
// vim:ft=javascript
ARG_WITH("interbase", "InterBase support", "no");
-2
View File
@@ -16,8 +16,6 @@
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-2
View File
@@ -16,8 +16,6 @@
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-2
View File
@@ -16,8 +16,6 @@
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-2
View File
@@ -16,8 +16,6 @@
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-2
View File
@@ -18,8 +18,6 @@
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-2
View File
@@ -18,8 +18,6 @@
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_IBASE_INCLUDES_H
#define PHP_IBASE_INCLUDES_H
-2
View File
@@ -16,8 +16,6 @@
+----------------------------------------------------------------------+
*/
/* $Id$ */
/**
* This UDF library adds the ability to call PHP functions from SQL
* statements. Because of SQL's strong typing, you will have to declare
-2
View File
@@ -18,8 +18,6 @@
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_INTERBASE_H
#define PHP_INTERBASE_H
+1 -1
View File
@@ -1,4 +1,4 @@
<?php /* $Id$ */
<?php
srand((double)microtime()*1000000);
+1 -1
View File
@@ -1,4 +1,4 @@
<?php /* $Id$ */
<?php
if (!extension_loaded("interbase")) print "skip interbase extension not available";
require("interbase.inc");
+4 -1
View File
@@ -13,7 +13,10 @@ foreach($funcs as $func) {
if($rfunc->getNumberOfRequiredParameters() == 0) {
continue;
}
$res = $func($arg);
try {
$res = $func($arg);
} catch (Exception $e) { continue; }
if($res != false) {
echo "$func: ";
var_dump($res);
+2
View File
@@ -1,5 +1,7 @@
--TEST--
Bug #50590 (IntlDateFormatter::parse result is limited to the integer range)
--INI--
date.timezone=Atlantic/Azores
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
+3 -5
View File
@@ -1,11 +1,9 @@
--TEST--
Bug #62070: Collator::getSortKey() returns garbage
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
if (version_compare(INTL_ICU_VERSION, '49') < 0)
die('skip ICU >= 49 only');
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '49') < 0) die('skip for ICU >= 49'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
--FILE--
<?php
$s1 = 'Hello';
+15
View File
@@ -0,0 +1,15 @@
--TEST--
Bug #62070: Collator::getSortKey() returns garbage
--SKIPIF--
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
--FILE--
<?php
$s1 = 'Hello';
$coll = collator_create('en_US');
$res = collator_get_sort_key($coll, $s1);
echo urlencode($res);
--EXPECT--
71%3F%3FE%01%09%01%DC%08
+1
View File
@@ -2,6 +2,7 @@
asort()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
--FILE--
<?php
+243
View File
@@ -0,0 +1,243 @@
--TEST--
asort()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
--FILE--
<?php
/*
* Sort associative arrays using various locales.
*/
$test_num = 1;
/*
* Sort various arrays in specified locale.
*/
function sort_arrays( $locale, $test_arrays, $sort_flag = Collator::SORT_REGULAR )
{
$res_str = '';
$coll = ut_coll_create( $locale );
foreach( $test_arrays as $test_array )
{
// Try to sort test data.
$res_val = ut_coll_asort( $coll, $test_array, $sort_flag );
// Return output data.
$res_dump = "\n" . dump( $test_array ) .
"\n Result: " . dump( $res_val );
// Preppend test signature to output string
$md5 = md5( $res_dump );
global $test_num;
$res_str .= "\n\n".
"Test $test_num.$md5:" .
$res_dump;
++$test_num;
}
return $res_str;
}
/*
* Test main function.
*/
function ut_main()
{
global $test_num;
$test_num = 1;
$res_str = '';
// Sort an array in SORT_REGULAR mode using en_US locale.
$test_params = array(
array( 'd' => 'y' ,
'c' => 'i' ,
'a' => 'k' ),
array( 'a' => 'a' ,
'b' => 'aaa',
'c' => 'aa' ),
array( 'a' => 'a' ,
'aaa'=> 'a' ,
'aa' => 'a' ),
array( '1' => 'abc',
'5' => '!' ,
'2' => null ,
'7' => '' ),
array( '1' => '100',
'2' => '25' ,
'3' => '36' ),
array( '1' => 5 ,
'2' => '30' ,
'3' => 2 )
);
$res_str .= sort_arrays( 'en_US', $test_params );
// Sort an array in SORT_STRING mode using en_US locale.
$test_params = array(
array( '1' => '100',
'2' => '25' ,
'3' => '36' ),
array( '1' => 5 ,
'2' => '30' ,
'3' => 2 ),
array( '1' => 'd' ,
'2' => '' ,
'3' => ' a' ),
array( '1' => 'y' ,
'2' => 'k' ,
'3' => 'i' )
);
$res_str .= sort_arrays( 'en_US', $test_params, Collator::SORT_STRING );
// Sort a non-ASCII array using ru_RU locale.
$test_params = array(
array( 'п' => 'у',
'б' => 'в',
'е' => 'а' ),
array( '1' => 'п',
'4' => '',
'7' => 'd',
'2' => 'пп' )
);
$res_str .= sort_arrays( 'ru_RU', $test_params );
// Sort an array using Lithuanian locale.
$test_params = array(
array( 'd' => 'y',
'c' => 'i',
'a' => 'k' )
);
$res_str .= sort_arrays( 'lt_LT', $test_params );
return $res_str . "\n";
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
Test 1.162b81ac12878b817fc39063097e45b5:
array (
'c' => 'i',
'a' => 'k',
'd' => 'y',
)
Result: true
Test 2.93d96e22f692d8a281b0a389f01f8d1e:
array (
'a' => 'a',
'c' => 'aa',
'b' => 'aaa',
)
Result: true
Test 3.9f25de4482bc7b58de508e278113317c:
array (
'aa' => 'a',
'aaa' => 'a',
'a' => 'a',
)
Result: true
Test 4.a85a41ea78e45b651080cfd98c0b431d:
array (
7 => '',
2 => NULL,
5 => '!',
1 => 'abc',
)
Result: true
Test 5.99dc71f405b286e03d489061b36e6900:
array (
2 => '25',
3 => '36',
1 => '100',
)
Result: true
Test 6.bf5bba243307c9d12934e756ad4be190:
array (
3 => 2,
1 => 5,
2 => '30',
)
Result: true
Test 7.e4ee7024c61476e9e7a6c28b5e47df6f:
array (
1 => '100',
2 => '25',
3 => '36',
)
Result: true
Test 8.5fa7033dd43784be0db1474eb48b83c8:
array (
3 => 2,
2 => '30',
1 => 5,
)
Result: true
Test 9.588cdf4692bc09aa92ffe7e48f9e4579:
array (
2 => '',
3 => ' a',
1 => 'd',
)
Result: true
Test 10.be02641a47ebcccd23e4183ca3a415f7:
array (
3 => 'i',
2 => 'k',
1 => 'y',
)
Result: true
Test 11.153d9b11d1e5936afc917a94a4e11f34:
array (
'е' => 'а',
'б' => 'в',
'п' => 'у',
)
Result: true
Test 12.e1f5cb037b564dce39ffbd0a61562d59:
array (
4 => '',
1 => 'п',
2 => 'пп',
7 => 'd',
)
Result: true
Test 13.8800d48abb960a59002eef77f1d73ae0:
array (
'c' => 'i',
'd' => 'y',
'a' => 'k',
)
Result: true
+1
View File
@@ -2,6 +2,7 @@
compare()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
--FILE--
<?php
@@ -0,0 +1,135 @@
--TEST--
compare()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
--FILE--
<?php
/*
* Compare various string pairs using various locales.
*/
/*
* Converts comparison result to a character.
*/
function cmp_to_char( $comp_res )
{
switch( $comp_res )
{
case 0: // UCOL_EQUAL
return '=';
case 1: // UCOL_GREATER
return '>';
case -1: // UCOL_LESS
return '<';
default:
return '?';
}
}
/*
* Compare string pairs in the given array
* using specified locale.
*/
function compare_pairs( $locale, $test_array )
{
$res_str = '';
$coll = ut_coll_create( $locale );
foreach( $test_array as $test_strings )
{
list( $str1, $str2 ) = $test_strings;
// Compare strings.
$res_val = cmp_to_char( ut_coll_compare( $coll, $str1, $str2 ) );
// Concatenate result strings.
$res_str .= dump( $str1 ) .
' ' . $res_val . ' ' .
dump( $str2 ) . "\n";
}
return $res_str;
}
function ut_main()
{
$res_str = '';
// Compare strings using en_US locale.
$test_params = array(
array( 'abc', 'abc' ),
array( 'Abc', 'abc' ),
array( 'a' , 'abc' ),
array( 'a' , '' ),
array( '' , '' ),
array( 'a' , 'b' ),
array( 'ab' , 'b' ),
array( 'ab' , 'a' ),
array( 123 , 'abc' ),
array( 'ac' , null ),
array( '.' , '.' ),
// Try to compare long strings.
array( 'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcde',
'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdea'),
array( null , null )
);
$res_str .= compare_pairs( 'en_US', $test_params );
// Compare strings using ru_RU locale.
$test_params = array(
array( 'а', 'б' ),
array( 'а', 'аа' ),
array( 'аб', 'ба' ),
array( 'а', ',' ),
array( 'а', 'b' ),
array( 'а', 'bb' ),
array( 'а', 'ab' ),
array( 'а', null )
);
$res_str .= compare_pairs( 'ru_RU', $test_params );
// Compare strings using lt_LT locale.
$test_params = array(
array( 'y', 'k' )
);
$res_str .= compare_pairs( 'lt_LT', $test_params );
return $res_str;
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
'abc' = 'abc'
'Abc' > 'abc'
'a' < 'abc'
'a' > ''
'' = ''
'a' < 'b'
'ab' < 'b'
'ab' > 'a'
123 < 'abc'
'ac' > NULL
'.' = '.'
'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcde' < 'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdea'
NULL = NULL
'а' < 'б'
'а' < 'аа'
'аб' < 'ба'
'а' > ','
'а' < 'b'
'а' < 'bb'
'а' < 'ab'
'а' > NULL
'y' < 'k'
+3 -2
View File
@@ -1,8 +1,9 @@
--TEST--
create() icu >= 4.8
create() icu >= 4.8 && icu < 53.1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip for ICU >= 4.8'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
--FILE--
<?php
+82
View File
@@ -0,0 +1,82 @@
--TEST--
create() icu >= 53.1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
--FILE--
<?php
/*
* Try creating collator with different locales
* with Procedural and Object methods.
*/
function ut_main()
{
$res_str = '';
$locales = array(
'EN-US-ODESSA',
'UK_UA_ODESSA',
'uk-ua_CALIFORNIA@currency=;currency=GRN',
'',
'root',
'uk@currency=EURO',
'1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
);
foreach( $locales as $locale )
{
// Create Collator with the current locale.
$coll = ut_coll_create( $locale );
if( !is_object($coll) )
{
$res_str .= "Error creating collator with '$locale' locale: " .
intl_get_error_message() . "\n";
continue;
}
// Get the requested, valid and actual locales.
$vloc = ut_coll_get_locale( $coll, Locale::VALID_LOCALE );
$aloc = ut_coll_get_locale( $coll, Locale::ACTUAL_LOCALE );
// Show them.
$res_str .= "Locale: '$locale'\n" .
" ULOC_REQUESTED_LOCALE = '$locale'\n" .
" ULOC_VALID_LOCALE = '$vloc'\n" .
" ULOC_ACTUAL_LOCALE = '$aloc'\n";
}
return $res_str;
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECTF--
Locale: 'EN-US-ODESSA'
ULOC_REQUESTED_LOCALE = 'EN-US-ODESSA'
ULOC_VALID_LOCALE = 'en_US'
ULOC_ACTUAL_LOCALE = 'root'
Locale: 'UK_UA_ODESSA'
ULOC_REQUESTED_LOCALE = 'UK_UA_ODESSA'
ULOC_VALID_LOCALE = 'uk'
ULOC_ACTUAL_LOCALE = 'uk'
Locale: 'uk-ua_CALIFORNIA@currency=;currency=GRN'
ULOC_REQUESTED_LOCALE = 'uk-ua_CALIFORNIA@currency=;currency=GRN'
ULOC_VALID_LOCALE = 'root'
ULOC_ACTUAL_LOCALE = 'root'
Locale: ''
ULOC_REQUESTED_LOCALE = ''
ULOC_VALID_LOCALE = '%s'
ULOC_ACTUAL_LOCALE = '%s'
Locale: 'root'
ULOC_REQUESTED_LOCALE = 'root'
ULOC_VALID_LOCALE = 'root'
ULOC_ACTUAL_LOCALE = 'root'
Locale: 'uk@currency=EURO'
ULOC_REQUESTED_LOCALE = 'uk@currency=EURO'
ULOC_VALID_LOCALE = 'uk'
ULOC_ACTUAL_LOCALE = 'uk'
Error creating collator with '1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than 80 characters: U_ILLEGAL_ARGUMENT_ERROR
+3 -1
View File
@@ -3,6 +3,8 @@ collator_get_sort_key()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip ICU >= 4.8 only'; ?>
<?php /* XXX Obviously it fails somewhere between >= 4.8 and < 51.2 */
if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
--FILE--
<?php
@@ -95,4 +97,4 @@ key: 5c0a161801070107
source: жжж
key: 5c3a3a3a01070107
source: эюя
key: 5d3b3f4501070107
key: 5d3b3f4501070107
@@ -0,0 +1,99 @@
--TEST--
collator_get_sort_key()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
--FILE--
<?php
/*
* Get sort keys using various locales
*/
function sort_arrays( $locale, $data )
{
$res_str = '';
$coll = ut_coll_create( $locale );
foreach($data as $value) {
$res_val = ut_coll_get_sort_key( $coll, $value );
$res_str .= "source: ".$value."\n".
"key: ".bin2hex($res_val)."\n";
}
return $res_str;
}
function ut_main()
{
$res_str = '';
// Regular strings keys
$test_params = array(
'abc', 'abd', 'aaa',
'аа', 'а', 'z',
'', null , '3',
'y' , 'i' , 'k'
);
$res_str .= sort_arrays( 'en_US', $test_params );
// Sort a non-ASCII array using ru_RU locale.
$test_params = array(
'абг', 'абв', 'жжж', 'эюя'
);
$res_str .= sort_arrays( 'ru_RU', $test_params );
// Sort an array using Lithuanian locale.
$res_str .= sort_arrays( 'lt_LT', $test_params );
return $res_str . "\n";
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
source: abc
key: 27292b01070107
source: abd
key: 27292d01070107
source: aaa
key: 27272701070107
source: аа
key: 5c0a0a01060106
source: а
key: 5c0a01050105
source: z
key: 5901050105
source:
key: 0101
source:
key: 0101
source: 3
key: 1801050105
source: y
key: 5701050105
source: i
key: 3701050105
source: k
key: 3b01050105
source: абг
key: 260a161a01070107
source: абв
key: 260a161801070107
source: жжж
key: 263a3a3a01070107
source: эюя
key: 273b3f4501070107
source: абг
key: 5c0a161a01070107
source: абв
key: 5c0a161801070107
source: жжж
key: 5c3a3a3a01070107
source: эюя
key: 5d3b3f4501070107
@@ -0,0 +1,98 @@
--TEST--
collator_get_sort_key()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
--FILE--
<?php
/*
* Get sort keys using various locales
*/
function sort_arrays( $locale, $data )
{
$res_str = '';
$coll = ut_coll_create( $locale );
foreach($data as $value) {
$res_val = ut_coll_get_sort_key( $coll, $value );
$res_str .= "source: ".$value."\n".
"key: ".bin2hex($res_val)."\n";
}
return $res_str;
}
function ut_main()
{
$res_str = '';
// Regular strings keys
$test_params = array(
'abc', 'abd', 'aaa',
'аа', 'а', 'z',
'', null , '3',
'y' , 'i' , 'k'
);
$res_str .= sort_arrays( 'en_US', $test_params );
// Sort a non-ASCII array using ru_RU locale.
$test_params = array(
'абг', 'абв', 'жжж', 'эюя'
);
$res_str .= sort_arrays( 'ru_RU', $test_params );
// Sort an array using Lithuanian locale.
$res_str .= sort_arrays( 'lt_LT', $test_params );
return $res_str . "\n";
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
source: abc
key: 292b2d01070107
source: abd
key: 292b2f01070107
source: aaa
key: 29292901070107
source: аа
key: 5e090901060106
source: а
key: 5e0901050105
source: z
key: 5b01050105
source:
key: 0101
source:
key: 0101
source: 3
key: 1a01050105
source: y
key: 5901050105
source: i
key: 3901050105
source: k
key: 3d01050105
source: абг
key: 2809131701070107
source: абв
key: 2809131501070107
source: жжж
key: 2833333301070107
source: эюя
key: 28cdd1d501070107
source: абг
key: 5e09131701070107
source: абв
key: 5e09131501070107
source: жжж
key: 5e33333301070107
source: эюя
key: 5ecdd1d501070107
+1
View File
@@ -2,6 +2,7 @@
sort()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
--FILE--
<?php
+248
View File
@@ -0,0 +1,248 @@
--TEST--
sort()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
--FILE--
<?php
/*
* Sort arrays using various locales.
*/
$test_num = 1;
/*
* Sort arrays in the given list using specified locale.
*/
function sort_arrays( $locale, $arrays, $sort_flag = Collator::SORT_REGULAR )
{
$res_str = '';
$coll = ut_coll_create( $locale );
foreach( $arrays as $array )
{
// Sort array values
$res_val = ut_coll_sort( $coll, $array, $sort_flag );
// Concatenate the sorted array and function result
// with output string.
$res_dump = "\n" . dump( $array ) .
"\n Result: " . dump( $res_val );
// Preppend test signature to output string
$md5 = md5( $res_dump );
global $test_num;
$res_str .= "\n\n".
"Test $test_num.$md5:" .
$res_dump;
++$test_num;
}
return $res_str;
}
function ut_main()
{
global $test_num;
$test_num = 1;
$res_str = '';
// Sort an array in SORT_REGULAR mode using en_US locale.
$test_params = array(
array( 'abc', 'abd', 'aaa' ),
array( 'm' , '1' , '_' ),
array( 'a' , 'aaa', 'aa' ),
array( 'ba' , 'b' , 'ab' ),
array( 'e' , 'c' , 'a' ),
array( '100', '25' , '36' ),
array( 5 , '30' , 2 ),
array( 'd' , '' , ' a' ),
array( 'd ' , 'f ' , ' a' ),
array( 'a' , null , '3' ),
array( 'y' , 'k' , 'i' )
);
$res_str .= sort_arrays( 'en_US', $test_params );
$test_params = array(
array( '100', '25' , '36' ),
array( 5 , '30' , 2 ),
array( 'd' , '' , ' a' ),
array( 'y' , 'k' , 'i' )
);
// Sort in en_US locale with SORT_STRING flag
$res_str .= sort_arrays( 'en_US', $test_params, Collator::SORT_STRING );
// Sort a non-ASCII array using ru_RU locale.
$test_params = array(
array( 'абг', 'абв', 'ааа', 'abc' ),
array( 'аа', 'ааа' , 'а' )
);
$res_str .= sort_arrays( 'ru_RU', $test_params );
// Sort an array using Lithuanian locale.
$test_params = array(
array( 'y' , 'k' , 'i' )
);
$res_str .= sort_arrays( 'lt_LT', $test_params );
return $res_str;
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
Test 1.e8f1cd28133d79ecd660002f1c660d0e:
array (
0 => 'aaa',
1 => 'abc',
2 => 'abd',
)
Result: true
Test 2.c2ded12173dd2996927378cae37eb275:
array (
0 => '_',
1 => '1',
2 => 'm',
)
Result: true
Test 3.54071c968d71cb98c5d379145f8d7d38:
array (
0 => 'a',
1 => 'aa',
2 => 'aaa',
)
Result: true
Test 4.19abe63d6f6dfef65b0e3c9ab4826b07:
array (
0 => 'ab',
1 => 'b',
2 => 'ba',
)
Result: true
Test 5.9a8dc0a9bc771368c2f1fc3d02754610:
array (
0 => 'a',
1 => 'c',
2 => 'e',
)
Result: true
Test 6.ab530b060e5e54a65bfb8b9f8fc61870:
array (
0 => '25',
1 => '36',
2 => '100',
)
Result: true
Test 7.0718dd838509017bded2ed307a6e785f:
array (
0 => 2,
1 => 5,
2 => '30',
)
Result: true
Test 8.923d65739c5219c634616ffd100a50e4:
array (
0 => '',
1 => ' a',
2 => 'd',
)
Result: true
Test 9.289bc2f28e87d3201ec9d7e8477ae1b0:
array (
0 => ' a',
1 => 'd ',
2 => 'f ',
)
Result: true
Test 10.de0fd958484f2377a645835d7fbcf124:
array (
0 => NULL,
1 => '3',
2 => 'a',
)
Result: true
Test 11.dd2b8f0adb37c45d528cad1a0cc0f361:
array (
0 => 'i',
1 => 'k',
2 => 'y',
)
Result: true
Test 12.1e6b4d6f7df9d4580317634ea46d8208:
array (
0 => '100',
1 => '25',
2 => '36',
)
Result: true
Test 13.cec115dc9850b98dfbdf102efa09e61b:
array (
0 => 2,
1 => '30',
2 => 5,
)
Result: true
Test 14.923d65739c5219c634616ffd100a50e4:
array (
0 => '',
1 => ' a',
2 => 'd',
)
Result: true
Test 15.dd2b8f0adb37c45d528cad1a0cc0f361:
array (
0 => 'i',
1 => 'k',
2 => 'y',
)
Result: true
Test 16.49056308afb2b800363c5baa735ed247:
array (
0 => 'ааа',
1 => 'абв',
2 => 'абг',
3 => 'abc',
)
Result: true
Test 17.91480b10473a0c96a4cd6d88c23c577a:
array (
0 => 'а',
1 => 'аа',
2 => 'ааа',
)
Result: true
Test 18.fdd3fe3981476039164aa000bf9177f2:
array (
0 => 'i',
1 => 'y',
2 => 'k',
)
Result: true
@@ -2,6 +2,7 @@
sort_with_sort_keys()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
--FILE--
<?php
@@ -0,0 +1,190 @@
--TEST--
sort_with_sort_keys()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
--FILE--
<?php
/*
* Sort arrays using various locales.
*/
$test_num = 1;
/*
* Sort arrays in the given list using specified locale.
*/
function sort_arrays( $locale, $arrays )
{
$res_str = '';
$coll = ut_coll_create( $locale );
foreach( $arrays as $array )
{
// Sort array values
$res_val = ut_coll_sort_with_sort_keys( $coll, $array );
// Concatenate the sorted array and function result
// with output string.
$res_dump = "\n" . dump( $array ) .
"\n Result: " . dump( $res_val );
// Preppend test signature to output string
$md5 = md5( $res_dump );
global $test_num;
$res_str .= "\n\n".
"Test $test_num.$md5:" .
$res_dump;
++$test_num;
}
return $res_str;
}
function ut_main()
{
global $test_num;
$test_num = 1;
$res_str = '';
// Sort an array in SORT_REGULAR mode using en_US locale.
$test_params = array(
array( 'abc', 'abd', 'aaa' ),
array( 'm' , '1' , '_' ),
array( 'a' , 'aaa', 'aa' ),
array( 'ba' , 'b' , 'ab' ),
array( 'e' , 'c' , 'a' ),
array( 'd' , '' , ' a' ),
array( 'd ' , 'f ' , ' a' ),
array( 'a' , null , '3' ),
array( 'y' , 'i' , 'k' )
);
$res_str .= sort_arrays( 'en_US', $test_params );
// Sort a non-ASCII array using ru_RU locale.
$test_params = array(
array( 'абг', 'абв', 'ааа', 'abc' ),
array( 'аа', 'ааа', 'а' )
);
$res_str .= sort_arrays( 'ru_RU', $test_params );
// Array with data for sorting.
$test_params = array(
array( 'y' , 'i' , 'k' )
);
// Sort an array using Lithuanian locale.
$res_str .= sort_arrays( 'lt_LT', $test_params );
return $res_str . "\n";
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
Test 1.e8f1cd28133d79ecd660002f1c660d0e:
array (
0 => 'aaa',
1 => 'abc',
2 => 'abd',
)
Result: true
Test 2.c2ded12173dd2996927378cae37eb275:
array (
0 => '_',
1 => '1',
2 => 'm',
)
Result: true
Test 3.54071c968d71cb98c5d379145f8d7d38:
array (
0 => 'a',
1 => 'aa',
2 => 'aaa',
)
Result: true
Test 4.19abe63d6f6dfef65b0e3c9ab4826b07:
array (
0 => 'ab',
1 => 'b',
2 => 'ba',
)
Result: true
Test 5.9a8dc0a9bc771368c2f1fc3d02754610:
array (
0 => 'a',
1 => 'c',
2 => 'e',
)
Result: true
Test 6.923d65739c5219c634616ffd100a50e4:
array (
0 => '',
1 => ' a',
2 => 'd',
)
Result: true
Test 7.289bc2f28e87d3201ec9d7e8477ae1b0:
array (
0 => ' a',
1 => 'd ',
2 => 'f ',
)
Result: true
Test 8.de0fd958484f2377a645835d7fbcf124:
array (
0 => NULL,
1 => '3',
2 => 'a',
)
Result: true
Test 9.dd2b8f0adb37c45d528cad1a0cc0f361:
array (
0 => 'i',
1 => 'k',
2 => 'y',
)
Result: true
Test 10.49056308afb2b800363c5baa735ed247:
array (
0 => 'ааа',
1 => 'абв',
2 => 'абг',
3 => 'abc',
)
Result: true
Test 11.91480b10473a0c96a4cd6d88c23c577a:
array (
0 => 'а',
1 => 'аа',
2 => 'ааа',
)
Result: true
Test 12.fdd3fe3981476039164aa000bf9177f2:
array (
0 => 'i',
1 => 'y',
2 => 'k',
)
Result: true
@@ -0,0 +1,45 @@
--TEST--
IntlDateFormatter, calendars and time zone
--INI--
date.timezone=Atlantic/Azores
--SKIPIF--
<?php
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$fmt1 = new IntlDateFormatter('en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'GMT+05:12',
IntlDateFormatter::TRADITIONAL);
$fmt2 = new IntlDateFormatter('en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'GMT+05:12',
IntlDateFormatter::GREGORIAN);
$fmt3 = new IntlDateFormatter('en_US@calendar=hebrew',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'GMT+05:12',
IntlDateFormatter::TRADITIONAL);
var_dump($fmt1->format(strtotime('2012-01-01 00:00:00 +0000')));
var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000')));
var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000')));
new IntlDateFormatter('en_US@calendar=hebrew',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'GMT+05:12',
-1);
?>
==DONE==
--EXPECTF--
string(47) "Sunday, January 1, 2012 at 5:12:00 AM GMT+05:12"
string(47) "Sunday, January 1, 2012 at 5:12:00 AM GMT+05:12"
string(48) "Sunday, Tevet 6, 5772 AM at 5:12:00 AM GMT+05:12"
Warning: IntlDateFormatter::__construct(): datefmt_create: invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %sdateformat_calendars_variant2.php on line %d
==DONE==
@@ -0,0 +1,85 @@
--TEST--
datefmt_set_timezone_id_code() icu >= 4.8
--INI--
date.timezone=Atlantic/Azores
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("error_reporting", ~E_DEPRECATED);
/*
* Test for the datefmt_set_timezone_id function
*/
function ut_main()
{
$timezone_id_arr = array (
'America/New_York',
'America/Los_Angeles',
'America/Chicago',
'CN'
);
$timestamp_entry = 0;
$res_str = '';
$fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN );
$timezone_id = ut_datefmt_get_timezone_id( $fmt );
$res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n";
foreach( $timezone_id_arr as $timezone_id_entry )
{
$res_str .= "-----------";
$res_str .= "\nTrying to set timezone_id= $timezone_id_entry";
ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry );
$timezone_id = ut_datefmt_get_timezone_id( $fmt );
$res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id";
$formatted = ut_datefmt_format( $fmt, 0);
$res_str .= "\nFormatting timestamp=0 resulted in $formatted";
$formatted = ut_datefmt_format( $fmt, 3600);
$res_str .= "\nFormatting timestamp=3600 resulted in $formatted";
$res_str .= "\n";
}
return $res_str;
}
include_once( 'ut_common.inc' );
// Run the test
ut_run();
?>
--EXPECTF--
Warning: IntlDateFormatter::setTimeZoneId(): datefmt_set_timezone: no such time zone: 'CN' in %sut_common.inc on line %d
Warning: datefmt_set_timezone_id(): datefmt_set_timezone: no such time zone: 'CN' in %sut_common.inc on line %d
After creation of the dateformatter : timezone_id= US/Pacific
-----------
Trying to set timezone_id= America/New_York
After call to set_timezone_id : timezone_id= America/New_York
Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 7:00:00 PM Eastern Standard Time
Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 8:00:00 PM Eastern Standard Time
-----------
Trying to set timezone_id= America/Los_Angeles
After call to set_timezone_id : timezone_id= America/Los_Angeles
Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 4:00:00 PM Pacific Standard Time
Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 5:00:00 PM Pacific Standard Time
-----------
Trying to set timezone_id= America/Chicago
After call to set_timezone_id : timezone_id= America/Chicago
Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 6:00:00 PM Central Standard Time
Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 7:00:00 PM Central Standard Time
-----------
Trying to set timezone_id= CN
After call to set_timezone_id : timezone_id= America/Chicago
Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 6:00:00 PM Central Standard Time
Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 7:00:00 PM Central Standard Time
+1 -1
View File
@@ -2,7 +2,7 @@
numfmt_format() icu >= 4.8
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) print 'skip'; ?>
--FILE--
<?php
+131
View File
@@ -0,0 +1,131 @@
--TEST--
numfmt_format() icu >= 52.1 && icu < 53.1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if(version_compare(INTL_ICU_VERSION, '52.1') < 0) print 'skip for ICU >= 52.1'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
--FILE--
<?php
/*
* Format a number using misc locales/patterns.
*/
/*
* TODO: doesn't pass on ICU 3.6 because 'ru' and 'de' locales changed
* currency and percent formatting.
*/
function ut_main()
{
$styles = array(
NumberFormatter::PATTERN_DECIMAL => '##.#####################',
NumberFormatter::DECIMAL => '',
NumberFormatter::CURRENCY => '',
NumberFormatter::PERCENT => '',
NumberFormatter::SCIENTIFIC => '',
NumberFormatter::SPELLOUT => '@@@@@@@',
NumberFormatter::ORDINAL => '',
NumberFormatter::DURATION => '',
NumberFormatter::PATTERN_RULEBASED => '#####.###',
1234999, // bad one
);
$integer = array(
NumberFormatter::ORDINAL => '',
NumberFormatter::DURATION => '',
);
$locales = array(
'en_US',
'ru_UA',
'de',
'fr',
'en_UK'
);
$str_res = '';
$number = 1234567.891234567890000;
foreach( $locales as $locale )
{
$str_res .= "\nLocale is: $locale\n";
foreach( $styles as $style => $pattern )
{
$fmt = ut_nfmt_create( $locale, $style, $pattern );
if(!$fmt) {
$str_res .= "Bad formatter!\n";
continue;
}
$str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
}
}
return $str_res;
}
include_once( 'ut_common.inc' );
// Run the test
ut_run();
?>
--EXPECTREGEX--
Locale is: en_US
'1234567.89123457'
'1,234,567.891'
'\$1,234,567.89'
'123,456,789%'
'1.23456789123457E6'
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven'
'1,234,567(th|ᵗʰ)'
'342:56:07'
'#####.###'
Bad formatter!
Locale is: ru_UA
'1234567,89123457'
'1 234 567,891'
'1 234 567,89 ?(грн\.|₴)'
'123 456 789 ?%'
'1,23456789123457E6'
'один миллион двести тридцать четыре тысяч пятьсот шестьдесят семь запятая восемь девять один два три четыре пять семь'
'1 234 567.?'
'1 234 567'
'#####.###'
Bad formatter!
Locale is: de
'1234567,89123457'
'1.234.567,891'
'(¤ )?1.234.567,89( ¤)?'
'123\.456\.789 %'
'1,23456789123457E6'
'eine Million zwei­hundert­vier­und­dreißig­tausend­fünf­hundert­sieben­und­sechzig Komma acht neun eins zwei drei vier fünf sieben'
'1.234.567.?'
'1.234.567'
'#####.###'
Bad formatter!
Locale is: fr
'1234567,89123457'
'1 234 567,891'
'1 234 567,89 ¤'
'123 456 789 ?%'
'1,23456789123457E6'
'un million deux cent trente-quatre mille cinq cent soixante-sept virgule huit neuf un deux trois quatre cinq sept'
'1 234 567e'
'1 234 567'
'#####.###'
Bad formatter!
Locale is: en_UK
'1234567.89123457'
'1,234,567.891'
'¤1,234,567.89'
'123,456,789%'
'1.23456789123457E6'
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven'
'1,234,567(th|ᵗʰ)'
'342:56:07'
'#####.###'
Bad formatter!
+130
View File
@@ -0,0 +1,130 @@
--TEST--
numfmt_format() icu >= 53.1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
--FILE--
<?php
/*
* Format a number using misc locales/patterns.
*/
/*
* TODO: doesn't pass on ICU 3.6 because 'ru' and 'de' locales changed
* currency and percent formatting.
*/
function ut_main()
{
$styles = array(
NumberFormatter::PATTERN_DECIMAL => '##.#####################',
NumberFormatter::DECIMAL => '',
NumberFormatter::CURRENCY => '',
NumberFormatter::PERCENT => '',
NumberFormatter::SCIENTIFIC => '',
NumberFormatter::SPELLOUT => '@@@@@@@',
NumberFormatter::ORDINAL => '',
NumberFormatter::DURATION => '',
NumberFormatter::PATTERN_RULEBASED => '#####.###',
1234999, // bad one
);
$integer = array(
NumberFormatter::ORDINAL => '',
NumberFormatter::DURATION => '',
);
$locales = array(
'en_US',
'ru_UA',
'de',
'fr',
'en_UK'
);
$str_res = '';
$number = 1234567.891234567890000;
foreach( $locales as $locale )
{
$str_res .= "\nLocale is: $locale\n";
foreach( $styles as $style => $pattern )
{
$fmt = ut_nfmt_create( $locale, $style, $pattern );
if(!$fmt) {
$str_res .= "Bad formatter!\n";
continue;
}
$str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
}
}
return $str_res;
}
include_once( 'ut_common.inc' );
// Run the test
ut_run();
?>
--EXPECTREGEX--
Locale is: en_US
'1234567.89123457'
'1,234,567.891'
'\$1,234,567.89'
'123,456,789%'
'1.23456789123457E6'
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven'
'1,234,567(th|ᵗʰ)'
'342:56:07'
'#####.###'
'USD1,234,567.89'
Locale is: ru_UA
'1234567,89123457'
'1 234 567,891'
'1 234 567,89 ?(грн\.|₴)'
'123 456 789 ?%'
'1,23456789123457E6'
'один миллион двести тридцать четыре тысяч пятьсот шестьдесят семь запятая восемь девять один два три четыре пять семь'
'1 234 567.?'
'1 234 567'
'#####.###'
'1 234 567,89 UAH'
Locale is: de
'1234567,89123457'
'1.234.567,891'
'(¤ )?1.234.567,89( ¤)?'
'123\.456\.789 %'
'1,23456789123457E6'
'eine Million zwei­hundert­vier­und­dreißig­tausend­fünf­hundert­sieben­und­sechzig Komma acht neun eins zwei drei vier fünf sieben'
'1.234.567.?'
'1.234.567'
'#####.###'
'1.234.567,89 ¤¤'
Locale is: fr
'1234567,89123457'
'1 234 567,891'
'1 234 567,89 ¤'
'123 456 789 ?%'
'1,23456789123457E6'
'un million deux cent trente-quatre mille cinq cent soixante-sept virgule huit neuf un deux trois quatre cinq sept'
'1 234 567e'
'1 234 567'
'#####.###'
'1 234 567,89 ¤¤'
Locale is: en_UK
'1234567.89123457'
'1,234,567.891'
'¤1,234,567.89'
'123,456,789%'
'1.23456789123457E6'
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven'
'1,234,567(th|ᵗʰ)'
'342:56:07'
'#####.###'
'¤¤1,234,567.89'
+1
View File
@@ -2,6 +2,7 @@
numfmt_get_locale()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
--FILE--
<?php
@@ -0,0 +1,50 @@
--TEST--
numfmt_get_locale()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
--FILE--
<?php
/*
* Get locale.
*/
function ut_main()
{
$locales = array(
'en_UK',
'en_US@California',
'fr_CA',
);
$loc_types = array(
Locale::ACTUAL_LOCALE => 'actual',
Locale::VALID_LOCALE => 'valid',
);
$res_str = '';
foreach( $locales as $locale )
{
$fmt = ut_nfmt_create( $locale, NumberFormatter::DECIMAL );
$res_str .= "$locale: ";
foreach( $loc_types as $loc_type => $loc_type_name )
$res_str .= sprintf( " %s=%s",
$loc_type_name,
dump( ut_nfmt_get_locale( $fmt, $loc_type ) ) );
$res_str .= "\n";
}
return $res_str;
}
include_once( 'ut_common.inc' );
// Run the test
ut_run();
?>
--EXPECT--
en_UK: actual='en' valid='en'
en_US@California: actual='en' valid='en'
fr_CA: actual='fr' valid='fr_CA'
+2 -1
View File
@@ -1,8 +1,9 @@
--TEST--
locale_filter_matches.phpt() icu >= 4.8
locale_filter_matches.phpt() icu >= 4.8 && icu < 51.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
--FILE--
<?php
+366
View File
@@ -0,0 +1,366 @@
--TEST--
locale_filter_matches.phpt() ICU >= 51.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
--FILE--
<?php
/*
* Try parsing different Locales
* with Procedural and Object methods.
*/
function ut_main()
{
$loc_ranges = array(
'de-de',
'sl_IT',
'sl_IT_Nedis',
'jbo',
'art-lojban',
'sl_IT'
);
$lang_tags = array(
'de-DEVA',
'de-DE-1996',
'de-DE',
'zh_Hans',
'de-CH-1996',
'sl_IT',
'sl_IT_nedis-a-kirti-x-xyz',
'sl_IT_rozaj',
'sl_IT_NEDIS_ROJAZ_1901',
'i-enochian',
'sgn-CH-de',
'art-lojban',
'i-lux',
'art-lojban',
'jbo',
'en_sl_IT'
);
$res_str = '';
$isCanonical = false;
foreach($loc_ranges as $loc_range){
foreach($lang_tags as $lang_tag){
$res_str .="--------------\n";
$result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , $isCanonical);
$res_str .= "loc_range:$loc_range matches lang_tag $lang_tag ? ";
if( $result){
$res_str .= "YES\n";
}else{
$res_str .= "NO\n";
}
//canonicalized version
$result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , !($isCanonical));
$can_loc_range = ut_loc_canonicalize($loc_range);
$can_lang_tag = ut_loc_canonicalize($lang_tag);
$res_str .= "loc_range:$can_loc_range canonically matches lang_tag $can_lang_tag ? ";
if( $result){
$res_str .= "YES\n";
}else{
$res_str .= "NO\n";
}
}
}
$res_str .= "\n";
return $res_str;
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
--------------
loc_range:de-de matches lang_tag de-DEVA ? NO
loc_range:de_DE canonically matches lang_tag de_Deva ? NO
--------------
loc_range:de-de matches lang_tag de-DE-1996 ? YES
loc_range:de_DE canonically matches lang_tag de_DE_1996 ? YES
--------------
loc_range:de-de matches lang_tag de-DE ? YES
loc_range:de_DE canonically matches lang_tag de_DE ? YES
--------------
loc_range:de-de matches lang_tag zh_Hans ? NO
loc_range:de_DE canonically matches lang_tag zh_Hans ? NO
--------------
loc_range:de-de matches lang_tag de-CH-1996 ? NO
loc_range:de_DE canonically matches lang_tag de_CH_1996 ? NO
--------------
loc_range:de-de matches lang_tag sl_IT ? NO
loc_range:de_DE canonically matches lang_tag sl_IT ? NO
--------------
loc_range:de-de matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? NO
loc_range:de_DE canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? NO
--------------
loc_range:de-de matches lang_tag sl_IT_rozaj ? NO
loc_range:de_DE canonically matches lang_tag sl_IT_ROZAJ ? NO
--------------
loc_range:de-de matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO
loc_range:de_DE canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO
--------------
loc_range:de-de matches lang_tag i-enochian ? NO
loc_range:de_DE canonically matches lang_tag @x=i-enochian ? NO
--------------
loc_range:de-de matches lang_tag sgn-CH-de ? NO
loc_range:de_DE canonically matches lang_tag sgn_CH_DE ? NO
--------------
loc_range:de-de matches lang_tag art-lojban ? NO
loc_range:de_DE canonically matches lang_tag art__LOJBAN ? NO
--------------
loc_range:de-de matches lang_tag i-lux ? NO
loc_range:de_DE canonically matches lang_tag lb ? NO
--------------
loc_range:de-de matches lang_tag art-lojban ? NO
loc_range:de_DE canonically matches lang_tag art__LOJBAN ? NO
--------------
loc_range:de-de matches lang_tag jbo ? NO
loc_range:de_DE canonically matches lang_tag jbo ? NO
--------------
loc_range:de-de matches lang_tag en_sl_IT ? NO
loc_range:de_DE canonically matches lang_tag en_SL_IT ? NO
--------------
loc_range:sl_IT matches lang_tag de-DEVA ? NO
loc_range:sl_IT canonically matches lang_tag de_Deva ? NO
--------------
loc_range:sl_IT matches lang_tag de-DE-1996 ? NO
loc_range:sl_IT canonically matches lang_tag de_DE_1996 ? NO
--------------
loc_range:sl_IT matches lang_tag de-DE ? NO
loc_range:sl_IT canonically matches lang_tag de_DE ? NO
--------------
loc_range:sl_IT matches lang_tag zh_Hans ? NO
loc_range:sl_IT canonically matches lang_tag zh_Hans ? NO
--------------
loc_range:sl_IT matches lang_tag de-CH-1996 ? NO
loc_range:sl_IT canonically matches lang_tag de_CH_1996 ? NO
--------------
loc_range:sl_IT matches lang_tag sl_IT ? YES
loc_range:sl_IT canonically matches lang_tag sl_IT ? YES
--------------
loc_range:sl_IT matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? YES
loc_range:sl_IT canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? YES
--------------
loc_range:sl_IT matches lang_tag sl_IT_rozaj ? YES
loc_range:sl_IT canonically matches lang_tag sl_IT_ROZAJ ? YES
--------------
loc_range:sl_IT matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES
loc_range:sl_IT canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES
--------------
loc_range:sl_IT matches lang_tag i-enochian ? NO
loc_range:sl_IT canonically matches lang_tag @x=i-enochian ? NO
--------------
loc_range:sl_IT matches lang_tag sgn-CH-de ? NO
loc_range:sl_IT canonically matches lang_tag sgn_CH_DE ? NO
--------------
loc_range:sl_IT matches lang_tag art-lojban ? NO
loc_range:sl_IT canonically matches lang_tag art__LOJBAN ? NO
--------------
loc_range:sl_IT matches lang_tag i-lux ? NO
loc_range:sl_IT canonically matches lang_tag lb ? NO
--------------
loc_range:sl_IT matches lang_tag art-lojban ? NO
loc_range:sl_IT canonically matches lang_tag art__LOJBAN ? NO
--------------
loc_range:sl_IT matches lang_tag jbo ? NO
loc_range:sl_IT canonically matches lang_tag jbo ? NO
--------------
loc_range:sl_IT matches lang_tag en_sl_IT ? NO
loc_range:sl_IT canonically matches lang_tag en_SL_IT ? NO
--------------
loc_range:sl_IT_Nedis matches lang_tag de-DEVA ? NO
loc_range:sl_IT_NEDIS canonically matches lang_tag de_Deva ? NO
--------------
loc_range:sl_IT_Nedis matches lang_tag de-DE-1996 ? NO
loc_range:sl_IT_NEDIS canonically matches lang_tag de_DE_1996 ? NO
--------------
loc_range:sl_IT_Nedis matches lang_tag de-DE ? NO
loc_range:sl_IT_NEDIS canonically matches lang_tag de_DE ? NO
--------------
loc_range:sl_IT_Nedis matches lang_tag zh_Hans ? NO
loc_range:sl_IT_NEDIS canonically matches lang_tag zh_Hans ? NO
--------------
loc_range:sl_IT_Nedis matches lang_tag de-CH-1996 ? NO
loc_range:sl_IT_NEDIS canonically matches lang_tag de_CH_1996 ? NO
--------------
loc_range:sl_IT_Nedis matches lang_tag sl_IT ? NO
loc_range:sl_IT_NEDIS canonically matches lang_tag sl_IT ? NO
--------------
loc_range:sl_IT_Nedis matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? YES
loc_range:sl_IT_NEDIS canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? YES
--------------
loc_range:sl_IT_Nedis matches lang_tag sl_IT_rozaj ? NO
loc_range:sl_IT_NEDIS canonically matches lang_tag sl_IT_ROZAJ ? NO
--------------
loc_range:sl_IT_Nedis matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES
loc_range:sl_IT_NEDIS canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES
--------------
loc_range:sl_IT_Nedis matches lang_tag i-enochian ? NO
loc_range:sl_IT_NEDIS canonically matches lang_tag @x=i-enochian ? NO
--------------
loc_range:sl_IT_Nedis matches lang_tag sgn-CH-de ? NO
loc_range:sl_IT_NEDIS canonically matches lang_tag sgn_CH_DE ? NO
--------------
loc_range:sl_IT_Nedis matches lang_tag art-lojban ? NO
loc_range:sl_IT_NEDIS canonically matches lang_tag art__LOJBAN ? NO
--------------
loc_range:sl_IT_Nedis matches lang_tag i-lux ? NO
loc_range:sl_IT_NEDIS canonically matches lang_tag lb ? NO
--------------
loc_range:sl_IT_Nedis matches lang_tag art-lojban ? NO
loc_range:sl_IT_NEDIS canonically matches lang_tag art__LOJBAN ? NO
--------------
loc_range:sl_IT_Nedis matches lang_tag jbo ? NO
loc_range:sl_IT_NEDIS canonically matches lang_tag jbo ? NO
--------------
loc_range:sl_IT_Nedis matches lang_tag en_sl_IT ? NO
loc_range:sl_IT_NEDIS canonically matches lang_tag en_SL_IT ? NO
--------------
loc_range:jbo matches lang_tag de-DEVA ? NO
loc_range:jbo canonically matches lang_tag de_Deva ? NO
--------------
loc_range:jbo matches lang_tag de-DE-1996 ? NO
loc_range:jbo canonically matches lang_tag de_DE_1996 ? NO
--------------
loc_range:jbo matches lang_tag de-DE ? NO
loc_range:jbo canonically matches lang_tag de_DE ? NO
--------------
loc_range:jbo matches lang_tag zh_Hans ? NO
loc_range:jbo canonically matches lang_tag zh_Hans ? NO
--------------
loc_range:jbo matches lang_tag de-CH-1996 ? NO
loc_range:jbo canonically matches lang_tag de_CH_1996 ? NO
--------------
loc_range:jbo matches lang_tag sl_IT ? NO
loc_range:jbo canonically matches lang_tag sl_IT ? NO
--------------
loc_range:jbo matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? NO
loc_range:jbo canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? NO
--------------
loc_range:jbo matches lang_tag sl_IT_rozaj ? NO
loc_range:jbo canonically matches lang_tag sl_IT_ROZAJ ? NO
--------------
loc_range:jbo matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO
loc_range:jbo canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO
--------------
loc_range:jbo matches lang_tag i-enochian ? NO
loc_range:jbo canonically matches lang_tag @x=i-enochian ? NO
--------------
loc_range:jbo matches lang_tag sgn-CH-de ? NO
loc_range:jbo canonically matches lang_tag sgn_CH_DE ? NO
--------------
loc_range:jbo matches lang_tag art-lojban ? NO
loc_range:jbo canonically matches lang_tag art__LOJBAN ? NO
--------------
loc_range:jbo matches lang_tag i-lux ? NO
loc_range:jbo canonically matches lang_tag lb ? NO
--------------
loc_range:jbo matches lang_tag art-lojban ? NO
loc_range:jbo canonically matches lang_tag art__LOJBAN ? NO
--------------
loc_range:jbo matches lang_tag jbo ? YES
loc_range:jbo canonically matches lang_tag jbo ? YES
--------------
loc_range:jbo matches lang_tag en_sl_IT ? NO
loc_range:jbo canonically matches lang_tag en_SL_IT ? NO
--------------
loc_range:art-lojban matches lang_tag de-DEVA ? NO
loc_range:art__LOJBAN canonically matches lang_tag de_Deva ? NO
--------------
loc_range:art-lojban matches lang_tag de-DE-1996 ? NO
loc_range:art__LOJBAN canonically matches lang_tag de_DE_1996 ? NO
--------------
loc_range:art-lojban matches lang_tag de-DE ? NO
loc_range:art__LOJBAN canonically matches lang_tag de_DE ? NO
--------------
loc_range:art-lojban matches lang_tag zh_Hans ? NO
loc_range:art__LOJBAN canonically matches lang_tag zh_Hans ? NO
--------------
loc_range:art-lojban matches lang_tag de-CH-1996 ? NO
loc_range:art__LOJBAN canonically matches lang_tag de_CH_1996 ? NO
--------------
loc_range:art-lojban matches lang_tag sl_IT ? NO
loc_range:art__LOJBAN canonically matches lang_tag sl_IT ? NO
--------------
loc_range:art-lojban matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? NO
loc_range:art__LOJBAN canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? NO
--------------
loc_range:art-lojban matches lang_tag sl_IT_rozaj ? NO
loc_range:art__LOJBAN canonically matches lang_tag sl_IT_ROZAJ ? NO
--------------
loc_range:art-lojban matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO
loc_range:art__LOJBAN canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? NO
--------------
loc_range:art-lojban matches lang_tag i-enochian ? NO
loc_range:art__LOJBAN canonically matches lang_tag @x=i-enochian ? NO
--------------
loc_range:art-lojban matches lang_tag sgn-CH-de ? NO
loc_range:art__LOJBAN canonically matches lang_tag sgn_CH_DE ? NO
--------------
loc_range:art-lojban matches lang_tag art-lojban ? YES
loc_range:art__LOJBAN canonically matches lang_tag art__LOJBAN ? YES
--------------
loc_range:art-lojban matches lang_tag i-lux ? NO
loc_range:art__LOJBAN canonically matches lang_tag lb ? NO
--------------
loc_range:art-lojban matches lang_tag art-lojban ? YES
loc_range:art__LOJBAN canonically matches lang_tag art__LOJBAN ? YES
--------------
loc_range:art-lojban matches lang_tag jbo ? NO
loc_range:art__LOJBAN canonically matches lang_tag jbo ? NO
--------------
loc_range:art-lojban matches lang_tag en_sl_IT ? NO
loc_range:art__LOJBAN canonically matches lang_tag en_SL_IT ? NO
--------------
loc_range:sl_IT matches lang_tag de-DEVA ? NO
loc_range:sl_IT canonically matches lang_tag de_Deva ? NO
--------------
loc_range:sl_IT matches lang_tag de-DE-1996 ? NO
loc_range:sl_IT canonically matches lang_tag de_DE_1996 ? NO
--------------
loc_range:sl_IT matches lang_tag de-DE ? NO
loc_range:sl_IT canonically matches lang_tag de_DE ? NO
--------------
loc_range:sl_IT matches lang_tag zh_Hans ? NO
loc_range:sl_IT canonically matches lang_tag zh_Hans ? NO
--------------
loc_range:sl_IT matches lang_tag de-CH-1996 ? NO
loc_range:sl_IT canonically matches lang_tag de_CH_1996 ? NO
--------------
loc_range:sl_IT matches lang_tag sl_IT ? YES
loc_range:sl_IT canonically matches lang_tag sl_IT ? YES
--------------
loc_range:sl_IT matches lang_tag sl_IT_nedis-a-kirti-x-xyz ? YES
loc_range:sl_IT canonically matches lang_tag sl_IT_NEDIS_A_KIRTI_X_XYZ ? YES
--------------
loc_range:sl_IT matches lang_tag sl_IT_rozaj ? YES
loc_range:sl_IT canonically matches lang_tag sl_IT_ROZAJ ? YES
--------------
loc_range:sl_IT matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES
loc_range:sl_IT canonically matches lang_tag sl_IT_NEDIS_ROJAZ_1901 ? YES
--------------
loc_range:sl_IT matches lang_tag i-enochian ? NO
loc_range:sl_IT canonically matches lang_tag @x=i-enochian ? NO
--------------
loc_range:sl_IT matches lang_tag sgn-CH-de ? NO
loc_range:sl_IT canonically matches lang_tag sgn_CH_DE ? NO
--------------
loc_range:sl_IT matches lang_tag art-lojban ? NO
loc_range:sl_IT canonically matches lang_tag art__LOJBAN ? NO
--------------
loc_range:sl_IT matches lang_tag i-lux ? NO
loc_range:sl_IT canonically matches lang_tag lb ? NO
--------------
loc_range:sl_IT matches lang_tag art-lojban ? NO
loc_range:sl_IT canonically matches lang_tag art__LOJBAN ? NO
--------------
loc_range:sl_IT matches lang_tag jbo ? NO
loc_range:sl_IT canonically matches lang_tag jbo ? NO
--------------
loc_range:sl_IT matches lang_tag en_sl_IT ? NO
loc_range:sl_IT canonically matches lang_tag en_SL_IT ? NO
+2 -1
View File
@@ -1,8 +1,9 @@
--TEST--
locale_get_display_name() icu >= 4.8
locale_get_display_name() icu >= 4.8 && icu < 51.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
--FILE--
<?php
@@ -0,0 +1,342 @@
--TEST--
locale_get_display_name() icu >= 51.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?>
--FILE--
<?php
/*
* Try getting the display_name for different locales
* with Procedural and Object methods.
*/
function ut_main()
{
$res_str='';
$disp_locales=array('en','fr','de');
$locales = array(
'sl_IT_nedis_KIRTI',
'sl_IT_nedis-a-kirti-x-xyz',
'sl_IT_rozaj',
'sl_IT_NEDIS_ROJAZ_1901',
'i-enochian',
'zh-hakka',
'zh-wuu',
'i-tay',
'sgn-BE-nl',
'sgn-CH-de',
'sl_IT_rozaj@currency=EUR',
'uk-ua_CALIFORNIA@currency=;currency=GRN',
'root',
'uk@currency=EURO',
'Hindi',
//Simple language subtag
'de',
'fr',
'ja',
'i-enochian', //(example of a grandfathered tag)
//Language subtag plus Script subtag:
'zh-Hant',
'zh-Hans',
'sr-Cyrl',
'sr-Latn',
//Language-Script-Region
'zh-Hans-CN',
'sr-Latn-CS',
//Language-Variant
'sl-rozaj',
'sl-nedis',
//Language-Region-Variant
'de-CH-1901',
'sl-IT-nedis',
//Language-Script-Region-Variant
'sl-Latn-IT-nedis',
//Language-Region:
'de-DE',
'en-US',
'es-419',
//Private use subtags:
'de-CH-x-phonebk',
'az-Arab-x-AZE-derbend',
//Extended language subtags
'zh-min',
'zh-min-nan-Hant-CN',
//Private use registry values
'x-whatever',
'qaa-Qaaa-QM-x-southern',
'sr-Latn-QM',
'sr-Qaaa-CS',
/*Tags that use extensions (examples ONLY: extensions MUST be defined
by revision or update to this document or by RFC): */
'en-US-u-islamCal',
'zh-CN-a-myExt-x-private',
'en-a-myExt-b-another',
//Some Invalid Tags:
'de-419-DE',
'a-DE',
'ar-a-aaa-b-bbb-a-ccc'
);
$res_str = '';
foreach( $locales as $locale )
{
$res_str .= "locale='$locale'\n";
foreach( $disp_locales as $disp_locale )
{
$scr = ut_loc_get_display_name( $locale ,$disp_locale );
$scr = str_replace(array('(', ')'), '#', $scr);
$res_str .= "disp_locale=$disp_locale : display_name=$scr";
$res_str .= "\n";
}
$res_str .= "-----------------\n";
}
return $res_str;
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECTREGEX--
locale='sl_IT_nedis_KIRTI'
disp_locale=en : display_name=Slovenian #Italy, NEDIS_KIRTI#
disp_locale=fr : display_name=slovène #Italie, NEDIS_KIRTI#
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_KIRTI#
-----------------
locale='sl_IT_nedis-a-kirti-x-xyz'
disp_locale=en : display_name=Slovenian #Italy, NEDIS_A_KIRTI_X_XYZ#
disp_locale=fr : display_name=slovène #Italie, NEDIS_A_KIRTI_X_XYZ#
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_A_KIRTI_X_XYZ#
-----------------
locale='sl_IT_rozaj'
disp_locale=en : display_name=Slovenian #Italy, Resian#
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia#
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch)#
-----------------
locale='sl_IT_NEDIS_ROJAZ_1901'
disp_locale=en : display_name=Slovenian #Italy, NEDIS_ROJAZ_1901#
disp_locale=fr : display_name=slovène #Italie, NEDIS_ROJAZ_1901#
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_ROJAZ_1901#
-----------------
locale='i-enochian'
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian#
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
-----------------
locale='zh-hakka'
disp_locale=en : display_name=Chinese( #HAKKA#)?
disp_locale=fr : display_name=chinois( #HAKKA#)?
disp_locale=de : display_name=Chinesisch( #HAKKA#)?
-----------------
locale='zh-wuu'
disp_locale=en : display_name=Chinese #WUU#
disp_locale=fr : display_name=chinois #WUU#
disp_locale=de : display_name=Chinesisch #WUU#
-----------------
locale='i-tay'
disp_locale=en : display_name=i-tay
disp_locale=fr : display_name=i-tay
disp_locale=de : display_name=i-tay
-----------------
locale='sgn-BE-nl'
disp_locale=en : display_name=Sign Languages? #Belgium, NL#
disp_locale=fr : display_name=langues? des signes #Belgique, NL#
disp_locale=de : display_name=Gebärdensprache #Belgien, NL#
-----------------
locale='sgn-CH-de'
disp_locale=en : display_name=Sign Languages? #Switzerland, DE#
disp_locale=fr : display_name=langues? des signes #Suisse, DE#
disp_locale=de : display_name=Gebärdensprache #Schweiz, DE#
-----------------
locale='sl_IT_rozaj@currency=EUR'
disp_locale=en : display_name=Slovenian #Italy, Resian, [Cc]urrency=Euro#
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia, [Dd]evise=euro#
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch), Währung=Euro#
-----------------
locale='uk-ua_CALIFORNIA@currency=;currency=GRN'
disp_locale=en : display_name=Ukrainian #Ukraine, CALIFORNIA, [Cc]urrency#
disp_locale=fr : display_name=ukrainien #Ukraine, CALIFORNIA, [Dd]evise#
disp_locale=de : display_name=Ukrainisch #Ukraine, CALIFORNIA, Währung#
-----------------
locale='root'
disp_locale=en : display_name=Root
disp_locale=fr : display_name=racine
disp_locale=de : display_name=[Rr]oot
-----------------
locale='uk@currency=EURO'
disp_locale=en : display_name=Ukrainian #[Cc]urrency=EURO#
disp_locale=fr : display_name=ukrainien #[Dd]evise=EURO#
disp_locale=de : display_name=Ukrainisch #Währung=EURO#
-----------------
locale='Hindi'
disp_locale=en : display_name=hindi
disp_locale=fr : display_name=hindi
disp_locale=de : display_name=hindi
-----------------
locale='de'
disp_locale=en : display_name=German
disp_locale=fr : display_name=allemand
disp_locale=de : display_name=Deutsch
-----------------
locale='fr'
disp_locale=en : display_name=French
disp_locale=fr : display_name=français
disp_locale=de : display_name=Französisch
-----------------
locale='ja'
disp_locale=en : display_name=Japanese
disp_locale=fr : display_name=japonais
disp_locale=de : display_name=Japanisch
-----------------
locale='i-enochian'
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian#
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
-----------------
locale='zh-Hant'
disp_locale=en : display_name=Chinese #Traditional#
disp_locale=fr : display_name=chinois #traditionnel#
disp_locale=de : display_name=Chinesisch #Traditionell#
-----------------
locale='zh-Hans'
disp_locale=en : display_name=Chinese #Simplified#
disp_locale=fr : display_name=chinois #simplifié#
disp_locale=de : display_name=Chinesisch #Vereinfacht#
-----------------
locale='sr-Cyrl'
disp_locale=en : display_name=Serbian #Cyrillic#
disp_locale=fr : display_name=serbe #cyrillique#
disp_locale=de : display_name=Serbisch #Kyrillisch#
-----------------
locale='sr-Latn'
disp_locale=en : display_name=Serbian #Latin#
disp_locale=fr : display_name=serbe #latin#
disp_locale=de : display_name=Serbisch #Lateinisch#
-----------------
locale='zh-Hans-CN'
disp_locale=en : display_name=Chinese #Simplified, China#
disp_locale=fr : display_name=chinois #simplifié, Chine#
disp_locale=de : display_name=Chinesisch #Vereinfacht, China#
-----------------
locale='sr-Latn-CS'
disp_locale=en : display_name=Serbian #Latin, Serbia#
disp_locale=fr : display_name=serbe #latin, Serbie#
disp_locale=de : display_name=Serbisch #Lateinisch, Serbien#
-----------------
locale='sl-rozaj'
disp_locale=en : display_name=Slovenian #Resian#
disp_locale=fr : display_name=slovène #dialecte de Resia#
disp_locale=de : display_name=Slowenisch( #(ROZAJ|Resianisch)#)?
-----------------
locale='sl-nedis'
disp_locale=en : display_name=Slovenian #Natisone dialect#
disp_locale=fr : display_name=slovène #dialecte de Natisone#
disp_locale=de : display_name=Slowenisch #Natisone-Dialekt#
-----------------
locale='de-CH-1901'
disp_locale=en : display_name=German #Switzerland, Traditional German orthography#
disp_locale=fr : display_name=allemand #Suisse, orthographe allemande traditionnelle#
disp_locale=de : display_name=Deutsch #Schweiz, (1901|[aA]lte deutsche Rechtschreibung)#
-----------------
locale='sl-IT-nedis'
disp_locale=en : display_name=Slovenian #Italy, Natisone dialect#
disp_locale=fr : display_name=slovène #Italie, dialecte de Natisone#
disp_locale=de : display_name=Slowenisch #Italien, (NEDIS|Natisone-Dialekt)#
-----------------
locale='sl-Latn-IT-nedis'
disp_locale=en : display_name=Slovenian #Latin, Italy, Natisone dialect#
disp_locale=fr : display_name=slovène #latin, Italie, dialecte de Natisone#
disp_locale=de : display_name=Slowenisch #Lateinisch, Italien, (NEDIS|Natisone-Dialekt)#
-----------------
locale='de-DE'
disp_locale=en : display_name=German #Germany#
disp_locale=fr : display_name=allemand #Allemagne#
disp_locale=de : display_name=Deutsch #Deutschland#
-----------------
locale='en-US'
disp_locale=en : display_name=English #United States#
disp_locale=fr : display_name=anglais #États-Unis#
disp_locale=de : display_name=Englisch #Vereinigte Staaten#
-----------------
locale='es-419'
disp_locale=en : display_name=Spanish #Latin America#
disp_locale=fr : display_name=espagnol #Amérique latine#
disp_locale=de : display_name=Spanisch #Lateinamerika#
-----------------
locale='de-CH-x-phonebk'
disp_locale=en : display_name=German #Switzerland, Private-Use=phonebk#
disp_locale=fr : display_name=allemand #Suisse, Usage privé=phonebk#
disp_locale=de : display_name=Deutsch #Schweiz, Privatnutzung=phonebk#
-----------------
locale='az-Arab-x-AZE-derbend'
disp_locale=en : display_name=Azerbaijani #Arabic, Private-Use=aze-derbend#
disp_locale=fr : display_name=azéri #arabe, Usage privé=aze-derbend#
disp_locale=de : display_name=Aserbaidschanisch #Arabisch, Privatnutzung=aze-derbend#
-----------------
locale='zh-min'
disp_locale=en : display_name=Chinese #MIN#
disp_locale=fr : display_name=chinois #MIN#
disp_locale=de : display_name=Chinesisch #MIN#
-----------------
locale='zh-min-nan-Hant-CN'
disp_locale=en : display_name=Chinese #MIN, NAN_HANT_CN#
disp_locale=fr : display_name=chinois #MIN, NAN_HANT_CN#
disp_locale=de : display_name=Chinesisch #MIN, NAN_HANT_CN#
-----------------
locale='x-whatever'
disp_locale=en : display_name=x-whatever #Private-Use=whatever#
disp_locale=fr : display_name=x-whatever #Usage privé=whatever#
disp_locale=de : display_name=x-whatever #Privatnutzung=whatever#
-----------------
locale='qaa-Qaaa-QM-x-southern'
disp_locale=en : display_name=qaa #Qaaa, QM, Private-Use=southern#
disp_locale=fr : display_name=qaa #Qaaa, QM, Usage privé=southern#
disp_locale=de : display_name=qaa #Qaaa, QM, Privatnutzung=southern#
-----------------
locale='sr-Latn-QM'
disp_locale=en : display_name=Serbian #Latin, QM#
disp_locale=fr : display_name=serbe #latin, QM#
disp_locale=de : display_name=Serbisch #Lateinisch, QM#
-----------------
locale='sr-Qaaa-CS'
disp_locale=en : display_name=Serbian #Qaaa, Serbia#
disp_locale=fr : display_name=serbe #Qaaa, Serbie#
disp_locale=de : display_name=Serbisch #Qaaa, Serbien#
-----------------
locale='en-US-u-islamCal'
disp_locale=en : display_name=English #United States, attribute=islamcal#
disp_locale=fr : display_name=anglais #États-Unis, attribute=islamcal#
disp_locale=de : display_name=Englisch #Vereinigte Staaten, attribute=islamcal#
-----------------
locale='zh-CN-a-myExt-x-private'
disp_locale=en : display_name=Chinese #China, a=myext, Private-Use=private#
disp_locale=fr : display_name=chinois #Chine, a=myext, Usage privé=private#
disp_locale=de : display_name=Chinesisch #China, a=myext, Privatnutzung=private#
-----------------
locale='en-a-myExt-b-another'
disp_locale=en : display_name=English #a=myext, b=another#
disp_locale=fr : display_name=anglais #a=myext, b=another#
disp_locale=de : display_name=Englisch #a=myext, b=another#
-----------------
locale='de-419-DE'
disp_locale=en : display_name=German #Latin America, DE#
disp_locale=fr : display_name=allemand #Amérique latine, DE#
disp_locale=de : display_name=Deutsch #Lateinamerika, DE#
-----------------
locale='a-DE'
disp_locale=en : display_name=a #Germany#
disp_locale=fr : display_name=a #Allemagne#
disp_locale=de : display_name=a #Deutschland#
-----------------
locale='ar-a-aaa-b-bbb-a-ccc'
disp_locale=en : display_name=Arabic #a=aaa, b=bbb#
disp_locale=fr : display_name=arabe #a=aaa, b=bbb#
disp_locale=de : display_name=Arabisch #a=aaa, b=bbb#
-----------------
@@ -0,0 +1,343 @@
--TEST--
locale_get_display_name() icu >= 52.1 && icu < 53.1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '52.1') < 0) die('skip for ICU >= 52.1'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
--FILE--
<?php
/*
* Try getting the display_name for different locales
* with Procedural and Object methods.
*/
function ut_main()
{
$res_str='';
$disp_locales=array('en','fr','de');
$locales = array(
'sl_IT_nedis_KIRTI',
'sl_IT_nedis-a-kirti-x-xyz',
'sl_IT_rozaj',
'sl_IT_NEDIS_ROJAZ_1901',
'i-enochian',
'zh-hakka',
'zh-wuu',
'i-tay',
'sgn-BE-nl',
'sgn-CH-de',
'sl_IT_rozaj@currency=EUR',
'uk-ua_CALIFORNIA@currency=;currency=GRN',
'root',
'uk@currency=EURO',
'Hindi',
//Simple language subtag
'de',
'fr',
'ja',
'i-enochian', //(example of a grandfathered tag)
//Language subtag plus Script subtag:
'zh-Hant',
'zh-Hans',
'sr-Cyrl',
'sr-Latn',
//Language-Script-Region
'zh-Hans-CN',
'sr-Latn-CS',
//Language-Variant
'sl-rozaj',
'sl-nedis',
//Language-Region-Variant
'de-CH-1901',
'sl-IT-nedis',
//Language-Script-Region-Variant
'sl-Latn-IT-nedis',
//Language-Region:
'de-DE',
'en-US',
'es-419',
//Private use subtags:
'de-CH-x-phonebk',
'az-Arab-x-AZE-derbend',
//Extended language subtags
'zh-min',
'zh-min-nan-Hant-CN',
//Private use registry values
'x-whatever',
'qaa-Qaaa-QM-x-southern',
'sr-Latn-QM',
'sr-Qaaa-CS',
/*Tags that use extensions (examples ONLY: extensions MUST be defined
by revision or update to this document or by RFC): */
'en-US-u-islamCal',
'zh-CN-a-myExt-x-private',
'en-a-myExt-b-another',
//Some Invalid Tags:
'de-419-DE',
'a-DE',
'ar-a-aaa-b-bbb-a-ccc'
);
$res_str = '';
foreach( $locales as $locale )
{
$res_str .= "locale='$locale'\n";
foreach( $disp_locales as $disp_locale )
{
$scr = ut_loc_get_display_name( $locale ,$disp_locale );
$scr = str_replace(array('(', ')'), '#', $scr);
$res_str .= "disp_locale=$disp_locale : display_name=$scr";
$res_str .= "\n";
}
$res_str .= "-----------------\n";
}
return $res_str;
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECTREGEX--
locale='sl_IT_nedis_KIRTI'
disp_locale=en : display_name=Slovenian #Italy, NEDIS_KIRTI#
disp_locale=fr : display_name=slovène #Italie, NEDIS_KIRTI#
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_KIRTI#
-----------------
locale='sl_IT_nedis-a-kirti-x-xyz'
disp_locale=en : display_name=Slovenian #Italy, NEDIS_A_KIRTI_X_XYZ#
disp_locale=fr : display_name=slovène #Italie, NEDIS_A_KIRTI_X_XYZ#
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_A_KIRTI_X_XYZ#
-----------------
locale='sl_IT_rozaj'
disp_locale=en : display_name=Slovenian #Italy, Resian#
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia#
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch)#
-----------------
locale='sl_IT_NEDIS_ROJAZ_1901'
disp_locale=en : display_name=Slovenian #Italy, NEDIS_ROJAZ_1901#
disp_locale=fr : display_name=slovène #Italie, NEDIS_ROJAZ_1901#
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_ROJAZ_1901#
-----------------
locale='i-enochian'
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian#
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
-----------------
locale='zh-hakka'
disp_locale=en : display_name=Chinese( #HAKKA#)?
disp_locale=fr : display_name=chinois( #HAKKA#)?
disp_locale=de : display_name=Chinesisch( #HAKKA#)?
-----------------
locale='zh-wuu'
disp_locale=en : display_name=Chinese #WUU#
disp_locale=fr : display_name=chinois #WUU#
disp_locale=de : display_name=Chinesisch #WUU#
-----------------
locale='i-tay'
disp_locale=en : display_name=i-tay
disp_locale=fr : display_name=i-tay
disp_locale=de : display_name=i-tay
-----------------
locale='sgn-BE-nl'
disp_locale=en : display_name=Sign Languages? #Belgium, NL#
disp_locale=fr : display_name=langues? des signes #Belgique, NL#
disp_locale=de : display_name=Gebärdensprache #Belgien, NL#
-----------------
locale='sgn-CH-de'
disp_locale=en : display_name=Sign Languages? #Switzerland, DE#
disp_locale=fr : display_name=langues? des signes #Suisse, DE#
disp_locale=de : display_name=Gebärdensprache #Schweiz, DE#
-----------------
locale='sl_IT_rozaj@currency=EUR'
disp_locale=en : display_name=Slovenian #Italy, Resian, [Cc]urrency=Euro#
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia, [Dd]evise=euro#
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch), Währung=Euro#
-----------------
locale='uk-ua_CALIFORNIA@currency=;currency=GRN'
disp_locale=en : display_name=
disp_locale=fr : display_name=
disp_locale=de : display_name=
-----------------
locale='root'
disp_locale=en : display_name=Root
disp_locale=fr : display_name=racine
disp_locale=de : display_name=[Rr]oot
-----------------
locale='uk@currency=EURO'
disp_locale=en : display_name=Ukrainian #[Cc]urrency=EURO#
disp_locale=fr : display_name=ukrainien #[Dd]evise=EURO#
disp_locale=de : display_name=Ukrainisch #Währung=EURO#
-----------------
locale='Hindi'
disp_locale=en : display_name=hindi
disp_locale=fr : display_name=hindi
disp_locale=de : display_name=hindi
-----------------
locale='de'
disp_locale=en : display_name=German
disp_locale=fr : display_name=allemand
disp_locale=de : display_name=Deutsch
-----------------
locale='fr'
disp_locale=en : display_name=French
disp_locale=fr : display_name=français
disp_locale=de : display_name=Französisch
-----------------
locale='ja'
disp_locale=en : display_name=Japanese
disp_locale=fr : display_name=japonais
disp_locale=de : display_name=Japanisch
-----------------
locale='i-enochian'
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian#
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
-----------------
locale='zh-Hant'
disp_locale=en : display_name=Chinese #Traditional#
disp_locale=fr : display_name=chinois #traditionnel#
disp_locale=de : display_name=Chinesisch #Traditionell#
-----------------
locale='zh-Hans'
disp_locale=en : display_name=Chinese #Simplified#
disp_locale=fr : display_name=chinois #simplifié#
disp_locale=de : display_name=Chinesisch #Vereinfacht#
-----------------
locale='sr-Cyrl'
disp_locale=en : display_name=Serbian #Cyrillic#
disp_locale=fr : display_name=serbe #cyrillique#
disp_locale=de : display_name=Serbisch #Kyrillisch#
-----------------
locale='sr-Latn'
disp_locale=en : display_name=Serbian #Latin#
disp_locale=fr : display_name=serbe #latin#
disp_locale=de : display_name=Serbisch #Lateinisch#
-----------------
locale='zh-Hans-CN'
disp_locale=en : display_name=Chinese #Simplified, China#
disp_locale=fr : display_name=chinois #simplifié, Chine#
disp_locale=de : display_name=Chinesisch #Vereinfacht, China#
-----------------
locale='sr-Latn-CS'
disp_locale=en : display_name=Serbian #Latin, Serbia#
disp_locale=fr : display_name=serbe #latin, Serbie#
disp_locale=de : display_name=Serbisch #Lateinisch, Serbien#
-----------------
locale='sl-rozaj'
disp_locale=en : display_name=Slovenian #Resian#
disp_locale=fr : display_name=slovène #dialecte de Resia#
disp_locale=de : display_name=Slowenisch( #(ROZAJ|Resianisch)#)?
-----------------
locale='sl-nedis'
disp_locale=en : display_name=Slovenian #Natisone dialect#
disp_locale=fr : display_name=slovène #dialecte de Natisone#
disp_locale=de : display_name=Slowenisch #Natisone-Dialekt#
-----------------
locale='de-CH-1901'
disp_locale=en : display_name=German #Switzerland, Traditional German orthography#
disp_locale=fr : display_name=allemand #Suisse, orthographe allemande traditionnelle#
disp_locale=de : display_name=Deutsch #Schweiz, (1901|[aA]lte deutsche Rechtschreibung)#
-----------------
locale='sl-IT-nedis'
disp_locale=en : display_name=Slovenian #Italy, Natisone dialect#
disp_locale=fr : display_name=slovène #Italie, dialecte de Natisone#
disp_locale=de : display_name=Slowenisch #Italien, (NEDIS|Natisone-Dialekt)#
-----------------
locale='sl-Latn-IT-nedis'
disp_locale=en : display_name=Slovenian #Latin, Italy, Natisone dialect#
disp_locale=fr : display_name=slovène #latin, Italie, dialecte de Natisone#
disp_locale=de : display_name=Slowenisch #Lateinisch, Italien, (NEDIS|Natisone-Dialekt)#
-----------------
locale='de-DE'
disp_locale=en : display_name=German #Germany#
disp_locale=fr : display_name=allemand #Allemagne#
disp_locale=de : display_name=Deutsch #Deutschland#
-----------------
locale='en-US'
disp_locale=en : display_name=English #United States#
disp_locale=fr : display_name=anglais #États-Unis#
disp_locale=de : display_name=Englisch #Vereinigte Staaten#
-----------------
locale='es-419'
disp_locale=en : display_name=Spanish #Latin America#
disp_locale=fr : display_name=espagnol #Amérique latine#
disp_locale=de : display_name=Spanisch #Lateinamerika#
-----------------
locale='de-CH-x-phonebk'
disp_locale=en : display_name=German #Switzerland, Private-Use=phonebk#
disp_locale=fr : display_name=allemand #Suisse, Usage privé=phonebk#
disp_locale=de : display_name=Deutsch #Schweiz, Privatnutzung=phonebk#
-----------------
locale='az-Arab-x-AZE-derbend'
disp_locale=en : display_name=Azerbaijani #Arabic, Private-Use=aze-derbend#
disp_locale=fr : display_name=azéri #arabe, Usage privé=aze-derbend#
disp_locale=de : display_name=Aserbaidschanisch #Arabisch, Privatnutzung=aze-derbend#
-----------------
locale='zh-min'
disp_locale=en : display_name=Chinese #MIN#
disp_locale=fr : display_name=chinois #MIN#
disp_locale=de : display_name=Chinesisch #MIN#
-----------------
locale='zh-min-nan-Hant-CN'
disp_locale=en : display_name=Chinese #MIN, NAN_HANT_CN#
disp_locale=fr : display_name=chinois #MIN, NAN_HANT_CN#
disp_locale=de : display_name=Chinesisch #MIN, NAN_HANT_CN#
-----------------
locale='x-whatever'
disp_locale=en : display_name=x-whatever #Private-Use=whatever#
disp_locale=fr : display_name=x-whatever #Usage privé=whatever#
disp_locale=de : display_name=x-whatever #Privatnutzung=whatever#
-----------------
locale='qaa-Qaaa-QM-x-southern'
disp_locale=en : display_name=qaa #Qaaa, QM, Private-Use=southern#
disp_locale=fr : display_name=qaa #Qaaa, QM, Usage privé=southern#
disp_locale=de : display_name=qaa #Qaaa, QM, Privatnutzung=southern#
-----------------
locale='sr-Latn-QM'
disp_locale=en : display_name=Serbian #Latin, QM#
disp_locale=fr : display_name=serbe #latin, QM#
disp_locale=de : display_name=Serbisch #Lateinisch, QM#
-----------------
locale='sr-Qaaa-CS'
disp_locale=en : display_name=Serbian #Qaaa, Serbia#
disp_locale=fr : display_name=serbe #Qaaa, Serbie#
disp_locale=de : display_name=Serbisch #Qaaa, Serbien#
-----------------
locale='en-US-u-islamCal'
disp_locale=en : display_name=English #United States, attribute=islamcal#
disp_locale=fr : display_name=anglais #États-Unis, attribute=islamcal#
disp_locale=de : display_name=Englisch #Vereinigte Staaten, attribute=islamcal#
-----------------
locale='zh-CN-a-myExt-x-private'
disp_locale=en : display_name=Chinese #China, a=myext, Private-Use=private#
disp_locale=fr : display_name=chinois #Chine, a=myext, Usage privé=private#
disp_locale=de : display_name=Chinesisch #China, a=myext, Privatnutzung=private#
-----------------
locale='en-a-myExt-b-another'
disp_locale=en : display_name=English #a=myext, b=another#
disp_locale=fr : display_name=anglais #a=myext, b=another#
disp_locale=de : display_name=Englisch #a=myext, b=another#
-----------------
locale='de-419-DE'
disp_locale=en : display_name=German #Latin America, DE#
disp_locale=fr : display_name=allemand #Amérique latine, DE#
disp_locale=de : display_name=Deutsch #Lateinamerika, DE#
-----------------
locale='a-DE'
disp_locale=en : display_name=a #Germany#
disp_locale=fr : display_name=a #Allemagne#
disp_locale=de : display_name=a #Deutschland#
-----------------
locale='ar-a-aaa-b-bbb-a-ccc'
disp_locale=en : display_name=Arabic #a=aaa, b=bbb#
disp_locale=fr : display_name=arabe #a=aaa, b=bbb#
disp_locale=de : display_name=Arabisch #a=aaa, b=bbb#
-----------------
@@ -0,0 +1,342 @@
--TEST--
locale_get_display_name() icu >= 53.1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
--FILE--
<?php
/*
* Try getting the display_name for different locales
* with Procedural and Object methods.
*/
function ut_main()
{
$res_str='';
$disp_locales=array('en','fr','de');
$locales = array(
'sl_IT_nedis_KIRTI',
'sl_IT_nedis-a-kirti-x-xyz',
'sl_IT_rozaj',
'sl_IT_NEDIS_ROJAZ_1901',
'i-enochian',
'zh-hakka',
'zh-wuu',
'i-tay',
'sgn-BE-nl',
'sgn-CH-de',
'sl_IT_rozaj@currency=EUR',
'uk-ua_CALIFORNIA@currency=;currency=GRN',
'root',
'uk@currency=EURO',
'Hindi',
//Simple language subtag
'de',
'fr',
'ja',
'i-enochian', //(example of a grandfathered tag)
//Language subtag plus Script subtag:
'zh-Hant',
'zh-Hans',
'sr-Cyrl',
'sr-Latn',
//Language-Script-Region
'zh-Hans-CN',
'sr-Latn-CS',
//Language-Variant
'sl-rozaj',
'sl-nedis',
//Language-Region-Variant
'de-CH-1901',
'sl-IT-nedis',
//Language-Script-Region-Variant
'sl-Latn-IT-nedis',
//Language-Region:
'de-DE',
'en-US',
'es-419',
//Private use subtags:
'de-CH-x-phonebk',
'az-Arab-x-AZE-derbend',
//Extended language subtags
'zh-min',
'zh-min-nan-Hant-CN',
//Private use registry values
'x-whatever',
'qaa-Qaaa-QM-x-southern',
'sr-Latn-QM',
'sr-Qaaa-CS',
/*Tags that use extensions (examples ONLY: extensions MUST be defined
by revision or update to this document or by RFC): */
'en-US-u-islamCal',
'zh-CN-a-myExt-x-private',
'en-a-myExt-b-another',
//Some Invalid Tags:
'de-419-DE',
'a-DE',
'ar-a-aaa-b-bbb-a-ccc'
);
$res_str = '';
foreach( $locales as $locale )
{
$res_str .= "locale='$locale'\n";
foreach( $disp_locales as $disp_locale )
{
$scr = ut_loc_get_display_name( $locale ,$disp_locale );
$scr = str_replace(array('(', ')'), '#', $scr);
$res_str .= "disp_locale=$disp_locale : display_name=$scr";
$res_str .= "\n";
}
$res_str .= "-----------------\n";
}
return $res_str;
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECTREGEX--
locale='sl_IT_nedis_KIRTI'
disp_locale=en : display_name=Slovenian #Italy, NEDIS_KIRTI#
disp_locale=fr : display_name=slovène #Italie, NEDIS_KIRTI#
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_KIRTI#
-----------------
locale='sl_IT_nedis-a-kirti-x-xyz'
disp_locale=en : display_name=Slovenian #Italy, NEDIS_A_KIRTI_X_XYZ#
disp_locale=fr : display_name=slovène #Italie, NEDIS_A_KIRTI_X_XYZ#
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_A_KIRTI_X_XYZ#
-----------------
locale='sl_IT_rozaj'
disp_locale=en : display_name=Slovenian #Italy, Resian#
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia#
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch)#
-----------------
locale='sl_IT_NEDIS_ROJAZ_1901'
disp_locale=en : display_name=Slovenian #Italy, NEDIS_ROJAZ_1901#
disp_locale=fr : display_name=slovène #Italie, NEDIS_ROJAZ_1901#
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_ROJAZ_1901#
-----------------
locale='i-enochian'
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian#
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
-----------------
locale='zh-hakka'
disp_locale=en : display_name=Chinese( #HAKKA#)?
disp_locale=fr : display_name=chinois( #HAKKA#)?
disp_locale=de : display_name=Chinesisch( #HAKKA#)?
-----------------
locale='zh-wuu'
disp_locale=en : display_name=Chinese #WUU#
disp_locale=fr : display_name=chinois #WUU#
disp_locale=de : display_name=Chinesisch #WUU#
-----------------
locale='i-tay'
disp_locale=en : display_name=i-tay
disp_locale=fr : display_name=i-tay
disp_locale=de : display_name=i-tay
-----------------
locale='sgn-BE-nl'
disp_locale=en : display_name=sgn #Belgium, NL#
disp_locale=fr : display_name=sgn #Belgique, NL#
disp_locale=de : display_name=sgn #Belgien, NL#
-----------------
locale='sgn-CH-de'
disp_locale=en : display_name=sgn #Switzerland, DE#
disp_locale=fr : display_name=sgn #Suisse, DE#
disp_locale=de : display_name=sgn #Schweiz, DE#
-----------------
locale='sl_IT_rozaj@currency=EUR'
disp_locale=en : display_name=Slovenian #Italy, Resian, [Cc]urrency=Euro#
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia, [Dd]evise=euro#
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch), Währung=Euro#
-----------------
locale='uk-ua_CALIFORNIA@currency=;currency=GRN'
disp_locale=en : display_name=
disp_locale=fr : display_name=
disp_locale=de : display_name=
-----------------
locale='root'
disp_locale=en : display_name=Root
disp_locale=fr : display_name=racine
disp_locale=de : display_name=[Rr]oot
-----------------
locale='uk@currency=EURO'
disp_locale=en : display_name=Ukrainian #[Cc]urrency=EURO#
disp_locale=fr : display_name=ukrainien #[Dd]evise=EURO#
disp_locale=de : display_name=Ukrainisch #Währung=EURO#
-----------------
locale='Hindi'
disp_locale=en : display_name=hindi
disp_locale=fr : display_name=hindi
disp_locale=de : display_name=hindi
-----------------
locale='de'
disp_locale=en : display_name=German
disp_locale=fr : display_name=allemand
disp_locale=de : display_name=Deutsch
-----------------
locale='fr'
disp_locale=en : display_name=French
disp_locale=fr : display_name=français
disp_locale=de : display_name=Französisch
-----------------
locale='ja'
disp_locale=en : display_name=Japanese
disp_locale=fr : display_name=japonais
disp_locale=de : display_name=Japanisch
-----------------
locale='i-enochian'
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian#
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
-----------------
locale='zh-Hant'
disp_locale=en : display_name=Chinese #Traditional#
disp_locale=fr : display_name=chinois #traditionnel#
disp_locale=de : display_name=Chinesisch #Traditionell#
-----------------
locale='zh-Hans'
disp_locale=en : display_name=Chinese #Simplified#
disp_locale=fr : display_name=chinois #simplifié#
disp_locale=de : display_name=Chinesisch #Vereinfacht#
-----------------
locale='sr-Cyrl'
disp_locale=en : display_name=Serbian #Cyrillic#
disp_locale=fr : display_name=serbe #cyrillique#
disp_locale=de : display_name=Serbisch #Kyrillisch#
-----------------
locale='sr-Latn'
disp_locale=en : display_name=Serbian #Latin#
disp_locale=fr : display_name=serbe #latin#
disp_locale=de : display_name=Serbisch #Lateinisch#
-----------------
locale='zh-Hans-CN'
disp_locale=en : display_name=Chinese #Simplified, China#
disp_locale=fr : display_name=chinois #simplifié, Chine#
disp_locale=de : display_name=Chinesisch #Vereinfacht, China#
-----------------
locale='sr-Latn-CS'
disp_locale=en : display_name=Serbian #Latin, Serbia#
disp_locale=fr : display_name=serbe #latin, Serbie#
disp_locale=de : display_name=Serbisch #Lateinisch, Serbien#
-----------------
locale='sl-rozaj'
disp_locale=en : display_name=Slovenian #Resian#
disp_locale=fr : display_name=slovène #dialecte de Resia#
disp_locale=de : display_name=Slowenisch( #(ROZAJ|Resianisch)#)?
-----------------
locale='sl-nedis'
disp_locale=en : display_name=Slovenian #Natisone dialect#
disp_locale=fr : display_name=slovène #dialecte de Natisone#
disp_locale=de : display_name=Slowenisch #Natisone-Dialekt#
-----------------
locale='de-CH-1901'
disp_locale=en : display_name=German #Switzerland, Traditional German orthography#
disp_locale=fr : display_name=allemand #Suisse, orthographe allemande traditionnelle#
disp_locale=de : display_name=Deutsch #Schweiz, (1901|[aA]lte deutsche Rechtschreibung)#
-----------------
locale='sl-IT-nedis'
disp_locale=en : display_name=Slovenian #Italy, Natisone dialect#
disp_locale=fr : display_name=slovène #Italie, dialecte de Natisone#
disp_locale=de : display_name=Slowenisch #Italien, (NEDIS|Natisone-Dialekt)#
-----------------
locale='sl-Latn-IT-nedis'
disp_locale=en : display_name=Slovenian #Latin, Italy, Natisone dialect#
disp_locale=fr : display_name=slovène #latin, Italie, dialecte de Natisone#
disp_locale=de : display_name=Slowenisch #Lateinisch, Italien, (NEDIS|Natisone-Dialekt)#
-----------------
locale='de-DE'
disp_locale=en : display_name=German #Germany#
disp_locale=fr : display_name=allemand #Allemagne#
disp_locale=de : display_name=Deutsch #Deutschland#
-----------------
locale='en-US'
disp_locale=en : display_name=English #United States#
disp_locale=fr : display_name=anglais #États-Unis#
disp_locale=de : display_name=Englisch #Vereinigte Staaten#
-----------------
locale='es-419'
disp_locale=en : display_name=Spanish #Latin America#
disp_locale=fr : display_name=espagnol #Amérique latine#
disp_locale=de : display_name=Spanisch #Lateinamerika#
-----------------
locale='de-CH-x-phonebk'
disp_locale=en : display_name=German #Switzerland, Private-Use=phonebk#
disp_locale=fr : display_name=allemand #Suisse, Usage privé=phonebk#
disp_locale=de : display_name=Deutsch #Schweiz, Privatnutzung=phonebk#
-----------------
locale='az-Arab-x-AZE-derbend'
disp_locale=en : display_name=Azerbaijani #Arabic, Private-Use=aze-derbend#
disp_locale=fr : display_name=azéri #arabe, Usage privé=aze-derbend#
disp_locale=de : display_name=Aserbaidschanisch #Arabisch, Privatnutzung=aze-derbend#
-----------------
locale='zh-min'
disp_locale=en : display_name=Chinese #MIN#
disp_locale=fr : display_name=chinois #MIN#
disp_locale=de : display_name=Chinesisch #MIN#
-----------------
locale='zh-min-nan-Hant-CN'
disp_locale=en : display_name=Chinese #MIN, NAN_HANT_CN#
disp_locale=fr : display_name=chinois #MIN, NAN_HANT_CN#
disp_locale=de : display_name=Chinesisch #MIN, NAN_HANT_CN#
-----------------
locale='x-whatever'
disp_locale=en : display_name=x-whatever #Private-Use=whatever#
disp_locale=fr : display_name=x-whatever #Usage privé=whatever#
disp_locale=de : display_name=x-whatever #Privatnutzung=whatever#
-----------------
locale='qaa-Qaaa-QM-x-southern'
disp_locale=en : display_name=qaa #Qaaa, QM, Private-Use=southern#
disp_locale=fr : display_name=qaa #Qaaa, QM, Usage privé=southern#
disp_locale=de : display_name=qaa #Qaaa, QM, Privatnutzung=southern#
-----------------
locale='sr-Latn-QM'
disp_locale=en : display_name=Serbian #Latin, QM#
disp_locale=fr : display_name=serbe #latin, QM#
disp_locale=de : display_name=Serbisch #Lateinisch, QM#
-----------------
locale='sr-Qaaa-CS'
disp_locale=en : display_name=Serbian #Qaaa, Serbia#
disp_locale=fr : display_name=serbe #Qaaa, Serbie#
disp_locale=de : display_name=Serbisch #Qaaa, Serbien#
-----------------
locale='en-US-u-islamCal'
disp_locale=en : display_name=English #United States, attribute=islamcal#
disp_locale=fr : display_name=anglais #États-Unis, attribute=islamcal#
disp_locale=de : display_name=Englisch #Vereinigte Staaten, attribute=islamcal#
-----------------
locale='zh-CN-a-myExt-x-private'
disp_locale=en : display_name=Chinese #China, a=myext, Private-Use=private#
disp_locale=fr : display_name=chinois #Chine, a=myext, Usage privé=private#
disp_locale=de : display_name=Chinesisch #China, a=myext, Privatnutzung=private#
-----------------
locale='en-a-myExt-b-another'
disp_locale=en : display_name=English #a=myext, b=another#
disp_locale=fr : display_name=anglais #a=myext, b=another#
disp_locale=de : display_name=Englisch #a=myext, b=another#
-----------------
locale='de-419-DE'
disp_locale=en : display_name=German #Latin America, DE#
disp_locale=fr : display_name=allemand #Amérique latine, DE#
disp_locale=de : display_name=Deutsch #Lateinamerika, DE#
-----------------
locale='a-DE'
disp_locale=en : display_name=a #Germany#
disp_locale=fr : display_name=a #Allemagne#
disp_locale=de : display_name=a #Deutschland#
-----------------
locale='ar-a-aaa-b-bbb-a-ccc'
disp_locale=en : display_name=Arabic #a=aaa, b=bbb#
disp_locale=fr : display_name=arabe #a=aaa, b=bbb#
disp_locale=de : display_name=Arabisch #a=aaa, b=bbb#
-----------------
@@ -1,8 +1,9 @@
--TEST--
locale_get_display_region() icu >= 4.8
locale_get_display_region() icu >= 4.8 && icu < 51.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
--FILE--
<?php
@@ -0,0 +1,275 @@
--TEST--
locale_get_display_region() icu >= 51.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
--FILE--
<?php
/*
* Try getting the display_region for different locales
* with Procedural and Object methods.
*/
function ut_main()
{
$res_str = '';
$disp_locales=array('en','fr','de');
$locales = array(
'uk-ua_CALIFORNIA@currency=;currency=GRN',
'root',
'uk@currency=EURO',
'Hindi',
//Simple language subtag
'de',
'fr',
'ja',
'i-enochian', //(example of a grandfathered tag)
//Language subtag plus Script subtag:
'zh-Hant',
'zh-Hans',
'sr-Cyrl',
'sr-Latn',
//Language-Script-Region
'zh-Hans-CN',
'sr-Latn-CS',
//Language-Variant
'sl-rozaj',
'sl-nedis',
//Language-Region-Variant
'de-CH-1901',
'sl-IT-nedis',
//Language-Script-Region-Variant
'sl-Latn-IT-nedis',
//Language-Region:
'de-DE',
'en-US',
'es-419',
//Private use subtags:
'de-CH-x-phonebk',
'az-Arab-x-AZE-derbend',
//Extended language subtags
'zh-min',
'zh-min-nan-Hant-CN',
//Private use registry values
'x-whatever',
'qaa-Qaaa-QM-x-southern',
'sr-Latn-QM',
'sr-Qaaa-CS',
/*Tags that use extensions (examples ONLY: extensions MUST be defined
by revision or update to this document or by RFC): */
'en-US-u-islamCal',
'zh-CN-a-myExt-x-private',
'en-a-myExt-b-another',
//Some Invalid Tags:
'de-419-DE',
'a-DE',
'ar-a-aaa-b-bbb-a-ccc'
);
$res_str = '';
foreach( $locales as $locale )
{
$res_str .= "locale='$locale'\n";
foreach( $disp_locales as $disp_locale )
{
$scr = ut_loc_get_display_region( $locale ,$disp_locale );
$res_str .= "disp_locale=$disp_locale : display_region=$scr";
$res_str .= "\n";
}
$res_str .= "-----------------\n";
}
return $res_str;
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECTREGEX--
locale='uk-ua_CALIFORNIA@currency=;currency=GRN'
disp_locale=en : display_region=Ukraine
disp_locale=fr : display_region=Ukraine
disp_locale=de : display_region=Ukraine
-----------------
locale='root'
disp_locale=en : display_region=
disp_locale=fr : display_region=
disp_locale=de : display_region=
-----------------
locale='uk@currency=EURO'
disp_locale=en : display_region=
disp_locale=fr : display_region=
disp_locale=de : display_region=
-----------------
locale='Hindi'
disp_locale=en : display_region=
disp_locale=fr : display_region=
disp_locale=de : display_region=
-----------------
locale='de'
disp_locale=en : display_region=
disp_locale=fr : display_region=
disp_locale=de : display_region=
-----------------
locale='fr'
disp_locale=en : display_region=
disp_locale=fr : display_region=
disp_locale=de : display_region=
-----------------
locale='ja'
disp_locale=en : display_region=
disp_locale=fr : display_region=
disp_locale=de : display_region=
-----------------
locale='i-enochian'
disp_locale=en : display_region=
disp_locale=fr : display_region=
disp_locale=de : display_region=
-----------------
locale='zh-Hant'
disp_locale=en : display_region=
disp_locale=fr : display_region=
disp_locale=de : display_region=
-----------------
locale='zh-Hans'
disp_locale=en : display_region=
disp_locale=fr : display_region=
disp_locale=de : display_region=
-----------------
locale='sr-Cyrl'
disp_locale=en : display_region=
disp_locale=fr : display_region=
disp_locale=de : display_region=
-----------------
locale='sr-Latn'
disp_locale=en : display_region=
disp_locale=fr : display_region=
disp_locale=de : display_region=
-----------------
locale='zh-Hans-CN'
disp_locale=en : display_region=China
disp_locale=fr : display_region=Chine
disp_locale=de : display_region=China
-----------------
locale='sr-Latn-CS'
disp_locale=en : display_region=Serbia
disp_locale=fr : display_region=Serbie
disp_locale=de : display_region=Serbien
-----------------
locale='sl-rozaj'
disp_locale=en : display_region=(ROZAJ)?
disp_locale=fr : display_region=(ROZAJ)?
disp_locale=de : display_region=(ROZAJ)?
-----------------
locale='sl-nedis'
disp_locale=en : display_region=(NEDIS)?
disp_locale=fr : display_region=(NEDIS)?
disp_locale=de : display_region=(NEDIS)?
-----------------
locale='de-CH-1901'
disp_locale=en : display_region=Switzerland
disp_locale=fr : display_region=Suisse
disp_locale=de : display_region=Schweiz
-----------------
locale='sl-IT-nedis'
disp_locale=en : display_region=Italy
disp_locale=fr : display_region=Italie
disp_locale=de : display_region=Italien
-----------------
locale='sl-Latn-IT-nedis'
disp_locale=en : display_region=Italy
disp_locale=fr : display_region=Italie
disp_locale=de : display_region=Italien
-----------------
locale='de-DE'
disp_locale=en : display_region=Germany
disp_locale=fr : display_region=Allemagne
disp_locale=de : display_region=Deutschland
-----------------
locale='en-US'
disp_locale=en : display_region=United States
disp_locale=fr : display_region=États-Unis
disp_locale=de : display_region=Vereinigte Staaten
-----------------
locale='es-419'
disp_locale=en : display_region=Latin America
disp_locale=fr : display_region=Amérique latine
disp_locale=de : display_region=Lateinamerika
-----------------
locale='de-CH-x-phonebk'
disp_locale=en : display_region=Switzerland
disp_locale=fr : display_region=Suisse
disp_locale=de : display_region=Schweiz
-----------------
locale='az-Arab-x-AZE-derbend'
disp_locale=en : display_region=X?
disp_locale=fr : display_region=X?
disp_locale=de : display_region=X?
-----------------
locale='zh-min'
disp_locale=en : display_region=
disp_locale=fr : display_region=
disp_locale=de : display_region=
-----------------
locale='zh-min-nan-Hant-CN'
disp_locale=en : display_region=MIN
disp_locale=fr : display_region=MIN
disp_locale=de : display_region=MIN
-----------------
locale='x-whatever'
disp_locale=en : display_region=
disp_locale=fr : display_region=
disp_locale=de : display_region=
-----------------
locale='qaa-Qaaa-QM-x-southern'
disp_locale=en : display_region=QM
disp_locale=fr : display_region=QM
disp_locale=de : display_region=QM
-----------------
locale='sr-Latn-QM'
disp_locale=en : display_region=QM
disp_locale=fr : display_region=QM
disp_locale=de : display_region=QM
-----------------
locale='sr-Qaaa-CS'
disp_locale=en : display_region=Serbia
disp_locale=fr : display_region=Serbie
disp_locale=de : display_region=Serbien
-----------------
locale='en-US-u-islamCal'
disp_locale=en : display_region=United States
disp_locale=fr : display_region=États-Unis
disp_locale=de : display_region=Vereinigte Staaten
-----------------
locale='zh-CN-a-myExt-x-private'
disp_locale=en : display_region=China
disp_locale=fr : display_region=Chine
disp_locale=de : display_region=China
-----------------
locale='en-a-myExt-b-another'
disp_locale=en : display_region=A?
disp_locale=fr : display_region=A?
disp_locale=de : display_region=A?
-----------------
locale='de-419-DE'
disp_locale=en : display_region=Latin America
disp_locale=fr : display_region=Amérique latine
disp_locale=de : display_region=Lateinamerika
-----------------
locale='a-DE'
disp_locale=en : display_region=Germany
disp_locale=fr : display_region=Allemagne
disp_locale=de : display_region=Deutschland
-----------------
locale='ar-a-aaa-b-bbb-a-ccc'
disp_locale=en : display_region=A?
disp_locale=fr : display_region=A?
disp_locale=de : display_region=A?
-----------------
@@ -2,7 +2,7 @@
locale_get_display_script() icu >= 49
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if(version_compare(INTL_ICU_VERSION, '49') < 0) print 'skip'; ?>
<?php if(version_compare(INTL_ICU_VERSION, '49') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) print 'skip'; ?>
--FILE--
<?php
@@ -0,0 +1,275 @@
--TEST--
locale_get_display_script() icu >= 52.1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if(version_compare(INTL_ICU_VERSION, '52.1') < 0) print 'skip'; ?>
--FILE--
<?php
/*
* Try getting the display_script for different locales
* with Procedural and Object methods.
*/
function ut_main()
{
$res_str = '';
$disp_locales=array('en','fr','de');
$locales = array(
'uk-ua_CALIFORNIA@currency=;currency=GRN',
'root',
'uk@currency=EURO',
'Hindi',
//Simple language subtag
'de',
'fr',
'ja',
'i-enochian', //(example of a grandfathered tag)
//Language subtag plus Script subtag:
'zh-Hant',
'zh-Hans',
'sr-Cyrl',
'sr-Latn',
//Language-Script-Region
'zh-Hans-CN',
'sr-Latn-CS',
//Language-Variant
'sl-rozaj',
'sl-nedis',
//Language-Region-Variant
'de-CH-1901',
'sl-IT-nedis',
//Language-Script-Region-Variant
'sl-Latn-IT-nedis',
//Language-Region:
'de-DE',
'en-US',
'es-419',
//Private use subtags:
'de-CH-x-phonebk',
'az-Arab-x-AZE-derbend',
//Extended language subtags
'zh-min',
'zh-min-nan-Hant-CN',
//Private use registry values
'x-whatever',
'qaa-Qaaa-QM-x-southern',
'sr-Latn-QM',
'sr-Qaaa-CS',
/*Tags that use extensions (examples ONLY: extensions MUST be defined
by revision or update to this document or by RFC): */
'en-US-u-islamCal',
'zh-CN-a-myExt-x-private',
'en-a-myExt-b-another',
//Some Invalid Tags:
'de-419-DE',
'a-DE',
'ar-a-aaa-b-bbb-a-ccc'
);
$res_str = '';
foreach( $locales as $locale )
{
$res_str .= "locale='$locale'\n";
foreach( $disp_locales as $disp_locale )
{
$scr = ut_loc_get_display_script( $locale ,$disp_locale );
$res_str .= "disp_locale=$disp_locale : display_script=$scr";
$res_str .= "\n";
}
$res_str .= "-----------------\n";
}
return $res_str;
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
locale='uk-ua_CALIFORNIA@currency=;currency=GRN'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='root'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='uk@currency=EURO'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='Hindi'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='de'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='fr'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='ja'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='i-enochian'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='zh-Hant'
disp_locale=en : display_script=Traditional Han
disp_locale=fr : display_script=sinogrammes traditionnels
disp_locale=de : display_script=Traditionelles Chinesisch
-----------------
locale='zh-Hans'
disp_locale=en : display_script=Simplified Han
disp_locale=fr : display_script=sinogrammes simplifiés
disp_locale=de : display_script=Vereinfachtes Chinesisch
-----------------
locale='sr-Cyrl'
disp_locale=en : display_script=Cyrillic
disp_locale=fr : display_script=cyrillique
disp_locale=de : display_script=Kyrillisch
-----------------
locale='sr-Latn'
disp_locale=en : display_script=Latin
disp_locale=fr : display_script=latin
disp_locale=de : display_script=Lateinisch
-----------------
locale='zh-Hans-CN'
disp_locale=en : display_script=Simplified Han
disp_locale=fr : display_script=sinogrammes simplifiés
disp_locale=de : display_script=Vereinfachtes Chinesisch
-----------------
locale='sr-Latn-CS'
disp_locale=en : display_script=Latin
disp_locale=fr : display_script=latin
disp_locale=de : display_script=Lateinisch
-----------------
locale='sl-rozaj'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='sl-nedis'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='de-CH-1901'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='sl-IT-nedis'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='sl-Latn-IT-nedis'
disp_locale=en : display_script=Latin
disp_locale=fr : display_script=latin
disp_locale=de : display_script=Lateinisch
-----------------
locale='de-DE'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='en-US'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='es-419'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='de-CH-x-phonebk'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='az-Arab-x-AZE-derbend'
disp_locale=en : display_script=Arabic
disp_locale=fr : display_script=arabe
disp_locale=de : display_script=Arabisch
-----------------
locale='zh-min'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='zh-min-nan-Hant-CN'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='x-whatever'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='qaa-Qaaa-QM-x-southern'
disp_locale=en : display_script=Qaaa
disp_locale=fr : display_script=Qaaa
disp_locale=de : display_script=Qaaa
-----------------
locale='sr-Latn-QM'
disp_locale=en : display_script=Latin
disp_locale=fr : display_script=latin
disp_locale=de : display_script=Lateinisch
-----------------
locale='sr-Qaaa-CS'
disp_locale=en : display_script=Qaaa
disp_locale=fr : display_script=Qaaa
disp_locale=de : display_script=Qaaa
-----------------
locale='en-US-u-islamCal'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='zh-CN-a-myExt-x-private'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='en-a-myExt-b-another'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='de-419-DE'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='a-DE'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
locale='ar-a-aaa-b-bbb-a-ccc'
disp_locale=en : display_script=
disp_locale=fr : display_script=
disp_locale=de : display_script=
-----------------
+1
View File
@@ -2,6 +2,7 @@
locale_lookup.phpt()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
--FILE--
<?php
+100
View File
@@ -0,0 +1,100 @@
--TEST--
locale_lookup.phpt()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
--FILE--
<?php
/*
* Try parsing different Locales
* with Procedural and Object methods.
*/
function ut_main()
{
$loc_ranges = array(
'de-de',
'sl_IT',
'sl_IT_Nedis',
'jbo',
'art-lojban'
);
$lang_tags = array(
'de-DEVA',
'de-DE-1996',
'de-DE',
'zh_Hans',
'de-CH-1996',
'sl_IT',
'sl_IT_nedis-a-kirti-x-xyz',
'sl_IT_rozaj',
'sl_IT_NEDIS_ROJAZ_1901',
'i-enochian',
'sgn-CH-de',
'art-lojban',
'i-lux',
'art-lojban',
'jbo',
'en_sl_IT',
'zh-Hant-CN-x-prv1-prv2'
);
$res_str = '';
$isCanonical = false;
foreach($loc_ranges as $loc_range){
$res_str .="--------------\n";
$result= ut_loc_locale_lookup( $lang_tags , $loc_range,$isCanonical,"en_US");
$comma_arr =implode(",",$lang_tags);
$res_str .= "loc_range:$loc_range \nlang_tags: $comma_arr\n";
$res_str .= "\nlookup result:$result\n";
//canonicalized version
$result= ut_loc_locale_lookup( $lang_tags , $loc_range,!($isCanonical),"en_US");
$can_loc_range = ut_loc_canonicalize($loc_range);
$res_str .= "Canonical lookup result:$result\n";
}
$res_str .= "\n";
return $res_str;
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
--------------
loc_range:de-de
lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2
lookup result:de-DE
Canonical lookup result:de_de
--------------
loc_range:sl_IT
lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2
lookup result:sl_IT
Canonical lookup result:sl_it
--------------
loc_range:sl_IT_Nedis
lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2
lookup result:sl_IT
Canonical lookup result:sl_it
--------------
loc_range:jbo
lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2
lookup result:jbo
Canonical lookup result:jbo
--------------
loc_range:art-lojban
lang_tags: de-DEVA,de-DE-1996,de-DE,zh_Hans,de-CH-1996,sl_IT,sl_IT_nedis-a-kirti-x-xyz,sl_IT_rozaj,sl_IT_NEDIS_ROJAZ_1901,i-enochian,sgn-CH-de,art-lojban,i-lux,art-lojban,jbo,en_sl_IT,zh-Hant-CN-x-prv1-prv2
lookup result:art-lojban
Canonical lookup result:art__lojban
@@ -3,11 +3,9 @@ ResourceBundle constructor bundle accepts NULL for first two arguments
--INI--
date.timezone=Atlantic/Azores
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
die('skip ICU >= 4.8 only');
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '4.8') < 0) die('skip ICU >= 4.8 only'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
@@ -0,0 +1,26 @@
--TEST--
ResourceBundle constructor bundle accepts NULL for first two arguments
--INI--
date.timezone=Atlantic/Azores
--SKIPIF--
<?php
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$r = new ResourceBundle('en_US', NULL);
$c = $r->get('calendar')->get('gregorian')->get('DateTimePatterns')->get(0);
var_dump($c);
ini_set('intl.default_locale', 'pt_PT');
$r = new ResourceBundle(NULL, NULL);
$c = $r->get('calendar')->get('gregorian')->get('DateTimePatterns')->get(0);
var_dump($c);
?>
==DONE==
--EXPECT--
string(14) "h:mm:ss a zzzz"
string(13) "HH:mm:ss zzzz"
==DONE==
+10 -8
View File
@@ -219,7 +219,7 @@ static inline void json_pretty_print_indent(smart_str *buf, int options TSRMLS_D
static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) /* {{{ */
{
int i, r;
int i, r, need_comma = 0;
HashTable *myht;
if (Z_TYPE_PP(val) == IS_ARRAY) {
@@ -242,7 +242,6 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC)
smart_str_appendc(buf, '{');
}
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
++JSON_G(encoder_depth);
i = myht ? zend_hash_num_elements(myht) : 0;
@@ -255,7 +254,6 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC)
uint key_len;
HashPosition pos;
HashTable *tmp_ht;
int need_comma = 0;
zend_hash_internal_pointer_reset_ex(myht, &pos);
for (;; zend_hash_move_forward_ex(myht, &pos)) {
@@ -272,11 +270,11 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC)
if (r == PHP_JSON_OUTPUT_ARRAY) {
if (need_comma) {
smart_str_appendc(buf, ',');
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
} else {
need_comma = 1;
}
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
json_pretty_print_indent(buf, options TSRMLS_CC);
php_json_encode(buf, *data, options TSRMLS_CC);
} else if (r == PHP_JSON_OUTPUT_OBJECT) {
@@ -291,11 +289,11 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC)
if (need_comma) {
smart_str_appendc(buf, ',');
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
} else {
need_comma = 1;
}
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
json_pretty_print_indent(buf, options TSRMLS_CC);
json_escape_string(buf, key, key_len - 1, options & ~PHP_JSON_NUMERIC_CHECK TSRMLS_CC);
@@ -307,11 +305,11 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC)
} else {
if (need_comma) {
smart_str_appendc(buf, ',');
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
} else {
need_comma = 1;
}
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
json_pretty_print_indent(buf, options TSRMLS_CC);
smart_str_appendc(buf, '"');
@@ -333,8 +331,12 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC)
}
--JSON_G(encoder_depth);
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
json_pretty_print_indent(buf, options TSRMLS_CC);
/* Only keep closing bracket on same line for empty arrays/objects */
if (need_comma) {
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
json_pretty_print_indent(buf, options TSRMLS_CC);
}
if (r == PHP_JSON_OUTPUT_ARRAY) {
smart_str_appendc(buf, ']');
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #66021 (Blank line inside empty array/object when JSON_PRETTY_PRINT is set)
--SKIPIF--
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
class Foo {
private $bar = 'baz';
}
echo json_encode([[], (object)[], new Foo], JSON_PRETTY_PRINT), "\n";
?>
--EXPECT--
[
[],
{},
{}
]
+10
View File
@@ -399,6 +399,16 @@ PHP_FUNCTION(ldap_bind)
RETURN_FALSE;
}
if (ldap_bind_dn != NULL && memchr(ldap_bind_dn, '\0', ldap_bind_dnlen) != NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "DN contains a null byte");
RETURN_FALSE;
}
if (ldap_bind_pw != NULL && memchr(ldap_bind_pw, '\0', ldap_bind_pwlen) != NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Password contains a null byte");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
if ((rc = ldap_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw, LDAP_AUTH_SIMPLE)) != LDAP_SUCCESS) {
+8 -1
View File
@@ -176,8 +176,11 @@ void php_clear_stmt_bind(MY_STMT *stmt TSRMLS_DC)
php_free_stmt_bind_buffer(stmt->param, FETCH_SIMPLE);
/* Clean output bind */
php_free_stmt_bind_buffer(stmt->result, FETCH_RESULT);
#endif
if (stmt->link_handle) {
zend_objects_store_del_ref_by_handle(stmt->link_handle TSRMLS_CC);
}
#endif
if (stmt->query) {
efree(stmt->query);
}
@@ -1055,6 +1058,10 @@ PHP_FUNCTION(mysqli_stmt_construct)
efree(stmt);
RETURN_FALSE;
}
#ifndef MYSQLI_USE_MYSQLND
stmt->link_handle = Z_OBJ_HANDLE(*mysql_link);
zend_objects_store_add_ref_by_handle(stmt->link_handle TSRMLS_CC);
#endif
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
mysqli_resource->ptr = (void *)stmt;
+8
View File
@@ -1840,6 +1840,10 @@ PHP_FUNCTION(mysqli_prepare)
efree(stmt);
RETURN_FALSE;
}
#ifndef MYSQLI_USE_MYSQLND
stmt->link_handle = Z_OBJ_HANDLE(*mysql_link);
zend_objects_store_add_ref_by_handle(stmt->link_handle TSRMLS_CC);
#endif
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
mysqli_resource->ptr = (void *)stmt;
@@ -2368,6 +2372,10 @@ PHP_FUNCTION(mysqli_stmt_init)
efree(stmt);
RETURN_FALSE;
}
#ifndef MYSQLI_USE_MYSQLND
stmt->link_handle = Z_OBJ_HANDLE(*mysql_link);
zend_objects_store_add_ref_by_handle(stmt->link_handle TSRMLS_CC);
#endif
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
mysqli_resource->status = MYSQLI_STATUS_INITIALIZED;
Loaded 100 of 204 files, more files were not shown because too many files have changed in this diff. Show more