mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-25 18:05:42 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61249b0125 | ||
|
|
7e4a42c278 | ||
|
|
b0a36007ab | ||
|
|
78cbe9aed5 | ||
|
|
9ccde8a415 | ||
|
|
2c9fc139fe | ||
|
|
7a038ccbe6 | ||
|
|
62a8305007 | ||
|
|
960b4e81f3 | ||
|
|
5c6dbc35e7 | ||
|
|
ef7fd7f4b5 | ||
|
|
ef8cf76815 | ||
|
|
f859b8d2cf | ||
|
|
9fbfdb3396 | ||
|
|
3b3c57e79e | ||
|
|
22700890d4 | ||
|
|
36fb4ed968 | ||
|
|
b026993a74 | ||
|
|
e3c7b48709 | ||
|
|
fe650a43ed | ||
|
|
f32d2ac3aa | ||
|
|
0117eb747e | ||
|
|
4840b0a749 | ||
|
|
b5a0f12871 | ||
|
|
fa40290fb7 | ||
|
|
63f242178d | ||
|
|
5ce23f39d5 | ||
|
|
d74b9cfee5 | ||
|
|
690bbe170d | ||
|
|
93f3ba66a7 | ||
|
|
3aaee86ee3 | ||
|
|
248afd1c3c | ||
|
|
5bc377457e | ||
|
|
fb6f5d2e2d | ||
|
|
6a823071f9 | ||
|
|
90f0a77cad | ||
|
|
96cc419924 | ||
|
|
d72a4d1634 | ||
|
|
8973390541 | ||
|
|
adfb5ab7ce | ||
|
|
e8ae795529 | ||
|
|
366491c1ce | ||
|
|
76d2d474be | ||
|
|
536260f2c5 | ||
|
|
2e2bda3508 | ||
|
|
f6ff3a28d6 | ||
|
|
2e2636dcc5 | ||
|
|
545363cce0 | ||
|
|
92fd085ebf | ||
|
|
dc3d360a0f | ||
|
|
86f2b33629 | ||
|
|
fc3f8a8f54 | ||
|
|
60d9175280 | ||
|
|
2ba3926815 | ||
|
|
9209c19f8f | ||
|
|
6cd0bd82dc | ||
|
|
dbe2d7745f | ||
|
|
b2f8f35a88 | ||
|
|
60e38b3243 | ||
|
|
ec5b87c50d | ||
|
|
33fd0e0b78 | ||
|
|
4b61203b01 | ||
|
|
cd1cab3f47 | ||
|
|
d56850aaff | ||
|
|
930946005e | ||
|
|
ad139d9a00 | ||
|
|
18b04b480e | ||
|
|
51fca2b4b3 | ||
|
|
aeb6e9c264 | ||
|
|
679bf479b6 | ||
|
|
d7baf0427f | ||
|
|
d4d6a95105 | ||
|
|
2b78edfba2 | ||
|
|
e9e63f9223 | ||
|
|
6b68f44e6b | ||
|
|
1d1fb69c8b | ||
|
|
f0c926564c | ||
|
|
f0c1ea1d2e | ||
|
|
c91a638ed7 | ||
|
|
d143c2b60f | ||
|
|
0eb414e2a5 | ||
|
|
7e35004e39 | ||
|
|
e98fc7de52 | ||
|
|
0ad0a2f56e | ||
|
|
80346690ba | ||
|
|
f904830012 | ||
|
|
ea0f832f10 | ||
|
|
7a1a1aec8c | ||
|
|
577b10b214 | ||
|
|
ac05cfb499 | ||
|
|
9aa904c375 | ||
|
|
9a655fcb18 | ||
|
|
b4b4372c88 | ||
|
|
69454d9f0f | ||
|
|
dc8705c256 | ||
|
|
f7eff9cd41 | ||
|
|
a92a350cce | ||
|
|
30e0442c54 | ||
|
|
9bf997c1db | ||
|
|
34fc79bd61 | ||
|
|
3f64d35559 | ||
|
|
cc66eaa04b | ||
|
|
8f146c2bb0 | ||
|
|
dfa43d55dd | ||
|
|
c2b8a72673 | ||
|
|
d5ba2d8a99 | ||
|
|
e06a712c90 | ||
|
|
d52dbd569f | ||
|
|
7bb8cbcdee | ||
|
|
e5678c9b95 | ||
|
|
768c776d30 |
No files matched your search
+1
-1
@@ -151,7 +151,7 @@ Naming Conventions
|
||||
|
||||
7. Classes should be given descriptive names. Avoid using abbreviations where
|
||||
possible. Each word in the class name should start with a capital letter,
|
||||
without underscore delimiters (CampelCaps starting with a capital letter).
|
||||
without underscore delimiters (CamelCaps starting with a capital letter).
|
||||
The class name should be prefixed with the name of the 'parent set' (e.g.
|
||||
the name of the extension)::
|
||||
|
||||
|
||||
@@ -1,31 +1,85 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2013, PHP 5.5.5
|
||||
17 Oct 2013, PHP 5.5.5
|
||||
|
||||
- Core:
|
||||
. Fixed bug #64979 (Wrong behavior of static variables in closure generators).
|
||||
(Nikita)
|
||||
. Fixed bug #65322 (compile time errors won't trigger auto loading). (Nikita)
|
||||
. Fixed bug #65821 (By-ref foreach on property access of string offset
|
||||
segfaults). (Nikita)
|
||||
|
||||
- CLI server:
|
||||
. Fixed bug #65633 (built-in server treat some http headers as
|
||||
case-sensitive). (Adam)
|
||||
. Fixed bug #65818 (Segfault with built-in webserver and chunked transfer
|
||||
encoding). (Felipe)
|
||||
. Added application/pdf to PHP CLI Web Server mime types (Chris Jones)
|
||||
|
||||
- Datetime:
|
||||
. Fixed bug #64157 (DateTime::createFromFormat() reports confusing error
|
||||
message). (Boro Sitnikovski)
|
||||
. Fixed bug #65502 (DateTimeImmutable::createFromFormat returns DateTime).
|
||||
(Boro Sitnikovski)
|
||||
. Fixed bug #65548 (Comparison for DateTimeImmutable doesn't work).
|
||||
(Boro Sitnikovski)
|
||||
|
||||
- DBA extension:
|
||||
. Fixed bug #65708 (dba functions cast $key param to string in-place,
|
||||
bypassing copy on write). (Adam)
|
||||
|
||||
- Filter:
|
||||
. Add RFC 6598 IPs to reserved addresses. (Sebastian Nohn)
|
||||
. Fixed bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names).
|
||||
(Syra)
|
||||
|
||||
- FTP:
|
||||
. Fixed bug #65667 (ftp_nb_continue produces segfault). (Philip Hofstetter)
|
||||
|
||||
- GD
|
||||
. Ensure that the defined interpolation method is used with the generic
|
||||
scaling methods. (Pierre)
|
||||
|
||||
- IMAP:
|
||||
. Fixed bug #65721 (configure script broken in 5.5.4 and 5.4.20 when enabling
|
||||
imap). (ryotakatsuki at gmail dot com)
|
||||
|
||||
- OPcache:
|
||||
. Added support for GNU Hurd. (Svante Signell)
|
||||
. Added function opcache_compile_file() to load PHP scripts into cache
|
||||
without execution. (Julien)
|
||||
. Fixed bug #65845 (Error when Zend Opcache Optimizer is fully enabled).
|
||||
(Dmitry)
|
||||
. Fixed bug #65665 (Exception not properly caught when opcache enabled).
|
||||
(Laruence)
|
||||
. Fixed bug #65510 (5.5.2 crashes in _get_zval_ptr_ptr_var). (Dmitry)
|
||||
. Fixed issue #135 (segfault in interned strings if initial memory is too
|
||||
low). (Julien)
|
||||
|
||||
- Sockets:
|
||||
. Fixed bug #65808 (the socket_connect() won't work with IPv6 address).
|
||||
(Mike)
|
||||
|
||||
- SPL:
|
||||
. Fix bug #64782 (SplFileObject constructor make $context optional / give it
|
||||
a default value). (Nikita)
|
||||
|
||||
?? ??? 2013, PHP 5.5.4
|
||||
- Standard:
|
||||
. Fixed bug #61548 (content-type must appear at the end of headers for 201
|
||||
Location to work in http). (Mike)
|
||||
|
||||
- XMLReader:
|
||||
. Fixed bug #51936 (Crash with clone XMLReader). (Mike)
|
||||
. Fixed bug #64230 (XMLReader does not suppress errors). (Mike)
|
||||
|
||||
- Build system:
|
||||
. Fixed bug #51076 (race condition in shtool's mkdir -p implementation).
|
||||
(Mike, Raphael Geissert)
|
||||
. Fixed bug #62396 ('make test' crashes starting with 5.3.14 (missing
|
||||
gzencode())). (Mike)
|
||||
|
||||
|
||||
19 Sep 2013, PHP 5.5.4
|
||||
|
||||
- Core:
|
||||
. Fixed bug #60598 (cli/apache sapi segfault on objects manipulation).
|
||||
@@ -35,6 +89,7 @@ PHP NEWS
|
||||
DTRACE_FUNCTION_*). (Chris Jones)
|
||||
. Fixed bug #65483 (quoted-printable encode stream filter incorrectly encoding
|
||||
spaces). (Michael M Slusarz)
|
||||
. Fixed bug #65481 (shutdown segfault due to serialize) (Mike)
|
||||
. Fixed bug #65470 (Segmentation fault in zend_error() with
|
||||
--enable-dtrace). (Chris Jones, Kris Van Hees)
|
||||
. Fixed bug #65225 (PHP_BINARY incorrectly set). (Patrick Allaert)
|
||||
@@ -61,6 +116,10 @@ PHP NEWS
|
||||
. Fixed bug #64802 (openssl_x509_parse fails to parse subject properly in
|
||||
some cases). (Mark Jones)
|
||||
|
||||
- PDO:
|
||||
. Fixed bug #64953 (Postgres prepared statement positional parameter
|
||||
casting). (Mike)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #65475 (Session ID is not initialized properly when strict session
|
||||
is enabled). (Yasuo)
|
||||
@@ -71,6 +130,10 @@ PHP NEWS
|
||||
. Fix issue with return types of password API helper functions. Found via
|
||||
static analysis by cjones. (Anthony Ferrara)
|
||||
|
||||
- Zlib:
|
||||
. Fixed bug #65391 (Unable to send vary header user-agent when
|
||||
ob_start('ob_gzhandler') is called) (Mike)
|
||||
|
||||
22 Aug 2013, PHP 5.5.3
|
||||
|
||||
- Openssl:
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ zend_module_entry foo_module_entry = {
|
||||
PHP_RSHUTDOWN(foo), /* per-request shutdown function */
|
||||
PHP_MINFO(foo), /* information function */
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
FOO_VERSION, /* extension version number (string) */
|
||||
PHP_FOO_VERSION, /* extension version number (string) */
|
||||
#endif
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
@@ -31,6 +31,11 @@ HOW TO USE IT
|
||||
|
||||
./buildconf; ./configure --enable-module_name; make
|
||||
|
||||
The definition of PHP_MODULE_NAME_VERSION will be present in the
|
||||
php_module_name.h and injected into the zend_module_entry definition. This
|
||||
is required by the PECL website for the version string conformity checks
|
||||
against package.xml
|
||||
|
||||
But if you already have planned the overall scheme of your module, what
|
||||
functions it will contain, their return types and the arguments they take
|
||||
(a very good idea) and don't want to bother yourself with creating function
|
||||
|
||||
@@ -153,3 +153,18 @@ ADDING SHARED MODULE SUPPORT TO A MODULE
|
||||
#ifdef COMPILE_DL_FOO
|
||||
ZEND_GET_MODULE(foo)
|
||||
#endif
|
||||
|
||||
PECL SITE CONFORMITY
|
||||
|
||||
If you plan to release an extension to the PECL website, there are several
|
||||
points to be regarded.
|
||||
|
||||
1. Add LICENSE or COPYING to the package.xml
|
||||
|
||||
2. The following should be defined in one of the extension header files
|
||||
|
||||
#define PHP_FOO_VERSION "1.2.3"
|
||||
|
||||
This macros has to be used within your foo_module_entry to indicate the
|
||||
extension version.
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
--TEST--
|
||||
Bug #64578 (Closures with static variables can be generators)
|
||||
--XFAIL--
|
||||
Bug #64979 not fixed yet.
|
||||
Bug #64979 (Wrong behavior of static variables in closure generators)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function new_closure_gen() {
|
||||
return function() {
|
||||
static $foo = 0;
|
||||
yield ++$foo;
|
||||
};
|
||||
return function() {
|
||||
static $foo = 0;
|
||||
yield ++$foo;
|
||||
};
|
||||
}
|
||||
|
||||
$closure1 = new_closure_gen();
|
||||
@@ -20,9 +18,9 @@ $gen2 = $closure1();
|
||||
$gen3 = $closure2();
|
||||
|
||||
foreach (array($gen1, $gen2, $gen3) as $gen) {
|
||||
foreach ($gen as $val) {
|
||||
print "$val\n";
|
||||
}
|
||||
foreach ($gen as $val) {
|
||||
var_dump($val);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #65322: compile time errors won't trigger auto loading
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
spl_autoload_register(function($class) {
|
||||
var_dump($class);
|
||||
class B {}
|
||||
});
|
||||
|
||||
set_error_handler(function($_, $msg, $file) {
|
||||
var_dump($msg, $file);
|
||||
new B;
|
||||
});
|
||||
|
||||
eval('class A { function a() {} function __construct() {} }');
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(50) "Redefining already defined constructor for class A"
|
||||
string(%d) "%s(%d) : eval()'d code"
|
||||
string(1) "B"
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Error message in error handler during compilation
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_error_handler(function($_, $msg, $file) {
|
||||
var_dump($msg, $file);
|
||||
echo $undefined;
|
||||
});
|
||||
|
||||
eval('class A { function a() {} function __construct() {} }');
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(50) "Redefining already defined constructor for class A"
|
||||
string(%d) "%s(%d) : eval()'d code"
|
||||
|
||||
Notice: Undefined variable: undefined in %s on line %d
|
||||
+3
-1
@@ -1184,7 +1184,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
* such scripts recursivly, but some CG() variables may be
|
||||
* inconsistent. */
|
||||
|
||||
in_compilation = zend_is_compiling(TSRMLS_C);
|
||||
in_compilation = CG(in_compilation);
|
||||
if (in_compilation) {
|
||||
saved_class_entry = CG(active_class_entry);
|
||||
CG(active_class_entry) = NULL;
|
||||
@@ -1196,6 +1196,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
SAVE_STACK(declare_stack);
|
||||
SAVE_STACK(list_stack);
|
||||
SAVE_STACK(context_stack);
|
||||
CG(in_compilation) = 0;
|
||||
}
|
||||
|
||||
if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) {
|
||||
@@ -1220,6 +1221,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
RESTORE_STACK(declare_stack);
|
||||
RESTORE_STACK(list_stack);
|
||||
RESTORE_STACK(context_stack);
|
||||
CG(in_compilation) = 1;
|
||||
}
|
||||
|
||||
if (!EG(user_error_handler)) {
|
||||
|
||||
+2
-31
@@ -1749,7 +1749,6 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
|
||||
zend_op dummy_opline;
|
||||
|
||||
dummy_opline.result_type = IS_UNUSED;
|
||||
dummy_opline.op1_type = IS_UNUSED;
|
||||
|
||||
zend_stack_push(&CG(foreach_copy_stack), (void *) &dummy_opline, sizeof(zend_op));
|
||||
}
|
||||
@@ -2662,7 +2661,7 @@ static int generate_free_switch_expr(const zend_switch_entry *switch_entry TSRML
|
||||
opline->opcode = (switch_entry->cond.op_type == IS_TMP_VAR) ? ZEND_FREE : ZEND_SWITCH_FREE;
|
||||
SET_NODE(opline->op1, &switch_entry->cond);
|
||||
SET_UNUSED(opline->op2);
|
||||
opline->extended_value = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2672,7 +2671,7 @@ static int generate_free_foreach_copy(const zend_op *foreach_copy TSRMLS_DC) /*
|
||||
zend_op *opline;
|
||||
|
||||
/* If we reach the separator then stop applying the stack */
|
||||
if (foreach_copy->result_type == IS_UNUSED && foreach_copy->op1_type == IS_UNUSED) {
|
||||
if (foreach_copy->result_type == IS_UNUSED) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2681,16 +2680,6 @@ static int generate_free_foreach_copy(const zend_op *foreach_copy TSRMLS_DC) /*
|
||||
opline->opcode = (foreach_copy->result_type == IS_TMP_VAR) ? ZEND_FREE : ZEND_SWITCH_FREE;
|
||||
COPY_NODE(opline->op1, foreach_copy->result);
|
||||
SET_UNUSED(opline->op2);
|
||||
opline->extended_value = 1;
|
||||
|
||||
if (foreach_copy->op1_type != IS_UNUSED) {
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
opline->opcode = (foreach_copy->op1_type == IS_TMP_VAR) ? ZEND_FREE : ZEND_SWITCH_FREE;
|
||||
COPY_NODE(opline->op1, foreach_copy->op1);
|
||||
SET_UNUSED(opline->op2);
|
||||
opline->extended_value = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -6227,7 +6216,6 @@ void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, zno
|
||||
{
|
||||
zend_op *opline;
|
||||
zend_bool is_variable;
|
||||
zend_bool push_container = 0;
|
||||
zend_op dummy_opline;
|
||||
|
||||
if (variable) {
|
||||
@@ -6239,14 +6227,6 @@ void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, zno
|
||||
/* save the location of FETCH_W instruction(s) */
|
||||
open_brackets_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
|
||||
zend_do_end_variable_parse(array, BP_VAR_W, 0 TSRMLS_CC);
|
||||
if (CG(active_op_array)->last > 0 &&
|
||||
CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode == ZEND_FETCH_OBJ_W) {
|
||||
/* Only lock the container if we are fetching from a real container and not $this */
|
||||
if (CG(active_op_array)->opcodes[CG(active_op_array)->last-1].op1_type == IS_VAR) {
|
||||
CG(active_op_array)->opcodes[CG(active_op_array)->last-1].extended_value |= ZEND_FETCH_ADD_LOCK;
|
||||
push_container = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
is_variable = 0;
|
||||
open_brackets_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
|
||||
@@ -6266,11 +6246,6 @@ void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, zno
|
||||
opline->extended_value = is_variable ? ZEND_FE_RESET_VARIABLE : 0;
|
||||
|
||||
COPY_NODE(dummy_opline.result, opline->result);
|
||||
if (push_container) {
|
||||
COPY_NODE(dummy_opline.op1, CG(active_op_array)->opcodes[CG(active_op_array)->last-2].op1);
|
||||
} else {
|
||||
dummy_opline.op1_type = IS_UNUSED;
|
||||
}
|
||||
zend_stack_push(&CG(foreach_copy_stack), (void *) &dummy_opline, sizeof(zend_op));
|
||||
|
||||
/* save the location of FE_FETCH */
|
||||
@@ -6327,7 +6302,6 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token
|
||||
opline->extended_value |= ZEND_FE_FETCH_BYREF;
|
||||
CG(active_op_array)->opcodes[foreach_token->u.op.opline_num].extended_value |= ZEND_FE_RESET_REFERENCE;
|
||||
} else {
|
||||
zend_op *foreach_copy;
|
||||
zend_op *fetch = &CG(active_op_array)->opcodes[foreach_token->u.op.opline_num];
|
||||
zend_op *end = &CG(active_op_array)->opcodes[open_brackets_token->u.op.opline_num];
|
||||
|
||||
@@ -6344,9 +6318,6 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token
|
||||
fetch->opcode -= 3; /* FETCH_W -> FETCH_R */
|
||||
}
|
||||
}
|
||||
/* prevent double SWITCH_FREE */
|
||||
zend_stack_top(&CG(foreach_copy_stack), (void **) &foreach_copy);
|
||||
foreach_copy->op1_type = IS_UNUSED;
|
||||
}
|
||||
|
||||
GET_NODE(&value_node, opline->result);
|
||||
|
||||
@@ -560,7 +560,7 @@ ZEND_METHOD(exception, getPrevious)
|
||||
RETURN_ZVAL(previous, 1, 0);
|
||||
}
|
||||
|
||||
int zend_spprintf(char **message, int max_len, char *format, ...) /* {{{ */
|
||||
int zend_spprintf(char **message, int max_len, const char *format, ...) /* {{{ */
|
||||
{
|
||||
va_list arg;
|
||||
int len;
|
||||
@@ -732,7 +732,7 @@ ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC) /* {{{ */
|
||||
ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval *ex;
|
||||
|
||||
@@ -760,7 +760,7 @@ ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *messa
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...) /* {{{ */
|
||||
ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...) /* {{{ */
|
||||
{
|
||||
va_list arg;
|
||||
char *message;
|
||||
@@ -775,7 +775,7 @@ ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long cod
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char *message, long code, int severity TSRMLS_DC) /* {{{ */
|
||||
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval *ex = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
|
||||
zend_update_property_long(default_exception_ce, ex, "severity", sizeof("severity")-1, severity TSRMLS_CC);
|
||||
|
||||
@@ -40,12 +40,12 @@ ZEND_API void zend_register_default_classes(TSRMLS_D);
|
||||
|
||||
/* exception_ce NULL or zend_exception_get_default() or a derived class
|
||||
* message NULL or the message of the exception */
|
||||
ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC);
|
||||
ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...);
|
||||
ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC);
|
||||
ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...);
|
||||
ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC);
|
||||
ZEND_API void zend_clear_exception(TSRMLS_D);
|
||||
|
||||
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char *message, long code, int severity TSRMLS_DC);
|
||||
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC);
|
||||
|
||||
extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
|
||||
|
||||
@@ -53,7 +53,7 @@ extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
|
||||
ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC);
|
||||
|
||||
/* do not export, in php it's available thru spprintf directly */
|
||||
int zend_spprintf(char **message, int max_len, char *format, ...);
|
||||
int zend_spprintf(char **message, int max_len, const char *format, ...);
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
|
||||
+27
-1
@@ -226,6 +226,16 @@ static zend_object_value zend_generator_create(zend_class_entry *class_type TSRM
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void copy_closure_static_var(zval **var TSRMLS_DC, int num_args, va_list args, zend_hash_key *key) /* {{{ */
|
||||
{
|
||||
HashTable *target = va_arg(args, HashTable *);
|
||||
|
||||
SEPARATE_ZVAL_TO_MAKE_IS_REF(var);
|
||||
Z_ADDREF_PP(var);
|
||||
zend_hash_quick_update(target, key->arKey, key->nKeyLength, key->h, var, sizeof(zval *), NULL);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Requires globals EG(scope), EG(current_scope), EG(This),
|
||||
* EG(active_symbol_table) and EG(current_execute_data). */
|
||||
ZEND_API zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC) /* {{{ */
|
||||
@@ -242,7 +252,23 @@ ZEND_API zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC) /*
|
||||
if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
|
||||
zend_op_array *op_array_copy = (zend_op_array*)emalloc(sizeof(zend_op_array));
|
||||
*op_array_copy = *op_array;
|
||||
function_add_ref((zend_function *) op_array_copy);
|
||||
|
||||
(*op_array->refcount)++;
|
||||
op_array->run_time_cache = NULL;
|
||||
if (op_array->static_variables) {
|
||||
ALLOC_HASHTABLE(op_array_copy->static_variables);
|
||||
zend_hash_init(
|
||||
op_array_copy->static_variables,
|
||||
zend_hash_num_elements(op_array->static_variables),
|
||||
NULL, ZVAL_PTR_DTOR, 0
|
||||
);
|
||||
zend_hash_apply_with_arguments(
|
||||
op_array->static_variables TSRMLS_CC,
|
||||
(apply_func_args_t) copy_closure_static_var,
|
||||
1, op_array_copy->static_variables
|
||||
);
|
||||
}
|
||||
|
||||
op_array = op_array_copy;
|
||||
}
|
||||
|
||||
|
||||
@@ -1392,11 +1392,6 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
SAVE_OPLINE();
|
||||
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
if (OP1_TYPE == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
|
||||
}
|
||||
|
||||
if (IS_OP2_TMP_FREE()) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
|
||||
@@ -14997,11 +14997,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA
|
||||
SAVE_OPLINE();
|
||||
property = opline->op2.zv;
|
||||
|
||||
if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
@@ -17353,11 +17348,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND
|
||||
SAVE_OPLINE();
|
||||
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
|
||||
|
||||
if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
|
||||
}
|
||||
|
||||
if (1) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
@@ -19616,11 +19606,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND
|
||||
SAVE_OPLINE();
|
||||
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
|
||||
|
||||
if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
@@ -23081,11 +23066,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL
|
||||
SAVE_OPLINE();
|
||||
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
|
||||
|
||||
if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
@@ -24867,11 +24847,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE
|
||||
SAVE_OPLINE();
|
||||
property = opline->op2.zv;
|
||||
|
||||
if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
@@ -26285,11 +26260,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_H
|
||||
SAVE_OPLINE();
|
||||
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
|
||||
|
||||
if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
|
||||
}
|
||||
|
||||
if (1) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
@@ -27606,11 +27576,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_H
|
||||
SAVE_OPLINE();
|
||||
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
|
||||
|
||||
if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
@@ -29349,11 +29314,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HA
|
||||
SAVE_OPLINE();
|
||||
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
|
||||
|
||||
if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
@@ -32493,11 +32453,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
|
||||
SAVE_OPLINE();
|
||||
property = opline->op2.zv;
|
||||
|
||||
if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
@@ -34614,11 +34569,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL
|
||||
SAVE_OPLINE();
|
||||
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
|
||||
|
||||
if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
|
||||
}
|
||||
|
||||
if (1) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
@@ -36739,11 +36689,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL
|
||||
SAVE_OPLINE();
|
||||
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
|
||||
|
||||
if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
@@ -39917,11 +39862,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE
|
||||
SAVE_OPLINE();
|
||||
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
|
||||
|
||||
if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
|
||||
+8
-1
@@ -1003,7 +1003,14 @@ mkdir )
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "mkdir $pathcomp" 1>&2
|
||||
fi
|
||||
mkdir $pathcomp || errstatus=$?
|
||||
# See https://bugs.php.net/51076
|
||||
# The fix is from Debian who have sent it
|
||||
# upstream, too; but upstream seems dead.
|
||||
mkdir $pathcomp || {
|
||||
_errstatus=$?
|
||||
[ -d "$pathcomp" ] || errstatus=${_errstatus}
|
||||
unset _errstatus
|
||||
}
|
||||
if [ ".$opt_o" != . ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "chown $opt_o $pathcomp" 1>&2
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=5
|
||||
PHP_RELEASE_VERSION=5
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
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`
|
||||
|
||||
|
||||
@@ -183,7 +183,6 @@ _bc_rec_mul (bc_num u, int ulen, bc_num v, int vlen, bc_num *prod,
|
||||
int full_scale TSRMLS_DC)
|
||||
{
|
||||
bc_num u0, u1, v0, v1;
|
||||
int u0len, v0len;
|
||||
bc_num m1, m2, m3, d1, d2;
|
||||
int n, prodlen, m1zero;
|
||||
int d1len, d2len;
|
||||
@@ -216,10 +215,8 @@ _bc_rec_mul (bc_num u, int ulen, bc_num v, int vlen, bc_num *prod,
|
||||
}
|
||||
_bc_rm_leading_zeros (u1);
|
||||
_bc_rm_leading_zeros (u0);
|
||||
u0len = u0->n_len;
|
||||
_bc_rm_leading_zeros (v1);
|
||||
_bc_rm_leading_zeros (v0);
|
||||
v0len = v0->n_len;
|
||||
|
||||
m1zero = bc_is_zero(u1 TSRMLS_CC) || bc_is_zero(v1 TSRMLS_CC);
|
||||
|
||||
|
||||
+784
-794
File diff suppressed because it is too large.
Load diff
+19
-6
@@ -226,12 +226,17 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS
|
||||
*key_free = *key_str;
|
||||
return len;
|
||||
} else {
|
||||
*key_free = NULL;
|
||||
zval tmp = *key;
|
||||
int len;
|
||||
|
||||
convert_to_string(key);
|
||||
*key_str = Z_STRVAL_P(key);
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_string(&tmp);
|
||||
|
||||
return Z_STRLEN_P(key);
|
||||
*key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
|
||||
len = Z_STRLEN(tmp);
|
||||
|
||||
zval_dtor(&tmp);
|
||||
return len;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -297,6 +302,14 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS
|
||||
RETURN_FALSE; \
|
||||
}
|
||||
|
||||
/* the same check, but with a call to DBA_ID_DONE before returning */
|
||||
#define DBA_WRITE_CHECK_WITH_ID \
|
||||
if(info->mode != DBA_WRITER && info->mode != DBA_TRUNC && info->mode != DBA_CREAT) { \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You cannot perform a modification to a database without proper access"); \
|
||||
DBA_ID_DONE; \
|
||||
RETURN_FALSE; \
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ globals */
|
||||
@@ -557,7 +570,7 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||
|
||||
DBA_FETCH_RESOURCE(info, &id);
|
||||
|
||||
DBA_WRITE_CHECK;
|
||||
DBA_WRITE_CHECK_WITH_ID;
|
||||
|
||||
if (info->hnd->update(info, key_str, key_len, val, val_len, mode TSRMLS_CC) == SUCCESS) {
|
||||
DBA_ID_DONE;
|
||||
@@ -1110,7 +1123,7 @@ PHP_FUNCTION(dba_delete)
|
||||
{
|
||||
DBA_ID_GET2;
|
||||
|
||||
DBA_WRITE_CHECK;
|
||||
DBA_WRITE_CHECK_WITH_ID;
|
||||
|
||||
if(info->hnd->delete(info, key_str, key_len TSRMLS_CC) == SUCCESS)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Bug #65708 (dba functions cast $key param to string in-place, bypassing copy on write)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) .'/skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once(dirname(__FILE__) .'/test.inc');
|
||||
|
||||
$db = dba_popen($db_filename, 'c');
|
||||
|
||||
$key = 1;
|
||||
$copy = $key;
|
||||
|
||||
echo gettype($key)."\n";
|
||||
echo gettype($copy)."\n";
|
||||
|
||||
dba_exists($key, $db);
|
||||
|
||||
echo gettype($key)."\n";
|
||||
echo gettype($copy)."\n";
|
||||
|
||||
dba_close($db);
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require(dirname(__FILE__) .'/clean.inc');
|
||||
?>
|
||||
--EXPECT--
|
||||
integer
|
||||
integer
|
||||
integer
|
||||
integer
|
||||
+3
-1
@@ -968,7 +968,9 @@ PHP_FUNCTION(ftp_nb_get)
|
||||
RETURN_LONG(PHP_FTP_FAILED);
|
||||
}
|
||||
|
||||
php_stream_close(outstream);
|
||||
if (ret == PHP_FTP_FINISHED){
|
||||
php_stream_close(outstream);
|
||||
}
|
||||
|
||||
RETURN_LONG(ret);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
--TEST--
|
||||
Testing whether ftp_nb_continue() fetches more data
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require 'skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'server.inc';
|
||||
|
||||
$file = "mediumfile.txt";
|
||||
|
||||
$ftp = ftp_connect('127.0.0.1', $port);
|
||||
ftp_login($ftp, 'user', 'pass');
|
||||
if (!$ftp) die("Couldn't connect to the server");
|
||||
|
||||
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . $file;
|
||||
touch($local_file);
|
||||
|
||||
$r = ftp_nb_get($ftp, $local_file, $file, FTP_BINARY);
|
||||
while ($r == FTP_MOREDATA) {
|
||||
$r = ftp_nb_continue($ftp);
|
||||
}
|
||||
ftp_close($ftp);
|
||||
|
||||
echo file_get_contents($local_file);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "mediumfile.txt");
|
||||
?>
|
||||
--EXPECT--
|
||||
This is line 0 of the test data.
|
||||
This is line 1 of the test data.
|
||||
This is line 2 of the test data.
|
||||
This is line 3 of the test data.
|
||||
This is line 4 of the test data.
|
||||
This is line 5 of the test data.
|
||||
This is line 6 of the test data.
|
||||
This is line 7 of the test data.
|
||||
This is line 8 of the test data.
|
||||
This is line 9 of the test data.
|
||||
This is line 10 of the test data.
|
||||
This is line 11 of the test data.
|
||||
This is line 12 of the test data.
|
||||
This is line 13 of the test data.
|
||||
This is line 14 of the test data.
|
||||
This is line 15 of the test data.
|
||||
This is line 16 of the test data.
|
||||
This is line 17 of the test data.
|
||||
This is line 18 of the test data.
|
||||
This is line 19 of the test data.
|
||||
This is line 20 of the test data.
|
||||
This is line 21 of the test data.
|
||||
This is line 22 of the test data.
|
||||
This is line 23 of the test data.
|
||||
This is line 24 of the test data.
|
||||
This is line 25 of the test data.
|
||||
This is line 26 of the test data.
|
||||
This is line 27 of the test data.
|
||||
This is line 28 of the test data.
|
||||
This is line 29 of the test data.
|
||||
This is line 30 of the test data.
|
||||
This is line 31 of the test data.
|
||||
This is line 32 of the test data.
|
||||
This is line 33 of the test data.
|
||||
This is line 34 of the test data.
|
||||
This is line 35 of the test data.
|
||||
This is line 36 of the test data.
|
||||
This is line 37 of the test data.
|
||||
This is line 38 of the test data.
|
||||
This is line 39 of the test data.
|
||||
This is line 40 of the test data.
|
||||
This is line 41 of the test data.
|
||||
This is line 42 of the test data.
|
||||
This is line 43 of the test data.
|
||||
This is line 44 of the test data.
|
||||
This is line 45 of the test data.
|
||||
This is line 46 of the test data.
|
||||
This is line 47 of the test data.
|
||||
This is line 48 of the test data.
|
||||
This is line 49 of the test data.
|
||||
This is line 50 of the test data.
|
||||
This is line 51 of the test data.
|
||||
This is line 52 of the test data.
|
||||
This is line 53 of the test data.
|
||||
This is line 54 of the test data.
|
||||
This is line 55 of the test data.
|
||||
This is line 56 of the test data.
|
||||
This is line 57 of the test data.
|
||||
This is line 58 of the test data.
|
||||
This is line 59 of the test data.
|
||||
This is line 60 of the test data.
|
||||
This is line 61 of the test data.
|
||||
This is line 62 of the test data.
|
||||
This is line 63 of the test data.
|
||||
This is line 64 of the test data.
|
||||
This is line 65 of the test data.
|
||||
This is line 66 of the test data.
|
||||
This is line 67 of the test data.
|
||||
This is line 68 of the test data.
|
||||
This is line 69 of the test data.
|
||||
This is line 70 of the test data.
|
||||
This is line 71 of the test data.
|
||||
This is line 72 of the test data.
|
||||
This is line 73 of the test data.
|
||||
This is line 74 of the test data.
|
||||
This is line 75 of the test data.
|
||||
This is line 76 of the test data.
|
||||
This is line 77 of the test data.
|
||||
This is line 78 of the test data.
|
||||
This is line 79 of the test data.
|
||||
This is line 80 of the test data.
|
||||
This is line 81 of the test data.
|
||||
This is line 82 of the test data.
|
||||
This is line 83 of the test data.
|
||||
This is line 84 of the test data.
|
||||
This is line 85 of the test data.
|
||||
This is line 86 of the test data.
|
||||
This is line 87 of the test data.
|
||||
This is line 88 of the test data.
|
||||
This is line 89 of the test data.
|
||||
This is line 90 of the test data.
|
||||
This is line 91 of the test data.
|
||||
This is line 92 of the test data.
|
||||
This is line 93 of the test data.
|
||||
This is line 94 of the test data.
|
||||
This is line 95 of the test data.
|
||||
This is line 96 of the test data.
|
||||
This is line 97 of the test data.
|
||||
This is line 98 of the test data.
|
||||
This is line 99 of the test data.
|
||||
This is line 100 of the test data.
|
||||
This is line 101 of the test data.
|
||||
This is line 102 of the test data.
|
||||
This is line 103 of the test data.
|
||||
This is line 104 of the test data.
|
||||
This is line 105 of the test data.
|
||||
This is line 106 of the test data.
|
||||
This is line 107 of the test data.
|
||||
This is line 108 of the test data.
|
||||
This is line 109 of the test data.
|
||||
This is line 110 of the test data.
|
||||
This is line 111 of the test data.
|
||||
This is line 112 of the test data.
|
||||
This is line 113 of the test data.
|
||||
This is line 114 of the test data.
|
||||
This is line 115 of the test data.
|
||||
This is line 116 of the test data.
|
||||
This is line 117 of the test data.
|
||||
This is line 118 of the test data.
|
||||
This is line 119 of the test data.
|
||||
This is line 120 of the test data.
|
||||
This is line 121 of the test data.
|
||||
This is line 122 of the test data.
|
||||
This is line 123 of the test data.
|
||||
This is line 124 of the test data.
|
||||
This is line 125 of the test data.
|
||||
This is line 126 of the test data.
|
||||
This is line 127 of the test data.
|
||||
This is line 128 of the test data.
|
||||
This is line 129 of the test data.
|
||||
This is line 130 of the test data.
|
||||
This is line 131 of the test data.
|
||||
This is line 132 of the test data.
|
||||
This is line 133 of the test data.
|
||||
This is line 134 of the test data.
|
||||
This is line 135 of the test data.
|
||||
This is line 136 of the test data.
|
||||
This is line 137 of the test data.
|
||||
This is line 138 of the test data.
|
||||
This is line 139 of the test data.
|
||||
This is line 140 of the test data.
|
||||
This is line 141 of the test data.
|
||||
This is line 142 of the test data.
|
||||
This is line 143 of the test data.
|
||||
This is line 144 of the test data.
|
||||
This is line 145 of the test data.
|
||||
This is line 146 of the test data.
|
||||
This is line 147 of the test data.
|
||||
This is line 148 of the test data.
|
||||
This is line 149 of the test data.
|
||||
@@ -368,6 +368,13 @@ if ($pid) {
|
||||
}
|
||||
fputs($s, "226 Closing data Connection.\r\n");
|
||||
break;
|
||||
case "mediumfile":
|
||||
fputs($s, "150 File status okay; about to open data connection.\r\n");
|
||||
for($i = 0; $i < 150; $i++){
|
||||
fputs($fs, "This is line $i of the test data.\n");
|
||||
}
|
||||
fputs($s, "226 Closing data Connection.\r\n");
|
||||
|
||||
default:
|
||||
fputs($s, "550 {$matches[1]}: No such file or directory \r\n");
|
||||
break;
|
||||
|
||||
+2
-2
@@ -198,9 +198,9 @@ if test "$PHP_IMAP" != "no"; then
|
||||
AC_MSG_ERROR(Cannot find rfc822.h. Please check your c-client installation.)
|
||||
fi
|
||||
|
||||
if test ! -r "$IMAP_DIR/c-client/libc-client.a" && -r "$IMAP_DIR/c-client/c-client.a" ; then
|
||||
if test ! -r "$IMAP_DIR/c-client/libc-client.a" && test -r "$IMAP_DIR/c-client/c-client.a" ; then
|
||||
ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1
|
||||
elif test ! -r "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" && -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
|
||||
elif test ! -r "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" && test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
|
||||
ln -s "$IMAP_DIR/$PHP_LIBDIR/c-client.a" "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ Bug #58756: w.r.t MessageFormatter
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
if (version_compare(INTL_ICU_VERSION, '51.2') >= 0)
|
||||
die('skip for ICU < 51.2');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
@@ -31,4 +34,4 @@ echo "msgf2: ", $msgf->format(array($time, 'date')), " ",
|
||||
--EXPECT--
|
||||
date: Tuesday, July 7, 2009 8:41:13 PM EDT
|
||||
msgf: Tuesday, July 7, 2009 8:41:13 PM EDT
|
||||
==DONE==
|
||||
==DONE==
|
||||
@@ -0,0 +1,37 @@
|
||||
--TEST--
|
||||
Bug #58756: w.r.t MessageFormatter
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
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("intl.default_locale", "nl");
|
||||
|
||||
$time = 1247013673;
|
||||
|
||||
ini_set('date.timezone', 'America/New_York');
|
||||
|
||||
$msgf = new MessageFormatter('en_US', '{0,date,full} {0,time,h:m:s a V}');
|
||||
|
||||
echo "date: " . date('l, F j, Y g:i:s A T', $time) . "\n";
|
||||
echo "msgf: " . $msgf->format(array($time)) . "\n";
|
||||
|
||||
//NOT FIXED:
|
||||
/*$msgf = new MessageFormatter('en_US',
|
||||
'{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}');
|
||||
|
||||
echo "msgf2: ", $msgf->format(array($time, 'date')), " ",
|
||||
$msgf->format(array($time, 'time')), "\n";
|
||||
*/
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
date: Tuesday, July 7, 2009 8:41:13 PM EDT
|
||||
msgf: Tuesday, July 7, 2009 8:41:13 PM usnyc
|
||||
==DONE==
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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,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,98 @@
|
||||
--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'); ?>
|
||||
--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
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -4,8 +4,8 @@ IntlDateFormatter, calendars and time zone
|
||||
date.timezone=Atlantic/Azores
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
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);
|
||||
|
||||
@@ -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==
|
||||
@@ -2,8 +2,8 @@
|
||||
IntlDateFormatter: several forms of the calendar arg
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
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);
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
--TEST--
|
||||
IntlDateFormatter: several forms of the calendar arg
|
||||
--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);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
ini_set("date.timezone", 'Atlantic/Azores');
|
||||
|
||||
$ts = strtotime('2012-01-01 00:00:00 UTC');
|
||||
|
||||
$cal = new IntlGregorianCalendar('UTC', NULL);
|
||||
$df = new IntlDateFormatter('es_ES', 0, 0, NULL, $cal);
|
||||
echo $df->format($ts), "\n";
|
||||
|
||||
$cal = IntlCalendar::createInstance('UTC', 'en@calendar=islamic');
|
||||
$df = new IntlDateFormatter('es_ES', 0, 0, NULL, $cal);
|
||||
echo $df->format($ts), "\n";
|
||||
|
||||
//override calendar's timezone
|
||||
$cal = new IntlGregorianCalendar('UTC', NULL);
|
||||
$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Madrid', $cal);
|
||||
echo $df->format($ts), "\n";
|
||||
|
||||
//default calendar is gregorian
|
||||
$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0);
|
||||
echo $df->format($ts), "\n";
|
||||
|
||||
//try now with traditional
|
||||
$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0, NULL, IntlDateFormatter::TRADITIONAL);
|
||||
echo $df->format($ts), "\n";
|
||||
|
||||
//the timezone can be overridden when not specifying a calendar
|
||||
$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0, 'UTC', IntlDateFormatter::TRADITIONAL);
|
||||
echo $df->format($ts), "\n";
|
||||
|
||||
$df = new IntlDateFormatter('es_ES', 0, 0, 'UTC', 0);
|
||||
echo $df->format($ts), "\n";
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
domingo%S 1 de enero de 2012 00:00:00 GMT
|
||||
domingo%S 8 de Safar de 1433 00:00:00 GMT
|
||||
domingo%S 1 de enero de 2012 01:00:00 Hora estándar de Europa central
|
||||
sábado%S 31 de diciembre de 2011 d.C. 23:00:00 Hora %Sde las Azores
|
||||
sábado%S 7 de Safar de 1433 AH 23:00:00 Hora %Sde las Azores
|
||||
domingo%S 8 de Safar de 1433 AH 00:00:00 GMT
|
||||
domingo%S 1 de enero de 2012 00:00:00 GMT
|
||||
==DONE==
|
||||
@@ -2,6 +2,7 @@
|
||||
datefmt_format_code()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
IntlDateFormatter::formatObject(): IntlCalendar tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
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);
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
IntlDateFormatter::formatObject(): IntlCalendar tests
|
||||
--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);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
ini_set("date.timezone", "Europe/Lisbon");
|
||||
|
||||
$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon
|
||||
echo IntlDateFormatter::formatObject($cal), "\n";
|
||||
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
|
||||
echo IntlDateFormatter::formatObject($cal, null, "en-US"), "\n";
|
||||
echo IntlDateFormatter::formatObject($cal, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
|
||||
echo IntlDateFormatter::formatObject($cal, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
|
||||
|
||||
$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00');
|
||||
echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n";
|
||||
|
||||
$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil');
|
||||
$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.);
|
||||
echo IntlDateFormatter::formatObject($cal), "\n";
|
||||
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
|
||||
--EXPECTF--
|
||||
01/01/2012, 00:00:00
|
||||
Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental
|
||||
Jan 1, 2012, 12:00:00 AM
|
||||
1/1/12, 12:00:00 AM Western European Standard %STime
|
||||
Sun 2012-01-1 00,00,00.000 Portugal Time
|
||||
Domingo, 1 de Janeiro de 2012 às 05:00:00 GMT+03:00
|
||||
06/02/1433, 00:00:00
|
||||
Sunday, Safar 6, 1433 at 12:00:00 AM Western European Standard Time
|
||||
==DONE==
|
||||
@@ -2,8 +2,8 @@
|
||||
IntlDateFormatter::formatObject(): DateTime tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
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);
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
IntlDateFormatter::formatObject(): DateTime tests
|
||||
--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);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
ini_set("date.timezone", "Europe/Lisbon");
|
||||
|
||||
$dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon
|
||||
echo IntlDateFormatter::formatObject($dt), "\n";
|
||||
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
|
||||
echo IntlDateFormatter::formatObject($dt, null, "en-US"), "\n";
|
||||
echo IntlDateFormatter::formatObject($dt, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
|
||||
echo IntlDateFormatter::formatObject($dt, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
|
||||
|
||||
$dt = new DateTime('2012-01-01 05:00:00+03:00');
|
||||
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
|
||||
--EXPECTF--
|
||||
01/01/2012, 00:00:00
|
||||
Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental
|
||||
Jan 1, 2012, 12:00:00 AM
|
||||
1/1/12, 12:00:00 AM Western European Standard %STime
|
||||
Sun 2012-01-1 00,00,00.000 Portugal Time
|
||||
Domingo, 1 de Janeiro de 2012 às 05:00:00 GMT+03:00
|
||||
==DONE==
|
||||
@@ -2,6 +2,7 @@
|
||||
datefmt_format_code() and datefmt_parse_code()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,295 @@
|
||||
--TEST--
|
||||
datefmt_format_code() and datefmt_parse_code()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Test for the datefmt_format function
|
||||
*/
|
||||
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$timezone = 'GMT+05:00';
|
||||
|
||||
$locale_arr = array (
|
||||
'en_US'
|
||||
);
|
||||
|
||||
$datetype_arr = array (
|
||||
IntlDateFormatter::FULL,
|
||||
IntlDateFormatter::LONG,
|
||||
IntlDateFormatter::MEDIUM
|
||||
);
|
||||
|
||||
$res_str = '';
|
||||
|
||||
|
||||
$time_arr = array (
|
||||
0,
|
||||
-1200000,
|
||||
1200000,
|
||||
2200000000,
|
||||
-2200000000,
|
||||
90099999,
|
||||
3600,
|
||||
-3600
|
||||
);
|
||||
|
||||
$localtime_arr1 = array (
|
||||
'tm_sec' => 24 ,
|
||||
'tm_min' => 3,
|
||||
'tm_hour' => 19,
|
||||
'tm_mday' => 3,
|
||||
'tm_mon' => 3,
|
||||
'tm_year' => 105,
|
||||
);
|
||||
$localtime_arr2 = array (
|
||||
'tm_sec' => 21,
|
||||
'tm_min' => 5,
|
||||
'tm_hour' => 7,
|
||||
'tm_mday' => 13,
|
||||
'tm_mon' => 7,
|
||||
'tm_year' => 205,
|
||||
);
|
||||
$localtime_arr3 = array (
|
||||
'tm_sec' => 11,
|
||||
'tm_min' => 13,
|
||||
'tm_hour' => 0,
|
||||
'tm_mday' => 17,
|
||||
'tm_mon' => 11,
|
||||
'tm_year' => -5
|
||||
);
|
||||
|
||||
$localtime_arr = array (
|
||||
$localtime_arr1,
|
||||
$localtime_arr2,
|
||||
$localtime_arr3
|
||||
);
|
||||
|
||||
//Test format and parse with a timestamp : long
|
||||
foreach( $time_arr as $timestamp_entry){
|
||||
$res_str .= "\n------------\n";
|
||||
$res_str .= "\nInput timestamp is : $timestamp_entry";
|
||||
$res_str .= "\n------------\n";
|
||||
foreach( $locale_arr as $locale_entry ){
|
||||
foreach( $datetype_arr as $datetype_entry ) {
|
||||
$res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
|
||||
$fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone);
|
||||
$formatted = ut_datefmt_format( $fmt , $timestamp_entry);
|
||||
$res_str .= "\nFormatted timestamp is : $formatted";
|
||||
$parsed = ut_datefmt_parse( $fmt , $formatted);
|
||||
if( intl_get_error_code() == U_ZERO_ERROR){
|
||||
$res_str .= "\nParsed timestamp is : $parsed";
|
||||
}else{
|
||||
$res_str .= "\nError while parsing as: '".intl_get_error_message()."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Test format and parse with a localtime :array
|
||||
foreach( $localtime_arr as $localtime_entry){
|
||||
$res_str .= "\n------------\n";
|
||||
$res_str .= "\nInput localtime is : ";
|
||||
foreach( $localtime_entry as $key => $value){
|
||||
$res_str .= "$key : '$value' , ";
|
||||
}
|
||||
|
||||
$res_str .= "\n------------\n";
|
||||
foreach( $locale_arr as $locale_entry ){
|
||||
foreach( $datetype_arr as $datetype_entry ) {
|
||||
$res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
|
||||
$fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone);
|
||||
$formatted1 = ut_datefmt_format( $fmt , $localtime_entry);
|
||||
if( intl_get_error_code() == U_ZERO_ERROR){
|
||||
$res_str .= "\nFormatted localtime_array is : $formatted1";
|
||||
}else{
|
||||
$res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
|
||||
}
|
||||
//Parsing
|
||||
$parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 );
|
||||
|
||||
if( $parsed_arr){
|
||||
$res_str .= "\nParsed array is: ";
|
||||
foreach( $parsed_arr as $key => $value){
|
||||
$res_str .= "$key : '$value' , ";
|
||||
}
|
||||
}
|
||||
/*
|
||||
else{
|
||||
//$res_str .= "No values found from LocaleTime parsing.";
|
||||
$res_str .= "\tError : '".intl_get_error_message()."'";
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $res_str;
|
||||
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
|
||||
// Run the test
|
||||
ut_run();
|
||||
?>
|
||||
--EXPECT--
|
||||
------------
|
||||
|
||||
Input timestamp is : 0
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Thursday, January 1, 1970 at 5:00:00 AM GMT+05:00
|
||||
Parsed timestamp is : 0
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : January 1, 1970 at 5:00:00 AM GMT+5
|
||||
Parsed timestamp is : 0
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Jan 1, 1970, 5:00:00 AM
|
||||
Parsed timestamp is : 0
|
||||
------------
|
||||
|
||||
Input timestamp is : -1200000
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Thursday, December 18, 1969 at 7:40:00 AM GMT+05:00
|
||||
Parsed timestamp is : -1200000
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : December 18, 1969 at 7:40:00 AM GMT+5
|
||||
Parsed timestamp is : -1200000
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Dec 18, 1969, 7:40:00 AM
|
||||
Parsed timestamp is : -1200000
|
||||
------------
|
||||
|
||||
Input timestamp is : 1200000
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Thursday, January 15, 1970 at 2:20:00 AM GMT+05:00
|
||||
Parsed timestamp is : 1200000
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : January 15, 1970 at 2:20:00 AM GMT+5
|
||||
Parsed timestamp is : 1200000
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Jan 15, 1970, 2:20:00 AM
|
||||
Parsed timestamp is : 1200000
|
||||
------------
|
||||
|
||||
Input timestamp is : 2200000000
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Monday, September 19, 2039 at 4:06:40 AM GMT+05:00
|
||||
Parsed timestamp is : 2200000000
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : September 19, 2039 at 4:06:40 AM GMT+5
|
||||
Parsed timestamp is : 2200000000
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Sep 19, 2039, 4:06:40 AM
|
||||
Parsed timestamp is : 2200000000
|
||||
------------
|
||||
|
||||
Input timestamp is : -2200000000
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Sunday, April 15, 1900 at 5:53:20 AM GMT+05:00
|
||||
Parsed timestamp is : -2200000000
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : April 15, 1900 at 5:53:20 AM GMT+5
|
||||
Parsed timestamp is : -2200000000
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Apr 15, 1900, 5:53:20 AM
|
||||
Parsed timestamp is : -2200000000
|
||||
------------
|
||||
|
||||
Input timestamp is : 90099999
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Thursday, November 9, 1972 at 12:46:39 AM GMT+05:00
|
||||
Parsed timestamp is : 90099999
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : November 9, 1972 at 12:46:39 AM GMT+5
|
||||
Parsed timestamp is : 90099999
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Nov 9, 1972, 12:46:39 AM
|
||||
Parsed timestamp is : 90099999
|
||||
------------
|
||||
|
||||
Input timestamp is : 3600
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Thursday, January 1, 1970 at 6:00:00 AM GMT+05:00
|
||||
Parsed timestamp is : 3600
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : January 1, 1970 at 6:00:00 AM GMT+5
|
||||
Parsed timestamp is : 3600
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Jan 1, 1970, 6:00:00 AM
|
||||
Parsed timestamp is : 3600
|
||||
------------
|
||||
|
||||
Input timestamp is : -3600
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Thursday, January 1, 1970 at 4:00:00 AM GMT+05:00
|
||||
Parsed timestamp is : -3600
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : January 1, 1970 at 4:00:00 AM GMT+5
|
||||
Parsed timestamp is : -3600
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Jan 1, 1970, 4:00:00 AM
|
||||
Parsed timestamp is : -3600
|
||||
------------
|
||||
|
||||
Input localtime is : tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_mday : '3' , tm_mon : '3' , tm_year : '105' ,
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted localtime_array is : Sunday, April 3, 2005 at 7:03:24 PM GMT+05:00
|
||||
Parsed array is: tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_year : '105' , tm_mday : '3' , tm_wday : '0' , tm_yday : '93' , tm_mon : '3' , tm_isdst : '0' ,
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted localtime_array is : April 3, 2005 at 7:03:24 PM GMT+5
|
||||
Parsed array is: tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_year : '105' , tm_mday : '3' , tm_wday : '0' , tm_yday : '93' , tm_mon : '3' , tm_isdst : '0' ,
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted localtime_array is : Apr 3, 2005, 7:03:24 PM
|
||||
Parsed array is: tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_year : '105' , tm_mday : '3' , tm_wday : '0' , tm_yday : '93' , tm_mon : '3' , tm_isdst : '0' ,
|
||||
------------
|
||||
|
||||
Input localtime is : tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_mday : '13' , tm_mon : '7' , tm_year : '205' ,
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted localtime_array is : Thursday, August 13, 2105 at 7:05:21 AM GMT+05:00
|
||||
Parsed array is: tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_year : '205' , tm_mday : '13' , tm_wday : '4' , tm_yday : '225' , tm_mon : '7' , tm_isdst : '0' ,
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted localtime_array is : August 13, 2105 at 7:05:21 AM GMT+5
|
||||
Parsed array is: tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_year : '205' , tm_mday : '13' , tm_wday : '4' , tm_yday : '225' , tm_mon : '7' , tm_isdst : '0' ,
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted localtime_array is : Aug 13, 2105, 7:05:21 AM
|
||||
Parsed array is: tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_year : '205' , tm_mday : '13' , tm_wday : '4' , tm_yday : '225' , tm_mon : '7' , tm_isdst : '0' ,
|
||||
------------
|
||||
|
||||
Input localtime is : tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_mday : '17' , tm_mon : '11' , tm_year : '-5' ,
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted localtime_array is : Tuesday, December 17, 1895 at 12:13:11 AM GMT+05:00
|
||||
Parsed array is: tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_year : '-5' , tm_mday : '17' , tm_wday : '2' , tm_yday : '351' , tm_mon : '11' , tm_isdst : '0' ,
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted localtime_array is : December 17, 1895 at 12:13:11 AM GMT+5
|
||||
Parsed array is: tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_year : '-5' , tm_mday : '17' , tm_wday : '2' , tm_yday : '351' , tm_mon : '11' , tm_isdst : '0' ,
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted localtime_array is : Dec 17, 1895, 12:13:11 AM
|
||||
Parsed array is: tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_year : '-5' , tm_mday : '17' , tm_wday : '2' , tm_yday : '351' , tm_mon : '11' , tm_isdst : '0' ,
|
||||
@@ -0,0 +1,423 @@
|
||||
--TEST--
|
||||
datefmt_format_code()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//ini_set("intl.error_level", E_WARNING);
|
||||
|
||||
/*
|
||||
* Test for the datefmt_format function
|
||||
*/
|
||||
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$timezone = 'GMT-10:00';
|
||||
|
||||
$locale_arr = array (
|
||||
'en_US'
|
||||
);
|
||||
|
||||
$datetype_arr = array (
|
||||
IntlDateFormatter::FULL,
|
||||
IntlDateFormatter::LONG,
|
||||
IntlDateFormatter::MEDIUM,
|
||||
IntlDateFormatter::SHORT,
|
||||
IntlDateFormatter::NONE
|
||||
);
|
||||
|
||||
$res_str = '';
|
||||
|
||||
|
||||
$time_arr = array (
|
||||
0,
|
||||
-1200000,
|
||||
1200000,
|
||||
2200000000.0,
|
||||
-2200000000.0,
|
||||
90099999,
|
||||
3600,
|
||||
-3600
|
||||
);
|
||||
|
||||
$localtime_arr1 = array (
|
||||
'tm_sec' => 24 ,
|
||||
'tm_min' => 3,
|
||||
'tm_hour' => 19,
|
||||
'tm_mday' => 3,
|
||||
'tm_mon' => 3,
|
||||
'tm_year' => 105,
|
||||
);
|
||||
$localtime_arr2 = array (
|
||||
'tm_sec' => 21,
|
||||
'tm_min' => 5,
|
||||
'tm_hour' => 7,
|
||||
'tm_mday' => 13,
|
||||
'tm_mon' => 4,
|
||||
'tm_year' => 205,
|
||||
);
|
||||
$localtime_arr3 = array (
|
||||
'tm_sec' => 11,
|
||||
'tm_min' => 13,
|
||||
'tm_hour' => 0,
|
||||
'tm_mday' => 17,
|
||||
'tm_mon' => 11,
|
||||
'tm_year' => -5
|
||||
);
|
||||
|
||||
$localtime_arr = array (
|
||||
$localtime_arr1,
|
||||
$localtime_arr2,
|
||||
$localtime_arr3
|
||||
);
|
||||
|
||||
$d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC"));
|
||||
$d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC"));
|
||||
$d2->setTimezone(new DateTimeZone("PDT"));
|
||||
$dates = array(
|
||||
$d1,
|
||||
$d2,
|
||||
new StdClass(),
|
||||
);
|
||||
|
||||
//Test format with input as a timestamp : integer
|
||||
foreach( $time_arr as $timestamp_entry){
|
||||
$res_str .= "\n------------\n";
|
||||
$res_str .= "\nInput timestamp is : $timestamp_entry";
|
||||
$res_str .= "\n------------\n";
|
||||
foreach( $locale_arr as $locale_entry ){
|
||||
foreach( $datetype_arr as $datetype_entry )
|
||||
{
|
||||
$res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
|
||||
$fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN);
|
||||
$formatted = ut_datefmt_format( $fmt , $timestamp_entry);
|
||||
$res_str .= "\nFormatted timestamp is : $formatted";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Test format with input as a localtime :array
|
||||
foreach( $localtime_arr as $localtime_entry){
|
||||
$res_str .= "\n------------\n";
|
||||
$res_str .= "\nInput localtime is : ";
|
||||
foreach( $localtime_entry as $key => $value){
|
||||
$res_str .= "$key : '$value' , ";
|
||||
}
|
||||
|
||||
$res_str .= "\n------------\n";
|
||||
foreach( $locale_arr as $locale_entry ){
|
||||
foreach( $datetype_arr as $datetype_entry )
|
||||
{
|
||||
$res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
|
||||
$fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
|
||||
$formatted1 = ut_datefmt_format( $fmt , $localtime_entry);
|
||||
if( intl_get_error_code() == U_ZERO_ERROR){
|
||||
$res_str .= "\nFormatted localtime_array is : $formatted1";
|
||||
}else{
|
||||
$res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($dates as $date_entry) {
|
||||
foreach( $locale_arr as $locale_entry ){
|
||||
foreach( $datetype_arr as $datetype_entry ) {
|
||||
$res_str .= "\n------------";
|
||||
$res_str .= "\nDate is: ".var_export($date_entry, true);
|
||||
$res_str .= "\n------------";
|
||||
|
||||
$fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
|
||||
$formatted1 = ut_datefmt_format( $fmt , $date_entry);
|
||||
if( intl_get_error_code() == U_ZERO_ERROR){
|
||||
$res_str .= "\nFormatted DateTime is : $formatted1";
|
||||
}else{
|
||||
$res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $res_str;
|
||||
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
|
||||
// Run the test
|
||||
ut_run();
|
||||
?>
|
||||
--EXPECT--
|
||||
------------
|
||||
|
||||
Input timestamp is : 0
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Wednesday, December 31, 1969 at 2:00:00 PM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : December 31, 1969 at 2:00:00 PM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Dec 31, 1969, 2:00:00 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 12/31/69, 2:00 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 19691231 02:00 PM
|
||||
------------
|
||||
|
||||
Input timestamp is : -1200000
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Wednesday, December 17, 1969 at 4:40:00 PM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : December 17, 1969 at 4:40:00 PM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Dec 17, 1969, 4:40:00 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 12/17/69, 4:40 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 19691217 04:40 PM
|
||||
------------
|
||||
|
||||
Input timestamp is : 1200000
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Wednesday, January 14, 1970 at 11:20:00 AM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : January 14, 1970 at 11:20:00 AM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Jan 14, 1970, 11:20:00 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 1/14/70, 11:20 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 19700114 11:20 AM
|
||||
------------
|
||||
|
||||
Input timestamp is : 2200000000
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Sunday, September 18, 2039 at 1:06:40 PM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : September 18, 2039 at 1:06:40 PM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Sep 18, 2039, 1:06:40 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 9/18/39, 1:06 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 20390918 01:06 PM
|
||||
------------
|
||||
|
||||
Input timestamp is : -2200000000
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Saturday, April 14, 1900 at 2:53:20 PM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : April 14, 1900 at 2:53:20 PM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Apr 14, 1900, 2:53:20 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 4/14/00, 2:53 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 19000414 02:53 PM
|
||||
------------
|
||||
|
||||
Input timestamp is : 90099999
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Wednesday, November 8, 1972 at 9:46:39 AM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : November 8, 1972 at 9:46:39 AM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Nov 8, 1972, 9:46:39 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 11/8/72, 9:46 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 19721108 09:46 AM
|
||||
------------
|
||||
|
||||
Input timestamp is : 3600
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Wednesday, December 31, 1969 at 3:00:00 PM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : December 31, 1969 at 3:00:00 PM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Dec 31, 1969, 3:00:00 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 12/31/69, 3:00 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 19691231 03:00 PM
|
||||
------------
|
||||
|
||||
Input timestamp is : -3600
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted timestamp is : Wednesday, December 31, 1969 at 1:00:00 PM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted timestamp is : December 31, 1969 at 1:00:00 PM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted timestamp is : Dec 31, 1969, 1:00:00 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted timestamp is : 12/31/69, 1:00 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted timestamp is : 19691231 01:00 PM
|
||||
------------
|
||||
|
||||
Input localtime is : tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_mday : '3' , tm_mon : '3' , tm_year : '105' ,
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted localtime_array is : Sunday, April 3, 2005 at 7:03:24 PM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted localtime_array is : April 3, 2005 at 7:03:24 PM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted localtime_array is : Apr 3, 2005, 7:03:24 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted localtime_array is : 4/3/05, 7:03 PM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted localtime_array is : 20050403 07:03 PM
|
||||
------------
|
||||
|
||||
Input localtime is : tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_mday : '13' , tm_mon : '4' , tm_year : '205' ,
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted localtime_array is : Wednesday, May 13, 2105 at 7:05:21 AM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted localtime_array is : May 13, 2105 at 7:05:21 AM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted localtime_array is : May 13, 2105, 7:05:21 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted localtime_array is : 5/13/05, 7:05 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted localtime_array is : 21050513 07:05 AM
|
||||
------------
|
||||
|
||||
Input localtime is : tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_mday : '17' , tm_mon : '11' , tm_year : '-5' ,
|
||||
------------
|
||||
|
||||
IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||||
Formatted localtime_array is : Tuesday, December 17, 1895 at 12:13:11 AM GMT-10:00
|
||||
IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||||
Formatted localtime_array is : December 17, 1895 at 12:13:11 AM GMT-10
|
||||
IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||||
Formatted localtime_array is : Dec 17, 1895, 12:13:11 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = 3 ,timetype =3
|
||||
Formatted localtime_array is : 12/17/95, 12:13 AM
|
||||
IntlDateFormatter locale= en_US ,datetype = -1 ,timetype =-1
|
||||
Formatted localtime_array is : 18951217 12:13 AM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2010-01-01 01:02:03',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'UTC',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : Thursday, December 31, 2009 at 3:02:03 PM GMT-10:00
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2010-01-01 01:02:03',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'UTC',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : December 31, 2009 at 3:02:03 PM GMT-10
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2010-01-01 01:02:03',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'UTC',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : Dec 31, 2009, 3:02:03 PM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2010-01-01 01:02:03',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'UTC',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : 12/31/09, 3:02 PM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2010-01-01 01:02:03',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'UTC',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : 20091231 03:02 PM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'America/Los_Angeles',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : Saturday, December 30, 2000 at 5:04:05 PM GMT-10:00
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'America/Los_Angeles',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : December 30, 2000 at 5:04:05 PM GMT-10
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'America/Los_Angeles',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : Dec 30, 2000, 5:04:05 PM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'America/Los_Angeles',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : 12/30/00, 5:04 PM
|
||||
------------
|
||||
Date is: DateTime::__set_state(array(
|
||||
'date' => '2000-12-30 19:04:05',
|
||||
'timezone_type' => 3,
|
||||
'timezone' => 'America/Los_Angeles',
|
||||
))
|
||||
------------
|
||||
Formatted DateTime is : 20001230 05:04 PM
|
||||
------------
|
||||
Date is: stdClass::__set_state(array(
|
||||
))
|
||||
------------
|
||||
Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
|
||||
------------
|
||||
Date is: stdClass::__set_state(array(
|
||||
))
|
||||
------------
|
||||
Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
|
||||
------------
|
||||
Date is: stdClass::__set_state(array(
|
||||
))
|
||||
------------
|
||||
Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
|
||||
------------
|
||||
Date is: stdClass::__set_state(array(
|
||||
))
|
||||
------------
|
||||
Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
|
||||
------------
|
||||
Date is: stdClass::__set_state(array(
|
||||
))
|
||||
------------
|
||||
Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR'
|
||||
@@ -2,8 +2,8 @@
|
||||
IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
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);
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
--TEST--
|
||||
IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject()
|
||||
--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);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
ini_set("date.timezone", 'Atlantic/Azores');
|
||||
|
||||
$ts = strtotime('2012-01-01 00:00:00 UTC');
|
||||
|
||||
function d(IntlDateFormatter $df) {
|
||||
global $ts;
|
||||
echo $df->format($ts), "\n";
|
||||
var_dump($df->getCalendar(),
|
||||
$df->getCalendarObject()->getType(),
|
||||
$df->getCalendarObject()->getTimeZone()->getId());
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk');
|
||||
d($df);
|
||||
|
||||
|
||||
//changing the calendar with a cal type should not change tz
|
||||
$df->setCalendar(IntlDateFormatter::TRADITIONAL);
|
||||
d($df);
|
||||
|
||||
//but changing with an actual calendar should
|
||||
$cal = IntlCalendar::createInstance("UTC");
|
||||
$df->setCalendar($cal);
|
||||
d($df);
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
dimanche 1 janvier 2012 ap. J.-C. 03:00:00 UTC+03:00
|
||||
int(1)
|
||||
string(9) "gregorian"
|
||||
string(12) "Europe/Minsk"
|
||||
|
||||
dimanche 8 safar 1433 AH 03:00:00 UTC+03:00
|
||||
int(0)
|
||||
string(7) "islamic"
|
||||
string(12) "Europe/Minsk"
|
||||
|
||||
dimanche 1 janvier 2012 ap. J.-C. 00:00:00 UTC
|
||||
bool(false)
|
||||
string(9) "gregorian"
|
||||
string(3) "UTC"
|
||||
|
||||
==DONE==
|
||||
@@ -2,8 +2,8 @@
|
||||
IntlDateFormatter: get/setTimeZone()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
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);
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
--TEST--
|
||||
IntlDateFormatter: get/setTimeZone()
|
||||
--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);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
ini_set("date.timezone", 'Atlantic/Azores');
|
||||
|
||||
$ts = strtotime('2012-01-01 00:00:00 UTC');
|
||||
|
||||
function d(IntlDateFormatter $df) {
|
||||
global $ts;
|
||||
echo $df->format($ts), "\n";
|
||||
var_dump(
|
||||
$df->getTimeZoneID(),
|
||||
$df->getTimeZone()->getID());
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
$df = new IntlDateFormatter('pt_PT', 0, 0, 'Europe/Minsk');
|
||||
d($df);
|
||||
|
||||
$df->setTimeZone(NULL);
|
||||
d($df);
|
||||
|
||||
$df->setTimeZone('Europe/Madrid');
|
||||
d($df);
|
||||
|
||||
$df->setTimeZone(IntlTimeZone::createTimeZone('Europe/Paris'));
|
||||
d($df);
|
||||
|
||||
$df->setTimeZone(new DateTimeZone('Europe/Amsterdam'));
|
||||
d($df);
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
Domingo, 1 de Janeiro de 2012 às 03:00:00 GMT+03:00
|
||||
string(12) "Europe/Minsk"
|
||||
string(12) "Europe/Minsk"
|
||||
|
||||
Sábado, 31 de Dezembro de 2011 às 23:00:00 Hor%s %Sdos Açores
|
||||
string(15) "Atlantic/Azores"
|
||||
string(15) "Atlantic/Azores"
|
||||
|
||||
Domingo, 1 de Janeiro de 2012 às 01:00:00 Hor%s %Sda Europa Central
|
||||
string(13) "Europe/Madrid"
|
||||
string(13) "Europe/Madrid"
|
||||
|
||||
Domingo, 1 de Janeiro de 2012 às 01:00:00 Hor%s %Sda Europa Central
|
||||
string(12) "Europe/Paris"
|
||||
string(12) "Europe/Paris"
|
||||
|
||||
Domingo, 1 de Janeiro de 2012 às 01:00:00 Hor%s %Sda Europa Central
|
||||
string(16) "Europe/Amsterdam"
|
||||
string(16) "Europe/Amsterdam"
|
||||
|
||||
==DONE==
|
||||
@@ -5,6 +5,7 @@ date.timezone=Atlantic/Azores
|
||||
--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,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
|
||||
@@ -2,8 +2,8 @@
|
||||
IntlDateFormatter: several forms of the timezone arg
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
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);
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
--TEST--
|
||||
IntlDateFormatter: several forms of the timezone arg
|
||||
--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);
|
||||
ini_set("date.timezone", 'Atlantic/Azores');
|
||||
|
||||
$ts = strtotime('2012-01-01 00:00:00 UTC');
|
||||
|
||||
//should use Atlantic/Azores
|
||||
$df = new IntlDateFormatter('es_ES', 0, 0, NULL);
|
||||
echo $df->format($ts), "\n";
|
||||
|
||||
$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam');
|
||||
echo $df->format($ts), "\n";
|
||||
|
||||
$df = new IntlDateFormatter('es_ES', 0, 0, new DateTimeZone('Europe/Lisbon'));
|
||||
echo $df->format($ts), "\n";
|
||||
|
||||
$df = new IntlDateFormatter('es_ES', 0, 0, IntlTimeZone::createTimeZone('America/New_York'));
|
||||
echo $df->format($ts), "\n";
|
||||
|
||||
//time zone has priority
|
||||
$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam', new IntlGregorianCalendar('Europe/Lisbon'));
|
||||
echo $df->format($ts), "\n";
|
||||
|
||||
//calendar has priority
|
||||
$df = new IntlDateFormatter('es_ES', 0, 0, NULL, new IntlGregorianCalendar('Europe/Lisbon'));
|
||||
echo $df->format($ts), "\n";
|
||||
|
||||
$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam', 0);
|
||||
echo $df->format($ts), "\n";
|
||||
|
||||
--EXPECTF--
|
||||
sábado%S, 31 de diciembre de 2011 23:00:00 Hora estándar de las Azores
|
||||
domingo%S, 1 de enero de 2012 01:00:00 Hora estándar de Europa central
|
||||
domingo%S, 1 de enero de 2012 00:00:00 Hora%S de Europa occidental
|
||||
sábado%S, 31 de diciembre de 2011 19:00:00 Hora estándar oriental
|
||||
domingo%S, 1 de enero de 2012 01:00:00 Hora estándar de Europa central
|
||||
domingo%S, 1 de enero de 2012 00:00:00 Hora%S de Europa occidental
|
||||
domingo%S, 1 de enero de 2012 01:00:00 Hora estándar de Europa central
|
||||
@@ -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'
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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) die('skip for ICU >= 51.2'); ?>
|
||||
--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#
|
||||
-----------------
|
||||
@@ -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,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
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -2,8 +2,8 @@
|
||||
MessageFormat accepts IntlCalendar args
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
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);
|
||||
@@ -27,4 +27,4 @@ echo "msgf2: ", $msgf->format(array($time, 'date')), " ",
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
Quinta-feira, 17 de Maio de 2012 5:35:36 p.m. WEST
|
||||
==DONE==
|
||||
==DONE==
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
MessageFormat accepts IntlCalendar args
|
||||
--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);
|
||||
//ini_set("intl.default_locale", "nl");
|
||||
ini_set('date.timezone', 'Europe/Lisbon');
|
||||
|
||||
$cal = new IntlGregorianCalendar(2012,04,17,17,35,36);
|
||||
|
||||
$msgf = new MessageFormatter('pt_PT', '{0,date,full} {0,time,h:m:s a V}');
|
||||
echo $msgf->format(array($cal)), "\n";
|
||||
|
||||
//NOT FIXED:
|
||||
/*$msgf = new MessageFormatter('en_US',
|
||||
'{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}');
|
||||
|
||||
echo "msgf2: ", $msgf->format(array($time, 'date')), " ",
|
||||
$msgf->format(array($time, 'time')), "\n";
|
||||
*/
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
Quinta-feira, 17 de Maio de 2012 5:35:36 PM ptlis
|
||||
==DONE==
|
||||
@@ -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==
|
||||
@@ -1,11 +1,9 @@
|
||||
--TEST--
|
||||
IntlTimeZone::getDisplayName(): type parameter (ICU >= 49)
|
||||
IntlTimeZone::getDisplayName(): type parameter (ICU >= 49 && ICU < 51.2)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
if (version_compare(INTL_ICU_VERSION, '49') < 0)
|
||||
die('skip for ICU 49+');
|
||||
<?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, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
@@ -35,4 +33,4 @@ string(5) "+0000"
|
||||
string(3) "GMT"
|
||||
string(3) "GMT"
|
||||
string(22) "Portugal Time (Lisbon)"
|
||||
==DONE==
|
||||
==DONE==
|
||||
@@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
IntlTimeZone::getDisplayName(): type parameter (ICU >= 51.2)
|
||||
--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);
|
||||
ini_set("error_reporting", -1);
|
||||
ini_set("display_errors", 1);
|
||||
|
||||
$lsb = IntlTimeZone::createTimeZone('Europe/Lisbon');
|
||||
|
||||
ini_set('intl.default_locale', 'en_US');
|
||||
var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT));
|
||||
var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_LONG));
|
||||
var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT_GENERIC));
|
||||
var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_LONG_GENERIC));
|
||||
var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT_GMT));
|
||||
var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_LONG_GMT));
|
||||
var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT_COMMONLY_USED));
|
||||
var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_GENERIC_LOCATION));
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
string(3) "GMT"
|
||||
string(30) "Western European Standard Time"
|
||||
string(13) "Portugal Time"
|
||||
string(21) "Western European Time"
|
||||
string(5) "+0000"
|
||||
string(3) "GMT"
|
||||
string(3) "GMT"
|
||||
string(13) "Portugal Time"
|
||||
==DONE==
|
||||
+35
-4
@@ -15,6 +15,28 @@ AC_DEFUN([PHP_LDAP_CHECKS], [
|
||||
LDAP_DIR=$1
|
||||
LDAP_INCDIR=$1/ldap/public
|
||||
LDAP_LIBDIR=$1/$PHP_LIBDIR
|
||||
else
|
||||
|
||||
dnl Find Oracle Instant Client RPM header location corresponding to the given lib path e.g. for --with-ldap=/usr/lib/oracle/12.1/client64/lib
|
||||
AC_CHECK_SIZEOF(long int, 4)
|
||||
if test "$ac_cv_sizeof_long_int" = "4"; then
|
||||
PHP_OCI8_IC_LIBDIR_SUFFIX=""
|
||||
else
|
||||
PHP_OCI8_IC_LIBDIR_SUFFIX=64
|
||||
fi
|
||||
OCISDKRPMINC=`echo "$1" | $SED -e 's!^/usr/lib/oracle/\(.*\)/client\('${PHP_OCI8_IC_LIBDIR_SUFFIX}'\)*/lib[/]*$!/usr/include/oracle/\1/client\2!'`
|
||||
|
||||
dnl Check for Oracle Instant Client RPM install
|
||||
if test -f $OCISDKRPMINC/ldap.h; then
|
||||
LDAP_DIR=$1
|
||||
LDAP_INCDIR=$OCISDKRPMINC
|
||||
LDAP_LIBDIR=$1
|
||||
dnl Check for Oracle Instant Client ZIP install
|
||||
elif test -f $1/sdk/include/ldap.h; then
|
||||
LDAP_DIR=$1
|
||||
LDAP_INCDIR=$1/sdk/include
|
||||
LDAP_LIBDIR=$1
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -143,12 +165,21 @@ if test "$PHP_LDAP" != "no"; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(umich_lber, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(umich_ldap, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
|
||||
|
||||
elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME; then
|
||||
elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME.12.1; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
|
||||
AC_DEFINE(HAVE_ORALDAP,1,[ ])
|
||||
if test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
|
||||
AC_DEFINE(HAVE_ORALDAP_10,1,[ ])
|
||||
fi
|
||||
AC_DEFINE(HAVE_ORALDAP_12,1,[ ])
|
||||
|
||||
elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
|
||||
AC_DEFINE(HAVE_ORALDAP,1,[ ])
|
||||
AC_DEFINE(HAVE_ORALDAP_11,1,[ ])
|
||||
|
||||
elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
|
||||
AC_DEFINE(HAVE_ORALDAP,1,[ ])
|
||||
AC_DEFINE(HAVE_ORALDAP_10,1,[ ])
|
||||
|
||||
else
|
||||
AC_MSG_ERROR(Cannot find ldap libraries in $LDAP_LIBDIR.)
|
||||
fi
|
||||
|
||||
+21
-20
@@ -152,7 +152,7 @@ PHP_MINIT_FUNCTION(ldap)
|
||||
REGISTER_LONG_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_LONG_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS);
|
||||
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
|
||||
/* LDAP options */
|
||||
REGISTER_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_LONG_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS);
|
||||
@@ -361,7 +361,7 @@ PHP_FUNCTION(ldap_connect)
|
||||
static int _get_lderrno(LDAP *ldap)
|
||||
{
|
||||
#if !HAVE_NSLDAP
|
||||
#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP_10
|
||||
#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP
|
||||
int lderr;
|
||||
|
||||
/* New versions of OpenLDAP do it this way */
|
||||
@@ -550,7 +550,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
|
||||
{
|
||||
/* sizelimit */
|
||||
if (sizelimit > -1) {
|
||||
#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP_10
|
||||
#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP
|
||||
ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_sizelimit);
|
||||
ldap_set_option(ldap, LDAP_OPT_SIZELIMIT, &sizelimit);
|
||||
#else
|
||||
@@ -561,7 +561,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
|
||||
|
||||
/* timelimit */
|
||||
if (timelimit > -1) {
|
||||
#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP_10
|
||||
#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP
|
||||
ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_timelimit);
|
||||
ldap_set_option(ldap, LDAP_OPT_TIMELIMIT, &timelimit);
|
||||
#else
|
||||
@@ -572,7 +572,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
|
||||
|
||||
/* deref */
|
||||
if (deref > -1) {
|
||||
#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP_10
|
||||
#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP
|
||||
ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_deref);
|
||||
ldap_set_option(ldap, LDAP_OPT_DEREF, &deref);
|
||||
#else
|
||||
@@ -975,12 +975,12 @@ PHP_FUNCTION(ldap_get_entries)
|
||||
add_index_string(tmp1, num_attrib, attribute, 1);
|
||||
|
||||
num_attrib++;
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
|
||||
ldap_memfree(attribute);
|
||||
#endif
|
||||
attribute = ldap_next_attribute(ldap, ldap_result_entry, ber);
|
||||
}
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
|
||||
if (ber != NULL) {
|
||||
ber_free(ber, 0);
|
||||
}
|
||||
@@ -989,7 +989,7 @@ PHP_FUNCTION(ldap_get_entries)
|
||||
add_assoc_long(tmp1, "count", num_attrib);
|
||||
dn = ldap_get_dn(ldap, ldap_result_entry);
|
||||
add_assoc_string(tmp1, "dn", dn, 1);
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
|
||||
ldap_memfree(dn);
|
||||
#else
|
||||
free(dn);
|
||||
@@ -1027,7 +1027,7 @@ PHP_FUNCTION(ldap_first_attribute)
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
RETVAL_STRING(attribute, 1);
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
|
||||
ldap_memfree(attribute);
|
||||
#endif
|
||||
}
|
||||
@@ -1057,7 +1057,7 @@ PHP_FUNCTION(ldap_next_attribute)
|
||||
}
|
||||
|
||||
if ((attribute = ldap_next_attribute(ld->link, resultentry->data, resultentry->ber)) == NULL) {
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
|
||||
if (resultentry->ber != NULL) {
|
||||
ber_free(resultentry->ber, 0);
|
||||
resultentry->ber = NULL;
|
||||
@@ -1066,7 +1066,7 @@ PHP_FUNCTION(ldap_next_attribute)
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
RETVAL_STRING(attribute, 1);
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
|
||||
ldap_memfree(attribute);
|
||||
#endif
|
||||
}
|
||||
@@ -1113,12 +1113,12 @@ PHP_FUNCTION(ldap_get_attributes)
|
||||
add_index_string(return_value, num_attrib, attribute, 1);
|
||||
|
||||
num_attrib++;
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
|
||||
ldap_memfree(attribute);
|
||||
#endif
|
||||
attribute = ldap_next_attribute(ld->link, resultentry->data, ber);
|
||||
}
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
|
||||
if (ber != NULL) {
|
||||
ber_free(ber, 0);
|
||||
}
|
||||
@@ -1183,7 +1183,7 @@ PHP_FUNCTION(ldap_get_dn)
|
||||
text = ldap_get_dn(ld->link, resultentry->data);
|
||||
if (text != NULL) {
|
||||
RETVAL_STRING(text, 1);
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
|
||||
ldap_memfree(text);
|
||||
#else
|
||||
free(text);
|
||||
@@ -1241,7 +1241,7 @@ PHP_FUNCTION(ldap_dn2ufn)
|
||||
|
||||
if (ufn != NULL) {
|
||||
RETVAL_STRING(ufn, 1);
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
|
||||
ldap_memfree(ufn);
|
||||
#endif
|
||||
} else {
|
||||
@@ -1546,7 +1546,7 @@ PHP_FUNCTION(ldap_sort)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
|
||||
/* {{{ proto bool ldap_get_option(resource link, int option, mixed retval)
|
||||
Get the current value of various session-wide parameters */
|
||||
PHP_FUNCTION(ldap_get_option)
|
||||
@@ -2003,7 +2003,7 @@ PHP_FUNCTION(ldap_rename)
|
||||
newparent = NULL;
|
||||
}
|
||||
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
|
||||
rc = ldap_rename_s(ld->link, dn, newrdn, newparent, deleteoldrdn, NULL, NULL);
|
||||
#else
|
||||
if (newparent_len != 0) {
|
||||
@@ -2047,7 +2047,7 @@ PHP_FUNCTION(ldap_start_tls)
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
#endif /* (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 */
|
||||
#endif /* (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP */
|
||||
|
||||
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
|
||||
/* {{{ _ldap_rebind_proc()
|
||||
@@ -2107,6 +2107,7 @@ PHP_FUNCTION(ldap_set_rebind_proc)
|
||||
/* unregister rebind procedure */
|
||||
if (ld->rebindproc != NULL) {
|
||||
zval_dtor(ld->rebindproc);
|
||||
FREE_ZVAL(ld->rebindproc);
|
||||
ld->rebindproc = NULL;
|
||||
ldap_set_rebind_proc(ld->link, NULL, NULL);
|
||||
}
|
||||
@@ -2566,7 +2567,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_control_paged_result_response, 0, 0, 2)
|
||||
ZEND_END_ARG_INFO();
|
||||
#endif
|
||||
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename, 0, 0, 5)
|
||||
ZEND_ARG_INFO(0, link_identifier)
|
||||
ZEND_ARG_INFO(0, dn)
|
||||
@@ -2682,7 +2683,7 @@ const zend_function_entry ldap_functions[] = {
|
||||
PHP_FE(ldap_compare, arginfo_ldap_compare)
|
||||
PHP_FE(ldap_sort, arginfo_ldap_sort)
|
||||
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
|
||||
PHP_FE(ldap_rename, arginfo_ldap_rename)
|
||||
PHP_FE(ldap_get_option, arginfo_ldap_get_option)
|
||||
PHP_FE(ldap_set_option, arginfo_ldap_set_option)
|
||||
|
||||
@@ -217,14 +217,26 @@ array(2) {
|
||||
[1]=>
|
||||
resource(%d) of type (ldap result)
|
||||
}
|
||||
NULL
|
||||
NULL
|
||||
array(1) {
|
||||
["count"]=>
|
||||
int(0)
|
||||
}
|
||||
array(1) {
|
||||
["count"]=>
|
||||
int(0)
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
resource(%d) of type (ldap result)
|
||||
[1]=>
|
||||
resource(%d) of type (ldap result)
|
||||
}
|
||||
NULL
|
||||
NULL
|
||||
array(1) {
|
||||
["count"]=>
|
||||
int(0)
|
||||
}
|
||||
array(1) {
|
||||
["count"]=>
|
||||
int(0)
|
||||
}
|
||||
===DONE===
|
||||
@@ -37,7 +37,6 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC) = get_binary_op(opline->opcode);
|
||||
zend_uint tv = ZEND_RESULT(opline).var; /* temporary variable */
|
||||
zval result;
|
||||
zend_op *tmp_opline;
|
||||
int er;
|
||||
|
||||
if (opline->opcode == ZEND_DIV &&
|
||||
@@ -61,95 +60,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
literal_dtor(&ZEND_OP2_LITERAL(opline));
|
||||
MAKE_NOP(opline);
|
||||
|
||||
/* substitute the following TMP_VAR usage with constant */
|
||||
for (tmp_opline = opline + 1; tmp_opline < end; tmp_opline++) {
|
||||
if (ZEND_OP1_TYPE(tmp_opline) == IS_TMP_VAR &&
|
||||
ZEND_OP1(tmp_opline).var == tv) {
|
||||
if (tmp_opline->opcode == ZEND_FREE) {
|
||||
MAKE_NOP(tmp_opline);
|
||||
zval_dtor(&result);
|
||||
} else {
|
||||
ZEND_OP1_TYPE(tmp_opline) = IS_CONST;
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
tmp_opline->op1.constant = zend_optimizer_add_literal(op_array, &result TSRMLS_CC);
|
||||
if (Z_TYPE(result) == IS_STRING) {
|
||||
Z_HASH_P(&ZEND_OP1_LITERAL(tmp_opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(tmp_opline)), Z_STRLEN(ZEND_OP1_LITERAL(tmp_opline)) + 1);
|
||||
if (tmp_opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
|
||||
tmp_opline->opcode == ZEND_DO_FCALL ||
|
||||
tmp_opline->opcode == ZEND_CATCH ||
|
||||
tmp_opline->opcode == ZEND_FETCH_CONSTANT) {
|
||||
op_array->literals[tmp_opline->op1.constant].cache_slot = op_array->last_cache_slot++;
|
||||
}
|
||||
}
|
||||
#else
|
||||
ZEND_OP1_LITERAL(tmp_opline) = result;
|
||||
#endif
|
||||
}
|
||||
/* TMP_VAR my be used only once */
|
||||
break;
|
||||
}
|
||||
if (ZEND_OP2_TYPE(tmp_opline) == IS_TMP_VAR &&
|
||||
ZEND_OP2(tmp_opline).var == tv) {
|
||||
ZEND_OP2_TYPE(tmp_opline) = IS_CONST;
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
tmp_opline->op2.constant = zend_optimizer_add_literal(op_array, &result TSRMLS_CC);
|
||||
if (Z_TYPE(result) == IS_STRING) {
|
||||
Z_HASH_P(&ZEND_OP2_LITERAL(tmp_opline)) = zend_hash_func(Z_STRVAL(ZEND_OP2_LITERAL(tmp_opline)), Z_STRLEN(ZEND_OP2_LITERAL(tmp_opline)) + 1);
|
||||
if (tmp_opline->opcode == ZEND_FETCH_R ||
|
||||
tmp_opline->opcode == ZEND_FETCH_W ||
|
||||
tmp_opline->opcode == ZEND_FETCH_RW ||
|
||||
tmp_opline->opcode == ZEND_FETCH_IS ||
|
||||
tmp_opline->opcode == ZEND_FETCH_UNSET ||
|
||||
tmp_opline->opcode == ZEND_FETCH_FUNC_ARG ||
|
||||
tmp_opline->opcode == ZEND_FETCH_CLASS ||
|
||||
tmp_opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
|
||||
tmp_opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
|
||||
tmp_opline->opcode == ZEND_UNSET_VAR ||
|
||||
tmp_opline->opcode == ZEND_ISSET_ISEMPTY_VAR ||
|
||||
tmp_opline->opcode == ZEND_ADD_INTERFACE ||
|
||||
tmp_opline->opcode == ZEND_ADD_TRAIT) {
|
||||
op_array->literals[tmp_opline->op2.constant].cache_slot = op_array->last_cache_slot++;
|
||||
} else if (tmp_opline->opcode == ZEND_INIT_METHOD_CALL ||
|
||||
tmp_opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
|
||||
tmp_opline->opcode == ZEND_FETCH_CONSTANT ||
|
||||
tmp_opline->opcode == ZEND_ASSIGN_OBJ ||
|
||||
tmp_opline->opcode == ZEND_FETCH_OBJ_R ||
|
||||
tmp_opline->opcode == ZEND_FETCH_OBJ_W ||
|
||||
tmp_opline->opcode == ZEND_FETCH_OBJ_RW ||
|
||||
tmp_opline->opcode == ZEND_FETCH_OBJ_IS ||
|
||||
tmp_opline->opcode == ZEND_FETCH_OBJ_UNSET ||
|
||||
tmp_opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG ||
|
||||
tmp_opline->opcode == ZEND_UNSET_OBJ ||
|
||||
tmp_opline->opcode == ZEND_PRE_INC_OBJ ||
|
||||
tmp_opline->opcode == ZEND_PRE_DEC_OBJ ||
|
||||
tmp_opline->opcode == ZEND_POST_INC_OBJ ||
|
||||
tmp_opline->opcode == ZEND_POST_DEC_OBJ ||
|
||||
tmp_opline->opcode == ZEND_ISSET_ISEMPTY_PROP_OBJ) {
|
||||
op_array->literals[tmp_opline->op2.constant].cache_slot = op_array->last_cache_slot;
|
||||
op_array->last_cache_slot += 2;
|
||||
} else if (tmp_opline->opcode == ZEND_ASSIGN_ADD ||
|
||||
tmp_opline->opcode == ZEND_ASSIGN_SUB ||
|
||||
tmp_opline->opcode == ZEND_ASSIGN_MUL ||
|
||||
tmp_opline->opcode == ZEND_ASSIGN_DIV ||
|
||||
tmp_opline->opcode == ZEND_ASSIGN_MOD ||
|
||||
tmp_opline->opcode == ZEND_ASSIGN_SL ||
|
||||
tmp_opline->opcode == ZEND_ASSIGN_SR ||
|
||||
tmp_opline->opcode == ZEND_ASSIGN_CONCAT ||
|
||||
tmp_opline->opcode == ZEND_ASSIGN_BW_OR ||
|
||||
tmp_opline->opcode == ZEND_ASSIGN_BW_AND ||
|
||||
tmp_opline->opcode == ZEND_ASSIGN_BW_XOR) {
|
||||
if (tmp_opline->extended_value == ZEND_ASSIGN_OBJ) {
|
||||
op_array->literals[tmp_opline->op2.constant].cache_slot = op_array->last_cache_slot;
|
||||
op_array->last_cache_slot += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
ZEND_OP2_LITERAL(tmp_opline) = result;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
replace_tmp_by_const(op_array, opline + 1, tv, &result TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -159,6 +70,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
opline->extended_value != IS_OBJECT &&
|
||||
opline->extended_value != IS_RESOURCE) {
|
||||
/* cast of constant operand */
|
||||
zend_uint tv = ZEND_RESULT(opline).var; /* temporary variable */
|
||||
zval res;
|
||||
res = ZEND_OP1_LITERAL(opline);
|
||||
zval_copy_ctor(&res);
|
||||
@@ -179,11 +91,11 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
convert_to_string(&res);
|
||||
break;
|
||||
}
|
||||
|
||||
literal_dtor(&ZEND_OP1_LITERAL(opline));
|
||||
opline->opcode = ZEND_QM_ASSIGN;
|
||||
opline->extended_value = 0;
|
||||
ZEND_OP1_LITERAL(opline) = res;
|
||||
SET_UNUSED(opline->op2);
|
||||
MAKE_NOP(opline);
|
||||
|
||||
replace_tmp_by_const(op_array, opline + 1, tv, &res TSRMLS_CC);
|
||||
} else if (opline->extended_value == IS_BOOL) {
|
||||
/* T = CAST(X, IS_BOOL) => T = BOOL(X) */
|
||||
opline->opcode = ZEND_BOOL;
|
||||
@@ -197,7 +109,6 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
/* unary operation on constant operand */
|
||||
unary_op_type unary_op = get_unary_op(opline->opcode);
|
||||
zval result;
|
||||
zend_op *tmp_opline;
|
||||
zend_uint tv = ZEND_RESULT(opline).var; /* temporary variable */
|
||||
int er;
|
||||
|
||||
@@ -218,34 +129,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
literal_dtor(&ZEND_OP1_LITERAL(opline));
|
||||
MAKE_NOP(opline);
|
||||
|
||||
/* substitute the following TMP_VAR usage with constant */
|
||||
for (tmp_opline = opline + 1; tmp_opline < end; tmp_opline++) {
|
||||
if (ZEND_OP1_TYPE(tmp_opline) == IS_TMP_VAR &&
|
||||
ZEND_OP1(tmp_opline).var == tv) {
|
||||
if (tmp_opline->opcode == ZEND_FREE) {
|
||||
MAKE_NOP(tmp_opline);
|
||||
zval_dtor(&result);
|
||||
} else {
|
||||
ZEND_OP1_TYPE(tmp_opline) = IS_CONST;
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
tmp_opline->op1.constant = zend_optimizer_add_literal(op_array, &result TSRMLS_CC);
|
||||
#else
|
||||
ZEND_OP1_LITERAL(tmp_opline) = result;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (ZEND_OP2_TYPE(tmp_opline) == IS_TMP_VAR &&
|
||||
ZEND_OP2(tmp_opline).var == tv) {
|
||||
ZEND_OP2_TYPE(tmp_opline) = IS_CONST;
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
tmp_opline->op2.constant = zend_optimizer_add_literal(op_array, &result TSRMLS_CC);
|
||||
#else
|
||||
ZEND_OP2_LITERAL(tmp_opline) = result;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
replace_tmp_by_const(op_array, opline + 1, tv, &result TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -110,6 +110,137 @@ int zend_optimizer_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC
|
||||
|
||||
#endif
|
||||
|
||||
static void replace_tmp_by_const(zend_op_array *op_array,
|
||||
zend_op *opline,
|
||||
zend_uint var,
|
||||
zval *val
|
||||
TSRMLS_DC)
|
||||
{
|
||||
zend_op *end = op_array->opcodes + op_array->last;
|
||||
|
||||
while (opline < end) {
|
||||
if (ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
|
||||
ZEND_OP1(opline).var == var) {
|
||||
|
||||
if (opline->opcode == ZEND_FREE) {
|
||||
MAKE_NOP(opline);
|
||||
zval_dtor(val);
|
||||
} else {
|
||||
ZEND_OP1_TYPE(opline) = IS_CONST;
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
if (Z_TYPE_P(val) == IS_STRING) {
|
||||
switch (opline->opcode) {
|
||||
case ZEND_INIT_STATIC_METHOD_CALL:
|
||||
case ZEND_CATCH:
|
||||
case ZEND_FETCH_CONSTANT:
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1);
|
||||
op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++;
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op1.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op1.constant+1].constant), Z_STRLEN(op_array->literals[opline->op1.constant+1].constant) + 1);
|
||||
break;
|
||||
case ZEND_DO_FCALL:
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1);
|
||||
op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++;
|
||||
break;
|
||||
default:
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
}
|
||||
#else
|
||||
ZEND_OP1_LITERAL(opline) = *val;
|
||||
#endif
|
||||
}
|
||||
/* TMP_VAR my be used only once */
|
||||
break;
|
||||
}
|
||||
|
||||
if (ZEND_OP2_TYPE(opline) == IS_TMP_VAR &&
|
||||
ZEND_OP2(opline).var == var) {
|
||||
|
||||
ZEND_OP2_TYPE(opline) = IS_CONST;
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
if (Z_TYPE_P(val) == IS_STRING) {
|
||||
Z_HASH_P(&ZEND_OP2_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)) + 1);
|
||||
switch (opline->opcode) {
|
||||
case ZEND_FETCH_R:
|
||||
case ZEND_FETCH_W:
|
||||
case ZEND_FETCH_RW:
|
||||
case ZEND_FETCH_IS:
|
||||
case ZEND_FETCH_UNSET:
|
||||
case ZEND_FETCH_FUNC_ARG:
|
||||
case ZEND_FETCH_CLASS:
|
||||
case ZEND_INIT_FCALL_BY_NAME:
|
||||
/*case ZEND_INIT_NS_FCALL_BY_NAME:*/
|
||||
case ZEND_UNSET_VAR:
|
||||
case ZEND_ISSET_ISEMPTY_VAR:
|
||||
case ZEND_ADD_INTERFACE:
|
||||
case ZEND_ADD_TRAIT:
|
||||
op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot++;
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1);
|
||||
break;
|
||||
case ZEND_INIT_METHOD_CALL:
|
||||
case ZEND_INIT_STATIC_METHOD_CALL:
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1);
|
||||
/* break missing intentionally */
|
||||
/*case ZEND_FETCH_CONSTANT:*/
|
||||
case ZEND_ASSIGN_OBJ:
|
||||
case ZEND_FETCH_OBJ_R:
|
||||
case ZEND_FETCH_OBJ_W:
|
||||
case ZEND_FETCH_OBJ_RW:
|
||||
case ZEND_FETCH_OBJ_IS:
|
||||
case ZEND_FETCH_OBJ_UNSET:
|
||||
case ZEND_FETCH_OBJ_FUNC_ARG:
|
||||
case ZEND_UNSET_OBJ:
|
||||
case ZEND_PRE_INC_OBJ:
|
||||
case ZEND_PRE_DEC_OBJ:
|
||||
case ZEND_POST_INC_OBJ:
|
||||
case ZEND_POST_DEC_OBJ:
|
||||
case ZEND_ISSET_ISEMPTY_PROP_OBJ:
|
||||
op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot;
|
||||
op_array->last_cache_slot += 2;
|
||||
break;
|
||||
case ZEND_ASSIGN_ADD:
|
||||
case ZEND_ASSIGN_SUB:
|
||||
case ZEND_ASSIGN_MUL:
|
||||
case ZEND_ASSIGN_DIV:
|
||||
case ZEND_ASSIGN_MOD:
|
||||
case ZEND_ASSIGN_SL:
|
||||
case ZEND_ASSIGN_SR:
|
||||
case ZEND_ASSIGN_CONCAT:
|
||||
case ZEND_ASSIGN_BW_OR:
|
||||
case ZEND_ASSIGN_BW_AND:
|
||||
case ZEND_ASSIGN_BW_XOR:
|
||||
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
|
||||
op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot;
|
||||
op_array->last_cache_slot += 2;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
ZEND_OP2_LITERAL(opline) = *val;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
opline++;
|
||||
}
|
||||
}
|
||||
|
||||
#include "Optimizer/nop_removal.c"
|
||||
#include "Optimizer/block_pass.c"
|
||||
#include "Optimizer/optimize_temp_vars_5.c"
|
||||
|
||||
@@ -1446,7 +1446,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han
|
||||
}
|
||||
|
||||
/* zend_compile() replacement */
|
||||
static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
|
||||
zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
|
||||
{
|
||||
zend_persistent_script *persistent_script = NULL;
|
||||
char *key = NULL;
|
||||
@@ -2407,14 +2407,14 @@ static inline int accel_find_sapi(TSRMLS_D)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
static void zend_accel_init_shm(TSRMLS_D)
|
||||
static int zend_accel_init_shm(TSRMLS_D)
|
||||
{
|
||||
zend_shared_alloc_lock(TSRMLS_C);
|
||||
|
||||
accel_shared_globals = zend_shared_alloc(sizeof(zend_accel_shared_globals));
|
||||
if (!accel_shared_globals) {
|
||||
zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
|
||||
return;
|
||||
return FAILURE;
|
||||
}
|
||||
ZSMMG(app_shared_globals) = accel_shared_globals;
|
||||
|
||||
@@ -2429,7 +2429,8 @@ static void zend_accel_init_shm(TSRMLS_D)
|
||||
ZCSG(interned_strings).arBuckets = zend_shared_alloc(ZCSG(interned_strings).nTableSize * sizeof(Bucket *));
|
||||
ZCSG(interned_strings_start) = zend_shared_alloc((ZCG(accel_directives).interned_strings_buffer * 1024 * 1024));
|
||||
if (!ZCSG(interned_strings).arBuckets || !ZCSG(interned_strings_start)) {
|
||||
zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " cannot allocate buffer for interned strings");
|
||||
zend_accel_error(ACCEL_LOG_FATAL, ACCELERATOR_PRODUCT_NAME " cannot allocate buffer for interned strings");
|
||||
return FAILURE;
|
||||
}
|
||||
ZCSG(interned_strings_end) = ZCSG(interned_strings_start) + (ZCG(accel_directives).interned_strings_buffer * 1024 * 1024);
|
||||
ZCSG(interned_strings_top) = ZCSG(interned_strings_start);
|
||||
@@ -2468,6 +2469,8 @@ static void zend_accel_init_shm(TSRMLS_D)
|
||||
ZCSG(restart_in_progress) = 0;
|
||||
|
||||
zend_shared_alloc_unlock(TSRMLS_C);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static void accel_globals_ctor(zend_accel_globals *accel_globals TSRMLS_DC)
|
||||
@@ -2525,7 +2528,10 @@ static int accel_startup(zend_extension *extension)
|
||||
/********************************************/
|
||||
switch (zend_shared_alloc_startup(ZCG(accel_directives).memory_consumption)) {
|
||||
case ALLOC_SUCCESS:
|
||||
zend_accel_init_shm(TSRMLS_C);
|
||||
if (zend_accel_init_shm(TSRMLS_C) == FAILURE) {
|
||||
accel_startup_ok = 0;
|
||||
return FAILURE;
|
||||
}
|
||||
break;
|
||||
case ALLOC_FAILURE:
|
||||
accel_startup_ok = 0;
|
||||
|
||||
@@ -80,6 +80,9 @@
|
||||
# endif
|
||||
# include <direct.h>
|
||||
#else
|
||||
# ifndef MAXPATHLEN
|
||||
# define MAXPATHLEN 4096
|
||||
# endif
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
@@ -100,7 +103,7 @@ extern int lock_file;
|
||||
# elif defined(__svr4__)
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {type, whence, start, len}
|
||||
# elif defined(__linux__) || defined(__hpux)
|
||||
# elif defined(__linux__) || defined(__hpux) || defined(__GNU__)
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {type, whence, start, len, 0}
|
||||
# elif defined(_AIX)
|
||||
@@ -111,6 +114,12 @@ extern int lock_file;
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {type, whence, start, len}
|
||||
# endif
|
||||
# elif defined(HAVE_FLOCK_BSD)
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {start, len, -1, type, whence}
|
||||
# elif defined(HAVE_FLOCK_LINUX)
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {type, whence, start, len}
|
||||
# else
|
||||
# error "Don't know how to define struct flock"
|
||||
# endif
|
||||
@@ -325,6 +334,7 @@ int accelerator_shm_read_lock(TSRMLS_D);
|
||||
void accelerator_shm_read_unlock(TSRMLS_D);
|
||||
|
||||
char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_length, int *key_len TSRMLS_DC);
|
||||
zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC);
|
||||
|
||||
#if !defined(ZEND_DECLARE_INHERITED_CLASS_DELAYED)
|
||||
# define ZEND_DECLARE_INHERITED_CLASS_DELAYED 145
|
||||
|
||||
+34
-32
@@ -326,40 +326,42 @@ int main() {
|
||||
msg=yes,msg=no,msg=no)
|
||||
AC_MSG_RESULT([$msg])
|
||||
|
||||
AC_MSG_CHECKING(for known struct flock definition)
|
||||
dnl Copied from ZendAccelerator.h
|
||||
AC_TRY_RUN([
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
flock_type=unknown
|
||||
AC_MSG_CHECKING("whether flock struct is linux ordered")
|
||||
AC_TRY_RUN([
|
||||
#include <fcntl.h>
|
||||
struct flock lock = { 1, 2, 3, 4, 5 };
|
||||
int main() {
|
||||
if(lock.l_type == 1 && lock.l_whence == 2 && lock.l_start == 3 && lock.l_len == 4) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
], [
|
||||
flock_type=linux
|
||||
AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type])
|
||||
AC_MSG_RESULT("yes")
|
||||
], AC_MSG_RESULT("no") )
|
||||
|
||||
#ifndef ZEND_WIN32
|
||||
extern int lock_file;
|
||||
AC_MSG_CHECKING("whether flock struct is BSD ordered")
|
||||
AC_TRY_RUN([
|
||||
#include <fcntl.h>
|
||||
struct flock lock = { 1, 2, 3, 4, 5 };
|
||||
int main() {
|
||||
if(lock.l_start == 1 && lock.l_len == 2 && lock.l_type == 4 && lock.l_whence == 5) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
], [
|
||||
flock_type=bsd
|
||||
AC_DEFINE([HAVE_FLOCK_BSD], [], [Struct flock is BSD-type])
|
||||
AC_MSG_RESULT("yes")
|
||||
], AC_MSG_RESULT("no") )
|
||||
|
||||
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (defined(__APPLE__) && defined(__MACH__)/* Darwin */) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {start, len, -1, type, whence}
|
||||
# elif defined(__svr4__)
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {type, whence, start, len}
|
||||
# elif defined(__linux__) || defined(__hpux)
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {type, whence, start, len, 0}
|
||||
# elif defined(_AIX)
|
||||
# if defined(_LARGE_FILES) || defined(__64BIT__)
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {type, whence, 0, 0, 0, start, len }
|
||||
# else
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {type, whence, start, len}
|
||||
# endif
|
||||
# else
|
||||
# error "Don't know how to define struct flock"
|
||||
# endif
|
||||
#endif
|
||||
int main() { return 0; }
|
||||
],
|
||||
[AC_MSG_RESULT([done])],
|
||||
[AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no])], [])
|
||||
if test "$flock_type" == "unknown"; then
|
||||
AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no])
|
||||
fi
|
||||
|
||||
PHP_NEW_EXTENSION(opcache,
|
||||
ZendAccelerator.c \
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #65845 (Error when Zend Opcache Optimizer is fully enabled)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$Pile['vars'][(string)'toto'] = 'tutu';
|
||||
var_dump($Pile['vars']['toto']);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(4) "tutu"
|
||||
@@ -314,6 +314,7 @@ void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename)
|
||||
blacklist->entries[blacklist->pos].path = (char *)malloc(path_length + 1);
|
||||
if (!blacklist->entries[blacklist->pos].path) {
|
||||
zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed\n");
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
blacklist->entries[blacklist->pos].id = blacklist->pos;
|
||||
|
||||
@@ -48,6 +48,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_get_status, 0, 0, 0)
|
||||
ZEND_ARG_INFO(0, fetch_scripts)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_compile_file, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, file)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_invalidate, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, script)
|
||||
ZEND_ARG_INFO(0, force)
|
||||
@@ -59,12 +63,14 @@ static ZEND_FUNCTION(opcache_invalidate);
|
||||
|
||||
/* Private functions */
|
||||
static ZEND_FUNCTION(opcache_get_status);
|
||||
static ZEND_FUNCTION(opcache_compile_file);
|
||||
static ZEND_FUNCTION(opcache_get_configuration);
|
||||
|
||||
static zend_function_entry accel_functions[] = {
|
||||
/* User functions */
|
||||
ZEND_FE(opcache_reset, arginfo_opcache_none)
|
||||
ZEND_FE(opcache_invalidate, arginfo_opcache_invalidate)
|
||||
ZEND_FE(opcache_compile_file, arginfo_opcache_compile_file)
|
||||
/* Private functions */
|
||||
ZEND_FE(opcache_get_configuration, arginfo_opcache_none)
|
||||
ZEND_FE(opcache_get_status, arginfo_opcache_get_status)
|
||||
@@ -709,3 +715,44 @@ static ZEND_FUNCTION(opcache_invalidate)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static ZEND_FUNCTION(opcache_compile_file)
|
||||
{
|
||||
char *script_name;
|
||||
int script_name_len;
|
||||
zend_file_handle handle;
|
||||
zend_op_array *op_array = NULL;
|
||||
zend_execute_data *orig_execute_data = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &script_name, &script_name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled)) {
|
||||
zend_error(E_NOTICE, ACCELERATOR_PRODUCT_NAME " seems to be disabled, can't compile file");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
handle.filename = script_name;
|
||||
handle.free_filename = 0;
|
||||
handle.opened_path = NULL;
|
||||
handle.type = ZEND_HANDLE_FILENAME;
|
||||
|
||||
orig_execute_data = EG(current_execute_data);
|
||||
|
||||
zend_try {
|
||||
op_array = persistent_compile_file(&handle, ZEND_INCLUDE TSRMLS_CC);
|
||||
} zend_catch {
|
||||
EG(current_execute_data) = orig_execute_data;
|
||||
zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " could not compile file %s" TSRMLS_CC, handle.filename);
|
||||
} zend_end_try();
|
||||
|
||||
if(op_array != NULL) {
|
||||
destroy_op_array(op_array TSRMLS_CC);
|
||||
efree(op_array);
|
||||
RETVAL_TRUE;
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
zend_destroy_file_handle(&handle TSRMLS_CC);
|
||||
}
|
||||
@@ -478,7 +478,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class
|
||||
if (accel_xlat_get(new_entry->scope, new_ce) == SUCCESS) {
|
||||
new_entry->scope = *new_ce;
|
||||
} else {
|
||||
zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s, function %s. Please call Zend Support", ce->name, new_entry->function_name);
|
||||
zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s, function %s", ce->name, new_entry->function_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,7 +487,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class
|
||||
if (accel_xlat_get(new_entry->prototype, new_prototype) == SUCCESS) {
|
||||
new_entry->prototype = *new_prototype;
|
||||
} else {
|
||||
zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s, function %s. Please call Zend Support", ce->name, new_entry->function_name);
|
||||
zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s, function %s", ce->name, new_entry->function_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla
|
||||
} else if (accel_xlat_get(prop_info->ce, new_ce) == SUCCESS) {
|
||||
prop_info->ce = *new_ce;
|
||||
} else {
|
||||
zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME" class loading error, class %s, property %s. Please call Zend Support", ce->name, prop_info->name);
|
||||
zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME" class loading error, class %s, property %s", ce->name, prop_info->name);
|
||||
}
|
||||
|
||||
p = p->pListNext;
|
||||
@@ -621,7 +621,7 @@ static int zend_prepare_function_for_execution(zend_op_array *op_array)
|
||||
if (accel_xlat_get(ce->handler, new_func) == SUCCESS) { \
|
||||
ce->handler = *new_func; \
|
||||
} else { \
|
||||
zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s. Please call Zend Support", ce->name); \
|
||||
zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s", ce->name); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
@@ -710,7 +710,7 @@ static void zend_class_copy_ctor(zend_class_entry **pce)
|
||||
if (accel_xlat_get(ce->parent, new_ce) == SUCCESS) {
|
||||
ce->parent = *new_ce;
|
||||
} else {
|
||||
zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME" class loading error, class %s. Please call Zend Support", ce->name);
|
||||
zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME" class loading error, class %s", ce->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-12
@@ -4676,9 +4676,6 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{
|
||||
|
||||
GET_VER_OPT_STRING("local_cert", certfile);
|
||||
if (certfile) {
|
||||
X509 *cert = NULL;
|
||||
EVP_PKEY *key = NULL;
|
||||
SSL *tmpssl;
|
||||
char resolved_path_buff[MAXPATHLEN];
|
||||
const char * private_key = NULL;
|
||||
|
||||
@@ -4705,16 +4702,22 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{
|
||||
}
|
||||
}
|
||||
|
||||
tmpssl = SSL_new(ctx);
|
||||
cert = SSL_get_certificate(tmpssl);
|
||||
|
||||
if (cert) {
|
||||
key = X509_get_pubkey(cert);
|
||||
EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl));
|
||||
EVP_PKEY_free(key);
|
||||
}
|
||||
SSL_free(tmpssl);
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10001001L
|
||||
do {
|
||||
/* Unnecessary as of OpenSSLv1.0.1 (will segfault if used with >= 10001001 ) */
|
||||
X509 *cert = NULL;
|
||||
EVP_PKEY *key = NULL;
|
||||
SSL *tmpssl = SSL_new(ctx);
|
||||
cert = SSL_get_certificate(tmpssl);
|
||||
|
||||
if (cert) {
|
||||
key = X509_get_pubkey(cert);
|
||||
EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl));
|
||||
EVP_PKEY_free(key);
|
||||
}
|
||||
SSL_free(tmpssl);
|
||||
} while (0);
|
||||
#endif
|
||||
if (!SSL_CTX_check_private_key(ctx)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Private key does not match certificate!");
|
||||
}
|
||||
|
||||
@@ -350,9 +350,10 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
|
||||
DBSETLAPP(H->login, vars[1].optval);
|
||||
|
||||
/* DBSETLDBNAME is only available in FreeTDS 0.92 or above */
|
||||
#ifdef DBSETLDBNAME
|
||||
if (vars[3].optval) {
|
||||
DBSETLDBNAME(H->login, vars[3].optval);
|
||||
if(FAIL == DBSETLDBNAME(H->login, vars[3].optval)) goto cleanup;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -362,8 +363,20 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* FreeTDS < 0.92 does not support the DBSETLDBNAME option
|
||||
* Send use database here after login (Will not work with SQL Azure)
|
||||
*/
|
||||
#ifndef DBSETLDBNAME
|
||||
if (vars[3].optval) {
|
||||
if(FAIL == dbuse(H->link, vars[3].optval)) goto cleanup;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PHP_DBLIB_IS_MSSQL
|
||||
/* dblib do not return more than this length from text/image */
|
||||
DBSETOPT(H->link, DBTEXTLIMIT, "2147483647");
|
||||
#endif
|
||||
|
||||
/* limit text/image from network */
|
||||
DBSETOPT(H->link, DBTEXTSIZE, "2147483647");
|
||||
@@ -375,23 +388,6 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
dbh->max_escaped_char_length = 2;
|
||||
dbh->alloc_own_columns = 1;
|
||||
|
||||
#if 0
|
||||
/* Cache the supported data types from the servers systypes table */
|
||||
if(dbcmd(H->link, "select usertype, name from systypes order by usertype") != FAIL) {
|
||||
if(dbsqlexec(H->link) != FAIL) {
|
||||
dbresults(H->link);
|
||||
while (dbnextrow(H->link) == SUCCESS) {
|
||||
val = dbdata(H->link, 1);
|
||||
add_index_string(pdo_dblib_datatypes, *val, dbdata(H->link, 2), 1);
|
||||
}
|
||||
}
|
||||
/* Throw out any remaining resultsets */
|
||||
dbcancel(H-link);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
cleanup:
|
||||
for (i = 0; i < nvars; i++) {
|
||||
if (vars[i].freeme) {
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
extern zend_module_entry extname_module_entry;
|
||||
#define phpext_extname_ptr &extname_module_entry
|
||||
|
||||
#define PHP_EXTNAME_VERSION "0.1.0" /* Replace with version number for your extension */
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
# define PHP_EXTNAME_API __declspec(dllexport)
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
|
||||
@@ -41,7 +41,7 @@ zend_module_entry extname_module_entry = {
|
||||
PHP_RSHUTDOWN(extname), /* Replace with NULL if there's nothing to do at request end */
|
||||
PHP_MINFO(extname),
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
"0.1", /* Replace with version number for your extension */
|
||||
PHP_EXTNAME_VERSION,
|
||||
#endif
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
+25
-17
@@ -63,6 +63,28 @@ static const char *_php_source_op_to_string(enum source_op sop);
|
||||
static int _php_source_op_to_ipv4_op(enum source_op sop);
|
||||
#endif
|
||||
|
||||
int php_string_to_if_index(const char *val, unsigned *out TSRMLS_DC)
|
||||
{
|
||||
#if HAVE_IF_NAMETOINDEX
|
||||
unsigned int ind;
|
||||
|
||||
ind = if_nametoindex(val);
|
||||
if (ind == 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
"no interface with name \"%s\" could be found", val);
|
||||
return FAILURE;
|
||||
} else {
|
||||
*out = ind;
|
||||
return SUCCESS;
|
||||
}
|
||||
#else
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
"this platform does not support looking up an interface by "
|
||||
"name, an integer interface index must be supplied instead");
|
||||
return FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int php_get_if_index_from_zval(zval *val, unsigned *out TSRMLS_DC)
|
||||
{
|
||||
int ret;
|
||||
@@ -78,31 +100,17 @@ static int php_get_if_index_from_zval(zval *val, unsigned *out TSRMLS_DC)
|
||||
ret = SUCCESS;
|
||||
}
|
||||
} else {
|
||||
#if HAVE_IF_NAMETOINDEX
|
||||
unsigned int ind;
|
||||
zval_add_ref(&val);
|
||||
convert_to_string_ex(&val);
|
||||
ind = if_nametoindex(Z_STRVAL_P(val));
|
||||
if (ind == 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
"no interface with name \"%s\" could be found", Z_STRVAL_P(val));
|
||||
ret = FAILURE;
|
||||
} else {
|
||||
*out = ind;
|
||||
ret = SUCCESS;
|
||||
}
|
||||
ret = php_string_to_if_index(Z_STRVAL_P(val), out TSRMLS_CC);
|
||||
zval_ptr_dtor(&val);
|
||||
#else
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
"this platform does not support looking up an interface by "
|
||||
"name, an integer interface index must be supplied instead");
|
||||
ret = FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int php_get_if_index_from_array(const HashTable *ht, const char *key,
|
||||
php_socket *sock, unsigned int *if_index TSRMLS_DC)
|
||||
{
|
||||
|
||||
@@ -65,6 +65,8 @@ int php_add4_to_if_index(
|
||||
php_socket *php_sock,
|
||||
unsigned *if_index TSRMLS_DC);
|
||||
|
||||
int php_string_to_if_index(const char *val, unsigned *out TSRMLS_DC);
|
||||
|
||||
int php_mcast_join(
|
||||
php_socket *sock,
|
||||
int level,
|
||||
|
||||
@@ -18,6 +18,7 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_
|
||||
struct addrinfo hints;
|
||||
struct addrinfo *addrinfo = NULL;
|
||||
#endif
|
||||
char *scope = strchr(string, '%');
|
||||
|
||||
if (inet_pton(AF_INET6, string, &tmp)) {
|
||||
memcpy(&(sin6->sin6_addr.s6_addr), &(tmp.s6_addr), sizeof(struct in6_addr));
|
||||
@@ -53,6 +54,22 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_
|
||||
|
||||
}
|
||||
|
||||
if (scope++) {
|
||||
long lval = 0;
|
||||
double dval = 0;
|
||||
unsigned scope_id = 0;
|
||||
|
||||
if (IS_LONG == is_numeric_string(scope, strlen(scope), &lval, &dval, 0)) {
|
||||
if (lval > 0 && lval <= UINT_MAX) {
|
||||
scope_id = lval;
|
||||
}
|
||||
} else {
|
||||
php_string_to_if_index(scope, &scope_id TSRMLS_CC);
|
||||
}
|
||||
|
||||
sin6->sin6_scope_id = scope_id;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -84,6 +84,30 @@
|
||||
#define HTTP_WRAPPER_HEADER_INIT 1
|
||||
#define HTTP_WRAPPER_REDIRECTED 2
|
||||
|
||||
static inline void strip_header(char *header_bag, char *lc_header_bag,
|
||||
const char *lc_header_name)
|
||||
{
|
||||
char *lc_header_start = strstr(lc_header_bag, lc_header_name);
|
||||
char *header_start = header_bag + (lc_header_start - lc_header_bag);
|
||||
|
||||
if (lc_header_start
|
||||
&& (lc_header_start == lc_header_bag || *(lc_header_start-1) == '\n')
|
||||
) {
|
||||
char *lc_eol = strchr(lc_header_start, '\n');
|
||||
char *eol = header_start + (lc_eol - lc_header_start);
|
||||
|
||||
if (lc_eol) {
|
||||
size_t eollen = strlen(lc_eol);
|
||||
|
||||
memmove(lc_header_start, lc_eol+1, eollen);
|
||||
memmove(header_start, eol+1, eollen);
|
||||
} else {
|
||||
*lc_header_start = '\0';
|
||||
*header_start = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context, int redirect_max, int flags STREAMS_DC TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
php_stream *stream = NULL;
|
||||
@@ -425,40 +449,17 @@ finish:
|
||||
if (tmp && strlen(tmp) > 0) {
|
||||
char *s;
|
||||
|
||||
if (!header_init) { /* Remove post headers for redirects */
|
||||
int l = strlen(tmp);
|
||||
char *s2, *tmp_c = estrdup(tmp);
|
||||
|
||||
php_strtolower(tmp_c, l);
|
||||
if ((s = strstr(tmp_c, "content-length:"))) {
|
||||
if ((s2 = memchr(s, '\n', tmp_c + l - s))) {
|
||||
int b = tmp_c + l - 1 - s2;
|
||||
memmove(tmp, tmp + (s2 + 1 - tmp_c), b);
|
||||
memmove(tmp_c, s2 + 1, b);
|
||||
|
||||
} else {
|
||||
tmp[s - tmp_c] = *s = '\0';
|
||||
}
|
||||
l = strlen(tmp_c);
|
||||
}
|
||||
if ((s = strstr(tmp_c, "content-type:"))) {
|
||||
if ((s2 = memchr(s, '\n', tmp_c + l - s))) {
|
||||
memmove(tmp, tmp + (s2 + 1 - tmp_c), tmp_c + l - 1 - s2);
|
||||
} else {
|
||||
tmp[s - tmp_c] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
efree(tmp_c);
|
||||
tmp_c = php_trim(tmp, strlen(tmp), NULL, 0, NULL, 3 TSRMLS_CC);
|
||||
efree(tmp);
|
||||
tmp = tmp_c;
|
||||
}
|
||||
|
||||
user_headers = estrdup(tmp);
|
||||
|
||||
/* Make lowercase for easy comparison against 'standard' headers */
|
||||
php_strtolower(tmp, strlen(tmp));
|
||||
|
||||
if (!header_init) {
|
||||
/* strip POST headers on redirect */
|
||||
strip_header(user_headers, tmp, "content-length:");
|
||||
strip_header(user_headers, tmp, "content-type:");
|
||||
}
|
||||
|
||||
if ((s = strstr(tmp, "user-agent:")) &&
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
--TEST--
|
||||
Bug #61548 (content-type must appear at the end of headers)
|
||||
--INI--
|
||||
allow_url_fopen=1
|
||||
--SKIPIF--
|
||||
<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'server.inc';
|
||||
|
||||
function do_test($header) {
|
||||
$options = [
|
||||
'http' => [
|
||||
'method' => 'POST',
|
||||
'header' => $header,
|
||||
'follow_location' => true,
|
||||
],
|
||||
];
|
||||
|
||||
$ctx = stream_context_create($options);
|
||||
|
||||
$responses = [
|
||||
"data://text/plain,HTTP/1.1 201\r\nLocation: /foo\r\n\r\n",
|
||||
"data://text/plain,HTTP/1.1 200\r\nConnection: close\r\n\r\n",
|
||||
];
|
||||
$pid = http_server('tcp://127.0.0.1:12342', $responses, $output);
|
||||
|
||||
$fd = fopen('http://127.0.0.1:12342/', 'rb', false, $ctx);
|
||||
fseek($output, 0, SEEK_SET);
|
||||
echo stream_get_contents($output);
|
||||
|
||||
http_server_kill($pid);
|
||||
}
|
||||
|
||||
do_test("First:1\nSecond:2\nContent-type: text/plain");
|
||||
do_test("First:1\nSecond:2\nContent-type: text/plain\n");
|
||||
do_test("First:1\nSecond:2\nContent-type: text/plain\nThird:");
|
||||
do_test("First:1\nContent-type:text/plain\nSecond:2");
|
||||
do_test("First:1\nContent-type:text/plain\nSecond:2\n");
|
||||
do_test("First:1\nContent-type:text/plain\nSecond:2\nThird:");
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
First:1
|
||||
Second:2
|
||||
Content-type: text/plain
|
||||
|
||||
GET /foo HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
First:1
|
||||
Second:2
|
||||
|
||||
|
||||
POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
First:1
|
||||
Second:2
|
||||
Content-type: text/plain
|
||||
|
||||
GET /foo HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
First:1
|
||||
Second:2
|
||||
|
||||
|
||||
POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
First:1
|
||||
Second:2
|
||||
Content-type: text/plain
|
||||
Third:
|
||||
|
||||
GET /foo HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
First:1
|
||||
Second:2
|
||||
Third:
|
||||
|
||||
POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
First:1
|
||||
Content-type:text/plain
|
||||
Second:2
|
||||
|
||||
GET /foo HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
First:1
|
||||
Second:2
|
||||
|
||||
POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
First:1
|
||||
Content-type:text/plain
|
||||
Second:2
|
||||
|
||||
GET /foo HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
First:1
|
||||
Second:2
|
||||
|
||||
POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
First:1
|
||||
Content-type:text/plain
|
||||
Second:2
|
||||
Third:
|
||||
|
||||
GET /foo HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
First:1
|
||||
Second:2
|
||||
Third:
|
||||
|
||||
Done
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
--TEST--
|
||||
Bug #64146 (serialize incorrectly saving objects when they are cloned)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo "Test\n";
|
||||
|
||||
class A
|
||||
{
|
||||
public $a = array();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->a[] = new B(1);
|
||||
$this->a[] = new B(2);
|
||||
}
|
||||
}
|
||||
|
||||
class B implements Serializable
|
||||
{
|
||||
public $b;
|
||||
|
||||
public function __construct($c)
|
||||
{
|
||||
$this->b = new C($c);
|
||||
}
|
||||
|
||||
public function serialize()
|
||||
{
|
||||
return serialize(clone $this->b);
|
||||
}
|
||||
|
||||
public function unserialize($data)
|
||||
{
|
||||
$this->b = unserialize($data);
|
||||
}
|
||||
}
|
||||
|
||||
class C
|
||||
{
|
||||
public $c;
|
||||
|
||||
public function __construct($c)
|
||||
{
|
||||
$this->c = $c;
|
||||
}
|
||||
}
|
||||
|
||||
$a = unserialize(serialize(new A()));
|
||||
|
||||
print $a->a[0]->b->c . "\n";
|
||||
print $a->a[1]->b->c . "\n";
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
Test
|
||||
1
|
||||
2
|
||||
Done
|
||||
@@ -0,0 +1,83 @@
|
||||
--TEST--
|
||||
Bug #65806 (unserialize fails with object which is referenced multiple times)
|
||||
--FILE--
|
||||
<?php
|
||||
class myObjA {}
|
||||
class myObjB {
|
||||
public $attrA;
|
||||
public $attrB;
|
||||
}
|
||||
class myObjC {
|
||||
public $attrC;
|
||||
public $attrD;
|
||||
}
|
||||
class myList {
|
||||
private $_serialized;
|
||||
private $_obj;
|
||||
|
||||
public function __construct($obj)
|
||||
{
|
||||
$this->_obj = $obj;
|
||||
$this->_serialized = serialize($this->_obj);
|
||||
}
|
||||
public function get()
|
||||
{
|
||||
return $this->_obj;
|
||||
}
|
||||
public function __sleep()
|
||||
{
|
||||
$this->_serialized = serialize($this->_obj);
|
||||
return array(
|
||||
"\0" . __CLASS__ . "\0_serialized",
|
||||
);
|
||||
}
|
||||
public function __wakeup()
|
||||
{
|
||||
$this->_obj = unserialize($this->_serialized);
|
||||
}
|
||||
}
|
||||
|
||||
echo "SCRIPT START" . PHP_EOL;
|
||||
|
||||
$objA = new myObjA();
|
||||
$objB = new myObjB();
|
||||
$objC = new myObjC();
|
||||
|
||||
$objB->attrA = new ArrayIterator();
|
||||
$objB->attrB = $objA;
|
||||
|
||||
$objC->attrC = $objB;
|
||||
$objC->attrD = $objA;
|
||||
|
||||
$list = new myList($objC);
|
||||
|
||||
echo 'check ' . check($list->get()) . PHP_EOL;
|
||||
|
||||
echo "start serialize/unserialize" . PHP_EOL;
|
||||
$newList = unserialize(serialize($list));
|
||||
echo "finish serialize/unserialize" . PHP_EOL;
|
||||
|
||||
//after unserialize the property myObjC::attrD is null instead of expected object
|
||||
echo 'check ' . check($newList->get()) . PHP_EOL;
|
||||
|
||||
echo "SCRIPT END" . PHP_EOL ;
|
||||
|
||||
function check(myObjC $obj) {
|
||||
|
||||
if (!is_object($obj->attrC)) {
|
||||
return 'failed (myObjC::attrC => ' . var_export($obj->attrC, true) . ')';
|
||||
}
|
||||
if (!is_object($obj->attrD)) {
|
||||
return 'failed (myObjC::attrD => ' . var_export($obj->attrD, true) . ')';
|
||||
}
|
||||
return 'successful';
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
SCRIPT START
|
||||
check successful
|
||||
start serialize/unserialize
|
||||
finish serialize/unserialize
|
||||
check successful
|
||||
SCRIPT END
|
||||
|
||||
+2
-4
@@ -549,11 +549,9 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var, void *var_old
|
||||
char id[32], *p;
|
||||
register int len;
|
||||
|
||||
/* relies on "(long)" being a perfect hash function for data pointers,
|
||||
* however the actual identity of an object has had to be determined
|
||||
* by its object handle since 5.0. */
|
||||
if ((Z_TYPE_P(var) == IS_OBJECT) && Z_OBJ_HT_P(var)->get_class_entry) {
|
||||
p = smart_str_print_long(id + sizeof(id) - 1, (long) Z_OBJ_HANDLE_P(var));
|
||||
p = smart_str_print_long(id + sizeof(id) - 1,
|
||||
(long) zend_objects_get_address(var TSRMLS_CC));
|
||||
*(--p) = 'O';
|
||||
len = id + sizeof(id) - 1 - p;
|
||||
} else {
|
||||
|
||||
@@ -805,7 +805,6 @@ PHP_METHOD(xmlreader, read)
|
||||
if (intern != NULL && intern->ptr != NULL) {
|
||||
retval = xmlTextReaderRead(intern->ptr);
|
||||
if (retval == -1) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "An Error Occurred while reading");
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
RETURN_BOOL(retval);
|
||||
@@ -847,7 +846,6 @@ PHP_METHOD(xmlreader, next)
|
||||
retval = xmlTextReaderNext(intern->ptr);
|
||||
}
|
||||
if (retval == -1) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "An Error Occurred while reading");
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
RETURN_BOOL(retval);
|
||||
@@ -1320,6 +1318,7 @@ PHP_MINIT_FUNCTION(xmlreader)
|
||||
xmlreader_object_handlers.read_property = xmlreader_read_property;
|
||||
xmlreader_object_handlers.write_property = xmlreader_write_property;
|
||||
xmlreader_object_handlers.get_property_ptr_ptr = xmlreader_get_property_ptr_ptr;
|
||||
xmlreader_object_handlers.clone_obj = NULL;
|
||||
|
||||
INIT_CLASS_ENTRY(ce, "XMLReader", xmlreader_functions);
|
||||
ce.create_object = xmlreader_objects_new;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #51936 (Crash with clone XMLReader)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("xmlreader") or die("skip requires xmlreader");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Test\n";
|
||||
|
||||
$xmlreader = new XMLReader();
|
||||
$xmlreader->xml("<a><b/></a>");
|
||||
|
||||
$xmlreader->next();
|
||||
$xmlreader2 = clone $xmlreader;
|
||||
$xmlreader2->next();
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Test
|
||||
|
||||
Fatal error: Trying to clone an uncloneable object of class XMLReader in %s on line %d
|
||||
@@ -0,0 +1,50 @@
|
||||
--TEST--
|
||||
Bug #64230 (XMLReader does not suppress errors)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("xmlreader") or die("skip requires xmlreader");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Test\n";
|
||||
|
||||
function show_internal_errors() {
|
||||
foreach (libxml_get_errors() as $error) {
|
||||
printf("Internal: %s\n", $error->message);
|
||||
}
|
||||
libxml_clear_errors();
|
||||
}
|
||||
|
||||
echo "Internal errors TRUE\n";
|
||||
libxml_use_internal_errors(true);
|
||||
|
||||
$x = new XMLReader;
|
||||
$x->xml("<root att/>");
|
||||
$x->read();
|
||||
|
||||
show_internal_errors();
|
||||
|
||||
echo "Internal errors FALSE\n";
|
||||
libxml_use_internal_errors(false);
|
||||
|
||||
$x = new XMLReader;
|
||||
$x->xml("<root att/>");
|
||||
$x->read();
|
||||
|
||||
show_internal_errors();
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Test
|
||||
Internal errors TRUE
|
||||
Internal: Specification mandate value for attribute att
|
||||
|
||||
Internal errors FALSE
|
||||
|
||||
Warning: XMLReader::read(): %s: parser error : Specification mandate value for attribute att in %s on line %d
|
||||
|
||||
Warning: XMLReader::read(): <root att/> in %s on line %d
|
||||
|
||||
Warning: XMLReader::read(): ^ in %s on line %d
|
||||
Done
|
||||
Loaded 100 of 107 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user