mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-09 02:00:49 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29b4532f61 |
No files matched your search
+2
-10
@@ -8,15 +8,7 @@ notifications:
|
||||
email: false
|
||||
|
||||
env:
|
||||
global:
|
||||
- MYSQL_TEST_HOST=127.0.0.1
|
||||
- MYSQL_TEST_USER=travis
|
||||
- PDO_MYSQL_TEST_DSN="mysql:host=127.0.0.1;dbname=test"
|
||||
- PDO_MYSQL_TEST_USER=travis
|
||||
- PDO_MYSQL_TEST_PASS=
|
||||
- PDO_MYSQL_TEST_HOST=127.0.0.1
|
||||
matrix:
|
||||
- REPORT_EXIT_STATUS=1
|
||||
- REPORT_EXIT_STATUS=1
|
||||
|
||||
before_script:
|
||||
# Compile PHP
|
||||
@@ -29,4 +21,4 @@ before_script:
|
||||
- . ./travis/ext/pdo_pgsql/setup.sh
|
||||
|
||||
# Run PHPs run-tests.php
|
||||
script: ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120
|
||||
script: ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff
|
||||
+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 (CamelCaps starting with a capital letter).
|
||||
without underscore delimiters (CampelCaps 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,155 +1,8 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
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)
|
||||
|
||||
- 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).
|
||||
(Laruence)
|
||||
. Improved fputcsv() to allow specifying escape character.
|
||||
. Fixed bug #65490 (Duplicate calls to get lineno & filename for
|
||||
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)
|
||||
. Fixed bug #62692 (PHP fails to build with DTrace). (Chris Jones, Kris Van Hees)
|
||||
. Fixed bug #61759 (class_alias() should accept classes with leading
|
||||
backslashes). (Julien)
|
||||
. Fixed bug #46311 (Pointer aliasing issue results in miscompile on gcc4.4).
|
||||
(Nikita Popov)
|
||||
|
||||
- cURL:
|
||||
. Fixed bug #65458 (curl memory leak). (Adam)
|
||||
|
||||
- Datetime:
|
||||
. Fixed bug #65554 (createFromFormat broken when weekday name is followed
|
||||
by some delimiters). (Valentin Logvinskiy, Stas).
|
||||
. Fixed bug #65564 (stack-buffer-overflow in DateTimeZone stuff caught
|
||||
by AddressSanitizer). (Remi).
|
||||
|
||||
- OPCache:
|
||||
. Fixed bug #65561 (Zend Opcache on Solaris 11 x86 needs ZEND_MM_ALIGNMENT=4).
|
||||
(Terry Ellison)
|
||||
|
||||
- Openssl:
|
||||
. 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)
|
||||
. Fixed bug #51127/#65359 Request #25630/#43980/#54383 (Added php_serialize
|
||||
session serialize handler that uses plain serialize()). (Yasuo)
|
||||
|
||||
- Standard:
|
||||
. 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:
|
||||
. Fixed UMR in fix for CVE-2013-4248.
|
||||
|
||||
15 Aug 2013, PHP 5.5.2
|
||||
|
||||
- Core:
|
||||
. Fixed bug #65372 (Segfault in gc_zval_possible_root when return reference
|
||||
fails). (Laruence)
|
||||
. Fixed value of FILTER_SANITIZE_FULL_SPECIAL_CHARS constant (previously was
|
||||
erroneously set to FILTER_SANITIZE_SPECIAL_CHARS value). (Andrey
|
||||
avp200681 gmail com).
|
||||
. Fixed bug #65304 (Use of max int in array_sum). (Laruence)
|
||||
. Fixed bug #65291 (get_defined_constants() causes PHP to crash in a very
|
||||
limited case). (Arpad)
|
||||
. Fixed bug #62691 (solaris sed has no -i switch). (Chris Jones)
|
||||
. Fixed bug #61345 (CGI mode - make install don't work). (Michael Heimpold)
|
||||
. Fixed bug #61268 (--enable-dtrace leads make to clobber
|
||||
@@ -160,37 +13,49 @@ PHP NEWS
|
||||
DOMDocument::schemaValidateSource(). Added LIBXML_SCHEMA_CREATE flag.
|
||||
(Chris Wright)
|
||||
|
||||
- Sessions:
|
||||
. Implemented strict sessions RFC (https://wiki.php.net/rfc/strict_sessions)
|
||||
which protects against session fixation attacks and session collisions.
|
||||
(Yasuo Ohgaki)
|
||||
. Fixed possible buffer overflow under Windows. Note: Not a security fix.
|
||||
(Yasuo)
|
||||
. Changed session.auto_start to PHP_INI_PERDIR. (Yasuo)
|
||||
|
||||
- Pgsql:
|
||||
. Fixed bug #62978 (Disallow possible SQL injections with pg_select()/pg_update()
|
||||
/pg_delete()/pg_insert()). (Yasuo)
|
||||
|
||||
?? ??? 2013, PHP 5.5.2
|
||||
|
||||
- Core:
|
||||
. Fixed bug #65372 (Segfault in gc_zval_possible_root when return reference
|
||||
fails). (Laruence)
|
||||
. Fixed value of FILTER_SANITIZE_FULL_SPECIAL_CHARS constant (previously was
|
||||
erroneously set to FILTER_SANITIZE_SPECIAL_CHARS value). (Andrey
|
||||
avp200681 gmail com).
|
||||
. Fixed bug #65304 (Use of max int in array_sum). (Laruence)
|
||||
. Fixed bug #65291 (get_defined_constants() causes PHP to crash in a very
|
||||
limited case). (Arpad)
|
||||
|
||||
- OPcache:
|
||||
. Added opcache.restrict_api configuration directive that may limit
|
||||
usage of OPcache API functions only to particular script(s). (Dmitry)
|
||||
usage of OPcahce API functions only to patricular script(s). (Dmitry)
|
||||
. Added support for glob symbols in blacklist entries (?, *, **).
|
||||
(Terry Elison, Dmitry)
|
||||
. Fixed bug #65338 (Enabling both php_opcache and php_wincache AVs on
|
||||
shutdown). (Dmitry)
|
||||
|
||||
- Openssl:
|
||||
. Fixed handling null bytes in subjectAltName (CVE-2013-4248).
|
||||
. Fixed handling null bytes in subjectAltName (CVE-2013-4073).
|
||||
(Christian Heimes)
|
||||
|
||||
- PDO_mysql:
|
||||
. Fixed bug #65299 (pdo mysql parsing errors). (Johannes)
|
||||
|
||||
- Pgsql:
|
||||
. Fixed bug #62978 (Disallow possible SQL injections with pg_select()/pg_update()
|
||||
/pg_delete()/pg_insert()). (Yasuo)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #65028 (Phar::buildFromDirectory creates corrupt archives for
|
||||
some specific contents). (Stas)
|
||||
|
||||
- Sessions:
|
||||
. Implemented strict sessions RFC (https://wiki.php.net/rfc/strict_sessions)
|
||||
which protects against session fixation attacks and session collisions.
|
||||
(CVE-2011-4718). (Yasuo Ohgaki)
|
||||
. Fixed possible buffer overflow under Windows. Note: Not a security fix.
|
||||
(Yasuo)
|
||||
. Changed session.auto_start to PHP_INI_PERDIR. (Yasuo)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #65018 (SoapHeader problems with SoapServer). (Dmitry)
|
||||
|
||||
|
||||
+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
|
||||
PHP_FOO_VERSION, /* extension version number (string) */
|
||||
FOO_VERSION, /* extension version number (string) */
|
||||
#endif
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
@@ -31,11 +31,6 @@ 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,18 +153,3 @@ 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.
|
||||
|
||||
@@ -186,9 +186,6 @@ PHP 5.5 UPGRADE NOTES
|
||||
DOMDocument::schemaValidate() accept flag parameter. Only flag
|
||||
available now is LIBXML_SCHEMA_CREATE. Default is 0.
|
||||
|
||||
- Since 5.5.4, fputcsv() has fifth parameter escape_char, allowing to
|
||||
specify escape char.
|
||||
|
||||
========================================
|
||||
5. New Functions
|
||||
========================================
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Bug #60598 (cli/apache sapi segfault on objects manipulation)
|
||||
--FILE--
|
||||
<?php
|
||||
define('OBJECT_COUNT', 10000);
|
||||
|
||||
$containers = array();
|
||||
|
||||
class Object {
|
||||
protected $_guid = 0;
|
||||
public function __construct() {
|
||||
global $containers;
|
||||
$this->guid = 1;
|
||||
$containers[spl_object_hash($this)] = $this;
|
||||
}
|
||||
public function __destruct() {
|
||||
global $containers;
|
||||
$containers[spl_object_hash($this)] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < OBJECT_COUNT; ++$i) {
|
||||
new Object();
|
||||
}
|
||||
|
||||
// You probably won't see this because of the "zend_mm_heap corrupted"
|
||||
?>
|
||||
If you see this, try to increase OBJECT_COUNT to 100,000
|
||||
--EXPECT--
|
||||
If you see this, try to increase OBJECT_COUNT to 100,000
|
||||
@@ -1,47 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64896 (Segfault with gc_collect_cycles using unserialize on certain objects)
|
||||
--XFAIL--
|
||||
We can not fix this bug without a significant (performace slow down) change to gc
|
||||
--FILE--
|
||||
<?php
|
||||
$bar = NULL;
|
||||
class bad
|
||||
{
|
||||
private $_private = array();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->_private[] = 'php';
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
global $bar;
|
||||
$bar = $this;
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new stdclass;
|
||||
$foo->foo = $foo;
|
||||
$foo->bad = new bad;
|
||||
|
||||
gc_disable();
|
||||
|
||||
unserialize(serialize($foo));
|
||||
gc_collect_cycles();
|
||||
var_dump($bar);
|
||||
/* will output:
|
||||
object(bad)#4 (1) {
|
||||
["_private":"bad":private]=>
|
||||
&UNKNOWN:0
|
||||
}
|
||||
*/
|
||||
?>
|
||||
--EXPECTF--
|
||||
bject(bad)#%d (1) {
|
||||
["_private":"bad":private]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(3) "php"
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64979 (Wrong behavior of static variables in closure generators)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function new_closure_gen() {
|
||||
return function() {
|
||||
static $foo = 0;
|
||||
yield ++$foo;
|
||||
};
|
||||
}
|
||||
|
||||
$closure1 = new_closure_gen();
|
||||
$closure2 = new_closure_gen();
|
||||
|
||||
$gen1 = $closure1();
|
||||
$gen2 = $closure1();
|
||||
$gen3 = $closure2();
|
||||
|
||||
foreach (array($gen1, $gen2, $gen3) as $gen) {
|
||||
foreach ($gen as $val) {
|
||||
var_dump($val);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(2)
|
||||
int(1)
|
||||
@@ -1,22 +0,0 @@
|
||||
--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"
|
||||
@@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Bug #65579 (Using traits with get_class_methods causes segfault)
|
||||
--FILE--
|
||||
<?php
|
||||
trait ParentTrait {
|
||||
public function testMethod() { }
|
||||
}
|
||||
|
||||
trait ChildTrait {
|
||||
use ParentTrait {
|
||||
testMethod as testMethodFromParentTrait;
|
||||
}
|
||||
public function testMethod() { }
|
||||
}
|
||||
|
||||
class TestClass {
|
||||
use ChildTrait;
|
||||
}
|
||||
|
||||
$obj = new TestClass();
|
||||
var_dump(get_class_methods($obj));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(10) "testMethod"
|
||||
[1]=>
|
||||
string(25) "testmethodfromparenttrait"
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Closure 047: Use in preg_replace_callback() using variables by reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function replace_variables($text, $params) {
|
||||
|
||||
preg_replace_callback( '/(\?)/', function($matches) use (&$params, &$text) {
|
||||
|
||||
$text = preg_replace( '/(\?)/', array_shift( $params ), $text, 1 );
|
||||
|
||||
}, $text );
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
echo replace_variables('a=?', array('0')) . "\n";
|
||||
echo replace_variables('a=?, b=?', array('0', '1')) . "\n";
|
||||
echo replace_variables('a=?, b=?, c=?', array('0', '1', '2')) . "\n";
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
a=0
|
||||
a=0, b=1
|
||||
a=0, b=1, c=2
|
||||
Done
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Closure 048: Use in preg_replace_callback() using variables by reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function replace_variables($text, $params) {
|
||||
|
||||
$c = function($matches) use (&$params, &$text) {
|
||||
$text = preg_replace( '/(\?)/', array_shift( $params ), $text, 1 );
|
||||
};
|
||||
|
||||
preg_replace_callback( '/(\?)/', $c, $text );
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
echo replace_variables('a=?', array('0')) . "\n";
|
||||
echo replace_variables('a=?, b=?', array('0', '1')) . "\n";
|
||||
echo replace_variables('a=?, b=?, c=?', array('0', '1', '2')) . "\n";
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
a=0
|
||||
a=0, b=1
|
||||
a=0, b=1, c=2
|
||||
Done
|
||||
@@ -1,18 +0,0 @@
|
||||
--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
-7
@@ -1092,19 +1092,17 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
error_filename = "Unknown";
|
||||
}
|
||||
|
||||
va_start(args, format);
|
||||
|
||||
#ifdef HAVE_DTRACE
|
||||
if(DTRACE_ERROR_ENABLED()) {
|
||||
char *dtrace_error_buffer;
|
||||
va_start(args, format);
|
||||
zend_vspprintf(&dtrace_error_buffer, 0, format, args);
|
||||
DTRACE_ERROR(dtrace_error_buffer, (char *)error_filename, error_lineno);
|
||||
efree(dtrace_error_buffer);
|
||||
va_end(args);
|
||||
}
|
||||
#endif /* HAVE_DTRACE */
|
||||
|
||||
va_start(args, format);
|
||||
|
||||
/* if we don't have a user defined error handler */
|
||||
if (!EG(user_error_handler)
|
||||
|| !(EG(user_error_handler_error_reporting) & type)
|
||||
@@ -1184,7 +1182,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
* such scripts recursivly, but some CG() variables may be
|
||||
* inconsistent. */
|
||||
|
||||
in_compilation = CG(in_compilation);
|
||||
in_compilation = zend_is_compiling(TSRMLS_C);
|
||||
if (in_compilation) {
|
||||
saved_class_entry = CG(active_class_entry);
|
||||
CG(active_class_entry) = NULL;
|
||||
@@ -1196,7 +1194,6 @@ 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) {
|
||||
@@ -1221,7 +1218,6 @@ 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)) {
|
||||
|
||||
+9
-15
@@ -2577,12 +2577,7 @@ ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_c
|
||||
char *lcname = zend_str_tolower_dup(name, name_len);
|
||||
int ret;
|
||||
|
||||
if (lcname[0] == '\\') {
|
||||
ret = zend_hash_add(CG(class_table), lcname+1, name_len, &ce, sizeof(zend_class_entry *), NULL);
|
||||
} else {
|
||||
ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, sizeof(zend_class_entry *), NULL);
|
||||
}
|
||||
|
||||
ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, sizeof(zend_class_entry *), NULL);
|
||||
efree(lcname);
|
||||
if (ret == SUCCESS) {
|
||||
ce->refcount++;
|
||||
@@ -3985,16 +3980,15 @@ ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name
|
||||
{
|
||||
zend_trait_alias *alias, **alias_ptr;
|
||||
|
||||
if ((alias_ptr = ce->trait_aliases)) {
|
||||
alias = *alias_ptr;
|
||||
while (alias) {
|
||||
if (alias->alias_len == len &&
|
||||
!strncasecmp(name, alias->alias, alias->alias_len)) {
|
||||
return alias->alias;
|
||||
}
|
||||
alias_ptr++;
|
||||
alias = *alias_ptr;
|
||||
alias_ptr = ce->trait_aliases;
|
||||
alias = *alias_ptr;
|
||||
while (alias) {
|
||||
if (alias->alias_len == len &&
|
||||
!strncasecmp(name, alias->alias, alias->alias_len)) {
|
||||
return alias->alias;
|
||||
}
|
||||
alias_ptr++;
|
||||
alias = *alias_ptr;
|
||||
}
|
||||
|
||||
return name;
|
||||
|
||||
@@ -1399,8 +1399,15 @@ ZEND_FUNCTION(class_alias)
|
||||
return;
|
||||
}
|
||||
|
||||
found = zend_lookup_class_ex(class_name, class_name_len, NULL, autoload, &ce TSRMLS_CC);
|
||||
if (!autoload) {
|
||||
lc_name = do_alloca(class_name_len + 1, use_heap);
|
||||
zend_str_tolower_copy(lc_name, class_name, class_name_len);
|
||||
|
||||
found = zend_hash_find(EG(class_table), lc_name, class_name_len+1, (void **) &ce);
|
||||
free_alloca(lc_name, use_heap);
|
||||
} else {
|
||||
found = zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC);
|
||||
}
|
||||
if (found == SUCCESS) {
|
||||
if ((*ce)->type == ZEND_USER_CLASS) {
|
||||
if (zend_register_class_alias_ex(alias_name, alias_name_len, *ce TSRMLS_CC) == SUCCESS) {
|
||||
|
||||
+31
-2
@@ -1749,6 +1749,7 @@ 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));
|
||||
}
|
||||
@@ -2661,7 +2662,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;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2671,7 +2672,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) {
|
||||
if (foreach_copy->result_type == IS_UNUSED && foreach_copy->op1_type == IS_UNUSED) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2680,6 +2681,16 @@ 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;
|
||||
}
|
||||
@@ -6216,6 +6227,7 @@ 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) {
|
||||
@@ -6227,6 +6239,14 @@ 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));
|
||||
@@ -6246,6 +6266,11 @@ 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 */
|
||||
@@ -6302,6 +6327,7 @@ 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];
|
||||
|
||||
@@ -6318,6 +6344,9 @@ 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);
|
||||
|
||||
@@ -58,8 +58,10 @@ ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
|
||||
}
|
||||
|
||||
if (DTRACE_FUNCTION_ENTRY_ENABLED() || DTRACE_FUNCTION_RETURN_ENABLED()) {
|
||||
filename = dtrace_get_executed_filename(TSRMLS_C);
|
||||
classname = get_active_class_name(&scope TSRMLS_CC);
|
||||
funcname = get_active_function_name(TSRMLS_C);
|
||||
lineno = zend_get_executed_lineno(TSRMLS_C);
|
||||
}
|
||||
|
||||
if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
|
||||
|
||||
@@ -560,7 +560,7 @@ ZEND_METHOD(exception, getPrevious)
|
||||
RETURN_ZVAL(previous, 1, 0);
|
||||
}
|
||||
|
||||
int zend_spprintf(char **message, int max_len, const char *format, ...) /* {{{ */
|
||||
int zend_spprintf(char **message, int max_len, 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, const char *message, long code TSRMLS_DC) /* {{{ */
|
||||
ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval *ex;
|
||||
|
||||
@@ -760,7 +760,7 @@ ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...) /* {{{ */
|
||||
ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, 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, const char *message, long code, int severity TSRMLS_DC) /* {{{ */
|
||||
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, 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, 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 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 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, const char *message, long code, int severity TSRMLS_DC);
|
||||
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, 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, const char *format, ...);
|
||||
int zend_spprintf(char **message, int max_len, char *format, ...);
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
|
||||
+1
-1
@@ -293,7 +293,7 @@ static zend_always_inline void zend_vm_stack_clear_multiple(int nested TSRMLS_DC
|
||||
void **end = p - (int)(zend_uintptr_t)*p;
|
||||
|
||||
while (p != end) {
|
||||
zval *q = (zval *) *(--p);
|
||||
zval *q = *(zval **)(--p);
|
||||
*p = NULL;
|
||||
i_zval_ptr_dtor(q ZEND_FILE_LINE_CC);
|
||||
}
|
||||
|
||||
+1
-27
@@ -226,16 +226,6 @@ 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) /* {{{ */
|
||||
@@ -252,23 +242,7 @@ 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;
|
||||
|
||||
(*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
|
||||
);
|
||||
}
|
||||
|
||||
function_add_ref((zend_function *) op_array_copy);
|
||||
op_array = op_array_copy;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,11 +57,6 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
|
||||
obj->dtor(obj->object, i TSRMLS_CC);
|
||||
obj = &objects->object_buckets[i].bucket.obj;
|
||||
obj->refcount--;
|
||||
|
||||
if (obj->refcount == 0) {
|
||||
/* in case gc_collect_cycle is triggered before free_storage */
|
||||
GC_REMOVE_ZOBJ_FROM_BUFFER(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2138,8 +2138,8 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */
|
||||
{
|
||||
int ret1, ret2;
|
||||
int oflow1, oflow2;
|
||||
long lval1 = 0, lval2 = 0;
|
||||
double dval1 = 0.0, dval2 = 0.0;
|
||||
long lval1, lval2;
|
||||
double dval1, dval2;
|
||||
|
||||
if ((ret1=is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0, &oflow1)) &&
|
||||
(ret2=is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0, &oflow2))) {
|
||||
|
||||
@@ -132,7 +132,7 @@ static inline zend_uchar is_numeric_string_ex(const char *str, int length, long
|
||||
{
|
||||
const char *ptr;
|
||||
int base = 10, digits = 0, dp_or_e = 0;
|
||||
double local_dval = 0.0;
|
||||
double local_dval;
|
||||
zend_uchar type;
|
||||
|
||||
if (!length) {
|
||||
|
||||
@@ -1392,6 +1392,11 @@ 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);
|
||||
}
|
||||
|
||||
+60
-7
@@ -20,13 +20,6 @@
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
# pragma warning(once : 4101)
|
||||
# pragma warning(once : 6235)
|
||||
# pragma warning(once : 6237)
|
||||
# pragma warning(once : 6239)
|
||||
# pragma warning(once : 6240)
|
||||
# pragma warning(once : 6285)
|
||||
# pragma warning(once : 6286)
|
||||
# pragma warning(once : 6326)
|
||||
#endif
|
||||
static user_opcode_handler_t zend_user_opcode_handlers[256] = {
|
||||
(user_opcode_handler_t)NULL,
|
||||
@@ -14997,6 +14990,11 @@ 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);
|
||||
}
|
||||
@@ -17348,6 +17346,11 @@ 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);
|
||||
}
|
||||
@@ -19606,6 +19609,11 @@ 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);
|
||||
}
|
||||
@@ -23066,6 +23074,11 @@ 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);
|
||||
}
|
||||
@@ -24847,6 +24860,11 @@ 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);
|
||||
}
|
||||
@@ -26260,6 +26278,11 @@ 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);
|
||||
}
|
||||
@@ -27576,6 +27599,11 @@ 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);
|
||||
}
|
||||
@@ -29314,6 +29342,11 @@ 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);
|
||||
}
|
||||
@@ -32453,6 +32486,11 @@ 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);
|
||||
}
|
||||
@@ -34569,6 +34607,11 @@ 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);
|
||||
}
|
||||
@@ -36689,6 +36732,11 @@ 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);
|
||||
}
|
||||
@@ -39862,6 +39910,11 @@ 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);
|
||||
}
|
||||
|
||||
+1
-19
@@ -1189,26 +1189,8 @@ function gen_vm($def, $skel) {
|
||||
// Insert header
|
||||
out($f, $GLOBALS['header_text']);
|
||||
|
||||
out($f, "#ifdef ZEND_WIN32\n");
|
||||
// Suppress free_op1 warnings on Windows
|
||||
out($f, "# pragma warning(once : 4101)\n");
|
||||
if (ZEND_VM_SPEC) {
|
||||
// Suppress (<non-zero constant> || <expression>) warnings on windows
|
||||
out($f, "# pragma warning(once : 6235)\n");
|
||||
// Suppress (<zero> && <expression>) warnings on windows
|
||||
out($f, "# pragma warning(once : 6237)\n");
|
||||
// Suppress (<non-zero constant> && <expression>) warnings on windows
|
||||
out($f, "# pragma warning(once : 6239)\n");
|
||||
// Suppress (<expression> && <non-zero constant>) warnings on windows
|
||||
out($f, "# pragma warning(once : 6240)\n");
|
||||
// Suppress (<non-zero constant> || <non-zero constant>) warnings on windows
|
||||
out($f, "# pragma warning(once : 6285)\n");
|
||||
// Suppress (<non-zero constant> || <expression>) warnings on windows
|
||||
out($f, "# pragma warning(once : 6286)\n");
|
||||
// Suppress constant with constant comparsion warnings on windows
|
||||
out($f, "# pragma warning(once : 6326)\n");
|
||||
}
|
||||
out($f, "#endif\n");
|
||||
out($f, "#ifdef ZEND_WIN32\n# pragma warning(once : 4101)\n#endif\n");
|
||||
|
||||
// Support for ZEND_USER_OPCODE
|
||||
out($f, "static user_opcode_handler_t zend_user_opcode_handlers[256] = {\n");
|
||||
|
||||
+4
-38
@@ -2925,17 +2925,17 @@ dnl providerdesc
|
||||
dnl header-file
|
||||
ac_hdrobj=$2
|
||||
|
||||
dnl Add providerdesc.o or .lo into global objects when needed
|
||||
dnl Add providerdesc.o into global objects when needed
|
||||
case $host_alias in
|
||||
*freebsd*)
|
||||
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.o"
|
||||
PHP_LDFLAGS="$PHP_LDFLAGS -lelf"
|
||||
;;
|
||||
*solaris*)
|
||||
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.lo"
|
||||
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.o"
|
||||
;;
|
||||
*linux*)
|
||||
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.lo"
|
||||
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.o"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -2969,46 +2969,12 @@ dnl in GNU Make which causes the .d file to be overwritten (Bug 61268)
|
||||
$abs_srcdir/$ac_provsrc:;
|
||||
|
||||
$ac_bdir[$]ac_hdrobj: $abs_srcdir/$ac_provsrc
|
||||
CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) -e 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@
|
||||
CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@
|
||||
|
||||
\$(PHP_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj
|
||||
|
||||
EOF
|
||||
|
||||
case $host_alias in
|
||||
*solaris*|*linux*)
|
||||
dtrace_prov_name="`echo $ac_provsrc | $SED -e 's#\(.*\)\/##'`.o"
|
||||
dtrace_lib_dir="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/[^/]*#\1#'`/.libs"
|
||||
dtrace_d_obj="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/\([^/]*\)#\1/.libs/\2#'`.o"
|
||||
dtrace_nolib_objs='$(PHP_DTRACE_OBJS:.lo=.o)'
|
||||
for ac_lo in $PHP_DTRACE_OBJS; do
|
||||
dtrace_lib_objs="[$]dtrace_lib_objs `echo $ac_lo | $SED -e 's,\.lo$,.o,' -e 's#\(.*\)\/#\1\/.libs\/#'`"
|
||||
done;
|
||||
dnl Always attempt to create both PIC and non-PIC DTrace objects (Bug 63692)
|
||||
cat>>Makefile.objects<<EOF
|
||||
$ac_bdir[$]ac_provsrc.lo: \$(PHP_DTRACE_OBJS)
|
||||
echo "[#] Generated by Makefile for libtool" > \$[]@
|
||||
@test -d "$dtrace_lib_dir" || mkdir $dtrace_lib_dir
|
||||
if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $dtrace_d_obj -s $abs_srcdir/$ac_provsrc $dtrace_lib_objs 2> /dev/null && test -f "$dtrace_d_obj"; then [\\]
|
||||
echo "pic_object=['].libs/$dtrace_prov_name[']" >> \$[]@ [;\\]
|
||||
else [\\]
|
||||
echo "pic_object='none'" >> \$[]@ [;\\]
|
||||
fi
|
||||
if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $ac_bdir[$]ac_provsrc.o -s $abs_srcdir/$ac_provsrc $dtrace_nolib_objs 2> /dev/null && test -f "$ac_bdir[$]ac_provsrc.o"; then [\\]
|
||||
echo "non_pic_object=[']$dtrace_prov_name[']" >> \$[]@ [;\\]
|
||||
else [\\]
|
||||
echo "non_pic_object='none'" >> \$[]@ [;\\]
|
||||
fi
|
||||
|
||||
EOF
|
||||
|
||||
;;
|
||||
*)
|
||||
cat>>Makefile.objects<<EOF
|
||||
$ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS)
|
||||
CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o \$[]@ -s $abs_srcdir/$ac_provsrc $dtrace_objs
|
||||
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
])
|
||||
+1
-8
@@ -1003,14 +1003,7 @@ mkdir )
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "mkdir $pathcomp" 1>&2
|
||||
fi
|
||||
# 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
|
||||
}
|
||||
mkdir $pathcomp || errstatus=$?
|
||||
if [ ".$opt_o" != . ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "chown $opt_o $pathcomp" 1>&2
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=5
|
||||
PHP_RELEASE_VERSION=5
|
||||
PHP_RELEASE_VERSION=2
|
||||
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,6 +183,7 @@ _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;
|
||||
@@ -215,8 +216,10 @@ _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);
|
||||
|
||||
|
||||
@@ -215,6 +215,7 @@ static php_stream_filter_status_t php_bz2_compress_filter(
|
||||
size_t consumed = 0;
|
||||
int status;
|
||||
php_stream_filter_status_t exit_status = PSFS_FEED_ME;
|
||||
bz_stream *streamp;
|
||||
|
||||
if (!thisfilter || !thisfilter->abstract) {
|
||||
/* Should never happen */
|
||||
@@ -222,6 +223,7 @@ static php_stream_filter_status_t php_bz2_compress_filter(
|
||||
}
|
||||
|
||||
data = (php_bz2_filter_data *)(thisfilter->abstract);
|
||||
streamp = &(data->strm);
|
||||
|
||||
while (buckets_in->head) {
|
||||
size_t bin = 0, desired;
|
||||
|
||||
+6
-10
@@ -1717,9 +1717,9 @@ static void curl_free_post(void **post)
|
||||
|
||||
/* {{{ curl_free_slist
|
||||
*/
|
||||
static void curl_free_slist(void *slist)
|
||||
static void curl_free_slist(void **slist)
|
||||
{
|
||||
curl_slist_free_all(*((struct curl_slist **) slist));
|
||||
curl_slist_free_all((struct curl_slist *) *slist);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1790,11 +1790,9 @@ static void alloc_curl_handle(php_curl **ch)
|
||||
(*ch)->handlers->read->stream = NULL;
|
||||
|
||||
zend_llist_init(&(*ch)->to_free->str, sizeof(char *), (llist_dtor_func_t) curl_free_string, 0);
|
||||
zend_llist_init(&(*ch)->to_free->slist, sizeof(struct curl_slist), (llist_dtor_func_t) curl_free_slist, 0);
|
||||
zend_llist_init(&(*ch)->to_free->post, sizeof(struct HttpPost), (llist_dtor_func_t) curl_free_post, 0);
|
||||
(*ch)->safe_upload = 0; /* for now, for BC reason we allow unsafe API */
|
||||
|
||||
(*ch)->to_free->slist = emalloc(sizeof(HashTable));
|
||||
zend_hash_init((*ch)->to_free->slist, 4, NULL, curl_free_slist, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -2045,7 +2043,6 @@ PHP_FUNCTION(curl_copy_handle)
|
||||
}
|
||||
#endif
|
||||
|
||||
efree(dupch->to_free->slist);
|
||||
efree(dupch->to_free);
|
||||
dupch->to_free = ch->to_free;
|
||||
|
||||
@@ -2441,7 +2438,7 @@ string_copy:
|
||||
|
||||
ph = HASH_OF(*zvalue);
|
||||
if (!ph) {
|
||||
char *name = NULL;
|
||||
char *name;
|
||||
switch (option) {
|
||||
case CURLOPT_HTTPHEADER:
|
||||
name = "CURLOPT_HTTPHEADER";
|
||||
@@ -2491,7 +2488,7 @@ string_copy:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
zend_hash_index_update(ch->to_free->slist, (ulong) option, &slist, sizeof(struct curl_slist *), NULL);
|
||||
zend_llist_add_element(&ch->to_free->slist, &slist);
|
||||
|
||||
error = curl_easy_setopt(ch->cp, option, slist);
|
||||
|
||||
@@ -3269,9 +3266,8 @@ static void _php_curl_close_ex(php_curl *ch TSRMLS_DC)
|
||||
/* cURL destructors should be invoked only by last curl handle */
|
||||
if (Z_REFCOUNT_P(ch->clone) <= 1) {
|
||||
zend_llist_clean(&ch->to_free->str);
|
||||
zend_llist_clean(&ch->to_free->slist);
|
||||
zend_llist_clean(&ch->to_free->post);
|
||||
zend_hash_destroy(ch->to_free->slist);
|
||||
efree(ch->to_free->slist);
|
||||
efree(ch->to_free);
|
||||
FREE_ZVAL(ch->clone);
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -168,7 +168,7 @@ struct _php_curl_send_headers {
|
||||
struct _php_curl_free {
|
||||
zend_llist str;
|
||||
zend_llist post;
|
||||
HashTable *slist;
|
||||
zend_llist slist;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
--TEST--
|
||||
Bug #65458 (curl memory leak)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('curl')) exit("skip curl extension not loaded");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$ch = curl_init();
|
||||
$init = memory_get_usage();
|
||||
for ($i = 0; $i < 10000; $i++) {
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [ "SOAPAction: getItems" ]);
|
||||
}
|
||||
|
||||
$preclose = memory_get_usage();
|
||||
curl_close($ch);
|
||||
|
||||
// This is a slightly tricky heuristic, but basically, we want to ensure
|
||||
// $preclose - $init has a delta in the order of bytes, not megabytes. Given
|
||||
// the number of iterations in the loop, if we're wasting memory here, we
|
||||
// should have megs and megs of extra allocations.
|
||||
var_dump(($preclose - $init) < 10000);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
+100
-101
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.13.5 on Sun Aug 25 15:12:48 2013 */
|
||||
/* Generated by re2c 0.13.5 on Fri Apr 26 11:10:28 2013 */
|
||||
#line 1 "ext/date/lib/parse_date.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
@@ -616,8 +616,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
|
||||
char *begin = *ptr, *end;
|
||||
const timelib_relunit *tp, *value = NULL;
|
||||
|
||||
while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' &&
|
||||
**ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) {
|
||||
while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') {
|
||||
++*ptr;
|
||||
}
|
||||
end = *ptr;
|
||||
@@ -837,11 +836,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
|
||||
std:
|
||||
s->tok = cursor;
|
||||
s->len = 0;
|
||||
#line 963 "ext/date/lib/parse_date.re"
|
||||
#line 962 "ext/date/lib/parse_date.re"
|
||||
|
||||
|
||||
|
||||
#line 845 "ext/date/lib/parse_date.c"
|
||||
#line 844 "ext/date/lib/parse_date.c"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
unsigned int yyaccept = 0;
|
||||
@@ -961,7 +960,7 @@ std:
|
||||
}
|
||||
yy2:
|
||||
YYDEBUG(2, *YYCURSOR);
|
||||
#line 1049 "ext/date/lib/parse_date.re"
|
||||
#line 1048 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("firstdayof | lastdayof");
|
||||
TIMELIB_INIT;
|
||||
@@ -977,7 +976,7 @@ yy2:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_LF_DAY_OF_MONTH;
|
||||
}
|
||||
#line 981 "ext/date/lib/parse_date.c"
|
||||
#line 980 "ext/date/lib/parse_date.c"
|
||||
yy3:
|
||||
YYDEBUG(3, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
@@ -1000,7 +999,7 @@ yy3:
|
||||
}
|
||||
yy4:
|
||||
YYDEBUG(4, *YYCURSOR);
|
||||
#line 1643 "ext/date/lib/parse_date.re"
|
||||
#line 1642 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
@@ -1013,7 +1012,7 @@ yy4:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIMEZONE;
|
||||
}
|
||||
#line 1017 "ext/date/lib/parse_date.c"
|
||||
#line 1016 "ext/date/lib/parse_date.c"
|
||||
yy5:
|
||||
YYDEBUG(5, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -1324,12 +1323,12 @@ yy12:
|
||||
if (yych <= '9') goto yy1385;
|
||||
yy13:
|
||||
YYDEBUG(13, *YYCURSOR);
|
||||
#line 1738 "ext/date/lib/parse_date.re"
|
||||
#line 1737 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
add_error(s, "Unexpected character");
|
||||
goto std;
|
||||
}
|
||||
#line 1333 "ext/date/lib/parse_date.c"
|
||||
#line 1332 "ext/date/lib/parse_date.c"
|
||||
yy14:
|
||||
YYDEBUG(14, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -2386,11 +2385,11 @@ yy49:
|
||||
if (yych <= '9') goto yy55;
|
||||
yy50:
|
||||
YYDEBUG(50, *YYCURSOR);
|
||||
#line 1727 "ext/date/lib/parse_date.re"
|
||||
#line 1726 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
goto std;
|
||||
}
|
||||
#line 2394 "ext/date/lib/parse_date.c"
|
||||
#line 2393 "ext/date/lib/parse_date.c"
|
||||
yy51:
|
||||
YYDEBUG(51, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -2399,12 +2398,12 @@ yy52:
|
||||
YYDEBUG(52, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(53, *YYCURSOR);
|
||||
#line 1732 "ext/date/lib/parse_date.re"
|
||||
#line 1731 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
s->pos = cursor; s->line++;
|
||||
goto std;
|
||||
}
|
||||
#line 2408 "ext/date/lib/parse_date.c"
|
||||
#line 2407 "ext/date/lib/parse_date.c"
|
||||
yy54:
|
||||
YYDEBUG(54, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -2791,7 +2790,7 @@ yy72:
|
||||
if (yych == 's') goto yy74;
|
||||
yy73:
|
||||
YYDEBUG(73, *YYCURSOR);
|
||||
#line 1711 "ext/date/lib/parse_date.re"
|
||||
#line 1710 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_ull i;
|
||||
DEBUG_OUTPUT("relative");
|
||||
@@ -2806,7 +2805,7 @@ yy73:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 2810 "ext/date/lib/parse_date.c"
|
||||
#line 2809 "ext/date/lib/parse_date.c"
|
||||
yy74:
|
||||
YYDEBUG(74, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -3568,7 +3567,7 @@ yy166:
|
||||
}
|
||||
yy167:
|
||||
YYDEBUG(167, *YYCURSOR);
|
||||
#line 1574 "ext/date/lib/parse_date.re"
|
||||
#line 1573 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
const timelib_relunit* relunit;
|
||||
DEBUG_OUTPUT("daytext");
|
||||
@@ -3585,7 +3584,7 @@ yy167:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_WEEKDAY;
|
||||
}
|
||||
#line 3589 "ext/date/lib/parse_date.c"
|
||||
#line 3588 "ext/date/lib/parse_date.c"
|
||||
yy168:
|
||||
YYDEBUG(168, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -4105,7 +4104,7 @@ yy193:
|
||||
}
|
||||
yy194:
|
||||
YYDEBUG(194, *YYCURSOR);
|
||||
#line 1633 "ext/date/lib/parse_date.re"
|
||||
#line 1632 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("monthtext");
|
||||
TIMELIB_INIT;
|
||||
@@ -4114,7 +4113,7 @@ yy194:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 4118 "ext/date/lib/parse_date.c"
|
||||
#line 4117 "ext/date/lib/parse_date.c"
|
||||
yy195:
|
||||
YYDEBUG(195, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
@@ -4165,7 +4164,7 @@ yy198:
|
||||
}
|
||||
yy199:
|
||||
YYDEBUG(199, *YYCURSOR);
|
||||
#line 1379 "ext/date/lib/parse_date.re"
|
||||
#line 1378 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datetextual | datenoyear");
|
||||
@@ -4178,7 +4177,7 @@ yy199:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 4182 "ext/date/lib/parse_date.c"
|
||||
#line 4181 "ext/date/lib/parse_date.c"
|
||||
yy200:
|
||||
YYDEBUG(200, *YYCURSOR);
|
||||
yyaccept = 6;
|
||||
@@ -4447,7 +4446,7 @@ yy222:
|
||||
}
|
||||
yy223:
|
||||
YYDEBUG(223, *YYCURSOR);
|
||||
#line 1681 "ext/date/lib/parse_date.re"
|
||||
#line 1680 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
|
||||
@@ -4476,7 +4475,7 @@ yy223:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_SHORTDATE_WITH_TIME;
|
||||
}
|
||||
#line 4480 "ext/date/lib/parse_date.c"
|
||||
#line 4479 "ext/date/lib/parse_date.c"
|
||||
yy224:
|
||||
YYDEBUG(224, *YYCURSOR);
|
||||
yyaccept = 7;
|
||||
@@ -5174,7 +5173,7 @@ yy278:
|
||||
YYDEBUG(278, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(279, *YYCURSOR);
|
||||
#line 1657 "ext/date/lib/parse_date.re"
|
||||
#line 1656 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
|
||||
TIMELIB_INIT;
|
||||
@@ -5197,7 +5196,7 @@ yy278:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_SHORTDATE_WITH_TIME;
|
||||
}
|
||||
#line 5201 "ext/date/lib/parse_date.c"
|
||||
#line 5200 "ext/date/lib/parse_date.c"
|
||||
yy280:
|
||||
YYDEBUG(280, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -5375,7 +5374,7 @@ yy294:
|
||||
++YYCURSOR;
|
||||
yy295:
|
||||
YYDEBUG(295, *YYCURSOR);
|
||||
#line 1351 "ext/date/lib/parse_date.re"
|
||||
#line 1350 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datenoday");
|
||||
@@ -5388,7 +5387,7 @@ yy295:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NO_DAY;
|
||||
}
|
||||
#line 5392 "ext/date/lib/parse_date.c"
|
||||
#line 5391 "ext/date/lib/parse_date.c"
|
||||
yy296:
|
||||
YYDEBUG(296, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -6608,7 +6607,7 @@ yy362:
|
||||
if (yych <= '9') goto yy365;
|
||||
yy364:
|
||||
YYDEBUG(364, *YYCURSOR);
|
||||
#line 1495 "ext/date/lib/parse_date.re"
|
||||
#line 1494 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgtextshort");
|
||||
@@ -6621,7 +6620,7 @@ yy364:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_TEXT;
|
||||
}
|
||||
#line 6625 "ext/date/lib/parse_date.c"
|
||||
#line 6624 "ext/date/lib/parse_date.c"
|
||||
yy365:
|
||||
YYDEBUG(365, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -7259,7 +7258,7 @@ yy392:
|
||||
}
|
||||
yy393:
|
||||
YYDEBUG(393, *YYCURSOR);
|
||||
#line 1553 "ext/date/lib/parse_date.re"
|
||||
#line 1552 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("ago");
|
||||
TIMELIB_INIT;
|
||||
@@ -7279,7 +7278,7 @@ yy393:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_AGO;
|
||||
}
|
||||
#line 7283 "ext/date/lib/parse_date.c"
|
||||
#line 7282 "ext/date/lib/parse_date.c"
|
||||
yy394:
|
||||
YYDEBUG(394, *YYCURSOR);
|
||||
yyaccept = 5;
|
||||
@@ -9029,7 +9028,7 @@ yy454:
|
||||
++YYCURSOR;
|
||||
yy455:
|
||||
YYDEBUG(455, *YYCURSOR);
|
||||
#line 1256 "ext/date/lib/parse_date.re"
|
||||
#line 1255 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
|
||||
TIMELIB_INIT;
|
||||
@@ -9040,7 +9039,7 @@ yy455:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 9044 "ext/date/lib/parse_date.c"
|
||||
#line 9043 "ext/date/lib/parse_date.c"
|
||||
yy456:
|
||||
YYDEBUG(456, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@@ -9600,7 +9599,7 @@ yy475:
|
||||
}
|
||||
yy476:
|
||||
YYDEBUG(476, *YYCURSOR);
|
||||
#line 1393 "ext/date/lib/parse_date.re"
|
||||
#line 1392 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datenoyearrev");
|
||||
TIMELIB_INIT;
|
||||
@@ -9611,7 +9610,7 @@ yy476:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 9615 "ext/date/lib/parse_date.c"
|
||||
#line 9614 "ext/date/lib/parse_date.c"
|
||||
yy477:
|
||||
YYDEBUG(477, *YYCURSOR);
|
||||
yyaccept = 10;
|
||||
@@ -9752,7 +9751,7 @@ yy488:
|
||||
YYDEBUG(488, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(489, *YYCURSOR);
|
||||
#line 1111 "ext/date/lib/parse_date.re"
|
||||
#line 1110 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
|
||||
TIMELIB_INIT;
|
||||
@@ -9768,7 +9767,7 @@ yy488:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME12;
|
||||
}
|
||||
#line 9772 "ext/date/lib/parse_date.c"
|
||||
#line 9771 "ext/date/lib/parse_date.c"
|
||||
yy490:
|
||||
YYDEBUG(490, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -9781,7 +9780,7 @@ yy490:
|
||||
}
|
||||
yy491:
|
||||
YYDEBUG(491, *YYCURSOR);
|
||||
#line 1148 "ext/date/lib/parse_date.re"
|
||||
#line 1147 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
|
||||
@@ -9806,7 +9805,7 @@ yy491:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME24_WITH_ZONE;
|
||||
}
|
||||
#line 9810 "ext/date/lib/parse_date.c"
|
||||
#line 9809 "ext/date/lib/parse_date.c"
|
||||
yy492:
|
||||
YYDEBUG(492, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -10116,7 +10115,7 @@ yy523:
|
||||
YYDEBUG(523, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(524, *YYCURSOR);
|
||||
#line 1128 "ext/date/lib/parse_date.re"
|
||||
#line 1127 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("mssqltime");
|
||||
TIMELIB_INIT;
|
||||
@@ -10135,7 +10134,7 @@ yy523:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME24_WITH_ZONE;
|
||||
}
|
||||
#line 10139 "ext/date/lib/parse_date.c"
|
||||
#line 10138 "ext/date/lib/parse_date.c"
|
||||
yy525:
|
||||
YYDEBUG(525, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -10241,7 +10240,7 @@ yy534:
|
||||
if (yych <= '9') goto yy541;
|
||||
yy535:
|
||||
YYDEBUG(535, *YYCURSOR);
|
||||
#line 1310 "ext/date/lib/parse_date.re"
|
||||
#line 1309 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datefull");
|
||||
@@ -10255,7 +10254,7 @@ yy535:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL;
|
||||
}
|
||||
#line 10259 "ext/date/lib/parse_date.c"
|
||||
#line 10258 "ext/date/lib/parse_date.c"
|
||||
yy536:
|
||||
YYDEBUG(536, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -10992,7 +10991,7 @@ yy605:
|
||||
YYDEBUG(606, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(607, *YYCURSOR);
|
||||
#line 1325 "ext/date/lib/parse_date.re"
|
||||
#line 1324 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("pointed date YYYY");
|
||||
TIMELIB_INIT;
|
||||
@@ -11003,7 +11002,7 @@ yy605:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL_POINTED;
|
||||
}
|
||||
#line 11007 "ext/date/lib/parse_date.c"
|
||||
#line 11006 "ext/date/lib/parse_date.c"
|
||||
yy608:
|
||||
YYDEBUG(608, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -11039,7 +11038,7 @@ yy611:
|
||||
if (yych <= '9') goto yy605;
|
||||
yy612:
|
||||
YYDEBUG(612, *YYCURSOR);
|
||||
#line 1337 "ext/date/lib/parse_date.re"
|
||||
#line 1336 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pointed date YY");
|
||||
@@ -11052,7 +11051,7 @@ yy612:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL_POINTED;
|
||||
}
|
||||
#line 11056 "ext/date/lib/parse_date.c"
|
||||
#line 11055 "ext/date/lib/parse_date.c"
|
||||
yy613:
|
||||
YYDEBUG(613, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -11693,7 +11692,7 @@ yy656:
|
||||
}
|
||||
yy657:
|
||||
YYDEBUG(657, *YYCURSOR);
|
||||
#line 1296 "ext/date/lib/parse_date.re"
|
||||
#line 1295 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("gnudateshort");
|
||||
@@ -11706,7 +11705,7 @@ yy657:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 11710 "ext/date/lib/parse_date.c"
|
||||
#line 11709 "ext/date/lib/parse_date.c"
|
||||
yy658:
|
||||
YYDEBUG(658, *YYCURSOR);
|
||||
yyaccept = 13;
|
||||
@@ -11812,7 +11811,7 @@ yy666:
|
||||
}
|
||||
yy667:
|
||||
YYDEBUG(667, *YYCURSOR);
|
||||
#line 1240 "ext/date/lib/parse_date.re"
|
||||
#line 1239 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("americanshort | american");
|
||||
@@ -11827,7 +11826,7 @@ yy667:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_AMERICAN;
|
||||
}
|
||||
#line 11831 "ext/date/lib/parse_date.c"
|
||||
#line 11830 "ext/date/lib/parse_date.c"
|
||||
yy668:
|
||||
YYDEBUG(668, *YYCURSOR);
|
||||
yyaccept = 14;
|
||||
@@ -12060,7 +12059,7 @@ yy700:
|
||||
if (yych <= ':') goto yy704;
|
||||
yy701:
|
||||
YYDEBUG(701, *YYCURSOR);
|
||||
#line 1523 "ext/date/lib/parse_date.re"
|
||||
#line 1522 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("clf");
|
||||
@@ -12080,7 +12079,7 @@ yy701:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
}
|
||||
#line 12084 "ext/date/lib/parse_date.c"
|
||||
#line 12083 "ext/date/lib/parse_date.c"
|
||||
yy702:
|
||||
YYDEBUG(702, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -12632,7 +12631,7 @@ yy763:
|
||||
}
|
||||
yy764:
|
||||
YYDEBUG(764, *YYCURSOR);
|
||||
#line 1268 "ext/date/lib/parse_date.re"
|
||||
#line 1267 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("iso8601date2");
|
||||
@@ -12645,7 +12644,7 @@ yy764:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 12649 "ext/date/lib/parse_date.c"
|
||||
#line 12648 "ext/date/lib/parse_date.c"
|
||||
yy765:
|
||||
YYDEBUG(765, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -12684,7 +12683,7 @@ yy771:
|
||||
YYDEBUG(771, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(772, *YYCURSOR);
|
||||
#line 1509 "ext/date/lib/parse_date.re"
|
||||
#line 1508 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgtextreverse");
|
||||
@@ -12697,7 +12696,7 @@ yy771:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_TEXT;
|
||||
}
|
||||
#line 12701 "ext/date/lib/parse_date.c"
|
||||
#line 12700 "ext/date/lib/parse_date.c"
|
||||
yy773:
|
||||
YYDEBUG(773, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -12835,7 +12834,7 @@ yy783:
|
||||
}
|
||||
yy784:
|
||||
YYDEBUG(784, *YYCURSOR);
|
||||
#line 1544 "ext/date/lib/parse_date.re"
|
||||
#line 1543 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("year4");
|
||||
TIMELIB_INIT;
|
||||
@@ -12843,7 +12842,7 @@ yy784:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
}
|
||||
#line 12847 "ext/date/lib/parse_date.c"
|
||||
#line 12846 "ext/date/lib/parse_date.c"
|
||||
yy785:
|
||||
YYDEBUG(785, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -12994,7 +12993,7 @@ yy793:
|
||||
}
|
||||
yy794:
|
||||
YYDEBUG(794, *YYCURSOR);
|
||||
#line 1365 "ext/date/lib/parse_date.re"
|
||||
#line 1364 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datenodayrev");
|
||||
@@ -13007,7 +13006,7 @@ yy794:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NO_DAY;
|
||||
}
|
||||
#line 13011 "ext/date/lib/parse_date.c"
|
||||
#line 13010 "ext/date/lib/parse_date.c"
|
||||
yy795:
|
||||
YYDEBUG(795, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13222,7 +13221,7 @@ yy814:
|
||||
if (yych <= '7') goto yy817;
|
||||
yy815:
|
||||
YYDEBUG(815, *YYCURSOR);
|
||||
#line 1476 "ext/date/lib/parse_date.re"
|
||||
#line 1475 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll w, d;
|
||||
DEBUG_OUTPUT("isoweek");
|
||||
@@ -13240,7 +13239,7 @@ yy815:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_WEEK;
|
||||
}
|
||||
#line 13244 "ext/date/lib/parse_date.c"
|
||||
#line 13243 "ext/date/lib/parse_date.c"
|
||||
yy816:
|
||||
YYDEBUG(816, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13250,7 +13249,7 @@ yy817:
|
||||
YYDEBUG(817, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(818, *YYCURSOR);
|
||||
#line 1457 "ext/date/lib/parse_date.re"
|
||||
#line 1456 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll w, d;
|
||||
DEBUG_OUTPUT("isoweekday");
|
||||
@@ -13268,7 +13267,7 @@ yy817:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_WEEK;
|
||||
}
|
||||
#line 13272 "ext/date/lib/parse_date.c"
|
||||
#line 13271 "ext/date/lib/parse_date.c"
|
||||
yy819:
|
||||
YYDEBUG(819, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13332,7 +13331,7 @@ yy821:
|
||||
}
|
||||
yy822:
|
||||
YYDEBUG(822, *YYCURSOR);
|
||||
#line 1443 "ext/date/lib/parse_date.re"
|
||||
#line 1442 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgydotd");
|
||||
@@ -13345,7 +13344,7 @@ yy822:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_YEARDAY;
|
||||
}
|
||||
#line 13349 "ext/date/lib/parse_date.c"
|
||||
#line 13348 "ext/date/lib/parse_date.c"
|
||||
yy823:
|
||||
YYDEBUG(823, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13448,7 +13447,7 @@ yy842:
|
||||
++YYCURSOR;
|
||||
yy843:
|
||||
YYDEBUG(843, *YYCURSOR);
|
||||
#line 1417 "ext/date/lib/parse_date.re"
|
||||
#line 1416 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
|
||||
@@ -13473,7 +13472,7 @@ yy843:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_XMLRPC_SOAP;
|
||||
}
|
||||
#line 13477 "ext/date/lib/parse_date.c"
|
||||
#line 13476 "ext/date/lib/parse_date.c"
|
||||
yy844:
|
||||
YYDEBUG(844, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13735,7 +13734,7 @@ yy848:
|
||||
}
|
||||
yy849:
|
||||
YYDEBUG(849, *YYCURSOR);
|
||||
#line 1405 "ext/date/lib/parse_date.re"
|
||||
#line 1404 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datenocolon");
|
||||
TIMELIB_INIT;
|
||||
@@ -13746,7 +13745,7 @@ yy849:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NOCOLON;
|
||||
}
|
||||
#line 13750 "ext/date/lib/parse_date.c"
|
||||
#line 13749 "ext/date/lib/parse_date.c"
|
||||
yy850:
|
||||
YYDEBUG(850, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -14666,7 +14665,7 @@ yy973:
|
||||
if (yych <= '9') goto yy996;
|
||||
yy974:
|
||||
YYDEBUG(974, *YYCURSOR);
|
||||
#line 1282 "ext/date/lib/parse_date.re"
|
||||
#line 1281 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("gnudateshorter");
|
||||
@@ -14679,7 +14678,7 @@ yy974:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 14683 "ext/date/lib/parse_date.c"
|
||||
#line 14682 "ext/date/lib/parse_date.c"
|
||||
yy975:
|
||||
YYDEBUG(975, *YYCURSOR);
|
||||
yyaccept = 22;
|
||||
@@ -15688,7 +15687,7 @@ yy1066:
|
||||
}
|
||||
yy1068:
|
||||
YYDEBUG(1068, *YYCURSOR);
|
||||
#line 1174 "ext/date/lib/parse_date.re"
|
||||
#line 1173 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("gnunocolon");
|
||||
TIMELIB_INIT;
|
||||
@@ -15710,7 +15709,7 @@ yy1068:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_GNU_NOCOLON;
|
||||
}
|
||||
#line 15714 "ext/date/lib/parse_date.c"
|
||||
#line 15713 "ext/date/lib/parse_date.c"
|
||||
yy1069:
|
||||
YYDEBUG(1069, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -15802,7 +15801,7 @@ yy1075:
|
||||
}
|
||||
yy1076:
|
||||
YYDEBUG(1076, *YYCURSOR);
|
||||
#line 1220 "ext/date/lib/parse_date.re"
|
||||
#line 1219 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("iso8601nocolon");
|
||||
@@ -15821,7 +15820,7 @@ yy1076:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_NOCOLON;
|
||||
}
|
||||
#line 15825 "ext/date/lib/parse_date.c"
|
||||
#line 15824 "ext/date/lib/parse_date.c"
|
||||
yy1077:
|
||||
YYDEBUG(1077, *YYCURSOR);
|
||||
yyaccept = 25;
|
||||
@@ -16719,7 +16718,7 @@ yy1117:
|
||||
}
|
||||
yy1118:
|
||||
YYDEBUG(1118, *YYCURSOR);
|
||||
#line 1616 "ext/date/lib/parse_date.re"
|
||||
#line 1615 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@@ -16735,7 +16734,7 @@ yy1118:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 16739 "ext/date/lib/parse_date.c"
|
||||
#line 16738 "ext/date/lib/parse_date.c"
|
||||
yy1119:
|
||||
YYDEBUG(1119, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
@@ -16786,7 +16785,7 @@ yy1126:
|
||||
YYDEBUG(1126, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(1127, *YYCURSOR);
|
||||
#line 1089 "ext/date/lib/parse_date.re"
|
||||
#line 1088 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@@ -16807,7 +16806,7 @@ yy1126:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_WEEK_DAY_OF_MONTH;
|
||||
}
|
||||
#line 16811 "ext/date/lib/parse_date.c"
|
||||
#line 16810 "ext/date/lib/parse_date.c"
|
||||
yy1128:
|
||||
YYDEBUG(1128, *YYCURSOR);
|
||||
yyaccept = 26;
|
||||
@@ -16915,7 +16914,7 @@ yy1141:
|
||||
}
|
||||
yy1142:
|
||||
YYDEBUG(1142, *YYCURSOR);
|
||||
#line 1592 "ext/date/lib/parse_date.re"
|
||||
#line 1591 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@@ -16938,7 +16937,7 @@ yy1142:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 16942 "ext/date/lib/parse_date.c"
|
||||
#line 16941 "ext/date/lib/parse_date.c"
|
||||
yy1143:
|
||||
YYDEBUG(1143, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -19615,7 +19614,7 @@ yy1294:
|
||||
goto yy1298;
|
||||
yy1295:
|
||||
YYDEBUG(1295, *YYCURSOR);
|
||||
#line 1066 "ext/date/lib/parse_date.re"
|
||||
#line 1065 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("backof | frontof");
|
||||
TIMELIB_INIT;
|
||||
@@ -19637,7 +19636,7 @@ yy1295:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_LF_DAY_OF_MONTH;
|
||||
}
|
||||
#line 19641 "ext/date/lib/parse_date.c"
|
||||
#line 19640 "ext/date/lib/parse_date.c"
|
||||
yy1296:
|
||||
YYDEBUG(1296, *YYCURSOR);
|
||||
yyaccept = 28;
|
||||
@@ -21328,7 +21327,7 @@ yy1385:
|
||||
if (yych <= '9') goto yy1385;
|
||||
yy1387:
|
||||
YYDEBUG(1387, *YYCURSOR);
|
||||
#line 1023 "ext/date/lib/parse_date.re"
|
||||
#line 1022 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_ull i;
|
||||
|
||||
@@ -21353,7 +21352,7 @@ yy1387:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 21357 "ext/date/lib/parse_date.c"
|
||||
#line 21356 "ext/date/lib/parse_date.c"
|
||||
yy1388:
|
||||
YYDEBUG(1388, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -21789,7 +21788,7 @@ yy1416:
|
||||
++YYCURSOR;
|
||||
yy1417:
|
||||
YYDEBUG(1417, *YYCURSOR);
|
||||
#line 1011 "ext/date/lib/parse_date.re"
|
||||
#line 1010 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("tomorrow");
|
||||
TIMELIB_INIT;
|
||||
@@ -21800,7 +21799,7 @@ yy1417:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 21804 "ext/date/lib/parse_date.c"
|
||||
#line 21803 "ext/date/lib/parse_date.c"
|
||||
yy1418:
|
||||
YYDEBUG(1418, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -21835,7 +21834,7 @@ yy1419:
|
||||
}
|
||||
yy1420:
|
||||
YYDEBUG(1420, *YYCURSOR);
|
||||
#line 1001 "ext/date/lib/parse_date.re"
|
||||
#line 1000 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("midnight | today");
|
||||
TIMELIB_INIT;
|
||||
@@ -21844,7 +21843,7 @@ yy1420:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 21848 "ext/date/lib/parse_date.c"
|
||||
#line 21847 "ext/date/lib/parse_date.c"
|
||||
yy1421:
|
||||
YYDEBUG(1421, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -23856,7 +23855,7 @@ yy1499:
|
||||
}
|
||||
yy1500:
|
||||
YYDEBUG(1500, *YYCURSOR);
|
||||
#line 980 "ext/date/lib/parse_date.re"
|
||||
#line 979 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("now");
|
||||
TIMELIB_INIT;
|
||||
@@ -23864,7 +23863,7 @@ yy1500:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 23868 "ext/date/lib/parse_date.c"
|
||||
#line 23867 "ext/date/lib/parse_date.c"
|
||||
yy1501:
|
||||
YYDEBUG(1501, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -24003,7 +24002,7 @@ yy1507:
|
||||
}
|
||||
yy1508:
|
||||
YYDEBUG(1508, *YYCURSOR);
|
||||
#line 989 "ext/date/lib/parse_date.re"
|
||||
#line 988 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("noon");
|
||||
TIMELIB_INIT;
|
||||
@@ -24014,7 +24013,7 @@ yy1508:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 24018 "ext/date/lib/parse_date.c"
|
||||
#line 24017 "ext/date/lib/parse_date.c"
|
||||
yy1509:
|
||||
YYDEBUG(1509, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@@ -24547,7 +24546,7 @@ yy1530:
|
||||
++YYCURSOR;
|
||||
yy1531:
|
||||
YYDEBUG(1531, *YYCURSOR);
|
||||
#line 968 "ext/date/lib/parse_date.re"
|
||||
#line 967 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("yesterday");
|
||||
TIMELIB_INIT;
|
||||
@@ -24558,7 +24557,7 @@ yy1531:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 24562 "ext/date/lib/parse_date.c"
|
||||
#line 24561 "ext/date/lib/parse_date.c"
|
||||
yy1532:
|
||||
YYDEBUG(1532, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@@ -24731,7 +24730,7 @@ yy1537:
|
||||
goto yy1531;
|
||||
}
|
||||
}
|
||||
#line 1742 "ext/date/lib/parse_date.re"
|
||||
#line 1741 "ext/date/lib/parse_date.re"
|
||||
|
||||
}
|
||||
|
||||
@@ -25002,7 +25001,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
|
||||
if (sec == TIMELIB_UNSET || length != 2) {
|
||||
add_pbf_error(s, "A two digit second could not be found", string, begin);
|
||||
add_pbf_error(s, "A two second minute could not be found", string, begin);
|
||||
} else {
|
||||
s->time->s = sec;
|
||||
}
|
||||
|
||||
@@ -614,8 +614,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
|
||||
char *begin = *ptr, *end;
|
||||
const timelib_relunit *tp, *value = NULL;
|
||||
|
||||
while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' &&
|
||||
**ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) {
|
||||
while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') {
|
||||
++*ptr;
|
||||
}
|
||||
end = *ptr;
|
||||
@@ -2009,7 +2008,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
|
||||
if (sec == TIMELIB_UNSET || length != 2) {
|
||||
add_pbf_error(s, "A two digit second could not be found", string, begin);
|
||||
add_pbf_error(s, "A two second minute could not be found", string, begin);
|
||||
} else {
|
||||
s->time->s = sec;
|
||||
}
|
||||
|
||||
+794
-784
File diff suppressed because it is too large.
Load diff
+27
-25
@@ -480,7 +480,7 @@ const zend_function_entry date_funcs_immutable[] = {
|
||||
PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
|
||||
PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(DateTimeImmutable, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_ME_MAPPING(createFromFormat, date_create_immutable_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0)
|
||||
PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_date_method_timezone_get, 0)
|
||||
@@ -2142,21 +2142,27 @@ static zval* date_clone_immutable(zval *object TSRMLS_DC)
|
||||
|
||||
static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC)
|
||||
{
|
||||
php_date_obj *o1 = zend_object_store_get_object(d1 TSRMLS_CC);
|
||||
php_date_obj *o2 = zend_object_store_get_object(d2 TSRMLS_CC);
|
||||
if (Z_TYPE_P(d1) == IS_OBJECT && Z_TYPE_P(d2) == IS_OBJECT &&
|
||||
instanceof_function(Z_OBJCE_P(d1), date_ce_date TSRMLS_CC) &&
|
||||
instanceof_function(Z_OBJCE_P(d2), date_ce_date TSRMLS_CC)) {
|
||||
php_date_obj *o1 = zend_object_store_get_object(d1 TSRMLS_CC);
|
||||
php_date_obj *o2 = zend_object_store_get_object(d2 TSRMLS_CC);
|
||||
|
||||
if (!o1->time || !o2->time) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to compare an incomplete DateTime or DateTimeImmutable object");
|
||||
return 1;
|
||||
}
|
||||
if (!o1->time->sse_uptodate) {
|
||||
timelib_update_ts(o1->time, o1->time->tz_info);
|
||||
}
|
||||
if (!o2->time->sse_uptodate) {
|
||||
timelib_update_ts(o2->time, o2->time->tz_info);
|
||||
if (!o1->time || !o2->time) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to compare an incomplete DateTime object");
|
||||
return 1;
|
||||
}
|
||||
if (!o1->time->sse_uptodate) {
|
||||
timelib_update_ts(o1->time, o1->time->tz_info);
|
||||
}
|
||||
if (!o2->time->sse_uptodate) {
|
||||
timelib_update_ts(o2->time, o2->time->tz_info);
|
||||
}
|
||||
|
||||
return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1);
|
||||
}
|
||||
|
||||
return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HashTable *date_object_get_gc(zval *object, zval ***table, int *n TSRMLS_DC)
|
||||
@@ -2192,13 +2198,13 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
|
||||
/* first we add the date and time in ISO format */
|
||||
MAKE_STD_ZVAL(zv);
|
||||
ZVAL_STRING(zv, date_format("Y-m-d H:i:s", 12, dateobj->time, 1), 0);
|
||||
zend_hash_update(props, "date", 5, &zv, sizeof(zv), NULL);
|
||||
zend_hash_update(props, "date", 5, &zv, sizeof(zval), NULL);
|
||||
|
||||
/* then we add the timezone name (or similar) */
|
||||
if (dateobj->time->is_localtime) {
|
||||
MAKE_STD_ZVAL(zv);
|
||||
ZVAL_LONG(zv, dateobj->time->zone_type);
|
||||
zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zv), NULL);
|
||||
zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zval), NULL);
|
||||
|
||||
MAKE_STD_ZVAL(zv);
|
||||
switch (dateobj->time->zone_type) {
|
||||
@@ -2221,7 +2227,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
|
||||
ZVAL_STRING(zv, dateobj->time->tz_abbr, 1);
|
||||
break;
|
||||
}
|
||||
zend_hash_update(props, "timezone", 9, &zv, sizeof(zv), NULL);
|
||||
zend_hash_update(props, "timezone", 9, &zv, sizeof(zval), NULL);
|
||||
}
|
||||
|
||||
return props;
|
||||
@@ -2299,7 +2305,7 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC)
|
||||
|
||||
MAKE_STD_ZVAL(zv);
|
||||
ZVAL_LONG(zv, tzobj->type);
|
||||
zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zv), NULL);
|
||||
zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zval), NULL);
|
||||
|
||||
MAKE_STD_ZVAL(zv);
|
||||
switch (tzobj->type) {
|
||||
@@ -2321,7 +2327,7 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC)
|
||||
ZVAL_STRING(zv, tzobj->tzi.z.abbr, 1);
|
||||
break;
|
||||
}
|
||||
zend_hash_update(props, "timezone", 9, &zv, sizeof(zv), NULL);
|
||||
zend_hash_update(props, "timezone", 9, &zv, sizeof(zval), NULL);
|
||||
|
||||
return props;
|
||||
}
|
||||
@@ -2388,7 +2394,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
|
||||
#define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \
|
||||
MAKE_STD_ZVAL(zv); \
|
||||
ZVAL_LONG(zv, (long)intervalobj->diff->f); \
|
||||
zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zv), NULL);
|
||||
zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zval), NULL);
|
||||
|
||||
PHP_DATE_INTERVAL_ADD_PROPERTY("y", y);
|
||||
PHP_DATE_INTERVAL_ADD_PROPERTY("m", m);
|
||||
@@ -2405,7 +2411,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
|
||||
} else {
|
||||
MAKE_STD_ZVAL(zv);
|
||||
ZVAL_FALSE(zv);
|
||||
zend_hash_update(props, "days", 5, &zv, sizeof(zv), NULL);
|
||||
zend_hash_update(props, "days", 5, &zv, sizeof(zval), NULL);
|
||||
}
|
||||
PHP_DATE_INTERVAL_ADD_PROPERTY("special_type", special.type);
|
||||
PHP_DATE_INTERVAL_ADD_PROPERTY("special_amount", special.amount);
|
||||
@@ -4058,11 +4064,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze
|
||||
ALLOC_INIT_ZVAL(retval);
|
||||
Z_SET_REFCOUNT_P(retval, 0);
|
||||
|
||||
if (value != -99999) {
|
||||
ZVAL_LONG(retval, value);
|
||||
} else {
|
||||
ZVAL_FALSE(retval);
|
||||
}
|
||||
ZVAL_LONG(retval, value);
|
||||
|
||||
if (member == &tmp_member) {
|
||||
zval_dtor(member);
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
Wrong var_dump(DateInterval->days) value
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$interval = new DateInterval('P2Y4DT6H8M');
|
||||
|
||||
var_dump($interval->days);
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
@@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Test fix for DateTime when date have textual day with dot or other special char at end
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//Set the default time zone
|
||||
date_default_timezone_set('Europe/London');
|
||||
|
||||
echo "*** Testing clone on DateTime objects ***\n";
|
||||
|
||||
// Create a DateTime object..
|
||||
$orig = new DateTime('2012-11-29 17:00:00');
|
||||
|
||||
// String to parse
|
||||
$string = "Thu., Nov. 29, 2012 5:00PM";
|
||||
|
||||
// Create a DateTime object from format
|
||||
$fromFormat = DateTime::createFromFormat( "D., M# j, Y g:iA", $string );
|
||||
|
||||
echo "Format method: " . $orig->format("D., M. j, Y g:iA") . "\n";
|
||||
echo "createFromFormat method: " . $fromFormat->format("D., M. j, Y g:iA") . "\n";
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing clone on DateTime objects ***
|
||||
Format method: Thu., Nov. 29, 2012 5:00PM
|
||||
createFromFormat method: Thu., Nov. 29, 2012 5:00PM
|
||||
===DONE===
|
||||
@@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
Test for bug #64157: DateTime::createFromFormat() reports confusing error message
|
||||
--CREDITS--
|
||||
Boro Sitnikovski <buritomath@yahoo.com>
|
||||
--INI--
|
||||
date.timezone = UTC
|
||||
--FILE--
|
||||
<?php
|
||||
DateTime::createFromFormat('s', '0');
|
||||
$lastErrors = DateTime::getLastErrors();
|
||||
print_r($lastErrors['errors'][0]);
|
||||
?>
|
||||
--EXPECT--
|
||||
A two digit second could not be found
|
||||
@@ -6,8 +6,6 @@ if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
|
||||
die("skip Test is valid for Windows");
|
||||
}
|
||||
?>
|
||||
--INI--
|
||||
date.timezone = UTC
|
||||
--FILE--
|
||||
<?php
|
||||
setlocale(LC_ALL, 'Japanese_Japan.932');
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
Test for bug #65502: DateTimeImmutable::createFromFormat returns DateTime
|
||||
--CREDITS--
|
||||
Boro Sitnikovski <buritomath@yahoo.com>
|
||||
--INI--
|
||||
date.timezone = UTC
|
||||
--FILE--
|
||||
<?php
|
||||
echo get_class(DateTimeImmutable::createFromFormat('j-M-Y', '12-Sep-2013'));
|
||||
?>
|
||||
--EXPECT--
|
||||
DateTimeImmutable
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
Test for bug #65548: Comparison for DateTimeImmutable doesn't work
|
||||
--CREDITS--
|
||||
Boro Sitnikovski <buritomath@yahoo.com>
|
||||
--INI--
|
||||
date.timezone = UTC
|
||||
--FILE--
|
||||
<?php
|
||||
$iToday = new DateTimeImmutable('today');
|
||||
$iTomorrow = new DateTimeImmutable('tomorrow');
|
||||
|
||||
$mToday = new DateTime('today');
|
||||
$mTomorrow = new DateTime('tomorrow');
|
||||
|
||||
var_dump($iToday < $iTomorrow);
|
||||
var_dump($iToday == $iTomorrow);
|
||||
var_dump($iToday > $iTomorrow);
|
||||
|
||||
var_dump($iToday == $mToday);
|
||||
var_dump($iToday === $mToday);
|
||||
|
||||
var_dump($iToday < $mTomorrow);
|
||||
var_dump($iToday == $mTomorrow);
|
||||
var_dump($iToday > $mTomorrow);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
+6
-19
@@ -226,17 +226,12 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS
|
||||
*key_free = *key_str;
|
||||
return len;
|
||||
} else {
|
||||
zval tmp = *key;
|
||||
int len;
|
||||
*key_free = NULL;
|
||||
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_string(&tmp);
|
||||
convert_to_string(key);
|
||||
*key_str = Z_STRVAL_P(key);
|
||||
|
||||
*key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
|
||||
len = Z_STRLEN(tmp);
|
||||
|
||||
zval_dtor(&tmp);
|
||||
return len;
|
||||
return Z_STRLEN_P(key);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -302,14 +297,6 @@ 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 */
|
||||
@@ -570,7 +557,7 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||
|
||||
DBA_FETCH_RESOURCE(info, &id);
|
||||
|
||||
DBA_WRITE_CHECK_WITH_ID;
|
||||
DBA_WRITE_CHECK;
|
||||
|
||||
if (info->hnd->update(info, key_str, key_len, val, val_len, mode TSRMLS_CC) == SUCCESS) {
|
||||
DBA_ID_DONE;
|
||||
@@ -1123,7 +1110,7 @@ PHP_FUNCTION(dba_delete)
|
||||
{
|
||||
DBA_ID_GET2;
|
||||
|
||||
DBA_WRITE_CHECK_WITH_ID;
|
||||
DBA_WRITE_CHECK;
|
||||
|
||||
if(info->hnd->delete(info, key_str, key_len TSRMLS_CC) == SUCCESS)
|
||||
{
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
--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
|
||||
@@ -1089,11 +1089,7 @@ void dom_xpath_objects_free_storage(void *object TSRMLS_DC)
|
||||
void dom_objects_free_storage(void *object TSRMLS_DC)
|
||||
{
|
||||
dom_object *intern = (dom_object *)object;
|
||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||
int retcount __attribute__((unused)); /* keep compiler quiet */
|
||||
#else
|
||||
int retcount;
|
||||
#endif
|
||||
|
||||
zend_object_std_dtor(&intern->std TSRMLS_CC);
|
||||
|
||||
|
||||
@@ -484,6 +484,10 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
}
|
||||
s++;
|
||||
}
|
||||
|
||||
if (*(e - 1) == '.') {
|
||||
goto bad_url;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -714,7 +718,6 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
if (flags & FILTER_FLAG_NO_RES_RANGE) {
|
||||
if (
|
||||
(ip[0] == 0) ||
|
||||
(ip[0] == 100 && (ip[1] >= 64 || ip[1] <= 127)) ||
|
||||
(ip[0] == 128 && ip[1] == 0) ||
|
||||
(ip[0] == 191 && ip[1] == 255) ||
|
||||
(ip[0] == 169 && ip[1] == 254) ||
|
||||
|
||||
@@ -15,8 +15,6 @@ var_dump(filter_var("192.168.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE
|
||||
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE));
|
||||
var_dump(filter_var("127.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
|
||||
var_dump(filter_var("192.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
|
||||
var_dump(filter_var("100.0.0.0", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
|
||||
var_dump(filter_var("100.127.255.255", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
|
||||
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP));
|
||||
var_dump(filter_var("256.1237.123.1", FILTER_VALIDATE_IP));
|
||||
var_dump(filter_var("255.255.255.255", FILTER_VALIDATE_IP));
|
||||
@@ -42,8 +40,6 @@ bool(false)
|
||||
string(12) "192.0.34.166"
|
||||
bool(false)
|
||||
string(9) "192.0.0.1"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(12) "192.0.34.166"
|
||||
bool(false)
|
||||
string(15) "255.255.255.255"
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
bug 64441, FILTER_VALIDATE_URL will invalidate a hostname that ended by dot
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(filter_var('http://example.com./', FILTER_VALIDATE_URL));
|
||||
var_dump(filter_var('http://example.com/', FILTER_VALIDATE_URL));
|
||||
--EXPECT--
|
||||
string(20) "http://example.com./"
|
||||
string(19) "http://example.com/"
|
||||
@@ -790,6 +790,7 @@ int
|
||||
ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC)
|
||||
{
|
||||
databuf_t *data = NULL;
|
||||
int lastch;
|
||||
size_t rcvd;
|
||||
char arg[11];
|
||||
|
||||
@@ -827,6 +828,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
|
||||
goto bail;
|
||||
}
|
||||
|
||||
lastch = 0;
|
||||
while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) {
|
||||
if (rcvd == -1) {
|
||||
goto bail;
|
||||
@@ -1185,9 +1187,12 @@ ftp_readline(ftpbuf_t *ftp)
|
||||
int
|
||||
ftp_getresp(ftpbuf_t *ftp)
|
||||
{
|
||||
char *buf;
|
||||
|
||||
if (ftp == NULL) {
|
||||
return 0;
|
||||
}
|
||||
buf = ftp->inbuf;
|
||||
ftp->resp = 0;
|
||||
|
||||
while (1) {
|
||||
|
||||
+1
-3
@@ -968,9 +968,7 @@ PHP_FUNCTION(ftp_nb_get)
|
||||
RETURN_LONG(PHP_FTP_FAILED);
|
||||
}
|
||||
|
||||
if (ret == PHP_FTP_FINISHED){
|
||||
php_stream_close(outstream);
|
||||
}
|
||||
php_stream_close(outstream);
|
||||
|
||||
RETURN_LONG(ret);
|
||||
}
|
||||
|
||||
@@ -1,182 +0,0 @@
|
||||
--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,13 +368,6 @@ 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;
|
||||
|
||||
@@ -1065,7 +1065,6 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt
|
||||
if (tmp_im == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
gdImageSetInterpolationMethod(tmp_im, src->interpolation_id);
|
||||
_gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height);
|
||||
|
||||
dst = gdImageCreateTrueColor(new_width, new_height);
|
||||
@@ -1073,7 +1072,6 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt
|
||||
gdFree(tmp_im);
|
||||
return NULL;
|
||||
}
|
||||
gdImageSetInterpolationMethod(dst, src->interpolation_id);
|
||||
_gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
|
||||
gdFree(tmp_im);
|
||||
|
||||
@@ -1088,9 +1086,8 @@ gdImagePtr Scale(const gdImagePtr src, const unsigned int src_width, const unsig
|
||||
if (tmp_im == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
gdImageSetInterpolationMethod(tmp_im, src->interpolation_id);
|
||||
|
||||
_gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height);
|
||||
|
||||
_gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
|
||||
|
||||
gdFree(tmp_im);
|
||||
|
||||
+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" && test -r "$IMAP_DIR/c-client/c-client.a" ; then
|
||||
if 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" && test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
|
||||
elif 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
|
||||
|
||||
|
||||
@@ -39,4 +39,4 @@ U_CFUNC zend_object_iterator *_breakiterator_get_iterator(
|
||||
zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
|
||||
U_CFUNC void breakiterator_register_IntlPartsIterator_class(TSRMLS_D);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -61,4 +61,4 @@ PHP_FUNCTION(breakiter_get_error_code);
|
||||
|
||||
PHP_FUNCTION(breakiter_get_error_message);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -95,4 +95,4 @@ namespace PHP {
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -41,4 +41,4 @@ U_CFUNC PHP_FUNCTION(cpbi_get_last_code_point)
|
||||
BREAKITER_METHOD_FETCH_OBJECT;
|
||||
|
||||
RETURN_LONG(fetch_cpbi(bio)->getLastCodePoint());
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,4 @@
|
||||
|
||||
PHP_FUNCTION(cpbi_get_last_code_point);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -29,4 +29,4 @@ PHP_FUNCTION(rbbi_get_rule_status_vec);
|
||||
|
||||
PHP_FUNCTION(rbbi_get_binary_rules);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -184,6 +184,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_keyword_values_for_locale)
|
||||
|
||||
U_CFUNC PHP_FUNCTION(intlcal_get_now)
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
intl_error_reset(NULL TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
|
||||
@@ -38,6 +38,7 @@ static inline GregorianCalendar *fetch_greg(Calendar_object *co) {
|
||||
|
||||
static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
zval *object = getThis();
|
||||
zval **tz_object = NULL;
|
||||
zval **args_a[6] = {0},
|
||||
***args = &args_a[0];
|
||||
@@ -83,7 +84,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
|
||||
}
|
||||
|
||||
// instantion of ICU object
|
||||
GregorianCalendar *gcal = NULL;
|
||||
GregorianCalendar *gcal;
|
||||
|
||||
if (variant <= 2) {
|
||||
// From timezone and locale (0 to 2 arguments)
|
||||
|
||||
@@ -31,4 +31,4 @@
|
||||
#define _MSC_STDINT_H_ 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -487,7 +487,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
|
||||
}
|
||||
case Formattable::kLong:
|
||||
{
|
||||
int32_t tInt32 = 0;
|
||||
int32_t tInt32;
|
||||
retry_klong:
|
||||
if (Z_TYPE_PP(elem) == IS_DOUBLE) {
|
||||
if (Z_DVAL_PP(elem) > (double)INT32_MAX ||
|
||||
@@ -517,7 +517,7 @@ retry_klong:
|
||||
}
|
||||
case Formattable::kInt64:
|
||||
{
|
||||
int64_t tInt64 = 0;
|
||||
int64_t tInt64;
|
||||
retry_kint64:
|
||||
if (Z_TYPE_PP(elem) == IS_DOUBLE) {
|
||||
if (Z_DVAL_PP(elem) > (double)U_INT64_MAX ||
|
||||
|
||||
@@ -41,7 +41,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so
|
||||
case URES_STRING:
|
||||
ufield = ures_getString( source->child, &ilen, &INTL_DATA_ERROR_CODE(source) );
|
||||
INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve string value");
|
||||
INTL_METHOD_RETVAL_UTF8(source, (UChar *)ufield, ilen, 0);
|
||||
INTL_METHOD_RETVAL_UTF8(source, ufield, ilen, 0);
|
||||
break;
|
||||
|
||||
case URES_BINARY:
|
||||
|
||||
@@ -163,6 +163,7 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_
|
||||
{
|
||||
int32_t meindex = 0;
|
||||
char * mekey = NULL;
|
||||
long mekeylen;
|
||||
zend_bool is_numeric = 0;
|
||||
char *pbuf;
|
||||
ResourceBundle_object *rb;
|
||||
@@ -176,6 +177,7 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_
|
||||
rb->child = ures_getByIndex( rb->me, meindex, rb->child, &INTL_DATA_ERROR_CODE(rb) );
|
||||
} else if(Z_TYPE_P(offset) == IS_STRING) {
|
||||
mekey = Z_STRVAL_P(offset);
|
||||
mekeylen = Z_STRLEN_P(offset);
|
||||
rb->child = ures_getByKey(rb->me, mekey, rb->child, &INTL_DATA_ERROR_CODE(rb) );
|
||||
} else {
|
||||
intl_errors_set(INTL_DATA_ERROR_P(rb), U_ILLEGAL_ARGUMENT_ERROR,
|
||||
|
||||
@@ -4,9 +4,6 @@ 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);
|
||||
@@ -34,4 +31,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==
|
||||
@@ -1,37 +0,0 @@
|
||||
--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,7 +2,6 @@
|
||||
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
|
||||
|
||||
|
||||
@@ -1,243 +0,0 @@
|
||||
--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,7 +2,6 @@
|
||||
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
|
||||
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
--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,8 +3,6 @@ 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
|
||||
|
||||
@@ -97,4 +95,4 @@ key: 5c0a161801070107
|
||||
source: жжж
|
||||
key: 5c3a3a3a01070107
|
||||
source: эюя
|
||||
key: 5d3b3f4501070107
|
||||
key: 5d3b3f4501070107
|
||||
@@ -1,98 +0,0 @@
|
||||
--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,7 +2,6 @@
|
||||
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
|
||||
|
||||
|
||||
@@ -1,248 +0,0 @@
|
||||
--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,7 +2,6 @@
|
||||
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
|
||||
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
--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'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
--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'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
--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,7 +2,6 @@
|
||||
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'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
--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') ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
--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,7 +2,6 @@
|
||||
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
|
||||
|
||||
|
||||
@@ -1,295 +0,0 @@
|
||||
--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' ,
|
||||
@@ -1,423 +0,0 @@
|
||||
--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'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
--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'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') >= 0) die('skip for ICU < 51.2'); ?>
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
--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==
|
||||
Loaded 100 of 240 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user