Compare commits

..
Author SHA1 Message Date
Davey Shafik 6a77550df1 Update versions/dates for PHP 7.1.0RC2 2016-09-14 11:58:39 +00:00
314 changed files with 20845 additions and 27606 deletions

No files matched your search

+3 -147
View File
@@ -1,153 +1,10 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
27 Oct 2016, PHP 7.1.0RC5
- Core:
. Fixed bug #73350 (Exception::__toString() cause circular references).
(Laruence)
. Fixed bug #73329 ((Float)"Nano" == NAN). (Anatol)
- CLI Server:
. Fixed bug #73360 (Unable to work in root with unicode chars). (Anatol)
- SQLite3:
. Fixed bug #73333 (2147483647 is fetched as string). (cmb)
19 Oct 2016, PHP 7.1.0RC4
- Core:
. Fixed bug #73288 (Segfault in __clone > Exception.toString > __get).
(Laruence)
. Fixed for #73240 (Write out of bounds at number_format). (Stas)
. Fix pthreads detection when cross-compiling (ffontaine)
. Fixed bug #73337 (try/catch not working with two exceptions inside a same
operation). (Dmitry)
- BCmath:
. Fix bug #73190 (memcpy negative parameter _bc_new_num_ex). (Stas)
- Date:
. Fixed bug #45554 (Inconsistent behavior of the u format char). (Derick)
. Fixed bug #48225 (DateTime parser doesn't set microseconds for "now").
(Derick)
. Fixed bug #52514 (microseconds are missing in DateTime class). (Derick)
. Fixed bug #52519 (microseconds in DateInterval are missing). (Derick)
. Fixed bug #60089 (DateTime::createFromFormat() U after u nukes microtime).
(Derick)
. Fixed bug #64887 (Allow DateTime modification with subsecond items).
(Derick)
. Fixed bug #68506 (General DateTime improvments needed for microseconds to
become useful). (Derick)
. Fixed bug #73109 (timelib_meridian doesn't parse dots correctly). (Derick)
. Fixed bug #73247 (DateTime constructor does not initialise microseconds
property). (Derick)
. Fixed bug #73147 (Use After Free in PHP7 unserialize()). (Stas)
. Fixed bug #73189 (Memcpy negative size parameter php_resolve_path). (Stas)
- DOM:
. Fixed bug #73150 (missing NULL check in dom_document_save_html). (Stas)
- GD:
. Fixed bug #73213 (Integer overflow in imageline() with antialiasing). (cmb)
. Fixed bug #73272 (imagescale() is not affected by, but affects
imagesetinterpolation()). (cmb)
. Fixed bug #73279 (Integer overflow in gdImageScaleBilinearPalette()). (cmb)
. Fixed bug #73280 (Stack Buffer Overflow in GD dynamicGetbuf). (cmb)
- Intl:
. Fixed bug #73007 (add locale length check). (Stas)
. Fixed bug #73218 (add mitigation for ICU int overflow). (Stas)
- OCI8
. Fixed bug #71148 (Bind reference overwritten on PHP 7). (Oracle Corp.)
- OpenSSL:
. Fixed bug #73276 (crash in openssl_random_pseudo_bytes function). (Stas)
- Session:
. Fixed bug #73273 (session_unset() empties values from all variables in which
is $_session stored). (Nikita)
- SOAP:
. Fixed bug #73037 (SoapServer reports Bad Request when gzipped). (Anatol)
. Fixed bug #73237 (Nested object in "any" element overwrites other fields).
(Keith Smiley)
. Fixed bug #69137 (Peer verification fails when using a proxy with SoapClient)
(Keith Smiley)
- SimpleXML:
. Fixed bug #73293 (NULL pointer dereference in SimpleXMLElement::asXML()).
(Stas)
- SQLite3:
. Updated to SQLite3 3.15.0. (cmb)
- Standard:
. Fixed bug #73203 (passing additional_parameters causes mail to fail). (cmb)
29 Sep 2016, PHP 7.1.0RC3
- Core:
. Fixed bug #73156 (segfault on undefined function). (Dmitry)
. Fixed bug #73163 (PHP hangs if error handler throws while accessing undef
const in default value). (Nikita)
. Fixed bug #73172 (parse error: Invalid numeric literal). (Nikita, Anatol)
. Fixed bug #73181 (parse_str() without a second argument leads to crash).
(Nikita)
- COM:
. Fixed bug #73126 (Cannot pass parameter 1 by reference). (Anatol)
. Fixed bug #69579 (Invalid free in extension trait). (John Boehr)
- GD:
. Fixed bug #50194 (imagettftext broken on transparent background w/o
alphablending). (cmb)
. Fixed bug #73003 (Integer Overflow in gdImageWebpCtx of gd_webp.c). (trylab,
cmb)
. Fixed bug #53504 (imagettfbbox gives incorrect values for bounding box).
(Mark Plomer, cmb)
. Fixed bug #73157 (imagegd2() ignores 3rd param if 4 are given). (cmb)
. Fixed bug #73155 (imagegd2() writes wrong chunk sizes on boundaries). (cmb)
. Fixed bug #73159 (imagegd2(): unrecognized formats may result in corrupted
files). (cmb)
. Fixed bug #73161 (imagecreatefromgd2() may leak memory). (cmb)
- JSON:
. Fixed bug #73113 (Segfault with throwing JsonSerializable). (julien)
- PCRE:
. Fixed bug #73121 (Bundled PCRE doesn't compile because JIT isn't supported
on s390). (Anatol)
- PDO_DBlib:
. Fixed bug #72414 (Never quote values as raw binary data). (Adam Baratz)
. Allow \PDO::setAttribute() to set query timeouts. (Adam Baratz)
. Handle SQLDECIMAL/SQLNUMERIC types, which are used by later TDS versions.
(Adam Baratz)
. Add common PDO test suite. (Adam Baratz)
. Free error and message strings when cleaning up PDO instances.
(Adam Baratz)
. Fixed bug #67130 (\PDOStatement::nextRowset() should succeed when all rows
in current rowset haven't been fetched). (Peter LeBrun)
. Ignore potentially misleading dberr values. (Chris Kings-Lynne)
- phpdbg:
. Added generator command for inspection of currently alive generators. (Bob)
- Reflection
. Undo backwards compatiblity break in ReflectionType->__toString() and
deprecate via documentation instead. (Nikita)
- Session:
. Fixed bug #73100 (session_destroy null dereference in ps_files_path_create).
(cmb)
- Standard:
. Fixed bug #73203 (passing additional_parameters causes mail to fail). (cmb)
15 Sep 2016, PHP 7.1.0RC2
- Core:
. Fixed bug #73067 (__debugInfo crashes when throwing an exception).
(Laruence)
. Fixed bug #73025 (Heap Buffer Overflow in virtual_popen of
zend_virtual_cwd.c). (cmb)
. Fixed bug #73058 (crypt broken when salt is 'too' long). (Anatol)
@@ -546,8 +403,7 @@ PHP NEWS
(Pierre)
. Fixed bug #72482 (Ilegal write/read access caused by gdImageAALine
overflow). (Pierre)
. Fixed bug #72494 (imagecropauto out-of-bounds access). (Fernando, Pierre,
cmb)
. Fixed bug #72494 (imagecropauto out-of-bounds access). (Pierre)
- Intl:
. Partially fixed #72506 (idn_to_ascii for UTS #46 incorrect for long domain
+29 -27
View File
@@ -66,10 +66,9 @@ dnl
dnl Check whether the current setup can use POSIX threads calls
dnl
AC_DEFUN([PTHREADS_CHECK_COMPILE], [
AC_TRY_LINK( [
AC_TRY_RUN( [
#include <pthread.h>
#include <stddef.h>
], [
void *thread_routine(void *data) {
return data;
@@ -82,10 +81,17 @@ int main() {
pthread_mutexattr_init(&mattr);
return pthread_create(&thd, NULL, thread_routine, &data);
} ], [
pthreads_checked=yes
pthreads_working=yes
], [
pthreads_checked=no
]
pthreads_working=no
], [
dnl For cross compiling running this test is of no use. NetWare supports pthreads
pthreads_working=no
case $host_alias in
*netware*)
pthreads_working=yes
esac
]
) ] )dnl
dnl
dnl PTHREADS_CHECK()
@@ -123,34 +129,30 @@ else
CFLAGS="$CFLAGS $flag"
PTHREADS_CHECK_COMPILE
CFLAGS=$ac_save
if test "$pthreads_checked" = "yes"; then
if test "$pthreads_working" = "yes"; then
ac_cv_pthreads_cflags=$flag
break
fi
done
fi
])
AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[
ac_cv_pthreads_lib=
if test "$pthreads_working" != "yes"; then
for lib in pthread pthreads c_r; do
ac_save=$LIBS
LIBS="$LIBS -l$lib"
PTHREADS_CHECK_COMPILE
LIBS=$ac_save
if test "$pthreads_checked" = "yes"; then
ac_cv_pthreads_lib=$lib
break
fi
done
fi
])
if test "x$ac_cv_pthreads_cflags" != "x" -o "x$ac_cv_pthreads_lib" != "x"; then
pthreads_working="yes"
fi
fi
])
AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[
ac_cv_pthreads_lib=
if test "$pthreads_working" != "yes"; then
for lib in pthread pthreads c_r; do
ac_save=$LIBS
LIBS="$LIBS -l$lib"
PTHREADS_CHECK_COMPILE
LIBS=$ac_save
if test "$pthreads_working" = "yes"; then
ac_cv_pthreads_lib=$lib
break
fi
done
fi
])
if test "$pthreads_working" = "yes"; then
threads_result="POSIX-Threads found"
+6 -20
View File
@@ -49,9 +49,9 @@ PHP 7.1 UPGRADE NOTES
the notice level only.
. Don't call destructors of incompletely constructed objects, even if they
are kept referenced. See bug #29368 and Zend/tests/bug29368_1.phpt.
. call_user_func() will now consistently throw a warning if a function with
reference arguments is called. However, call_user_func() will no longer
abort the call in this case.
. call_user_func() will now consistently fail to perform calls to functions
that accept reference arguments. Previously this sometimes worked if
call_user_func() was used outside a namespace.
. rand() and srand() are now aliases of mt_rand() and mt_srand().
Consequently the output of the following functions has changed:
. rand()
@@ -80,16 +80,6 @@ PHP 7.1 UPGRADE NOTES
fatal error" to "Recoverable fatal error".
. The empty index operator (e.g. $str[] = $x) is not supported for strings
anymore, and throws a fatal error instead of silently converting to array.
. Array elements or object properties that are automatically created during
by-reference assignments will now result in a different order. For example
$array = [];
$array["a"] =& $array["b"];
$array["b"] = 1;
var_dump($array);
now results in the array ["b" => 1, "a" => 1], while for PHP 7.0 the result
was ["a" => 1, "b" => 1].
- JSON:
. The serialize_precision is used instead of precision when encoding double
@@ -133,13 +123,14 @@ PHP 7.1 UPGRADE NOTES
SHA2 and 5 bits = 39 chars, ceil(192/5)=39
SHA1 and 6 bits = 32 chars, ceil(192/6)=32
and so on.
. session_start() returns FALSE and no longer initializes $_SESSION when
it failed to start session.
- Reflection:
. The behavior of ReflectionMethod::invoke() and ::invokeArgs() has been
aligned, which causes slightly different behavior than before for some
pathological cases.
. ReflectionType::__toString() will now return the type name with a leading
"?" if it is nullable. To retrieve the type name without leading "?" the new
ReflectionNamedType::getName() method can be used.
========================================
2. New Features
@@ -177,8 +168,6 @@ PHP 7.1 UPGRADE NOTES
type declarations, and some internal functions. Both nullable type
declarations (?int) and parameters with default values of null
(int $foo = NULL) are considered to "accept null" for this purpose.
. The simple syntax for variable parsing inside of string literals now
supports negative offsets.
========================================
3. Changes in SAPI modules
@@ -387,9 +376,6 @@ PHP 7.1 UPGRADE NOTES
PGSQL_NOTICE_ALL
PGSQL_NOTICE_CLEAR
- Standard:
. IMAGETYPE_WEBP
========================================
11. Changes to INI File Handling
========================================
@@ -1,25 +0,0 @@
--TEST--
Next free element may overflow in array literals
--FILE--
<?php
$i = PHP_INT_MAX;
$array = [$i => 42, new stdClass];
var_dump($array);
const FOO = [PHP_INT_MAX => 42, "foo"];
var_dump(FOO);
?>
--EXPECTF--
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
array(1) {
[%d]=>
int(42)
}
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
array(1) {
[%d]=>
int(42)
}
@@ -1,56 +0,0 @@
--TEST--
Various null return conditions of dim/obj assignments
--FILE--
<?php
function test() {
$array = [PHP_INT_MAX => 42];
$true = true;
var_dump($array[] = 123);
var_dump($array[[]] = 123);
var_dump($array[new stdClass] = 123);
var_dump($true[123] = 456);
var_dump($array[] += 123);
var_dump($array[[]] += 123);
var_dump($array[new stdClass] += 123);
var_dump($true[123] += 456);
var_dump($true->foo = 123);
var_dump($true->foo += 123);
}
test();
?>
--EXPECTF--
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
NULL
Warning: Illegal offset type in %s on line %d
NULL
Warning: Illegal offset type in %s on line %d
NULL
Warning: Cannot use a scalar value as an array in %s on line %d
NULL
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
NULL
Warning: Illegal offset type in %s on line %d
NULL
Warning: Illegal offset type in %s on line %d
NULL
Warning: Cannot use a scalar value as an array in %s on line %d
NULL
Warning: Attempt to assign property of non-object in %s on line %d
NULL
Warning: Attempt to assign property of non-object in %s on line %d
NULL
+1 -1
View File
@@ -7,7 +7,7 @@ $r = new ReflectionMethod($f, '__invoke');
var_dump($r->getParameters()[0]->getName());
var_dump($r->getParameters()[0]->getClass());
echo $r->getParameters()[0], "\n";
echo $r->getReturnType()->getName(), "\n";
echo $r->getReturnType(),"\n";
echo $r,"\n";
?>
--EXPECT--
-22
View File
@@ -1,22 +0,0 @@
--TEST--
Bug #72918 (negative offset inside a quoted string leads to parse error)
--FILE--
<?php
$array = [-3 => 'foo'];
$string = 'abcde';
echo "$array[-3]\n";
echo "$string[-3]\n";
echo <<<EOT
$array[-3]
$string[-3]
EOT;
?>
===DONE===
--EXPECT--
foo
c
foo
c
===DONE===
+21
View File
@@ -0,0 +1,21 @@
--TEST--
Bug #73067 (__debugInfo crashes when throwing an exception)
--FILE--
<?php
class Debug
{
public function __debugInfo()
{
throw new Exception("Test Crash");
}
}
try {
var_dump(new Debug());
} catch (Exception $e) {
echo $e->getMessage();
}
?>
--EXPECTF--
Fatal error: __debuginfo() must return an array in %sbug73067.php on line %d
-50
View File
@@ -1,50 +0,0 @@
--TEST--
Bug #73156 (segfault on undefined function)
--FILE--
<?php
class A {
public function __call($name, $args) {
eval('$args = array(); var_dump(debug_backtrace());');
}
}
$a = new A();
$a->test("test");
?>
--EXPECTF--
array(2) {
[0]=>
array(3) {
["file"]=>
string(%d) "%sbug73156.php"
["line"]=>
int(4)
["function"]=>
string(4) "eval"
}
[1]=>
array(7) {
["file"]=>
string(%d) "%sbug73156.php"
["line"]=>
int(10)
["function"]=>
string(6) "__call"
["class"]=>
string(1) "A"
["object"]=>
object(A)#%d (0) {
}
["type"]=>
string(2) "->"
["args"]=>
array(2) {
[0]=>
string(4) "test"
[1]=>
array(0) {
}
}
}
}
-22
View File
@@ -1,22 +0,0 @@
--TEST--
Bug #73163 (PHP hangs if error handler throws while accessing undef const in default value)
--FILE--
<?php
function doSomething(string $value = UNDEFINED) {
}
set_error_handler(function($errno, $errstr) {
throw new Exception($errstr);
});
doSomething();
?>
--EXPECTF--
Fatal error: Uncaught Exception: Use of undefined constant UNDEFINED - assumed 'UNDEFINED' in %s:%d
Stack trace:
#0 %s(%d): {closure}(%s)
#1 %s(%d): doSomething()
#2 {main}
thrown in %s on line %d
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #73181: parse_str() without a second argument leads to crash
--FILE--
<?php
function x() {
parse_str("1&x");
var_dump(get_defined_vars());
}
x();
?>
--EXPECT--
array(2) {
[1]=>
string(0) ""
["x"]=>
string(0) ""
}
-34
View File
@@ -1,34 +0,0 @@
--TEST--
Bug #73288 (Segfault in __clone > Exception.toString > __get)
--INI--
opcache.enable=1
opcache.enable_cli=1
--FILE--
<?php
class NoClone {
public function __clone() {
throw new Exception("No Cloneable");
}
}
class C {
public function __get($name) {
return new NoClone;
}
}
function test_clone() {
$c = new C;
$b = clone $c->x;
}
test_clone();
?>
--EXPECTF--
Fatal error: Uncaught Exception: No Cloneable in %sbug73288.php:%d
Stack trace:
#0 %s(%d): NoClone->__clone()
#1 %s(%d): test_clone()
#2 {main}
thrown in %sbug73288.php on line %d
-12
View File
@@ -1,12 +0,0 @@
--TEST--
Bug #73337 (try/catch not working with two exceptions inside a same operation)
--FILE--
<?php
class d { function __destruct() { throw new Exception; } }
try { new d + new d; } catch (Exception $e) { print "Exception properly caught\n"; }
?>
--EXPECTF--
Notice: Object of class d could not be converted to int in %sbug73337.php on line 3
Notice: Object of class d could not be converted to int in %sbug73337.php on line 3
Exception properly caught
-18
View File
@@ -1,18 +0,0 @@
--TEST--
Bug #73338: Ensure exceptions in function init opcodes are cleaned properly
--FILE--
<?php
try { call_user_func(new class { function __destruct () { throw new Error; } }); } catch (Error $e) {}
set_error_handler(function() { throw new Error; });
try { var_dump(new stdClass, call_user_func("fail")); } catch (Error $e) {}
try { (function() { call_user_func("fail"); })(); } catch (Error $e) {}
try { [new class { static function foo() {} function __destruct () { throw new Error; } }, "foo"](); } catch (Error $e) {}
?>
--EXPECTF--
Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-27
View File
@@ -1,27 +0,0 @@
--TEST--
Bug #73350 (Exception::__toString() cause circular references)
--FILE--
<?php
$e = new Exception();
// This line cause problem :(
// Comment it to see the difference.
(string) $e;
// This line show the clue (PHP Warning: ...).
var_export($e);
?>
--EXPECTF--
Exception::__set_state(array(
'message' => '',
'string' => 'Exception in %sbug73350.php:%d
Stack trace:
#0 {main}',
'code' => 0,
'file' => '%sbug73350.php',
'line' => %d,
'trace' =>
array (
),
'previous' => NULL,
))
-17
View File
@@ -1,17 +0,0 @@
--TEST--
call_user_func() behavior when passing literal to reference parameter
--FILE--
<?php
namespace Foo;
var_dump(call_user_func('sort', []));
var_dump(\call_user_func('sort', []));
?>
--EXPECTF--
Warning: Parameter 1 to sort() expected to be a reference, value given in %s on line %d
bool(true)
Warning: Parameter 1 to sort() expected to be a reference, value given in %s on line %d
bool(true)
@@ -29,7 +29,7 @@ foreach ($callables as $callable) {
foreach ($refl->getParameters() as $param) {
if ($param->hasType()) {
$type = $param->getType();
echo $type->getName() . "\n";
echo $type->__toString() . "\n";
}
}
}
@@ -1,15 +0,0 @@
--TEST--
Constexpr arrays should be able to handle resource keys
--FILE--
<?php
const FOO = [STDIN => 42];
var_dump(FOO);
?>
--EXPECTF--
Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
array(1) {
[%d]=>
int(42)
}
@@ -1,39 +0,0 @@
--TEST--
When performing a dynamic call to a ret-by-ref function, the reference should be unwrapped
--FILE--
<?php
namespace Foo;
function &retRef($x) {
return $x;
}
var_dump(call_user_func('Foo\retRef', 42));
var_dump(call_user_func_array('Foo\retRef', [42]));
$closure = function &($x) {
return $x;
};
var_dump($closure->call(new class {}, 42));
var_dump((new \ReflectionFunction('Foo\retRef'))->invoke(42));
var_dump((new \ReflectionFunction('Foo\retRef'))->invokeArgs([42]));
class Bar {
function &method($x) {
return $x;
}
}
var_dump((new \ReflectionMethod('Foo\Bar', 'method'))->invoke(new Bar, 42));
var_dump((new \ReflectionMethod('Foo\Bar', 'method'))->invokeArgs(new Bar, [42]));
?>
--EXPECT--
int(42)
int(42)
int(42)
int(42)
int(42)
int(42)
int(42)
-11
View File
@@ -1,11 +0,0 @@
--TEST--
Cannot use empty elements in keyed array destructuring
--FILE--
<?php
$array = ['a' => 1, 'b' => 2];
['a' => $a, , 'b' => $b] = $array;
?>
--EXPECTF--
Fatal error: Cannot use empty array entries in keyed array assignment in %s on line %d
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #69579 (Internal trait double-free)
--SKIPIF--
<?php
if (!PHP_DEBUG) die("skip only run in debug version");
?>
--FILE--
<?php
class Bar{
use _ZendTestTrait;
}
$bar = new Bar();
var_dump($bar->testMethod());
// destruction causes a double-free and explodes
?>
--EXPECT--
bool(true)
@@ -12,8 +12,8 @@ final class e { }
var_dump(get_declared_traits());
?>
--EXPECTF--
array(%d) {%A
[%d]=>
--EXPECT--
array(1) {
[0]=>
string(1) "c"
}
@@ -13,8 +13,8 @@ namespace test {
}
?>
--EXPECTF--
array(%d) {%A
[%d]=>
--EXPECT--
array(1) {
[0]=>
string(6) "test\c"
}
@@ -13,15 +13,13 @@ var_dump(get_declared_traits());
?>
--EXPECTF--
array(%d) {%A
[%d]=>
string(1) "a"
%astring(1) "a"
[%d]=>
string(1) "d"
[%d]=>
string(1) "e"
}
array(%d) {%A
[%d]=>
array(1) {
[0]=>
string(1) "c"
}
@@ -1,15 +0,0 @@
--TEST--
"use function" should not conflict with class names
--FILE--
<?php
namespace Foo;
class Bar {}
use function bar;
?>
===DONE===
--EXPECT--
===DONE===
-12
View File
@@ -1,12 +0,0 @@
--TEST--
Use conflicts should not occur across files
--FILE--
<?php
require __DIR__ . '/use_no_file_conflict_1.inc';
require __DIR__ . '/use_no_file_conflict_2.inc';
?>
===DONE===
--EXPECT--
===DONE===
-4
View File
@@ -1,4 +0,0 @@
<?php
namespace Foo;
class A {}
-4
View File
@@ -1,4 +0,0 @@
<?php
namespace Foo;
use A;
+2 -20
View File
@@ -1855,7 +1855,7 @@ static int zend_startup_module_zval(zval *zv) /* {{{ */
{
zend_module_entry *module = Z_PTR_P(zv);
return (zend_startup_module_ex(module) == SUCCESS) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
return zend_startup_module_ex(module);
}
/* }}} */
@@ -2158,7 +2158,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
internal_function->prototype = NULL;
if (ptr->flags) {
if (!(ptr->flags & ZEND_ACC_PPP_MASK)) {
if (ptr->flags != ZEND_ACC_DEPRECATED && scope) {
if (ptr->flags != ZEND_ACC_DEPRECATED || scope) {
zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? ZSTR_VAL(scope->name) : "", scope ? "::" : "", ptr->fname);
}
internal_function->fn_flags = ZEND_ACC_PUBLIC | ptr->flags;
@@ -3886,24 +3886,6 @@ ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, c
}
/* }}} */
ZEND_API void zend_unset_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length) /* {{{ */
{
zval property;
zend_class_entry *old_scope = EG(fake_scope);
EG(fake_scope) = scope;
if (!Z_OBJ_HT_P(object)->unset_property) {
zend_error_noreturn(E_CORE_ERROR, "Property %s of class %s cannot be unset", name, ZSTR_VAL(Z_OBJCE_P(object)->name));
}
ZVAL_STRINGL(&property, name, name_length);
Z_OBJ_HT_P(object)->unset_property(object, &property, 0);
zval_ptr_dtor(&property);
EG(fake_scope) = old_scope;
}
/* }}} */
ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_long value) /* {{{ */
{
zval tmp;
-1
View File
@@ -346,7 +346,6 @@ ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object,
ZEND_API void zend_update_property_str(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_string *value);
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, size_t name_length, const char *value);
ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, size_t name_length, const char *value, size_t value_length);
ZEND_API void zend_unset_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length);
ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value);
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length);
+21 -8
View File
@@ -1427,7 +1427,7 @@ static void *zend_mm_realloc_heap(zend_mm_heap *heap, void *ptr, size_t size, si
#endif
#ifdef ZEND_WIN32
/* On Windows we don't have ability to extend huge blocks in-place.
* We allocate them with 2MB size granularity, to avoid many
* We allocate them with 2MB size granularity, to avoid many
* reallocations when they are extended by small pieces
*/
new_size = ZEND_MM_ALIGNED_SIZE_EX(size, MAX(REAL_PAGE_SIZE, ZEND_MM_CHUNK_SIZE));
@@ -1695,7 +1695,7 @@ static void *zend_mm_alloc_huge(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D
{
#ifdef ZEND_WIN32
/* On Windows we don't have ability to extend huge blocks in-place.
* We allocate them with 2MB size granularity, to avoid many
* We allocate them with 2MB size granularity, to avoid many
* reallocations when they are extended by small pieces
*/
size_t new_size = ZEND_MM_ALIGNED_SIZE_EX(size, MAX(REAL_PAGE_SIZE, ZEND_MM_CHUNK_SIZE));
@@ -2456,24 +2456,37 @@ ZEND_API size_t ZEND_FASTCALL _zend_mem_block_size(void *ptr ZEND_FILE_LINE_DC Z
return zend_mm_size(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
static zend_always_inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
{
int overflow;
size_t ret = zend_safe_address(nmemb, size, offset, &overflow);
if (UNEXPECTED(overflow)) {
zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
return 0;
}
return ret;
}
ZEND_API void* ZEND_FASTCALL _safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
return emalloc_rel(zend_safe_address_guarded(nmemb, size, offset));
return emalloc_rel(safe_address(nmemb, size, offset));
}
ZEND_API void* ZEND_FASTCALL _safe_malloc(size_t nmemb, size_t size, size_t offset)
{
return pemalloc(zend_safe_address_guarded(nmemb, size, offset), 1);
return pemalloc(safe_address(nmemb, size, offset), 1);
}
ZEND_API void* ZEND_FASTCALL _safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
return erealloc_rel(ptr, zend_safe_address_guarded(nmemb, size, offset));
return erealloc_rel(ptr, safe_address(nmemb, size, offset));
}
ZEND_API void* ZEND_FASTCALL _safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset)
{
return perealloc(ptr, zend_safe_address_guarded(nmemb, size, offset), 1);
return perealloc(ptr, safe_address(nmemb, size, offset), 1);
}
@@ -2589,9 +2602,9 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
alloc_globals->mm_heap = malloc(sizeof(zend_mm_heap));
memset(alloc_globals->mm_heap, 0, sizeof(zend_mm_heap));
alloc_globals->mm_heap->use_custom_heap = ZEND_MM_CUSTOM_HEAP_STD;
alloc_globals->mm_heap->custom_heap.std._malloc = __zend_malloc;
alloc_globals->mm_heap->custom_heap.std._malloc = malloc;
alloc_globals->mm_heap->custom_heap.std._free = free;
alloc_globals->mm_heap->custom_heap.std._realloc = __zend_realloc;
alloc_globals->mm_heap->custom_heap.std._realloc = realloc;
return;
}
#endif
+1 -9
View File
@@ -181,11 +181,7 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr)
{
switch (Z_TYPE_P(offset)) {
case IS_UNDEF:
if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), expr)) {
zend_error(E_WARNING,
"Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr);
}
zend_hash_next_index_insert(Z_ARRVAL_P(result), expr);
break;
case IS_STRING:
zend_symtable_update(Z_ARRVAL_P(result), Z_STR_P(offset), expr);
@@ -206,10 +202,6 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr)
case IS_DOUBLE:
zend_hash_index_update(Z_ARRVAL_P(result), zend_dval_to_lval(Z_DVAL_P(offset)), expr);
break;
case IS_RESOURCE:
zend_error(E_NOTICE, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(offset), Z_RES_HANDLE_P(offset));
zend_hash_index_update(Z_ARRVAL_P(result), Z_RES_HANDLE_P(offset), expr);
break;
default:
zend_throw_error(NULL, "Illegal offset type");
return FAILURE;
+3 -43
View File
@@ -34,7 +34,6 @@
#if ZEND_DEBUG
static zend_class_entry *zend_test_interface;
static zend_class_entry *zend_test_class;
static zend_class_entry *zend_test_trait;
static zend_object_handlers zend_test_class_handlers;
#endif
@@ -307,16 +306,6 @@ static int zend_test_class_call_method(zend_string *method, zend_object *object,
return 0;
}
/* }}} */
static ZEND_METHOD(_ZendTestTrait, testMethod) /* {{{ */ {
RETURN_TRUE;
}
/* }}} */
static zend_function_entry zend_test_trait_methods[] = {
ZEND_ME(_ZendTestTrait, testMethod, arginfo_zend__void, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
#endif
static const zend_function_entry builtin_functions[] = { /* {{{ */
@@ -414,11 +403,6 @@ ZEND_MINIT_FUNCTION(core) { /* {{{ */
memcpy(&zend_test_class_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
zend_test_class_handlers.get_method = zend_test_class_method_get;
zend_test_class_handlers.call_method = zend_test_class_call_method;
INIT_CLASS_ENTRY(class_entry, "_ZendTestTrait", zend_test_trait_methods);
zend_test_trait = zend_register_internal_class(&class_entry);
zend_test_trait->ce_flags |= ZEND_ACC_TRAIT;
zend_declare_property_null(zend_test_trait, "testProp", sizeof("testProp")-1, ZEND_ACC_PUBLIC);
#endif
return SUCCESS;
@@ -2293,33 +2277,9 @@ static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array) /
zend_hash_real_init(Z_ARRVAL_P(arg_array), 1);
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(arg_array)) {
if (call->func->type == ZEND_USER_FUNCTION) {
uint32_t first_extra_arg = MIN(num_args, call->func->op_array.num_args);
uint32_t first_extra_arg = call->func->op_array.num_args;
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_HAS_SYMBOL_TABLE)) {
/* In case of attached symbol_table, values on stack may be invalid
* and we have to access them through symbol_table
* See: https://bugs.php.net/bug.php?id=73156
*/
zend_string *arg_name;
zval *arg;
while (i < first_extra_arg) {
arg_name = call->func->op_array.vars[i];
arg = zend_hash_find_ind(call->symbol_table, arg_name);
if (arg) {
if (Z_OPT_REFCOUNTED_P(arg)) {
Z_ADDREF_P(arg);
}
n++;
ZEND_HASH_FILL_ADD(arg);
} else {
zval tmp;
ZVAL_UNDEF(&tmp);
ZEND_HASH_FILL_ADD(&tmp);
}
i++;
}
} else {
if (ZEND_CALL_NUM_ARGS(call) > first_extra_arg) {
while (i < first_extra_arg) {
if (EXPECTED(Z_TYPE_INFO_P(p) != IS_UNDEF)) {
if (Z_OPT_REFCOUNTED_P(p)) {
@@ -2331,8 +2291,8 @@ static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array) /
p++;
i++;
}
p = ZEND_CALL_VAR_NUM(call, call->func->op_array.last_var + call->func->op_array.T);
}
p = ZEND_CALL_VAR_NUM(call, call->func->op_array.last_var + call->func->op_array.T);
}
while (i < num_args) {
-3
View File
@@ -166,9 +166,6 @@ ZEND_METHOD(Closure, call)
}
if (zend_call_function(&fci, &fci_cache) == SUCCESS && Z_TYPE(closure_result) != IS_UNDEF) {
if (Z_ISREF(closure_result)) {
zend_unwrap_reference(&closure_result);
}
ZVAL_COPY_VALUE(return_value, &closure_result);
}
+98 -73
View File
@@ -2804,58 +2804,37 @@ static void zend_verify_list_assign_target(zend_ast *var_ast, zend_bool old_styl
}
/* }}} */
static void zend_compile_list_assign(
znode *result, zend_ast *ast, znode *expr_node, zend_bool old_style) /* {{{ */
static void zend_compile_unkeyed_list_assign(zend_ast_list *list, znode *expr_node, zend_bool old_style) /* {{{ */
{
zend_ast_list *list = zend_ast_get_list(ast);
uint32_t i;
zend_bool has_elems = 0;
zend_bool is_keyed =
list->children > 0 && list->child[0] != NULL && list->child[0]->child[1] != NULL;
for (i = 0; i < list->children; ++i) {
zend_ast *elem_ast = list->child[i];
zend_ast *var_ast, *key_ast;
zend_ast *var_ast;
znode fetch_result, dim_node;
if (elem_ast == NULL) {
if (is_keyed) {
zend_error(E_COMPILE_ERROR,
"Cannot use empty array entries in keyed array assignment");
} else {
continue;
}
continue;
}
if (elem_ast->attr) {
zend_error(E_COMPILE_ERROR, "[] and list() assignments cannot be by reference");
}
var_ast = elem_ast->child[0];
key_ast = elem_ast->child[1];
has_elems = 1;
if (is_keyed) {
if (key_ast == NULL) {
zend_error(E_COMPILE_ERROR,
"Cannot mix keyed and unkeyed array entries in assignments");
}
zend_compile_expr(&dim_node, key_ast);
} else {
if (key_ast != NULL) {
zend_error(E_COMPILE_ERROR,
"Cannot mix keyed and unkeyed array entries in assignments");
}
dim_node.op_type = IS_CONST;
ZVAL_LONG(&dim_node.u.constant, i);
}
dim_node.op_type = IS_CONST;
ZVAL_LONG(&dim_node.u.constant, i);
if (expr_node->op_type == IS_CONST) {
Z_TRY_ADDREF(expr_node->u.constant);
}
if (elem_ast->child[1] != NULL) {
zend_error(E_COMPILE_ERROR, "Cannot mix keyed and unkeyed array entries in assignments");
}
zend_verify_list_assign_target(var_ast, old_style);
zend_emit_op(&fetch_result, ZEND_FETCH_LIST, expr_node, &dim_node);
@@ -2866,6 +2845,55 @@ static void zend_compile_list_assign(
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use empty list");
}
}
/* }}} */
static void zend_compile_keyed_list_assign(zend_ast_list *list, znode *expr_node, zend_bool old_style) /* {{{ */
{
uint32_t i;
for (i = 0; i < list->children; ++i) {
zend_ast *pair_ast = list->child[i];
zend_ast *var_ast = pair_ast->child[0];
zend_ast *key_ast = pair_ast->child[1];
znode fetch_result, dim_node;
if (pair_ast->attr) {
zend_error(E_COMPILE_ERROR, "[] and list() assignments cannot be by reference");
}
if (key_ast == NULL) {
zend_error(E_COMPILE_ERROR, "Cannot mix keyed and unkeyed array entries in assignments");
}
zend_compile_expr(&dim_node, key_ast);
if (expr_node->op_type == IS_CONST) {
Z_TRY_ADDREF(expr_node->u.constant);
}
if (var_ast == NULL) {
zend_error(E_COMPILE_ERROR, "Cannot use empty array entries in keyed array");
}
zend_verify_list_assign_target(var_ast, old_style);
zend_emit_op(&fetch_result, ZEND_FETCH_LIST, expr_node, &dim_node);
zend_emit_assign_znode(var_ast, &fetch_result);
}
}
/* }}} */
static void zend_compile_list_assign(znode *result, zend_ast *ast, znode *expr_node, zend_bool old_style) /* {{{ */
{
zend_ast_list *list = zend_ast_get_list(ast);
if (list->children > 0 && list->child[0] != NULL && list->child[0]->child[1] != NULL /* has key */) {
zend_compile_keyed_list_assign(list, expr_node, old_style);
} else {
zend_compile_unkeyed_list_assign(list, expr_node, old_style);
}
*result = *expr_node;
}
/* }}} */
@@ -3564,8 +3592,12 @@ int zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcnam
zend_op *opline;
zend_compile_expr(&arg_node, arg_ast);
if (arg_node.op_type & (IS_VAR|IS_CV)) {
opline = zend_emit_op(NULL, ZEND_SEND_USER, &arg_node, NULL);
} else {
opline = zend_emit_op(NULL, ZEND_SEND_VAL, &arg_node, NULL);
}
opline = zend_emit_op(NULL, ZEND_SEND_USER, &arg_node, NULL);
opline->op2.num = i;
opline->result.var = (uint32_t)(zend_intptr_t)ZEND_CALL_ARG(NULL, i);
}
@@ -6135,41 +6167,6 @@ static void zend_check_already_in_use(uint32_t type, zend_string *old_name, zend
}
/* }}} */
static void zend_check_use_conflict(
uint32_t type, zend_string *old_name, zend_string *new_name, zend_string *lookup_name) {
switch (type) {
case T_CLASS:
{
zend_class_entry *ce = zend_hash_find_ptr(CG(class_table), lookup_name);
if (ce && ce->type == ZEND_USER_CLASS
&& ce->info.user.filename == CG(compiled_filename)
) {
zend_check_already_in_use(type, old_name, new_name, lookup_name);
}
break;
}
case T_FUNCTION:
{
zend_function *fn = zend_hash_find_ptr(CG(function_table), lookup_name);
if (fn && fn->type == ZEND_USER_FUNCTION
&& fn->op_array.filename == CG(compiled_filename)
) {
zend_check_already_in_use(type, old_name, new_name, lookup_name);
}
break;
}
case T_CONST:
{
zend_string *filename = zend_hash_find_ptr(&CG(const_filenames), lookup_name);
if (filename && filename == CG(compiled_filename)) {
zend_check_already_in_use(type, old_name, new_name, lookup_name);
}
break;
}
EMPTY_SWITCH_DEFAULT_CASE()
}
}
void zend_compile_use(zend_ast *ast) /* {{{ */
{
zend_ast_list *list = zend_ast_get_list(ast);
@@ -6226,11 +6223,43 @@ void zend_compile_use(zend_ast *ast) /* {{{ */
ZSTR_VAL(ns_name)[ZSTR_LEN(current_ns)] = '\\';
memcpy(ZSTR_VAL(ns_name) + ZSTR_LEN(current_ns) + 1, ZSTR_VAL(lookup_name), ZSTR_LEN(lookup_name));
zend_check_use_conflict(type, old_name, new_name, ns_name);
if (zend_hash_exists(CG(class_table), ns_name)) {
zend_check_already_in_use(type, old_name, new_name, ns_name);
}
zend_string_free(ns_name);
} else {
zend_check_use_conflict(type, old_name, new_name, lookup_name);
switch (type) {
case T_CLASS:
{
zend_class_entry *ce = zend_hash_find_ptr(CG(class_table), lookup_name);
if (ce && ce->type == ZEND_USER_CLASS
&& ce->info.user.filename == CG(compiled_filename)
) {
zend_check_already_in_use(type, old_name, new_name, lookup_name);
}
break;
}
case T_FUNCTION:
{
zend_function *fn = zend_hash_find_ptr(CG(function_table), lookup_name);
if (fn && fn->type == ZEND_USER_FUNCTION
&& fn->op_array.filename == CG(compiled_filename)
) {
zend_check_already_in_use(type, old_name, new_name, lookup_name);
}
break;
}
case T_CONST:
{
zend_string *filename = zend_hash_find_ptr(&CG(const_filenames), lookup_name);
if (filename && filename == CG(compiled_filename)) {
zend_check_already_in_use(type, old_name, new_name, lookup_name);
}
break;
}
EMPTY_SWITCH_DEFAULT_CASE()
}
}
zend_string_addref(old_name);
@@ -6631,11 +6660,7 @@ static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */
break;
}
} else {
if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), value)) {
zval_ptr_dtor_nogc(value);
zval_ptr_dtor(result);
return 0;
}
zend_hash_next_index_insert(Z_ARRVAL_P(result), value);
}
}
+5 -22
View File
@@ -306,7 +306,10 @@ ZEND_METHOD(exception, __construct)
#define CHECK_EXC_TYPE(id, type) \
pvalue = zend_read_property_ex(i_get_exception_base(object), (object), CG(known_strings)[id], 1, &value); \
if (Z_TYPE_P(pvalue) != IS_NULL && Z_TYPE_P(pvalue) != type) { \
zend_unset_property(i_get_exception_base(object), object, ZSTR_VAL(CG(known_strings)[id]), ZSTR_LEN(CG(known_strings)[id])); \
zval tmp; \
ZVAL_STR_COPY(&tmp, CG(known_strings)[id]); \
Z_OBJ_HANDLER_P(object, unset_property)(object, &tmp, NULL); \
zval_ptr_dtor(&tmp); \
}
ZEND_METHOD(exception, __wakeup)
@@ -319,12 +322,7 @@ ZEND_METHOD(exception, __wakeup)
CHECK_EXC_TYPE(ZEND_STR_FILE, IS_STRING);
CHECK_EXC_TYPE(ZEND_STR_LINE, IS_LONG);
CHECK_EXC_TYPE(ZEND_STR_TRACE, IS_ARRAY);
pvalue = zend_read_property(i_get_exception_base(object), object, "previous", sizeof("previous")-1, 1, &value);
if (pvalue && Z_TYPE_P(pvalue) != IS_NULL && (Z_TYPE_P(pvalue) != IS_OBJECT ||
!instanceof_function(Z_OBJCE_P(pvalue), i_get_exception_base(object)) ||
pvalue == object)) {
zend_unset_property(i_get_exception_base(object), object, "previous", sizeof("previous")-1);
}
CHECK_EXC_TYPE(ZEND_STR_PREVIOUS, IS_OBJECT);
}
/* }}} */
@@ -737,25 +735,10 @@ ZEND_METHOD(exception, __toString)
zend_string_release(file);
zval_ptr_dtor(&trace);
Z_OBJPROP_P(exception)->u.v.nApplyCount++;
exception = GET_PROPERTY(exception, ZEND_STR_PREVIOUS);
if (exception && Z_TYPE_P(exception) == IS_OBJECT && Z_OBJPROP_P(exception)->u.v.nApplyCount > 0) {
break;
}
}
zend_string_release(fname);
exception = getThis();
/* Reset apply counts */
while (exception && Z_TYPE_P(exception) == IS_OBJECT && (base_ce = i_get_exception_base(exception)) && instanceof_function(Z_OBJCE_P(exception), base_ce)) {
if (Z_OBJPROP_P(exception)->u.v.nApplyCount) {
Z_OBJPROP_P(exception)->u.v.nApplyCount--;
} else {
break;
}
exception = GET_PROPERTY(exception, ZEND_STR_PREVIOUS);
}
exception = getThis();
base_ce = i_get_exception_base(exception);
+3 -11
View File
@@ -567,6 +567,7 @@ static inline zval *_get_obj_zval_ptr_ptr(int op_type, znode_op node, zend_execu
static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr)
{
zend_reference *ref;
zval garbage;
if (EXPECTED(!Z_ISREF_P(value_ptr))) {
ZVAL_NEW_REF(value_ptr, value_ptr);
@@ -576,18 +577,9 @@ static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *v
ref = Z_REF_P(value_ptr);
GC_REFCOUNT(ref)++;
if (Z_REFCOUNTED_P(variable_ptr)) {
zend_refcounted *garbage = Z_COUNTED_P(variable_ptr);
if (--GC_REFCOUNT(garbage) == 0) {
ZVAL_REF(variable_ptr, ref);
zval_dtor_func(garbage);
return;
} else {
GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr);
}
}
ZVAL_COPY_VALUE(&garbage, variable_ptr);
ZVAL_REF(variable_ptr, ref);
zval_ptr_dtor(&garbage);
}
/* this should modify object only if it's empty */
+12 -16
View File
@@ -587,6 +587,8 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */
ZVAL_EMPTY_STRING(p);
}
} else if (UNEXPECTED((const_value = zend_get_constant_ex(Z_STR_P(p), scope, Z_CONST_FLAGS_P(p))) == NULL)) {
char *actual = Z_STRVAL_P(p);
if (UNEXPECTED(EG(exception))) {
RESET_CONSTANT_VISITED(p);
return FAILURE;
@@ -601,29 +603,26 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */
return FAILURE;
} else {
zend_string *save = Z_STR_P(p);
char *actual = Z_STRVAL_P(p);
size_t actual_len = Z_STRLEN_P(p);
char *slash = (char *) zend_memrchr(actual, '\\', actual_len);
if (slash) {
actual = slash + 1;
actual_len -= (actual - Z_STRVAL_P(p));
if (inline_change) {
zend_string *s = zend_string_init(actual, actual_len, 0);
Z_STR_P(p) = s;
Z_TYPE_FLAGS_P(p) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
}
}
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
if (EG(exception)) {
RESET_CONSTANT_VISITED(p);
return FAILURE;
}
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
if (!inline_change) {
ZVAL_STRINGL(p, actual, actual_len);
} else {
if (slash) {
ZVAL_STRINGL(p, actual, actual_len);
Z_TYPE_INFO_P(p) = Z_REFCOUNTED_P(p) ?
IS_STRING_EX : IS_INTERNED_STRING_EX;
if (save && ZSTR_VAL(save) != actual) {
zend_string_release(save);
} else {
Z_TYPE_INFO_P(p) = Z_REFCOUNTED_P(p) ?
IS_STRING_EX : IS_INTERNED_STRING_EX;
}
}
}
@@ -820,13 +819,10 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
ZEND_ADD_CALL_FLAG(call, ZEND_CALL_CLOSURE);
}
if (func->type == ZEND_USER_FUNCTION) {
if (func->type == ZEND_USER_FUNCTION) {
int call_via_handler = (func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) != 0;
const zend_op *current_opline_before_exception = EG(opline_before_exception);
zend_init_execute_data(call, &func->op_array, fci->retval);
zend_execute_ex(call);
EG(opline_before_exception) = current_opline_before_exception;
if (call_via_handler) {
/* We must re-initialize function again */
fci_cache->initialized = 0;
+5 -5
View File
@@ -31,7 +31,7 @@ static zend_object_handlers zend_generator_handlers;
static zend_object *zend_generator_create(zend_class_entry *class_type);
ZEND_API void zend_generator_restore_call_stack(zend_generator *generator) /* {{{ */
static void zend_restore_call_stack(zend_generator *generator) /* {{{ */
{
zend_execute_data *call, *new_call, *prev_call = NULL;
@@ -57,7 +57,7 @@ ZEND_API void zend_generator_restore_call_stack(zend_generator *generator) /* {{
}
/* }}} */
ZEND_API zend_execute_data* zend_generator_freeze_call_stack(zend_execute_data *execute_data) /* {{{ */
static zend_execute_data* zend_freeze_call_stack(zend_execute_data *execute_data) /* {{{ */
{
size_t used_stack;
zend_execute_data *call, *new_call, *prev_call = NULL;
@@ -106,7 +106,7 @@ static void zend_generator_cleanup_unfinished_execution(
uint32_t op_num = execute_data->opline - execute_data->func->op_array.opcodes - 1;
if (UNEXPECTED(generator->frozen_call_stack)) {
zend_generator_restore_call_stack(generator);
zend_restore_call_stack(generator);
}
zend_cleanup_unfinished_execution(execute_data, op_num, 0);
}
@@ -808,7 +808,7 @@ try_again:
if (UNEXPECTED(generator->frozen_call_stack)) {
/* Restore frozen call-stack */
zend_generator_restore_call_stack(generator);
zend_restore_call_stack(generator);
}
/* Resume execution */
@@ -820,7 +820,7 @@ try_again:
if (EXPECTED(generator->execute_data) &&
UNEXPECTED(generator->execute_data->call)) {
/* Frize call-stack */
generator->frozen_call_stack = zend_generator_freeze_call_stack(generator->execute_data);
generator->frozen_call_stack = zend_freeze_call_stack(generator->execute_data);
}
/* Restore executor globals */
-3
View File
@@ -105,9 +105,6 @@ void zend_register_generator_ce(void);
ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished_execution);
ZEND_API void zend_generator_resume(zend_generator *generator);
ZEND_API void zend_generator_restore_call_stack(zend_generator *generator);
ZEND_API zend_execute_data* zend_generator_freeze_call_stack(zend_execute_data *execute_data);
void zend_generator_yield_from(zend_generator *generator, zend_generator *from);
ZEND_API zend_execute_data *zend_generator_check_placeholder_frame(zend_execute_data *ptr);
+27 -29
View File
@@ -34,7 +34,9 @@
#define HT_POISONED_PTR ((HashTable *) (intptr_t) -1)
#if ZEND_DEBUG
/*
#define HASH_MASK_CONSISTENCY 0xc0
*/
#define HT_OK 0x00
#define HT_IS_DESTROYING 0x40
#define HT_DESTROYED 0x80
@@ -42,10 +44,10 @@
static void _zend_is_inconsistent(const HashTable *ht, const char *file, int line)
{
if (ht->u.v.consistency == HT_OK) {
if ((ht->u.flags & HASH_MASK_CONSISTENCY) == HT_OK) {
return;
}
switch (ht->u.v.consistency) {
switch ((ht->u.flags & HASH_MASK_CONSISTENCY)) {
case HT_IS_DESTROYING:
zend_output_debug_string(1, "%s(%d) : ht=%p is being destroyed", file, line, ht);
break;
@@ -63,7 +65,7 @@ static void _zend_is_inconsistent(const HashTable *ht, const char *file, int lin
}
#define IS_CONSISTENT(a) _zend_is_inconsistent(a, __FILE__, __LINE__);
#define SET_INCONSISTENT(n) do { \
(ht)->u.v.consistency = n; \
(ht)->u.flags |= n; \
} while (0)
#else
#define IS_CONSISTENT(a)
@@ -889,7 +891,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_rehash(HashTable *ht)
HT_HASH_RESET(ht);
i = 0;
p = ht->arData;
if (HT_IS_WITHOUT_HOLES(ht)) {
if (ht->nNumUsed == ht->nNumOfElements) {
do {
nIndex = p->h | ht->nTableMask;
Z_NEXT(p->val) = HT_HASH(ht, nIndex);
@@ -1230,8 +1232,8 @@ ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
if (ht->pDestructor) {
SET_INCONSISTENT(HT_IS_DESTROYING);
if (HT_HAS_STATIC_KEYS_ONLY(ht)) {
if (HT_IS_WITHOUT_HOLES(ht)) {
if (ht->u.flags & (HASH_FLAG_PACKED|HASH_FLAG_STATIC_KEYS)) {
if (ht->nNumUsed == ht->nNumOfElements) {
do {
ht->pDestructor(&p->val);
} while (++p != end);
@@ -1242,7 +1244,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
}
} while (++p != end);
}
} else if (HT_IS_WITHOUT_HOLES(ht)) {
} else if (ht->nNumUsed == ht->nNumOfElements) {
do {
ht->pDestructor(&p->val);
if (EXPECTED(p->key)) {
@@ -1262,7 +1264,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
SET_INCONSISTENT(HT_DESTROYED);
} else {
if (!HT_HAS_STATIC_KEYS_ONLY(ht)) {
if (!(ht->u.flags & (HASH_FLAG_PACKED|HASH_FLAG_STATIC_KEYS))) {
do {
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
if (EXPECTED(p->key)) {
@@ -1301,11 +1303,11 @@ ZEND_API void ZEND_FASTCALL zend_array_destroy(HashTable *ht)
end = p + ht->nNumUsed;
SET_INCONSISTENT(HT_IS_DESTROYING);
if (HT_HAS_STATIC_KEYS_ONLY(ht)) {
if (ht->u.flags & (HASH_FLAG_PACKED|HASH_FLAG_STATIC_KEYS)) {
do {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC);
} while (++p != end);
} else if (HT_IS_WITHOUT_HOLES(ht)) {
} else if (ht->nNumUsed == ht->nNumOfElements) {
do {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC);
if (EXPECTED(p->key)) {
@@ -1343,8 +1345,8 @@ ZEND_API void ZEND_FASTCALL zend_hash_clean(HashTable *ht)
p = ht->arData;
end = p + ht->nNumUsed;
if (ht->pDestructor) {
if (HT_HAS_STATIC_KEYS_ONLY(ht)) {
if (HT_IS_WITHOUT_HOLES(ht)) {
if (ht->u.flags & (HASH_FLAG_PACKED|HASH_FLAG_STATIC_KEYS)) {
if (ht->nNumUsed == ht->nNumOfElements) {
do {
ht->pDestructor(&p->val);
} while (++p != end);
@@ -1355,7 +1357,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_clean(HashTable *ht)
}
} while (++p != end);
}
} else if (HT_IS_WITHOUT_HOLES(ht)) {
} else if (ht->nNumUsed == ht->nNumOfElements) {
do {
ht->pDestructor(&p->val);
if (EXPECTED(p->key)) {
@@ -1373,8 +1375,8 @@ ZEND_API void ZEND_FASTCALL zend_hash_clean(HashTable *ht)
} while (++p != end);
}
} else {
if (!HT_HAS_STATIC_KEYS_ONLY(ht)) {
if (HT_IS_WITHOUT_HOLES(ht)) {
if (!(ht->u.flags & (HASH_FLAG_PACKED|HASH_FLAG_STATIC_KEYS))) {
if (ht->nNumUsed == ht->nNumOfElements) {
do {
if (EXPECTED(p->key)) {
zend_string_release(p->key);
@@ -1411,24 +1413,20 @@ ZEND_API void ZEND_FASTCALL zend_symtable_clean(HashTable *ht)
if (ht->nNumUsed) {
p = ht->arData;
end = p + ht->nNumUsed;
if (HT_HAS_STATIC_KEYS_ONLY(ht)) {
if (ht->u.flags & HASH_FLAG_STATIC_KEYS) {
do {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC);
} while (++p != end);
} else if (HT_IS_WITHOUT_HOLES(ht)) {
} else if (ht->nNumUsed == ht->nNumOfElements) {
do {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC);
if (EXPECTED(p->key)) {
zend_string_release(p->key);
}
zend_string_release(p->key);
} while (++p != end);
} else {
do {
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC);
if (EXPECTED(p->key)) {
zend_string_release(p->key);
}
zend_string_release(p->key);
}
} while (++p != end);
}
@@ -1803,7 +1801,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
target->nInternalPointer = source->nInternalPointer;
HT_HASH_RESET_PACKED(target);
if (HT_IS_WITHOUT_HOLES(target)) {
if (target->nNumUsed == target->nNumOfElements) {
zend_array_dup_packed_elements(source, target, 0);
} else {
zend_array_dup_packed_elements(source, target, 1);
@@ -1824,14 +1822,14 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
HT_SET_DATA_ADDR(target, emalloc(HT_SIZE(target)));
HT_HASH_RESET(target);
if (HT_HAS_STATIC_KEYS_ONLY(target)) {
if (HT_IS_WITHOUT_HOLES(source)) {
if (target->u.flags & HASH_FLAG_STATIC_KEYS) {
if (source->nNumUsed == source->nNumOfElements) {
idx = zend_array_dup_elements(source, target, 1, 0);
} else {
idx = zend_array_dup_elements(source, target, 1, 1);
}
} else {
if (HT_IS_WITHOUT_HOLES(source)) {
if (source->nNumUsed == source->nNumOfElements) {
idx = zend_array_dup_elements(source, target, 0, 0);
} else {
idx = zend_array_dup_elements(source, target, 0, 1);
@@ -2254,7 +2252,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort, co
return SUCCESS;
}
if (HT_IS_WITHOUT_HOLES(ht)) {
if (ht->nNumUsed == ht->nNumOfElements) {
i = ht->nNumUsed;
} else {
for (j = 0, i = 0; j < ht->nNumUsed; j++) {
+2 -9
View File
@@ -39,17 +39,10 @@
#define HASH_FLAG_APPLY_PROTECTION (1<<1)
#define HASH_FLAG_PACKED (1<<2)
#define HASH_FLAG_INITIALIZED (1<<3)
#define HASH_FLAG_STATIC_KEYS (1<<4) /* long and interned strings */
#define HASH_FLAG_STATIC_KEYS (1<<4)
#define HASH_FLAG_HAS_EMPTY_IND (1<<5)
#define HT_IS_PACKED(ht) \
(((ht)->u.flags & HASH_FLAG_PACKED) != 0)
#define HT_IS_WITHOUT_HOLES(ht) \
((ht)->nNumUsed == (ht)->nNumOfElements)
#define HT_HAS_STATIC_KEYS_ONLY(ht) \
(((ht)->u.flags & (HASH_FLAG_PACKED|HASH_FLAG_STATIC_KEYS)) != 0)
#define HASH_MASK_CONSISTENCY 0xc0
typedef struct _zend_hash_key {
zend_ulong h;
-1
View File
@@ -1227,7 +1227,6 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
function_add_ref(fn);
new_fn = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
memcpy(new_fn, fn, sizeof(zend_op_array));
new_fn->common.fn_flags |= ZEND_ACC_ARENA_ALLOCATED;
fn = zend_hash_update_ptr(&ce->function_table, key, new_fn);
zend_add_magic_methods(ce, key, fn);
}
-1
View File
@@ -1249,7 +1249,6 @@ encaps_var:
encaps_var_offset:
T_STRING { $$ = $1; }
| T_NUM_STRING { $$ = $1; }
| '-' T_NUM_STRING { $$ = zend_ast_create(ZEND_AST_UNARY_MINUS, $2); }
| T_VARIABLE { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
;
File diff suppressed because it is too large. Load diff
+2 -4
View File
@@ -583,7 +583,6 @@ static zend_op_array *zend_compile(int type)
CG(ast_arena) = zend_arena_create(1024 * 32);
if (!zendparse()) {
int last_lineno = CG(zend_lineno);
zend_file_context original_file_context;
zend_oparray_context original_oparray_context;
zend_op_array *original_active_op_array = CG(active_op_array);
@@ -599,10 +598,9 @@ static zend_op_array *zend_compile(int type)
zend_file_context_begin(&original_file_context);
zend_oparray_context_begin(&original_oparray_context);
zend_compile_top_stmt(CG(ast));
CG(zend_lineno) = last_lineno;
zend_emit_final_return(type == ZEND_USER_FUNCTION);
op_array->line_start = 1;
op_array->line_end = last_lineno;
op_array->line_end = CG(zend_lineno);
pass_two(op_array);
zend_oparray_context_end(&original_oparray_context);
zend_file_context_end(&original_file_context);
@@ -1877,7 +1875,7 @@ inline_char_handler:
}
<ST_VAR_OFFSET>{TOKENS}|[{}"`] {
/* Only '[' or '-' can be valid, but returning other tokens will allow a more explicit parse error */
/* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */
RETURN_TOKEN(yytext[0]);
}
-12
View File
@@ -266,18 +266,6 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si
}
#endif
static zend_always_inline size_t zend_safe_address_guarded(size_t nmemb, size_t size, size_t offset)
{
int overflow;
size_t ret = zend_safe_address(nmemb, size, offset, &overflow);
if (UNEXPECTED(overflow)) {
zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
return 0;
}
return ret;
}
#endif /* ZEND_MULTIPLY_H */
/*
+1
View File
@@ -182,6 +182,7 @@ ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp) /* {{{ *
return ht;
}
zend_clear_exception();
zend_error_noreturn(E_ERROR, ZEND_DEBUGINFO_FUNC_NAME "() must return an array");
return NULL; /* Compilers are dumb and don't understand that noreturn means that the function does NOT need a return value... */
+3 -9
View File
@@ -170,7 +170,7 @@ zend_memnstr(const char *haystack, const char *needle, size_t needle_len, const
return NULL;
}
if (EXPECTED(off_s < 1024 || needle_len < 9)) { /* glibc memchr is faster when needle is too short */
if (EXPECTED(off_s < 1024 || needle_len < 3)) {
end -= needle_len;
while (p <= end) {
@@ -520,10 +520,7 @@ static zend_always_inline void fast_long_decrement_function(zval *op1)
static zend_always_inline void fast_long_add_function(zval *result, zval *op1, zval *op2)
{
#if defined(__GNUC__) && defined(__i386__) \
&& !(4 == __GNUC__ && 8 == __GNUC_MINOR__) \
&& !(4 == __GNUC__ && 9 == __GNUC_MINOR__ && (defined(__PIC__) || defined(__PIE__)))
/* Position-independent builds fail with gcc-4.9.x */
#if defined(__GNUC__) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
__asm__(
"movl (%1), %%eax\n\t"
"addl (%2), %%eax\n\t"
@@ -609,10 +606,7 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
static zend_always_inline void fast_long_sub_function(zval *result, zval *op1, zval *op2)
{
#if defined(__GNUC__) && defined(__i386__) && \
!(4 == __GNUC__ && 8 == __GNUC_MINOR__) && \
!(4 == __GNUC__ && 9 == __GNUC_MINOR__ && (defined(__PIC__) || defined(__PIE__)))
/* Position-independent builds fail with gcc-4.9.x */
#if defined(__GNUC__) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
__asm__(
"movl (%1), %%eax\n\t"
"subl (%2), %%eax\n\t"
+2 -6
View File
@@ -64,12 +64,8 @@ typedef unsigned long int uint32_t;
# endif
#endif
#ifdef USE_LOCALE
#undef USE_LOCALE
#endif
#ifndef NO_INFNAN_CHECK
#define NO_INFNAN_CHECK
#ifdef HAVE_LOCALE_H
#define USE_LOCALE 1
#endif
#ifdef WORDS_BIGENDIAN
+1 -1
View File
@@ -182,7 +182,7 @@ struct _zend_array {
zend_uchar flags,
zend_uchar nApplyCount,
zend_uchar nIteratorsCount,
zend_uchar consistency)
zend_uchar reserve)
} v;
uint32_t flags;
} u;
+49 -76
View File
@@ -1701,12 +1701,11 @@ ZEND_VM_HELPER(zend_fetch_static_prop_helper, CONST|TMPVAR|CV, UNUSED|CONST|VAR,
} else if (UNEXPECTED((ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)))) == NULL)) {
ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op2)), EX_CONSTANT(opline->op2) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
if (UNEXPECTED(ce == NULL)) {
ZEND_ASSERT(EG(exception));
if (OP1_TYPE != IS_CONST) {
zend_string_release(name);
}
FREE_OP1();
HANDLE_EXCEPTION();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce);
}
@@ -3234,19 +3233,15 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|THIS|CV, CONST|T
GC_REFCOUNT(obj)++; /* For $this pointer */
}
FREE_OP2();
FREE_OP1();
if ((OP1_TYPE & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, obj);
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE();
FREE_OP2();
FREE_OP1();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR, CONST|TMPVAR|UNUSED|CONSTRUCTOR|CV, NUM)
@@ -3266,7 +3261,10 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR,
if (UNEXPECTED(ce == NULL)) {
ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op1)), EX_CONSTANT(opline->op1) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
if (UNEXPECTED(ce == NULL)) {
ZEND_ASSERT(EG(exception));
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
zend_throw_error(NULL, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
HANDLE_EXCEPTION();
}
CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -3401,7 +3399,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR,
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST, NUM)
@@ -3465,23 +3463,9 @@ ZEND_VM_C_LABEL(try_function_name):
call = NULL;
}
if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
FREE_OP2();
if (OP2_TYPE & (IS_VAR|IS_TMP_VAR)) {
if (UNEXPECTED(EG(exception))) {
if (call) {
if (call->func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
zend_string_release(call->func->common.function_name);
zend_free_trampoline(call->func);
}
zend_vm_stack_free_call_frame(call);
}
HANDLE_EXCEPTION();
}
} else if (UNEXPECTED(!call)) {
if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
@@ -3510,17 +3494,6 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM)
func = fcc.function_handler;
called_scope = fcc.called_scope;
object = fcc.object;
if (error) {
efree(error);
/* This is the only soft error is_callable() can generate */
zend_error(E_DEPRECATED,
"Non-static method %s::%s() should not be called statically",
ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
if (UNEXPECTED(EG(exception) != NULL)) {
FREE_OP2();
HANDLE_EXCEPTION();
}
}
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
if (OP2_TYPE & (IS_VAR|IS_CV)) {
@@ -3533,28 +3506,22 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM)
call_info |= ZEND_CALL_RELEASE_THIS;
GC_REFCOUNT(object)++; /* For $this pointer */
}
FREE_OP2();
if ((OP2_TYPE & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) {
if (call_info & ZEND_CALL_CLOSURE) {
zend_object_release((zend_object*)func->common.prototype);
if (error) {
efree(error);
/* This is the only soft error is_callable() can generate */
zend_error(E_DEPRECATED,
"Non-static method %s::%s() should not be called statically",
ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (call_info & ZEND_CALL_RELEASE_THIS) {
zend_object_release(object);
}
HANDLE_EXCEPTION();
}
if (EXPECTED(func->type == ZEND_USER_FUNCTION) && UNEXPECTED(!func->op_array.run_time_cache)) {
init_func_run_time_cache(&func->op_array);
}
} else {
zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(EX_CONSTANT(opline->op1)), error);
efree(error);
FREE_OP2();
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
func = (zend_function*)&zend_pass_function;
called_scope = NULL;
object = NULL;
@@ -3565,7 +3532,8 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM)
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE();
FREE_OP2();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST, NUM)
@@ -4748,24 +4716,30 @@ ZEND_VM_C_LABEL(send_array):
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_HANDLER(120, ZEND_SEND_USER, CONST|TMP|VAR|CV, NUM)
ZEND_VM_HANDLER(120, ZEND_SEND_USER, VAR|CV, NUM)
{
USE_OPLINE
zval *arg, *param;
zend_free_op free_op1;
SAVE_OPLINE();
arg = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
arg = GET_OP1_ZVAL_PTR(BP_VAR_R);
param = ZEND_CALL_VAR(EX(call), opline->result.var);
if (UNEXPECTED(ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num))) {
ZVAL_DEREF(arg);
zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given",
opline->op2.num,
EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "",
EX(call)->func->common.scope ? "::" : "",
ZSTR_VAL(EX(call)->func->common.function_name));
} else {
if (Z_ISREF_P(arg) &&
!(EX(call)->func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
/* don't separate references for __call */
arg = Z_REFVAL_P(arg);
}
}
ZVAL_COPY(param, arg);
FREE_OP1();
@@ -4973,8 +4947,7 @@ ZEND_VM_HANDLER(68, ZEND_NEW, UNUSED|CLASS_FETCH|CONST|VAR, ANY, NUM)
if (UNEXPECTED(ce == NULL)) {
ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op1)), EX_CONSTANT(opline->op1) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
if (UNEXPECTED(ce == NULL)) {
ZEND_ASSERT(EG(exception));
HANDLE_EXCEPTION();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
}
@@ -5026,7 +4999,7 @@ ZEND_VM_HANDLER(68, ZEND_NEW, UNUSED|CLASS_FETCH|CONST|VAR, ANY, NUM)
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|THIS|CV, ANY)
@@ -5034,7 +5007,6 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|THIS|CV, ANY)
USE_OPLINE
zend_free_op free_op1;
zval *obj;
zend_object *clone_obj;
zend_class_entry *ce, *scope;
zend_function *clone;
zend_object_clone_obj_t clone_call;
@@ -5099,11 +5071,9 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|THIS|CV, ANY)
}
}
clone_obj = clone_call(obj);
if (EXPECTED(EG(exception) == NULL)) {
ZVAL_OBJ(EX_VAR(opline->result.var), clone_obj);
} else {
OBJ_RELEASE(clone_obj);
ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj));
if (UNEXPECTED(EG(exception) != NULL)) {
OBJ_RELEASE(Z_OBJ_P(EX_VAR(opline->result.var)));
}
FREE_OP1();
@@ -5176,7 +5146,9 @@ ZEND_VM_HANDLER(181, ZEND_FETCH_CLASS_CONSTANT, VAR|CONST|UNUSED|CLASS_FETCH, CO
} else {
ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op1)), EX_CONSTANT(opline->op1) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
if (UNEXPECTED(ce == NULL)) {
ZEND_ASSERT(EG(exception));
if (EXPECTED(!EG(exception))) {
zend_throw_error(NULL, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
}
HANDLE_EXCEPTION();
}
CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -5320,10 +5292,7 @@ ZEND_VM_C_LABEL(num_index):
}
FREE_OP2();
} else {
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -5600,7 +5569,9 @@ ZEND_VM_HANDLER(179, ZEND_UNSET_STATIC_PROP, CONST|TMPVAR|CV, UNUSED|CLASS_FETCH
if (UNEXPECTED(ce == NULL)) {
ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op2)), EX_CONSTANT(opline->op2) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
if (UNEXPECTED(ce == NULL)) {
ZEND_ASSERT(EG(exception));
if (EXPECTED(!EG(exception))) {
zend_throw_error(NULL, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
}
if (OP1_TYPE != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
zend_string_release(Z_STR(tmp));
}
@@ -6507,8 +6478,7 @@ ZEND_VM_HANDLER(180, ZEND_ISSET_ISEMPTY_STATIC_PROP, CONST|TMPVAR|CV, UNUSED|CLA
} else if (UNEXPECTED((ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)))) == NULL)) {
ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op2)), EX_CONSTANT(opline->op2) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
if (UNEXPECTED(ce == NULL)) {
ZEND_ASSERT(EG(exception));
HANDLE_EXCEPTION();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce);
}
@@ -7085,9 +7055,12 @@ ZEND_VM_C_LABEL(try_instanceof):
ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)));
if (UNEXPECTED(ce == NULL)) {
ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op2)), EX_CONSTANT(opline->op2) + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD);
if (EXPECTED(ce)) {
CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce);
if (UNEXPECTED(ce == NULL)) {
ZVAL_FALSE(EX_VAR(opline->result.var));
FREE_OP1();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce);
}
} else if (OP2_TYPE == IS_UNUSED) {
ce = zend_fetch_class(NULL, opline->op2.num);
+257 -435
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -332,7 +332,7 @@ static uint32_t zend_vm_opcodes_flags[187] = {
0x00001001,
0x01000703,
0x00000000,
0x00001003,
0x00001001,
0x00000007,
0x00000003,
0x07000003,
+1 -1
View File
@@ -120,7 +120,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=7
PHP_MINOR_VERSION=1
PHP_RELEASE_VERSION=0
PHP_EXTRA_VERSION="RC5"
PHP_EXTRA_VERSION="RC2"
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`
+1 -4
View File
@@ -49,10 +49,7 @@ _bc_new_num_ex (length, scale, persistent)
int length, scale, persistent;
{
bc_num temp;
/* PHP Change: add length check */
if ((size_t)length+(size_t)scale > INT_MAX) {
zend_error(E_ERROR, "Result too long, max is %d", INT_MAX);
}
/* PHP Change: malloc() -> pemalloc(), removed free_list code */
temp = (bc_num) safe_pemalloc (1, sizeof(bc_struct)+length, scale, persistent);
#if 0
+2 -1
View File
@@ -41,5 +41,6 @@
void bc_out_of_memory (void)
{
zend_error(E_ERROR, "bcmath: out of memory!");
(void) fprintf (stderr, "bcmath: out of memory!\n");
exit (1);
}
+9 -7
View File
@@ -309,6 +309,7 @@ static union _zend_function *com_method_get(zend_object **object_ptr, zend_strin
}
f.num_args = bindptr.lpfuncdesc->cParams;
zend_set_function_arg_flags((zend_function*)&f);
ITypeInfo_ReleaseFuncDesc(TI, bindptr.lpfuncdesc);
break;
@@ -334,14 +335,15 @@ static union _zend_function *com_method_get(zend_object **object_ptr, zend_strin
}
}
zend_set_function_arg_flags((zend_function*)&f);
/* save this method in the cache */
if (!obj->method_cache) {
ALLOC_HASHTABLE(obj->method_cache);
zend_hash_init(obj->method_cache, 2, NULL, function_dtor, 0);
}
if (fptr) {
/* save this method in the cache */
if (!obj->method_cache) {
ALLOC_HASHTABLE(obj->method_cache);
zend_hash_init(obj->method_cache, 2, NULL, function_dtor, 0);
}
zend_hash_update_mem(obj->method_cache, name, &f, sizeof(f));
zend_hash_update_mem(obj->method_cache, name, &f, sizeof(f));
}
}
if (fptr) {
-1
View File
@@ -137,7 +137,6 @@ ZEND_METHOD(CURLFile, setPostFilename)
Unserialization handler */
ZEND_METHOD(CURLFile, __wakeup)
{
zend_unset_property(curl_CURLFile_class, getThis(), "name", sizeof("name")-1);
zend_update_property_string(curl_CURLFile_class, getThis(), "name", sizeof("name")-1, "");
zend_throw_exception(NULL, "Unserialization of CURLFile instances is not allowed", 0);
}
-3
View File
@@ -816,9 +816,6 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLE_SSL_ENGINE_NOTFOUND);
REGISTER_CURL_CONSTANT(CURLE_SSL_ENGINE_SETFAILED);
REGISTER_CURL_CONSTANT(CURLE_SSL_PEER_CERTIFICATE);
#if LIBCURL_VERSION_NUM >= 0x072700 /* Available since 7.39.0 */
REGISTER_CURL_CONSTANT(CURLE_SSL_PINNEDPUBKEYNOTMATCH);
#endif
REGISTER_CURL_CONSTANT(CURLE_TELNET_OPTION_SYNTAX);
REGISTER_CURL_CONSTANT(CURLE_TOO_MANY_REDIRECTS);
REGISTER_CURL_CONSTANT(CURLE_UNKNOWN_TELNET_OPTION);
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #73147: Use After Free in PHP7 unserialize()
--SKIPIF--
<?php
if (!extension_loaded("curl")) {
exit("skip curl extension not loaded");
}
?>
--FILE--
<?php
$poc = 'a:1:{i:0;O:8:"CURLFile":1:{s:4:"name";R:1;}}';
try {
var_dump(unserialize($poc));
} catch(Exception $e) {
echo $e->getMessage();
}
?>
--EXPECT--
Unserialization of CURLFile instances is not allowed
-1
View File
@@ -11,7 +11,6 @@ var tl_config = FSO.CreateTextFile("ext/date/lib/timelib_config.h", true);
tl_config.WriteLine("#include \"config.w32.h\"");
tl_config.WriteLine("#include <php_stdint.h>");
tl_config.WriteLine("#define TIMELIB_OMIT_STDINT 1");
tl_config.WriteLine("#define HAVE_GETTIMEOFDAY 1");
tl_config.WriteLine("#include \"zend.h\"");
tl_config.WriteLine("#define timelib_malloc emalloc");
tl_config.WriteLine("#define timelib_realloc erealloc");
-3
View File
@@ -65,7 +65,6 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
rt->h = two->h - one->h;
rt->i = two->i - one->i;
rt->s = two->s - one->s;
rt->f = two->f - one->f;
if (one_backup.dst == 0 && two_backup.dst == 1 && two->sse >= one->sse + 86400 - dst_corr) {
rt->h += dst_h_corr;
rt->i += dst_m_corr;
@@ -111,7 +110,6 @@ timelib_time *timelib_add(timelib_time *old_time, timelib_rel_time *interval)
t->relative.h = interval->h * bias;
t->relative.i = interval->i * bias;
t->relative.s = interval->s * bias;
t->relative.f = interval->f * bias;
}
t->have_relative = 1;
t->sse_uptodate = 0;
@@ -147,7 +145,6 @@ timelib_time *timelib_sub(timelib_time *old_time, timelib_rel_time *interval)
t->relative.h = 0 - (interval->h * bias);
t->relative.i = 0 - (interval->i * bias);
t->relative.s = 0 - (interval->s * bias);
t->relative.f = 0 - (interval->f * bias);
t->have_relative = 1;
t->sse_uptodate = 0;
+12786 -13776
View File
File diff suppressed because it is too large. Load diff
+20 -73
View File
@@ -52,15 +52,14 @@
#define TIMELIB_UNSET -99999
#define TIMELIB_SECOND 1
#define TIMELIB_MINUTE 2
#define TIMELIB_HOUR 3
#define TIMELIB_DAY 4
#define TIMELIB_MONTH 5
#define TIMELIB_YEAR 6
#define TIMELIB_WEEKDAY 7
#define TIMELIB_SPECIAL 8
#define TIMELIB_MICROSEC 9
#define TIMELIB_SECOND 1
#define TIMELIB_MINUTE 2
#define TIMELIB_HOUR 3
#define TIMELIB_DAY 4
#define TIMELIB_MONTH 5
#define TIMELIB_YEAR 6
#define TIMELIB_WEEKDAY 7
#define TIMELIB_SPECIAL 8
#define EOI 257
#define TIME 258
@@ -191,18 +190,6 @@ const static timelib_tz_lookup_table timelib_timezone_utc[] = {
};
static timelib_relunit const timelib_relunit_lookup[] = {
{ "ms", TIMELIB_MICROSEC, 1000 },
{ "msec", TIMELIB_MICROSEC, 1000 },
{ "msecs", TIMELIB_MICROSEC, 1000 },
{ "millisecond", TIMELIB_MICROSEC, 1000 },
{ "milliseconds", TIMELIB_MICROSEC, 1000 },
{ "µs", TIMELIB_MICROSEC, 1 },
{ "usec", TIMELIB_MICROSEC, 1 },
{ "usecs", TIMELIB_MICROSEC, 1 },
{ "µsec", TIMELIB_MICROSEC, 1 },
{ "µsecs", TIMELIB_MICROSEC, 1 },
{ "microsecond", TIMELIB_MICROSEC, 1 },
{ "microseconds", TIMELIB_MICROSEC, 1 },
{ "sec", TIMELIB_SECOND, 1 },
{ "secs", TIMELIB_SECOND, 1 },
{ "second", TIMELIB_SECOND, 1 },
@@ -407,12 +394,8 @@ static timelib_sll timelib_meridian(char **ptr, timelib_sll h)
}
++*ptr;
if (**ptr == '.') {
++*ptr;
}
if (**ptr == 'M' || **ptr == 'm') {
++*ptr;
}
if (**ptr == '.') {
*ptr += 3;
} else {
++*ptr;
}
return retval;
@@ -668,13 +651,12 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
}
switch (relunit->unit) {
case TIMELIB_MICROSEC: s->time->relative.f += (((double) amount * (double) relunit->multiplier) / 1000000); break;
case TIMELIB_SECOND: s->time->relative.s += amount * relunit->multiplier; break;
case TIMELIB_MINUTE: s->time->relative.i += amount * relunit->multiplier; break;
case TIMELIB_HOUR: s->time->relative.h += amount * relunit->multiplier; break;
case TIMELIB_DAY: s->time->relative.d += amount * relunit->multiplier; break;
case TIMELIB_MONTH: s->time->relative.m += amount * relunit->multiplier; break;
case TIMELIB_YEAR: s->time->relative.y += amount * relunit->multiplier; break;
case TIMELIB_SECOND: s->time->relative.s += amount * relunit->multiplier; break;
case TIMELIB_MINUTE: s->time->relative.i += amount * relunit->multiplier; break;
case TIMELIB_HOUR: s->time->relative.h += amount * relunit->multiplier; break;
case TIMELIB_DAY: s->time->relative.d += amount * relunit->multiplier; break;
case TIMELIB_MONTH: s->time->relative.m += amount * relunit->multiplier; break;
case TIMELIB_YEAR: s->time->relative.y += amount * relunit->multiplier; break;
case TIMELIB_WEEKDAY:
TIMELIB_HAVE_WEEKDAY_RELATIVE();
@@ -939,7 +921,6 @@ clf = day "/" monthabbr "/" year4 ":" hour24lz ":" minutelz ":" sec
/* Timestamp format: @1126396800 */
timestamp = "@" "-"? [0-9]+;
timestampms = "@" "-"? [0-9]+ "." [0-9]{6};
/* To fix some ambiguities */
dateshortwithtimeshort12 = datenoyear timeshort12;
@@ -953,7 +934,7 @@ dateshortwithtimelongtz = datenoyear iso8601normtz;
*/
reltextnumber = 'first'|'second'|'third'|'fourth'|'fifth'|'sixth'|'seventh'|'eight'|'eighth'|'ninth'|'tenth'|'eleventh'|'twelfth';
reltexttext = 'next'|'last'|'previous'|'this';
reltextunit = 'ms' | 'µs' | (('msec'|'millisecond'|'µsec'|'microsecond'|'usec'|'sec'|'second'|'min'|'minute'|'hour'|'day'|'fortnight'|'forthnight'|'month'|'year') 's'?) | 'weeks' | daytext;
reltextunit = (('sec'|'second'|'min'|'minute'|'hour'|'day'|'fortnight'|'forthnight'|'month'|'year') 's'?) | 'weeks' | daytext;
relnumber = ([+-]*[ \t]*[0-9]+);
relative = relnumber space? (reltextunit | 'week' );
@@ -1047,34 +1028,6 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
return TIMELIB_RELATIVE;
}
timestampms
{
timelib_ull i, ms;
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
TIMELIB_UNHAVE_DATE();
TIMELIB_UNHAVE_TIME();
TIMELIB_HAVE_TZ();
i = timelib_get_unsigned_nr((char **) &ptr, 24);
ms = timelib_get_unsigned_nr((char **) &ptr, 24);
s->time->y = 1970;
s->time->m = 1;
s->time->d = 1;
s->time->h = s->time->i = s->time->s = 0;
s->time->f = 0.0;
s->time->relative.s += i;
s->time->relative.f = ((double) ms) / 1000000.0;
s->time->is_localtime = 1;
s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
s->time->z = 0;
s->time->dst = 0;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
firstdayof | lastdayof
{
DEBUG_OUTPUT("firstdayof | lastdayof");
@@ -2075,6 +2028,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
s->time->m = 1;
s->time->d = 1;
s->time->h = s->time->i = s->time->s = 0;
s->time->f = 0.0;
s->time->relative.s += tmp;
s->time->is_localtime = 1;
s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
@@ -2232,20 +2186,13 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
parsed->s = 0;
parsed->f = 0;
}
if (
parsed->y != TIMELIB_UNSET || parsed->m != TIMELIB_UNSET || parsed->d != TIMELIB_UNSET ||
parsed->h != TIMELIB_UNSET || parsed->i != TIMELIB_UNSET || parsed->s != TIMELIB_UNSET
) {
if (parsed->f == TIMELIB_UNSET) parsed->f = 0;
} else {
if (parsed->f == TIMELIB_UNSET) parsed->f = now->f != TIMELIB_UNSET ? now->f : 0;
}
if (parsed->y == TIMELIB_UNSET) parsed->y = now->y != TIMELIB_UNSET ? now->y : 0;
if (parsed->m == TIMELIB_UNSET) parsed->m = now->m != TIMELIB_UNSET ? now->m : 0;
if (parsed->d == TIMELIB_UNSET) parsed->d = now->d != TIMELIB_UNSET ? now->d : 0;
if (parsed->m == TIMELIB_UNSET) parsed->m = now->m != TIMELIB_UNSET ? now->m : 0;
if (parsed->h == TIMELIB_UNSET) parsed->h = now->h != TIMELIB_UNSET ? now->h : 0;
if (parsed->i == TIMELIB_UNSET) parsed->i = now->i != TIMELIB_UNSET ? now->i : 0;
if (parsed->s == TIMELIB_UNSET) parsed->s = now->s != TIMELIB_UNSET ? now->s : 0;
if (parsed->f == TIMELIB_UNSET) parsed->f = now->f != TIMELIB_UNSET ? now->f : 0;
if (parsed->z == TIMELIB_UNSET) parsed->z = now->z != TIMELIB_UNSET ? now->z : 0;
if (parsed->dst == TIMELIB_UNSET) parsed->dst = now->dst != TIMELIB_UNSET ? now->dst : 0;
+1 -4
View File
@@ -231,7 +231,7 @@ void timelib_dump_date(timelib_time *d, int options)
printf("TS: %lld | %s%04lld-%02lld-%02lld %02lld:%02lld:%02lld",
d->sse, d->y < 0 ? "-" : "", TIMELIB_LLABS(d->y), d->m, d->d, d->h, d->i, d->s);
if (d->f > +0.0) {
printf(" %.6f", d->f);
printf(" %.5f", d->f);
}
if (d->is_localtime) {
@@ -260,9 +260,6 @@ void timelib_dump_date(timelib_time *d, int options)
if (d->have_relative) {
printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS",
d->relative.y, d->relative.m, d->relative.d, d->relative.h, d->relative.i, d->relative.s);
if (d->relative.f) {
printf(" %6f", d->relative.f);
}
if (d->relative.first_last_day_of != 0) {
switch (d->relative.first_last_day_of) {
case 1:
+2 -3
View File
@@ -38,8 +38,8 @@
# define timelib_free free
#endif
#define TIMELIB_VERSION 201605
#define TIMELIB_ASCII_VERSION "2016.05"
#define TIMELIB_VERSION 201602
#define TIMELIB_ASCII_VERSION "2016.02"
#define TIMELIB_NONE 0x00
#define TIMELIB_OVERRIDE_TIME 0x01
@@ -139,7 +139,6 @@ void timelib_time_set_option(timelib_time* tm, int option, void* option_value);
void timelib_time_dtor(timelib_time* t);
timelib_time* timelib_time_clone(timelib_time* orig);
int timelib_time_compare(timelib_time *t1, timelib_time *t2);
void timelib_set_fraction_from_timeval(timelib_time *t, struct timeval tp);
timelib_time_offset* timelib_time_offset_ctor(void);
void timelib_time_offset_dtor(timelib_time_offset* t);
+1 -1
View File
@@ -77,4 +77,4 @@ stdlib.h
])
dnl Check for strtoll, atoll
AC_CHECK_FUNCS(strtoll atoll strftime gettimeofday)
AC_CHECK_FUNCS(strtoll atoll strftime)
+1 -2
View File
@@ -125,7 +125,7 @@ typedef unsigned __int64 uint64_t;
#include <strings.h>
#endif
#if (defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)) && !defined(TIMELIB_FORCE_LONG32)
#if defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
typedef int64_t timelib_long;
typedef uint64_t timelib_ulong;
# define TIMELIB_LONG_MAX INT64_MAX
@@ -216,7 +216,6 @@ typedef struct timelib_special {
typedef struct timelib_rel_time {
timelib_sll y, m, d; /* Years, Months and Days */
timelib_sll h, i, s; /* Hours, mInutes and Seconds */
double f; /* Fraction */
int weekday; /* Stores the day in 'next monday' */
int weekday_behavior; /* 0: the current day should *not* be counted when advancing forwards; 1: the current day *should* be counted */
+2248 -2138
View File
File diff suppressed because it is too large. Load diff
+255 -38
View File
@@ -5,16 +5,10 @@
{ "acdt", 1, 37800, "Australia/South" },
{ "acdt", 1, 37800, "Australia/Yancowinna" },
{ "acst", 1, -14400, "America/Porto_Acre" },
{ "acst", 0, 32400, "Australia/Adelaide" },
{ "acst", 0, 34200, "Australia/Adelaide" },
{ "acst", 1, -14400, "America/Eirunepe" },
{ "acst", 1, -14400, "America/Rio_Branco" },
{ "acst", 1, -14400, "Brazil/Acre" },
{ "acst", 0, 32400, "Australia/Broken_Hill" },
{ "acst", 0, 32400, "Australia/Darwin" },
{ "acst", 0, 32400, "Australia/North" },
{ "acst", 0, 32400, "Australia/South" },
{ "acst", 0, 32400, "Australia/Yancowinna" },
{ "acst", 0, 34200, "Asia/Jayapura" },
{ "acst", 0, 34200, "Australia/Broken_Hill" },
{ "acst", 0, 34200, "Australia/Darwin" },
@@ -77,16 +71,23 @@
{ "ahst", 0, -36000, "America/Atka" },
{ "akdt", 1, -28800, "America/Anchorage" },
{ "akdt", 1, -28800, "America/Juneau" },
{ "akdt", 1, -28800, "America/Metlakatla" },
{ "akdt", 1, -28800, "America/Nome" },
{ "akdt", 1, -28800, "America/Sitka" },
{ "akdt", 1, -28800, "America/Yakutat" },
{ "akst", 0, -32400, "America/Anchorage" },
{ "akst", 0, -32400, "America/Juneau" },
{ "akst", 0, -32400, "America/Metlakatla" },
{ "akst", 0, -32400, "America/Nome" },
{ "akst", 0, -32400, "America/Sitka" },
{ "akst", 0, -32400, "America/Yakutat" },
{ "aktst", 1, 21600, "Asia/Aqtobe" },
{ "aktt", 0, 21600, "Asia/Aqtobe" },
{ "aktt", 0, 14400, "Asia/Aqtobe" },
{ "aktt", 0, 18000, "Asia/Aqtobe" },
{ "almst", 1, 25200, "Asia/Almaty" },
{ "almt", 0, 21600, "Asia/Almaty" },
{ "almt", 0, 18000, "Asia/Almaty" },
{ "amst", 1, 18000, "Asia/Yerevan" },
{ "amst", 1, 14400, "Asia/Yerevan" },
{ "amst", 1, -10800, "America/Boa_Vista" },
{ "amst", 1, -10800, "America/Campo_Grande" },
{ "amst", 1, -10800, "America/Cuiaba" },
@@ -94,6 +95,8 @@
{ "amst", 1, -10800, "America/Porto_Velho" },
{ "amst", 1, -10800, "America/Santarem" },
{ "amst", 1, -10800, "Brazil/West" },
{ "amt", 0, 14400, "Asia/Yerevan" },
{ "amt", 0, 10800, "Asia/Yerevan" },
{ "amt", 0, -13840, "America/Asuncion" },
{ "amt", 0, -14400, "America/Boa_Vista" },
{ "amt", 0, -14400, "America/Campo_Grande" },
@@ -108,6 +111,12 @@
{ "amt", 0, -14400, "Brazil/West" },
{ "amt", 0, 1172, "Europe/Amsterdam" },
{ "amt", 0, 5692, "Europe/Athens" },
{ "anast", 1, 50400, "Asia/Anadyr" },
{ "anast", 1, 43200, "Asia/Anadyr" },
{ "anast", 1, 46800, "Asia/Anadyr" },
{ "anat", 0, 46800, "Asia/Anadyr" },
{ "anat", 0, 39600, "Asia/Anadyr" },
{ "anat", 0, 43200, "Asia/Anadyr" },
{ "ant", 0, -16200, "America/Curacao" },
{ "ant", 0, -16200, "America/Aruba" },
{ "ant", 0, -16200, "America/Kralendijk" },
@@ -119,6 +128,12 @@
{ "apt", 1, -10800, "America/Pangnirtung" },
{ "apt", 1, -10800, "America/Puerto_Rico" },
{ "apt", 1, -10800, "Canada/Atlantic" },
{ "aqtst", 1, 21600, "Asia/Aqtau" },
{ "aqtst", 1, 18000, "Asia/Aqtau" },
{ "aqtst", 1, 21600, "Asia/Aqtobe" },
{ "aqtt", 0, 18000, "Asia/Aqtau" },
{ "aqtt", 0, 14400, "Asia/Aqtau" },
{ "aqtt", 0, 18000, "Asia/Aqtobe" },
{ "arst", 1, -7200, "America/Buenos_Aires" },
{ "arst", 1, -10800, "America/Buenos_Aires" },
{ "arst", 1, -10800, "America/Argentina/Buenos_Aires" },
@@ -199,6 +214,14 @@
{ "art", 0, -14400, "America/Mendoza" },
{ "art", 0, -14400, "America/Rosario" },
{ "art", 0, -14400, "Antarctica/Palmer" },
{ "ashst", 1, 21600, "Asia/Ashkhabad" },
{ "ashst", 1, 18000, "Asia/Ashkhabad" },
{ "ashst", 1, 18000, "Asia/Ashgabat" },
{ "ashst", 1, 21600, "Asia/Ashgabat" },
{ "asht", 0, 18000, "Asia/Ashkhabad" },
{ "asht", 0, 14400, "Asia/Ashkhabad" },
{ "asht", 0, 14400, "Asia/Ashgabat" },
{ "asht", 0, 18000, "Asia/Ashgabat" },
{ "ast", 0, 10800, "Asia/Riyadh" },
{ "ast", 0, -14400, "America/Anguilla" },
{ "ast", 0, -14400, "America/Antigua" },
@@ -242,6 +265,7 @@
{ "awdt", 1, 32400, "Australia/Perth" },
{ "awdt", 1, 32400, "Australia/West" },
{ "awst", 0, 28800, "Australia/Perth" },
{ "awst", 0, 28800, "Antarctica/Casey" },
{ "awst", 0, 28800, "Australia/West" },
{ "awt", 1, -10800, "America/Halifax" },
{ "awt", 1, -10800, "America/Blanc-Sablon" },
@@ -255,6 +279,14 @@
{ "azost", 1, -3600, "Atlantic/Azores" },
{ "azot", 0, -3600, "Atlantic/Azores" },
{ "azot", 0, -7200, "Atlantic/Azores" },
{ "azst", 1, 18000, "Asia/Baku" },
{ "azst", 1, 14400, "Asia/Baku" },
{ "azt", 0, 14400, "Asia/Baku" },
{ "azt", 0, 10800, "Asia/Baku" },
{ "bakst", 1, 18000, "Asia/Baku" },
{ "bakst", 1, 14400, "Asia/Baku" },
{ "bakt", 0, 14400, "Asia/Baku" },
{ "bakt", 0, 10800, "Asia/Baku" },
{ "bdst", 1, 7200, "Europe/London" },
{ "bdst", 1, 25200, "Asia/Dacca" },
{ "bdst", 1, 25200, "Asia/Dhaka" },
@@ -294,11 +326,7 @@
{ "bmt", 0, -14309, "America/Barbados" },
{ "bmt", 0, 6264, "Europe/Tiraspol" },
{ "bmt", 0, -17776, "America/Bogota" },
{ "bmt", 0, 1050, "Europe/Brussels" },
{ "bmt", 0, 10656, "Asia/Baghdad" },
{ "bmt", 0, 1786, "Europe/Busingen" },
{ "bmt", 0, 1786, "Europe/Vaduz" },
{ "bmt", 0, 1786, "Europe/Zurich" },
{ "bmt", 0, 24124, "Asia/Bangkok" },
{ "bmt", 0, 24124, "Asia/Phnom_Penh" },
{ "bmt", 0, 24124, "Asia/Vientiane" },
@@ -357,12 +385,12 @@
{ "burt", 0, 23400, "Asia/Dacca" },
{ "burt", 0, 23400, "Asia/Dhaka" },
{ "burt", 0, 23400, "Asia/Rangoon" },
{ "burt", 0, 23400, "Asia/Yangon" },
{ "cant", 0, -3600, "Atlantic/Canary" },
{ "capt", 1, -32400, "America/Anchorage" },
{ "cast", 0, 34200, "Australia/Adelaide" },
{ "cast", 1, 10800, "Africa/Juba" },
{ "cast", 1, 10800, "Africa/Khartoum" },
{ "cast", 0, 39600, "Antarctica/Casey" },
{ "cat", 0, -36000, "America/Anchorage" },
{ "cat", 0, 7200, "Africa/Khartoum" },
{ "cat", 0, 7200, "Africa/Blantyre" },
@@ -438,6 +466,7 @@
{ "cest", 1, 7200, "Africa/Ceuta" },
{ "cest", 1, 7200, "Africa/Tripoli" },
{ "cest", 1, 7200, "Africa/Tunis" },
{ "cest", 1, 7200, "Antarctica/Troll" },
{ "cest", 1, 7200, "Arctic/Longyearbyen" },
{ "cest", 1, 7200, "Atlantic/Jan_Mayen" },
{ "cest", 1, 7200, "Europe/Amsterdam" },
@@ -559,7 +588,10 @@
{ "clst", 1, -10800, "Chile/Continental" },
{ "clst", 1, -14400, "Chile/Continental" },
{ "clt", 0, -14400, "America/Santiago" },
{ "clt", 0, -10800, "America/Santiago" },
{ "clt", 0, -18000, "America/Santiago" },
{ "clt", 0, -10800, "Antarctica/Palmer" },
{ "clt", 0, -10800, "Chile/Continental" },
{ "clt", 0, -14400, "Antarctica/Palmer" },
{ "clt", 0, -14400, "Chile/Continental" },
{ "clt", 0, -18000, "Chile/Continental" },
@@ -586,7 +618,6 @@
{ "cmt", 0, -16356, "America/La_Paz" },
{ "cmt", 0, -19176, "America/Cayman" },
{ "cmt", 0, -19176, "America/Panama" },
{ "cmt", 0, 3020, "Europe/Copenhagen" },
{ "cmt", 0, 6900, "Europe/Chisinau" },
{ "cmt", 0, 6900, "Europe/Tiraspol" },
{ "cost", 1, -14400, "America/Bogota" },
@@ -707,13 +738,22 @@
{ "chst", 0, 36000, "Pacific/Saipan" },
{ "dact", 0, 21600, "Asia/Dacca" },
{ "dact", 0, 21600, "Asia/Dhaka" },
{ "davt", 0, 25200, "Antarctica/Davis" },
{ "davt", 0, 18000, "Antarctica/Davis" },
{ "ddut", 0, 36000, "Antarctica/DumontDUrville" },
{ "dmt", 0, -1521, "Europe/Dublin" },
{ "dusst", 1, 25200, "Asia/Dushanbe" },
{ "dusst", 1, 21600, "Asia/Dushanbe" },
{ "dust", 0, 21600, "Asia/Dushanbe" },
{ "dust", 0, 18000, "Asia/Dushanbe" },
{ "easst", 1, -21600, "Chile/EasterIsland" },
{ "easst", 1, -18000, "Chile/EasterIsland" },
{ "easst", 1, -18000, "Pacific/Easter" },
{ "easst", 1, -21600, "Pacific/Easter" },
{ "east", 0, -18000, "Chile/EasterIsland" },
{ "east", 0, -21600, "Chile/EasterIsland" },
{ "east", 0, -25200, "Chile/EasterIsland" },
{ "east", 0, -18000, "Pacific/Easter" },
{ "east", 0, -21600, "Pacific/Easter" },
{ "east", 0, -25200, "Pacific/Easter" },
{ "eat", 0, 10800, "Africa/Khartoum" },
@@ -779,6 +819,7 @@
{ "eest", 1, 10800, "Europe/Moscow" },
{ "eest", 1, 10800, "Europe/Nicosia" },
{ "eest", 1, 10800, "Europe/Riga" },
{ "eest", 1, 10800, "Europe/Samara" },
{ "eest", 1, 10800, "Europe/Simferopol" },
{ "eest", 1, 10800, "Europe/Sofia" },
{ "eest", 1, 10800, "Europe/Tallinn" },
@@ -880,6 +921,8 @@
{ "ewt", 1, -14400, "America/Thunder_Bay" },
{ "ewt", 1, -14400, "America/Toronto" },
{ "ewt", 1, -14400, "Canada/Eastern" },
{ "fet", 0, 10800, "Europe/Kaliningrad" },
{ "fet", 0, 10800, "Europe/Minsk" },
{ "ffmt", 0, -14660, "America/Martinique" },
{ "fjst", 1, 46800, "Pacific/Fiji" },
{ "fjt", 0, 43200, "Pacific/Fiji" },
@@ -893,9 +936,19 @@
{ "fnst", 1, -3600, "Brazil/DeNoronha" },
{ "fnt", 0, -7200, "America/Noronha" },
{ "fnt", 0, -7200, "Brazil/DeNoronha" },
{ "fort", 0, 18000, "Asia/Aqtau" },
{ "fort", 0, 14400, "Asia/Aqtau" },
{ "frust", 1, 25200, "Asia/Bishkek" },
{ "frust", 1, 21600, "Asia/Bishkek" },
{ "frut", 0, 21600, "Asia/Bishkek" },
{ "frut", 0, 18000, "Asia/Bishkek" },
{ "galt", 0, -21600, "Pacific/Galapagos" },
{ "gamt", 0, -32400, "Pacific/Gambier" },
{ "gbgt", 0, -13500, "America/Guyana" },
{ "gest", 1, 14400, "Asia/Tbilisi" },
{ "gest", 1, 18000, "Asia/Tbilisi" },
{ "get", 0, 14400, "Asia/Tbilisi" },
{ "get", 0, 10800, "Asia/Tbilisi" },
{ "gft", 0, -14400, "America/Cayenne" },
{ "gft", 0, -10800, "America/Cayenne" },
{ "ghst", 1, 1200, "Africa/Accra" },
@@ -937,9 +990,11 @@
{ "gyt", 0, -14400, "America/Guyana" },
{ "gyt", 0, -10800, "America/Guyana" },
{ "gyt", 0, -13500, "America/Guyana" },
{ "hadt", 1, -32400, "America/Adak" },
{ "hadt", 1, -32400, "America/Atka" },
{ "hast", 0, -36000, "America/Adak" },
{ "hast", 0, -36000, "America/Atka" },
{ "hdt", 1, -34200, "Pacific/Honolulu" },
{ "hdt", 1, -32400, "America/Adak" },
{ "hdt", 1, -32400, "America/Atka" },
{ "hdt", 1, -34200, "Pacific/Johnston" },
{ "hkst", 1, 32400, "Asia/Hong_Kong" },
{ "hkt", 0, 28800, "Asia/Hong_Kong" },
@@ -956,8 +1011,6 @@
{ "hovt", 0, 21600, "Asia/Hovd" },
{ "hst", 0, -36000, "Pacific/Honolulu" },
{ "hst", 0, -37800, "Pacific/Honolulu" },
{ "hst", 0, -36000, "America/Adak" },
{ "hst", 0, -36000, "America/Atka" },
{ "hst", 0, -36000, "Pacific/Johnston" },
{ "hst", 0, -37800, "Pacific/Johnston" },
{ "ict", 0, 25200, "Asia/Bangkok" },
@@ -977,11 +1030,16 @@
{ "imt", 0, 25025, "Asia/Irkutsk" },
{ "imt", 0, 7016, "Asia/Istanbul" },
{ "imt", 0, 7016, "Europe/Istanbul" },
{ "imt", 0, 7016, "Europe/Sofia" },
{ "iot", 0, 21600, "Indian/Chagos" },
{ "iot", 0, 18000, "Indian/Chagos" },
{ "irdt", 1, 16200, "Asia/Tehran" },
{ "irdt", 1, 18000, "Asia/Tehran" },
{ "irkst", 1, 32400, "Asia/Irkutsk" },
{ "irkst", 1, 28800, "Asia/Irkutsk" },
{ "irkt", 0, 28800, "Asia/Irkutsk" },
{ "irkt", 0, 25200, "Asia/Irkutsk" },
{ "irkt", 0, 32400, "Asia/Irkutsk" },
{ "irkt", 0, 28800, "Asia/Chita" },
{ "irst", 0, 12600, "Asia/Tehran" },
{ "irst", 0, 14400, "Asia/Tehran" },
{ "isst", 1, 0, "Atlantic/Reykjavik" },
@@ -1009,6 +1067,7 @@
{ "ist", 0, 7200, "Asia/Tel_Aviv" },
{ "javt", 0, 26400, "Asia/Jakarta" },
{ "jcst", 0, 32400, "Asia/Pyongyang" },
{ "jcst", 0, 32400, "Asia/Sakhalin" },
{ "jcst", 0, 32400, "Asia/Seoul" },
{ "jcst", 0, 32400, "Asia/Tokyo" },
{ "jcst", 0, 32400, "ROK" },
@@ -1028,11 +1087,11 @@
{ "jst", 0, 32400, "Asia/Pyongyang" },
{ "jst", 0, 32400, "Asia/Rangoon" },
{ "jst", 0, 32400, "Asia/Saigon" },
{ "jst", 0, 32400, "Asia/Sakhalin" },
{ "jst", 0, 32400, "Asia/Seoul" },
{ "jst", 0, 32400, "Asia/Singapore" },
{ "jst", 0, 32400, "Asia/Taipei" },
{ "jst", 0, 32400, "Asia/Ujung_Pandang" },
{ "jst", 0, 32400, "Asia/Yangon" },
{ "jst", 0, 32400, "Pacific/Bougainville" },
{ "jst", 0, 32400, "Pacific/Nauru" },
{ "jst", 0, 32400, "ROC" },
@@ -1044,18 +1103,37 @@
{ "kdt", 1, 34200, "Asia/Seoul" },
{ "kdt", 1, 34200, "ROK" },
{ "kdt", 1, 36000, "ROK" },
{ "kgst", 1, 21600, "Asia/Bishkek" },
{ "kgt", 0, 18000, "Asia/Bishkek" },
{ "kgt", 0, 21600, "Asia/Bishkek" },
{ "kizst", 1, 21600, "Asia/Qyzylorda" },
{ "kizt", 0, 21600, "Asia/Qyzylorda" },
{ "kizt", 0, 14400, "Asia/Qyzylorda" },
{ "kizt", 0, 18000, "Asia/Qyzylorda" },
{ "kmt", 0, 5736, "Europe/Vilnius" },
{ "kmt", 0, -18431, "America/Grand_Turk" },
{ "kmt", 0, -18431, "America/Jamaica" },
{ "kmt", 0, 7324, "Europe/Kiev" },
{ "kost", 0, 43200, "Pacific/Kosrae" },
{ "kost", 0, 39600, "Pacific/Kosrae" },
{ "krast", 1, 28800, "Asia/Krasnoyarsk" },
{ "krast", 1, 25200, "Asia/Krasnoyarsk" },
{ "krast", 1, 25200, "Asia/Novokuznetsk" },
{ "krast", 1, 28800, "Asia/Novokuznetsk" },
{ "krat", 0, 25200, "Asia/Krasnoyarsk" },
{ "krat", 0, 21600, "Asia/Krasnoyarsk" },
{ "krat", 0, 28800, "Asia/Krasnoyarsk" },
{ "krat", 0, 21600, "Asia/Novokuznetsk" },
{ "krat", 0, 25200, "Asia/Novokuznetsk" },
{ "kst", 0, 30600, "Asia/Seoul" },
{ "kst", 0, 32400, "Asia/Pyongyang" },
{ "kst", 0, 32400, "Asia/Seoul" },
{ "kst", 0, 30600, "Asia/Pyongyang" },
{ "kst", 0, 30600, "ROK" },
{ "kst", 0, 32400, "ROK" },
{ "kuyst", 1, 18000, "Europe/Samara" },
{ "kuyt", 0, 14400, "Europe/Samara" },
{ "kuyt", 0, 10800, "Europe/Samara" },
{ "kwat", 0, -43200, "Pacific/Kwajalein" },
{ "lhdt", 1, 39600, "Australia/LHI" },
{ "lhdt", 1, 39600, "Australia/Lord_Howe" },
@@ -1073,6 +1151,21 @@
{ "madmt", 1, 3600, "Atlantic/Madeira" },
{ "madst", 1, 0, "Atlantic/Madeira" },
{ "madt", 0, -3600, "Atlantic/Madeira" },
{ "magst", 1, 43200, "Asia/Magadan" },
{ "magst", 1, 39600, "Asia/Magadan" },
{ "magst", 1, 39600, "Asia/Srednekolymsk" },
{ "magst", 1, 39600, "Asia/Ust-Nera" },
{ "magst", 1, 43200, "Asia/Srednekolymsk" },
{ "magst", 1, 43200, "Asia/Ust-Nera" },
{ "magt", 0, 36000, "Asia/Magadan" },
{ "magt", 0, 39600, "Asia/Magadan" },
{ "magt", 0, 43200, "Asia/Magadan" },
{ "magt", 0, 36000, "Asia/Srednekolymsk" },
{ "magt", 0, 36000, "Asia/Ust-Nera" },
{ "magt", 0, 39600, "Asia/Srednekolymsk" },
{ "magt", 0, 39600, "Asia/Ust-Nera" },
{ "magt", 0, 43200, "Asia/Srednekolymsk" },
{ "magt", 0, 43200, "Asia/Ust-Nera" },
{ "malst", 1, 26400, "Asia/Singapore" },
{ "malst", 1, 26400, "Asia/Kuala_Lumpur" },
{ "malt", 0, 27000, "Asia/Singapore" },
@@ -1082,6 +1175,8 @@
{ "malt", 0, 26400, "Asia/Kuala_Lumpur" },
{ "malt", 0, 27000, "Asia/Kuala_Lumpur" },
{ "mart", 0, -34200, "Pacific/Marquesas" },
{ "mawt", 0, 21600, "Antarctica/Mawson" },
{ "mawt", 0, 18000, "Antarctica/Mawson" },
{ "mddt", 1, -18000, "America/Cambridge_Bay" },
{ "mddt", 1, -18000, "America/Yellowknife" },
{ "mdst", 1, 16279, "Europe/Moscow" },
@@ -1107,8 +1202,6 @@
{ "mdt", 1, -21600, "Canada/Mountain" },
{ "mdt", 1, -21600, "Canada/Saskatchewan" },
{ "mdt", 1, -21600, "Mexico/BajaSur" },
{ "mest", 1, 7200, "MET" },
{ "met", 0, 3600, "MET" },
{ "mht", 0, 43200, "Pacific/Kwajalein" },
{ "mht", 0, 39600, "Pacific/Kwajalein" },
{ "mht", 0, 39600, "Pacific/Majuro" },
@@ -1122,7 +1215,6 @@
{ "mmt", 0, 17640, "Indian/Maldives" },
{ "mmt", 0, 19172, "Asia/Colombo" },
{ "mmt", 0, 23400, "Asia/Rangoon" },
{ "mmt", 0, 23400, "Asia/Yangon" },
{ "mmt", 0, 28656, "Asia/Makassar" },
{ "mmt", 0, 28656, "Asia/Ujung_Pandang" },
{ "mmt", 0, 6600, "Europe/Minsk" },
@@ -1150,11 +1242,13 @@
{ "msd", 1, 14400, "Europe/Kiev" },
{ "msd", 1, 14400, "Europe/Minsk" },
{ "msd", 1, 14400, "Europe/Riga" },
{ "msd", 1, 14400, "Europe/Samara" },
{ "msd", 1, 14400, "Europe/Simferopol" },
{ "msd", 1, 14400, "Europe/Tallinn" },
{ "msd", 1, 14400, "Europe/Tiraspol" },
{ "msd", 1, 14400, "Europe/Uzhgorod" },
{ "msd", 1, 14400, "Europe/Vilnius" },
{ "msd", 1, 14400, "Europe/Volgograd" },
{ "msd", 1, 14400, "Europe/Zaporozhye" },
{ "msk", 0, 10800, "Europe/Moscow" },
{ "msk", 0, 14400, "Europe/Moscow" },
@@ -1163,13 +1257,17 @@
{ "msk", 0, 10800, "Europe/Kiev" },
{ "msk", 0, 10800, "Europe/Minsk" },
{ "msk", 0, 10800, "Europe/Riga" },
{ "msk", 0, 10800, "Europe/Samara" },
{ "msk", 0, 10800, "Europe/Simferopol" },
{ "msk", 0, 10800, "Europe/Tallinn" },
{ "msk", 0, 10800, "Europe/Tiraspol" },
{ "msk", 0, 10800, "Europe/Uzhgorod" },
{ "msk", 0, 10800, "Europe/Vilnius" },
{ "msk", 0, 10800, "Europe/Volgograd" },
{ "msk", 0, 10800, "Europe/Zaporozhye" },
{ "msk", 0, 14400, "Europe/Simferopol" },
{ "msk", 0, 14400, "Europe/Volgograd" },
{ "msm", 1, 18000, "Europe/Moscow" },
{ "mst", 0, -25200, "America/Denver" },
{ "mst", 0, -25200, "America/Bahia_Banderas" },
{ "mst", 0, -25200, "America/Boise" },
@@ -1179,7 +1277,6 @@
{ "mst", 0, -25200, "America/Dawson_Creek" },
{ "mst", 0, -25200, "America/Edmonton" },
{ "mst", 0, -25200, "America/Ensenada" },
{ "mst", 0, -25200, "America/Fort_Nelson" },
{ "mst", 0, -25200, "America/Hermosillo" },
{ "mst", 0, -25200, "America/Inuvik" },
{ "mst", 0, -25200, "America/Mazatlan" },
@@ -1235,10 +1332,15 @@
{ "negt", 0, -12600, "America/Paramaribo" },
{ "nest", 1, 4800, "Europe/Amsterdam" },
{ "net", 0, 1200, "Europe/Amsterdam" },
{ "nfst", 1, 45000, "Pacific/Norfolk" },
{ "nft", 0, 41400, "Pacific/Norfolk" },
{ "nft", 0, 39600, "Pacific/Norfolk" },
{ "nmt", 0, 40320, "Pacific/Norfolk" },
{ "novst", 1, 25200, "Asia/Novosibirsk" },
{ "novst", 1, 28800, "Asia/Novosibirsk" },
{ "novst", 1, 25200, "Asia/Novokuznetsk" },
{ "novt", 0, 21600, "Asia/Novosibirsk" },
{ "novt", 0, 25200, "Asia/Novosibirsk" },
{ "novt", 0, 21600, "Asia/Novokuznetsk" },
{ "novt", 0, 25200, "Asia/Novokuznetsk" },
{ "npt", 1, -9000, "America/St_Johns" },
{ "npt", 0, 20700, "Asia/Katmandu" },
{ "npt", 1, -36000, "America/Adak" },
@@ -1291,13 +1393,20 @@
{ "nzst", 1, 45000, "Antarctica/McMurdo" },
{ "nzst", 1, 45000, "Antarctica/South_Pole" },
{ "nzst", 1, 45000, "NZ" },
{ "omsst", 1, 25200, "Asia/Omsk" },
{ "omsst", 1, 21600, "Asia/Omsk" },
{ "omst", 0, 21600, "Asia/Omsk" },
{ "omst", 0, 18000, "Asia/Omsk" },
{ "omst", 0, 25200, "Asia/Omsk" },
{ "orast", 1, 18000, "Asia/Oral" },
{ "orat", 0, 18000, "Asia/Oral" },
{ "orat", 0, 14400, "Asia/Oral" },
{ "pddt", 1, -21600, "America/Inuvik" },
{ "pdt", 1, -25200, "America/Los_Angeles" },
{ "pdt", 1, -25200, "America/Boise" },
{ "pdt", 1, -25200, "America/Dawson" },
{ "pdt", 1, -25200, "America/Dawson_Creek" },
{ "pdt", 1, -25200, "America/Ensenada" },
{ "pdt", 1, -25200, "America/Fort_Nelson" },
{ "pdt", 1, -25200, "America/Juneau" },
{ "pdt", 1, -25200, "America/Metlakatla" },
{ "pdt", 1, -25200, "America/Santa_Isabel" },
@@ -1309,6 +1418,10 @@
{ "pdt", 1, -25200, "Canada/Yukon" },
{ "pdt", 1, -25200, "Mexico/BajaNorte" },
{ "pest", 1, -14400, "America/Lima" },
{ "petst", 1, 46800, "Asia/Kamchatka" },
{ "petst", 1, 43200, "Asia/Kamchatka" },
{ "pett", 0, 43200, "Asia/Kamchatka" },
{ "pett", 0, 39600, "Asia/Kamchatka" },
{ "pet", 0, -18000, "America/Lima" },
{ "pgt", 0, 36000, "Pacific/Bougainville" },
{ "pgt", 0, 36000, "Pacific/Port_Moresby" },
@@ -1322,14 +1435,12 @@
{ "plmt", 0, 25590, "Asia/Ho_Chi_Minh" },
{ "plmt", 0, 25590, "Asia/Saigon" },
{ "pmdt", 1, -7200, "America/Miquelon" },
{ "pmmt", 0, 35312, "Pacific/Bougainville" },
{ "pmst", 0, -10800, "America/Miquelon" },
{ "pmt", 0, -13236, "America/Paramaribo" },
{ "pmt", 0, -13252, "America/Paramaribo" },
{ "pmt", 0, 36000, "Antarctica/DumontDUrville" },
{ "pmt", 0, 13505, "Asia/Yekaterinburg" },
{ "pmt", 0, 26240, "Asia/Pontianak" },
{ "pmt", 0, 3464, "Europe/Bratislava" },
{ "pmt", 0, 3464, "Europe/Prague" },
{ "pmt", 0, 561, "Africa/Algiers" },
{ "pmt", 0, 561, "Africa/Tunis" },
{ "pmt", 0, 561, "Europe/Monaco" },
@@ -1341,7 +1452,6 @@
{ "ppt", 1, -25200, "America/Los_Angeles" },
{ "ppt", 1, -25200, "America/Dawson_Creek" },
{ "ppt", 1, -25200, "America/Ensenada" },
{ "ppt", 1, -25200, "America/Fort_Nelson" },
{ "ppt", 1, -25200, "America/Juneau" },
{ "ppt", 1, -25200, "America/Metlakatla" },
{ "ppt", 1, -25200, "America/Santa_Isabel" },
@@ -1357,7 +1467,6 @@
{ "pst", 0, -28800, "America/Dawson" },
{ "pst", 0, -28800, "America/Dawson_Creek" },
{ "pst", 0, -28800, "America/Ensenada" },
{ "pst", 0, -28800, "America/Fort_Nelson" },
{ "pst", 0, -28800, "America/Hermosillo" },
{ "pst", 0, -28800, "America/Inuvik" },
{ "pst", 0, -28800, "America/Juneau" },
@@ -1376,7 +1485,6 @@
{ "pwt", 1, -25200, "America/Los_Angeles" },
{ "pwt", 1, -25200, "America/Dawson_Creek" },
{ "pwt", 1, -25200, "America/Ensenada" },
{ "pwt", 1, -25200, "America/Fort_Nelson" },
{ "pwt", 1, -25200, "America/Juneau" },
{ "pwt", 1, -25200, "America/Metlakatla" },
{ "pwt", 1, -25200, "America/Santa_Isabel" },
@@ -1390,13 +1498,24 @@
{ "pyt", 0, -14400, "America/Asuncion" },
{ "pyt", 0, -10800, "America/Asuncion" },
{ "qmt", 0, -18840, "America/Guayaquil" },
{ "qyzst", 1, 25200, "Asia/Qyzylorda" },
{ "qyzt", 0, 21600, "Asia/Qyzylorda" },
{ "qyzt", 0, 18000, "Asia/Qyzylorda" },
{ "ret", 0, 14400, "Indian/Reunion" },
{ "rmt", 0, 5794, "Europe/Riga" },
{ "rmt", 0, 23080, "Asia/Rangoon" },
{ "rmt", 0, 23080, "Asia/Yangon" },
{ "rmt", 0, 2996, "Europe/Rome" },
{ "rmt", 0, 2996, "Europe/San_Marino" },
{ "rmt", 0, 2996, "Europe/Vatican" },
{ "rott", 0, -10800, "Antarctica/Rothera" },
{ "sakst", 1, 39600, "Asia/Sakhalin" },
{ "sakst", 1, 43200, "Asia/Sakhalin" },
{ "sakt", 0, 36000, "Asia/Sakhalin" },
{ "sakt", 0, 39600, "Asia/Sakhalin" },
{ "samst", 1, 21600, "Asia/Samarkand" },
{ "samst", 1, 14400, "Europe/Samara" },
{ "samst", 1, 18000, "Europe/Samara" },
{ "samt", 0, 18000, "Asia/Samarkand" },
{ "samt", 0, 14400, "Asia/Samarkand" },
{ "samt", 0, 10800, "Europe/Samara" },
{ "samt", 0, 14400, "Europe/Samara" },
{ "sast", 0, 7200, "Africa/Johannesburg" },
{ "sast", 1, 10800, "Africa/Johannesburg" },
{ "sast", 0, 5400, "Africa/Johannesburg" },
@@ -1412,9 +1531,11 @@
{ "sct", 0, 14400, "Indian/Mahe" },
{ "sdmt", 0, -16800, "America/Santo_Domingo" },
{ "sdt", 1, -36000, "Pacific/Apia" },
{ "set", 0, 3614, "Europe/Stockholm" },
{ "sgt", 0, 28800, "Asia/Singapore" },
{ "sgt", 0, 27000, "Asia/Singapore" },
{ "shest", 1, 21600, "Asia/Aqtau" },
{ "shet", 0, 21600, "Asia/Aqtau" },
{ "shet", 0, 18000, "Asia/Aqtau" },
{ "sjmt", 0, -20173, "America/Costa_Rica" },
{ "smt", 0, -13884, "Atlantic/Stanley" },
{ "smt", 0, -16966, "America/Santiago" },
@@ -1422,24 +1543,53 @@
{ "smt", 0, 24925, "Asia/Kuala_Lumpur" },
{ "smt", 0, 24925, "Asia/Singapore" },
{ "smt", 0, 8160, "Europe/Simferopol" },
{ "sret", 0, 39600, "Asia/Srednekolymsk" },
{ "srt", 0, -10800, "America/Paramaribo" },
{ "srt", 0, -12600, "America/Paramaribo" },
{ "sst", 0, -39600, "Pacific/Samoa" },
{ "sst", 0, -39600, "Pacific/Apia" },
{ "sst", 0, -39600, "Pacific/Midway" },
{ "sst", 0, -39600, "Pacific/Pago_Pago" },
{ "stat", 0, 10800, "Europe/Volgograd" },
{ "stat", 0, 14400, "Europe/Volgograd" },
{ "svest", 1, 21600, "Asia/Yekaterinburg" },
{ "svest", 1, 18000, "Asia/Yekaterinburg" },
{ "svet", 0, 18000, "Asia/Yekaterinburg" },
{ "svet", 0, 14400, "Asia/Yekaterinburg" },
{ "swat", 0, 5400, "Africa/Windhoek" },
{ "syot", 0, 10800, "Antarctica/Syowa" },
{ "taht", 0, -36000, "Pacific/Tahiti" },
{ "tasst", 1, 25200, "Asia/Samarkand" },
{ "tasst", 1, 21600, "Asia/Tashkent" },
{ "tasst", 1, 25200, "Asia/Tashkent" },
{ "tast", 0, 21600, "Asia/Samarkand" },
{ "tast", 0, 18000, "Asia/Tashkent" },
{ "tast", 0, 21600, "Asia/Tashkent" },
{ "tbist", 1, 18000, "Asia/Tbilisi" },
{ "tbist", 1, 14400, "Asia/Tbilisi" },
{ "tbit", 0, 14400, "Asia/Tbilisi" },
{ "tbit", 0, 10800, "Asia/Tbilisi" },
{ "tbmt", 0, 10751, "Asia/Tbilisi" },
{ "tft", 0, 18000, "Indian/Kerguelen" },
{ "tjt", 0, 18000, "Asia/Dushanbe" },
{ "tkt", 0, -39600, "Pacific/Fakaofo" },
{ "tkt", 0, 46800, "Pacific/Fakaofo" },
{ "tlt", 0, 32400, "Asia/Dili" },
{ "tlt", 0, 28800, "Asia/Dili" },
{ "tmt", 0, 12344, "Asia/Tehran" },
{ "tmt", 0, 5940, "Europe/Tallinn" },
{ "tmt", 0, 14400, "Asia/Ashgabat" },
{ "tmt", 0, 14400, "Asia/Ashkhabad" },
{ "tmt", 0, 18000, "Asia/Ashgabat" },
{ "tmt", 0, 18000, "Asia/Ashkhabad" },
{ "tost", 1, 50400, "Pacific/Tongatapu" },
{ "tot", 0, 46800, "Pacific/Tongatapu" },
{ "tot", 0, 44400, "Pacific/Tongatapu" },
{ "trst", 1, 14400, "Europe/Istanbul" },
{ "trst", 1, 14400, "Asia/Istanbul" },
{ "trt", 0, 10800, "Europe/Istanbul" },
{ "trt", 0, 10800, "Asia/Istanbul" },
{ "tsat", 0, 10800, "Europe/Volgograd" },
{ "tvt", 0, 43200, "Pacific/Funafuti" },
{ "uct", 0, 0, "Etc/UCT" },
{ "ulast", 1, 32400, "Asia/Ulaanbaatar" },
@@ -1450,6 +1600,12 @@
{ "ulat", 0, 25200, "Asia/Ulan_Bator" },
{ "ulat", 0, 28800, "Asia/Choibalsan" },
{ "ulat", 0, 28800, "Asia/Ulan_Bator" },
{ "urast", 1, 21600, "Asia/Oral" },
{ "urast", 1, 18000, "Asia/Oral" },
{ "urat", 0, 21600, "Asia/Oral" },
{ "urat", 0, 14400, "Asia/Oral" },
{ "urat", 0, 18000, "Asia/Oral" },
{ "utc", 0, 0, "Antarctica/Troll" },
{ "utc", 0, 0, "Etc/Universal" },
{ "utc", 0, 0, "Etc/UTC" },
{ "utc", 0, 0, "Etc/Zulu" },
@@ -1460,8 +1616,27 @@
{ "uyst", 1, -7200, "America/Montevideo" },
{ "uyt", 0, -10800, "America/Montevideo" },
{ "uyt", 0, -12600, "America/Montevideo" },
{ "uzst", 1, 21600, "Asia/Samarkand" },
{ "uzst", 1, 21600, "Asia/Tashkent" },
{ "uzt", 0, 18000, "Asia/Samarkand" },
{ "uzt", 0, 18000, "Asia/Tashkent" },
{ "vet", 0, -16200, "America/Caracas" },
{ "vet", 0, -14400, "America/Caracas" },
{ "vlast", 1, 39600, "Asia/Vladivostok" },
{ "vlast", 1, 36000, "Asia/Vladivostok" },
{ "vlast", 1, 39600, "Asia/Khandyga" },
{ "vlat", 0, 36000, "Asia/Vladivostok" },
{ "vlat", 0, 32400, "Asia/Vladivostok" },
{ "vlat", 0, 39600, "Asia/Vladivostok" },
{ "vlat", 0, 36000, "Asia/Khandyga" },
{ "vlat", 0, 36000, "Asia/Ust-Nera" },
{ "vlat", 0, 39600, "Asia/Khandyga" },
{ "vlat", 0, 39600, "Asia/Ust-Nera" },
{ "volst", 1, 14400, "Europe/Volgograd" },
{ "volst", 1, 18000, "Europe/Volgograd" },
{ "volt", 0, 10800, "Europe/Volgograd" },
{ "volt", 0, 14400, "Europe/Volgograd" },
{ "vost", 0, 21600, "Antarctica/Vostok" },
{ "vust", 1, 43200, "Pacific/Efate" },
{ "vut", 0, 39600, "Pacific/Efate" },
{ "wakt", 0, 43200, "Pacific/Wake" },
@@ -1562,6 +1737,23 @@
{ "wsst", 0, 46800, "Pacific/Apia" },
{ "xjt", 0, 21600, "Asia/Kashgar" },
{ "xjt", 0, 21600, "Asia/Urumqi" },
{ "yakst", 1, 36000, "Asia/Yakutsk" },
{ "yakst", 1, 32400, "Asia/Yakutsk" },
{ "yakst", 1, 32400, "Asia/Chita" },
{ "yakst", 1, 32400, "Asia/Khandyga" },
{ "yakst", 1, 36000, "Asia/Chita" },
{ "yakst", 1, 36000, "Asia/Khandyga" },
{ "yakt", 0, 32400, "Asia/Yakutsk" },
{ "yakt", 0, 28800, "Asia/Yakutsk" },
{ "yakt", 0, 36000, "Asia/Yakutsk" },
{ "yakt", 0, 28800, "Asia/Chita" },
{ "yakt", 0, 28800, "Asia/Khandyga" },
{ "yakt", 0, 28800, "Asia/Ust-Nera" },
{ "yakt", 0, 32400, "Asia/Chita" },
{ "yakt", 0, 32400, "Asia/Khandyga" },
{ "yakt", 0, 32400, "Asia/Ust-Nera" },
{ "yakt", 0, 36000, "Asia/Chita" },
{ "yakt", 0, 36000, "Asia/Khandyga" },
{ "yddt", 1, -25200, "America/Dawson" },
{ "yddt", 1, -25200, "America/Whitehorse" },
{ "yddt", 1, -25200, "Canada/Yukon" },
@@ -1570,6 +1762,13 @@
{ "ydt", 1, -28800, "America/Whitehorse" },
{ "ydt", 1, -28800, "America/Yakutat" },
{ "ydt", 1, -28800, "Canada/Yukon" },
{ "yekst", 1, 21600, "Asia/Yekaterinburg" },
{ "yekt", 0, 18000, "Asia/Yekaterinburg" },
{ "yekt", 0, 21600, "Asia/Yekaterinburg" },
{ "yerst", 1, 18000, "Asia/Yerevan" },
{ "yerst", 1, 14400, "Asia/Yerevan" },
{ "yert", 0, 14400, "Asia/Yerevan" },
{ "yert", 0, 10800, "Asia/Yerevan" },
{ "ypt", 1, -28800, "America/Dawson" },
{ "ypt", 1, -28800, "America/Whitehorse" },
{ "ypt", 1, -28800, "America/Yakutat" },
@@ -1610,4 +1809,22 @@
{ "w", 0, -36000, NULL },
{ "x", 0, -39600, NULL },
{ "y", 0, -43200, NULL },
{ "zzz", 0, 0, "Antarctica/Davis" },
{ "zzz", 0, 0, "America/Cambridge_Bay" },
{ "zzz", 0, 0, "America/Inuvik" },
{ "zzz", 0, 0, "America/Iqaluit" },
{ "zzz", 0, 0, "America/Pangnirtung" },
{ "zzz", 0, 0, "America/Rankin_Inlet" },
{ "zzz", 0, 0, "America/Resolute" },
{ "zzz", 0, 0, "America/Yellowknife" },
{ "zzz", 0, 0, "Antarctica/Casey" },
{ "zzz", 0, 0, "Antarctica/DumontDUrville" },
{ "zzz", 0, 0, "Antarctica/Macquarie" },
{ "zzz", 0, 0, "Antarctica/Mawson" },
{ "zzz", 0, 0, "Antarctica/Palmer" },
{ "zzz", 0, 0, "Antarctica/Rothera" },
{ "zzz", 0, 0, "Antarctica/Syowa" },
{ "zzz", 0, 0, "Antarctica/Troll" },
{ "zzz", 0, 0, "Antarctica/Vostok" },
{ "zzz", 0, 0, "Indian/Kerguelen" },
{ "z", 0, 0, NULL },
-15
View File
@@ -32,18 +32,6 @@ static int month_tab[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 24
static int days_in_month_leap[13] = { 31, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
static int days_in_month[13] = { 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
static void do_range_limit_fraction(double *fraction, timelib_sll *seconds)
{
if (*fraction < 0) {
*fraction += 1;
*seconds -= 1;
}
if (*fraction > 1) {
*fraction -= 1;
*seconds += 1;
}
}
static void do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, timelib_sll *a, timelib_sll *b)
{
if (*a < start) {
@@ -204,7 +192,6 @@ void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt)
void timelib_do_normalize(timelib_time* time)
{
if (time->s != TIMELIB_UNSET) do_range_limit_fraction(&time->f, &time->s);
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->s, &time->i);
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->i, &time->h);
if (time->s != TIMELIB_UNSET) do_range_limit(0, 24, 24, &time->h, &time->d);
@@ -222,8 +209,6 @@ static void do_adjust_relative(timelib_time* time)
timelib_do_normalize(time);
if (time->have_relative) {
time->f += time->relative.f;
time->s += time->relative.s;
time->i += time->relative.i;
time->h += time->relative.h;
-7
View File
@@ -294,10 +294,3 @@ int timelib_apply_localtime(timelib_time *t, unsigned int localtime)
}
return 0;
}
#if HAVE_GETTIMEOFDAY
void timelib_set_fraction_from_timeval(timelib_time *t, struct timeval tp)
{
t->f = (double) tp.tv_usec / 1000000;
}
#endif
+12 -69
View File
@@ -29,11 +29,7 @@
#include "php_date.h"
#include "zend_interfaces.h"
#include "lib/timelib.h"
#ifndef PHP_WIN32
#include <time.h>
#else
#include "win32/time.h"
#endif
#ifdef PHP_WIN32
static __inline __int64 php_date_llabs( __int64 i ) { return i >= 0? i: -i; }
@@ -257,14 +253,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_date_time_set, 0, 0, 3)
ZEND_ARG_INFO(0, hour)
ZEND_ARG_INFO(0, minute)
ZEND_ARG_INFO(0, second)
ZEND_ARG_INFO(0, microseconds)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_time_set, 0, 0, 2)
ZEND_ARG_INFO(0, hour)
ZEND_ARG_INFO(0, minute)
ZEND_ARG_INFO(0, second)
ZEND_ARG_INFO(0, microseconds)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_date_date_set, 0, 0, 4)
@@ -2376,8 +2370,6 @@ static HashTable *date_object_get_properties_interval(zval *object) /* {{{ */
PHP_DATE_INTERVAL_ADD_PROPERTY("h", h);
PHP_DATE_INTERVAL_ADD_PROPERTY("i", i);
PHP_DATE_INTERVAL_ADD_PROPERTY("s", s);
ZVAL_DOUBLE(&zv, (double)intervalobj->diff->f);
zend_hash_str_update(props, "f", sizeof("f") - 1, &zv);
PHP_DATE_INTERVAL_ADD_PROPERTY("weekday", weekday);
PHP_DATE_INTERVAL_ADD_PROPERTY("weekday_behavior", weekday_behavior);
PHP_DATE_INTERVAL_ADD_PROPERTY("first_last_day_of", first_last_day_of);
@@ -2495,23 +2487,6 @@ static void update_errors_warnings(timelib_error_container *last_errors) /* {{{
DATEG(last_errors) = last_errors;
} /* }}} */
static void php_date_set_time_fraction(timelib_time *time, int microseconds)
{
time->f = microseconds / 1000000;
}
static void php_date_set_current_time_fraction(timelib_time *time)
{
#if HAVE_GETTIMEOFDAY
struct timeval tp = {0}; /* For setting microseconds */
gettimeofday(&tp, NULL);
timelib_set_fraction_from_timeval(time, tp);
#else
time->f = 0;
#endif
}
PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, size_t time_str_len, char *format, zval *timezone_object, int ctor) /* {{{ */
{
timelib_time *now;
@@ -2585,7 +2560,7 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
break;
}
timelib_unixtime2local(now, (timelib_sll) time(NULL));
php_date_set_current_time_fraction(now);
timelib_fill_holes(dateobj->time, now, TIMELIB_NO_CLONE);
timelib_update_ts(dateobj->time, tzi);
timelib_update_from_sse(dateobj->time);
@@ -3081,11 +3056,6 @@ static int php_date_modify(zval *object, char *modify, size_t modify_len) /* {{{
dateobj->time->s = 0;
}
}
if (tmp_time->f != -99999) {
dateobj->time->f = tmp_time->f;
}
timelib_time_dtor(tmp_time);
timelib_update_ts(dateobj->time, NULL);
@@ -3385,7 +3355,7 @@ PHP_FUNCTION(date_offset_get)
}
/* }}} */
static void php_date_time_set(zval *object, zend_long h, zend_long i, zend_long s, zend_long ms, zval *return_value) /* {{{ */
static void php_date_time_set(zval *object, zend_long h, zend_long i, zend_long s, zval *return_value) /* {{{ */
{
php_date_obj *dateobj;
@@ -3394,23 +3364,22 @@ static void php_date_time_set(zval *object, zend_long h, zend_long i, zend_long
dateobj->time->h = h;
dateobj->time->i = i;
dateobj->time->s = s;
dateobj->time->f = ((double) ms) / 1000000;
timelib_update_ts(dateobj->time, NULL);
} /* }}} */
/* {{{ proto DateTime date_time_set(DateTime object, long hour, long minute[, long second[, long microseconds]])
/* {{{ proto DateTime date_time_set(DateTime object, long hour, long minute[, long second])
Sets the time.
*/
PHP_FUNCTION(date_time_set)
{
zval *object;
zend_long h, i, s = 0, ms = 0;
zend_long h, i, s = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oll|ll", &object, date_ce_date, &h, &i, &s, &ms) == FAILURE) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oll|l", &object, date_ce_date, &h, &i, &s) == FAILURE) {
RETURN_FALSE;
}
php_date_time_set(object, h, i, s, ms, return_value);
php_date_time_set(object, h, i, s, return_value);
Z_ADDREF_P(object);
ZVAL_COPY_VALUE(return_value, object);
@@ -3422,14 +3391,14 @@ PHP_FUNCTION(date_time_set)
PHP_METHOD(DateTimeImmutable, setTime)
{
zval *object, new_object;
zend_long h, i, s = 0, ms = 0;
zend_long h, i, s = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oll|ll", &object, date_ce_immutable, &h, &i, &s, &ms) == FAILURE) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oll|l", &object, date_ce_immutable, &h, &i, &s) == FAILURE) {
RETURN_FALSE;
}
date_clone_immutable(object, &new_object);
php_date_time_set(&new_object, h, i, s, ms, return_value);
php_date_time_set(&new_object, h, i, s, return_value);
ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
@@ -3545,7 +3514,6 @@ static void php_date_timestamp_set(zval *object, zend_long timestamp, zval *retu
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
timelib_unixtime2local(dateobj->time, (timelib_sll)timestamp);
timelib_update_ts(dateobj->time, NULL);
php_date_set_time_fraction(dateobj->time, 0);
} /* }}} */
/* {{{ proto DateTime date_timestamp_set(DateTime object, long unixTimestamp)
@@ -4011,7 +3979,6 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c
zval *retval;
zval tmp_member;
timelib_sll value = -1;
double fvalue = -1;
if (Z_TYPE_P(member) != IS_STRING) {
tmp_member = *member;
@@ -4043,10 +4010,6 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c
GET_VALUE_FROM_STRUCT(h, "h");
GET_VALUE_FROM_STRUCT(i, "i");
GET_VALUE_FROM_STRUCT(s, "s");
if (strcmp(Z_STRVAL_P(member), "f") == 0) {
fvalue = obj->diff->f;
break;
}
GET_VALUE_FROM_STRUCT(invert, "invert");
GET_VALUE_FROM_STRUCT(days, "days");
/* didn't find any */
@@ -4061,9 +4024,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c
retval = rv;
if (fvalue != -1) {
ZVAL_DOUBLE(retval, fvalue);
} else if (value != -99999) {
if (value != -99999) {
ZVAL_LONG(retval, value);
} else {
ZVAL_FALSE(retval);
@@ -4114,10 +4075,6 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void
SET_VALUE_FROM_STRUCT(h, "h");
SET_VALUE_FROM_STRUCT(i, "i");
SET_VALUE_FROM_STRUCT(s, "s");
if (strcmp(Z_STRVAL_P(member), "f") == 0) {
obj->diff->f = zval_get_double(value);
break;
}
SET_VALUE_FROM_STRUCT(invert, "invert");
/* didn't find any */
(zend_get_std_object_handlers())->write_property(object, member, value, cache_slot);
@@ -4163,7 +4120,7 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
#define PHP_DATE_INTERVAL_READ_PROPERTY(element, member, itype, def) \
do { \
zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \
if (z_arg && Z_TYPE_P(z_arg) <= IS_STRING) { \
if (z_arg) { \
(*intobj)->diff->member = (itype)zval_get_long(z_arg); \
} else { \
(*intobj)->diff->member = (itype)def; \
@@ -4173,7 +4130,7 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
#define PHP_DATE_INTERVAL_READ_PROPERTY_I64(element, member) \
do { \
zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \
if (z_arg && Z_TYPE_P(z_arg) <= IS_STRING) { \
if (z_arg) { \
zend_string *str = zval_get_string(z_arg); \
DATE_A64I((*intobj)->diff->member, ZSTR_VAL(str)); \
zend_string_release(str); \
@@ -4182,23 +4139,12 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
} \
} while (0);
#define PHP_DATE_INTERVAL_READ_PROPERTY_DOUBLE(element, member, def) \
do { \
zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \
if (z_arg) { \
(*intobj)->diff->member = (double)zval_get_double(z_arg); \
} else { \
(*intobj)->diff->member = (double)def; \
} \
} while (0);
PHP_DATE_INTERVAL_READ_PROPERTY("y", y, timelib_sll, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("m", m, timelib_sll, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("d", d, timelib_sll, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("h", h, timelib_sll, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("i", i, timelib_sll, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("s", s, timelib_sll, -1)
PHP_DATE_INTERVAL_READ_PROPERTY_DOUBLE("f", f, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("weekday", weekday, int, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("weekday_behavior", weekday_behavior, int, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("first_last_day_of", first_last_day_of, int, -1)
@@ -4308,9 +4254,6 @@ static zend_string *date_interval_format(char *format, size_t format_len, timeli
case 'S': length = slprintf(buffer, 32, "%02" ZEND_LONG_FMT_SPEC, (zend_long) t->s); break;
case 's': length = slprintf(buffer, 32, ZEND_LONG_FMT, (zend_long) t->s); break;
case 'F': length = slprintf(buffer, 32, "%06" ZEND_LONG_FMT_SPEC, (zend_long) (t->f * 1000000)); break;
case 'f': length = slprintf(buffer, 32, ZEND_LONG_FMT, (zend_long) (t->f * 1000000)); break;
case 'a': {
if ((int) t->days != -99999) {
length = slprintf(buffer, 32, "%d", (int) t->days);
+14 -5
View File
@@ -8,7 +8,7 @@ date_default_timezone_set('UTC');
echo "Done\n";
?>
--EXPECTF--
array(5) {
array(6) {
[0]=>
array(3) {
["dst"]=>
@@ -16,7 +16,7 @@ array(5) {
["offset"]=>
int(0)
["timezone_id"]=>
string(13) "Etc/Universal"
string(16) "Antarctica/Troll"
}
[1]=>
array(3) {
@@ -25,7 +25,7 @@ array(5) {
["offset"]=>
int(0)
["timezone_id"]=>
string(7) "Etc/UTC"
string(13) "Etc/Universal"
}
[2]=>
array(3) {
@@ -34,7 +34,7 @@ array(5) {
["offset"]=>
int(0)
["timezone_id"]=>
string(8) "Etc/Zulu"
string(7) "Etc/UTC"
}
[3]=>
array(3) {
@@ -43,7 +43,7 @@ array(5) {
["offset"]=>
int(0)
["timezone_id"]=>
string(3) "UTC"
string(8) "Etc/Zulu"
}
[4]=>
array(3) {
@@ -54,5 +54,14 @@ array(5) {
["timezone_id"]=>
string(3) "UTC"
}
[5]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(0)
["timezone_id"]=>
string(3) "UTC"
}
}
Done
+16 -1
View File
@@ -1,5 +1,6 @@
--TEST--
DateTimeZone::getLocation -- timezone_location_get — Returns location information for a timezone public array DateTimeZone::getLocation ( void ) ;
DateTimeZone::getLocation -- timezone_location_get — Returns location information for a timezone
public array DateTimeZone::getLocation ( void ) ;
--CREDITS--
marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br
--SKIPIF--
@@ -65,3 +66,17 @@ Array
[longitude] => %f
[comments] => %s
)
Array
(
[country_code] => %s
[latitude] => %f
[longitude] => %f
[comments] => %s
)
Array
(
[country_code] => %s
[latitude] => %f
[longitude] => %f
[comments] =>
)
@@ -29,7 +29,7 @@ string(5) "array"
int(%d)
-- Format a sample entry --
array(17) {
array(11) {
[0]=>
array(3) {
["dst"]=>
@@ -40,15 +40,6 @@ array(17) {
string(18) "America/Porto_Acre"
}
[1]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(32400)
["timezone_id"]=>
string(18) "Australia/Adelaide"
}
[2]=>
array(3) {
["dst"]=>
bool(false)
@@ -57,7 +48,7 @@ array(17) {
["timezone_id"]=>
string(18) "Australia/Adelaide"
}
[3]=>
[2]=>
array(3) {
["dst"]=>
bool(true)
@@ -66,7 +57,7 @@ array(17) {
["timezone_id"]=>
string(16) "America/Eirunepe"
}
[4]=>
[3]=>
array(3) {
["dst"]=>
bool(true)
@@ -75,7 +66,7 @@ array(17) {
["timezone_id"]=>
string(18) "America/Rio_Branco"
}
[5]=>
[4]=>
array(3) {
["dst"]=>
bool(true)
@@ -84,52 +75,7 @@ array(17) {
["timezone_id"]=>
string(11) "Brazil/Acre"
}
[6]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(32400)
["timezone_id"]=>
string(21) "Australia/Broken_Hill"
}
[7]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(32400)
["timezone_id"]=>
string(16) "Australia/Darwin"
}
[8]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(32400)
["timezone_id"]=>
string(15) "Australia/North"
}
[9]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(32400)
["timezone_id"]=>
string(15) "Australia/South"
}
[10]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(32400)
["timezone_id"]=>
string(20) "Australia/Yancowinna"
}
[11]=>
[5]=>
array(3) {
["dst"]=>
bool(false)
@@ -138,7 +84,7 @@ array(17) {
["timezone_id"]=>
string(13) "Asia/Jayapura"
}
[12]=>
[6]=>
array(3) {
["dst"]=>
bool(false)
@@ -147,7 +93,7 @@ array(17) {
["timezone_id"]=>
string(21) "Australia/Broken_Hill"
}
[13]=>
[7]=>
array(3) {
["dst"]=>
bool(false)
@@ -156,7 +102,7 @@ array(17) {
["timezone_id"]=>
string(16) "Australia/Darwin"
}
[14]=>
[8]=>
array(3) {
["dst"]=>
bool(false)
@@ -165,7 +111,7 @@ array(17) {
["timezone_id"]=>
string(15) "Australia/North"
}
[15]=>
[9]=>
array(3) {
["dst"]=>
bool(false)
@@ -174,7 +120,7 @@ array(17) {
["timezone_id"]=>
string(15) "Australia/South"
}
[16]=>
[10]=>
array(3) {
["dst"]=>
bool(false)
+2 -3
View File
@@ -25,8 +25,7 @@ echo "\n-- Testing DateTime::setTime() function with more than expected no. of a
$min = 15;
$sec = 30;
$extra_arg = 10;
$microseconds = 123123;
var_dump( $datetime->setTime($hour, $min, $sec, $microseconds, $extra_arg) );
var_dump( $datetime->setTime($hour, $min, $sec, $extra_arg) );
?>
===DONE===
@@ -45,6 +44,6 @@ bool(false)
-- Testing DateTime::setTime() function with more than expected no. of arguments --
Warning: DateTime::setTime() expects at most 4 parameters, 5 given in %s on line %d
Warning: DateTime::setTime() expects at most 3 parameters, 4 given in %s on line %d
bool(false)
===DONE===
+6 -6
View File
@@ -75,8 +75,8 @@ result = Monday 1983-04-18 01:00:00 CEST
wanted = Monday 00:00:00
Asia/Yerevan
ts = Monday 2037-10-19 17:17:17 +04
result = Monday 2037-10-26 00:00:00 +04
ts = Monday 2037-10-19 17:17:17 AMT
result = Monday 2037-10-26 00:00:00 AMT
wanted = Monday 00:00:00
America/Curacao
@@ -115,8 +115,8 @@ result = Monday 1971-04-05 00:00:00 AST
wanted = Monday 00:00:00
Asia/Baku
ts = Friday 1971-01-01 17:17:17 +04
result = Monday 1971-01-04 00:00:00 +04
ts = Friday 1971-01-01 17:17:17 BAKT
result = Monday 1971-01-04 00:00:00 BAKT
wanted = Monday 00:00:00
Europe/Sarajevo
@@ -165,6 +165,6 @@ result = Monday 1980-04-07 00:00:00 CEST
wanted = Monday 00:00:00
Asia/Baku
ts = Monday 1995-12-25 17:17:17 +04
result = Monday 1996-01-01 00:00:00 +04
ts = Monday 1995-12-25 17:17:17 AZT
result = Monday 1996-01-01 00:00:00 AZT
wanted = Monday 00:00:00
+2 -2
View File
@@ -226,8 +226,8 @@ result=Thursday 1980-04-10 00:00:00 CEST 1
wanted=Thursday 00:00:00
TZ=Asia/Baku - wrong day.
tStamp=Sunday 1992-09-20 17:17:17 +04 1
result=Monday 1992-09-28 00:00:00 +04 0
tStamp=Sunday 1992-09-20 17:17:17 AZST 1
result=Monday 1992-09-28 00:00:00 AZT 0
wanted=Monday 00:00:00
TZ=America/Noronha - wrong day.
+2 -2
View File
@@ -28,6 +28,6 @@ result=Monday 1990-10-22 00:00:00 WART 0
wanted=Monday 00:00:00
TZ=Asia/Tbilisi - Is it OK for this to be 2 AM?
tStamp=Sunday 2005-03-20 17:17:17 +03 0
result=Sunday 2005-03-27 00:00:00 +03 0
tStamp=Sunday 2005-03-20 17:17:17 GET 0
result=Sunday 2005-03-27 00:00:00 GET 0
wanted=Sunday 00:00:00
+1 -3
View File
@@ -12,7 +12,7 @@ $diff = date_diff($date, $other);
var_dump($diff);
--EXPECTF--
object(DateInterval)#%d (16) {
object(DateInterval)#%d (15) {
["y"]=>
int(0)
["m"]=>
@@ -25,8 +25,6 @@ object(DateInterval)#%d (16) {
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
-2
View File
@@ -15,7 +15,6 @@ DateInterval Object
[h] => 12
[i] => 30
[s] => 5
[f] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
@@ -34,7 +33,6 @@ DateInterval Object
[h] => 12
[i] => 30
[s] => 5
[f] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
-1
View File
@@ -17,7 +17,6 @@ DateInterval Object
[h] => 4
[i] => 0
[s] => 0
[f] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
+2 -4
View File
@@ -7,8 +7,8 @@ var_dump($i);
echo $i->format("%d"), "\n";
echo $i->format("%a"), "\n";
?>
--EXPECTF--
object(DateInterval)#%d (16) {
--EXPECT--
object(DateInterval)#1 (15) {
["y"]=>
int(0)
["m"]=>
@@ -21,8 +21,6 @@ object(DateInterval)#%d (16) {
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
+6 -18
View File
@@ -23,7 +23,6 @@ $unser = DateInterval::__set_state(array(
'h' => 4,
'i' => 3,
's' => 2,
'f' => 0.876543,
'invert' => 1,
'days' => 2400,
));
@@ -33,7 +32,7 @@ var_dump($unser, $p);
?>
--EXPECT--
object(DateInterval)#3 (16) {
object(DateInterval)#3 (15) {
["y"]=>
int(0)
["m"]=>
@@ -46,8 +45,6 @@ object(DateInterval)#3 (16) {
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -67,7 +64,7 @@ object(DateInterval)#3 (16) {
["have_special_relative"]=>
int(0)
}
string(332) "O:12:"DateInterval":16:{s:1:"y";i:0;s:1:"m";i:0;s:1:"d";i:0;s:1:"h";i:4;s:1:"i";i:0;s:1:"s";i:0;s:1:"f";d:0;s:7:"weekday";i:0;s:16:"weekday_behavior";i:0;s:17:"first_last_day_of";i:0;s:6:"invert";i:0;s:4:"days";i:0;s:12:"special_type";i:0;s:14:"special_amount";i:0;s:21:"have_weekday_relative";i:0;s:21:"have_special_relative";i:0;}"
string(320) "O:12:"DateInterval":15:{s:1:"y";i:0;s:1:"m";i:0;s:1:"d";i:0;s:1:"h";i:4;s:1:"i";i:0;s:1:"s";i:0;s:7:"weekday";i:0;s:16:"weekday_behavior";i:0;s:17:"first_last_day_of";i:0;s:6:"invert";i:0;s:4:"days";i:0;s:12:"special_type";i:0;s:14:"special_amount";i:0;s:21:"have_weekday_relative";i:0;s:21:"have_special_relative";i:0;}"
DateInterval::__set_state(array(
'y' => 0,
'm' => 0,
@@ -75,7 +72,6 @@ DateInterval::__set_state(array(
'h' => 4,
'i' => 0,
's' => 0,
'f' => 0.0,
'weekday' => 0,
'weekday_behavior' => 0,
'first_last_day_of' => 0,
@@ -85,7 +81,7 @@ DateInterval::__set_state(array(
'special_amount' => 0,
'have_weekday_relative' => 0,
'have_special_relative' => 0,
))object(DateInterval)#5 (16) {
))object(DateInterval)#5 (15) {
["y"]=>
int(0)
["m"]=>
@@ -98,8 +94,6 @@ DateInterval::__set_state(array(
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -134,7 +128,7 @@ object(DatePeriod)#6 (6) {
["end"]=>
NULL
["interval"]=>
object(DateInterval)#7 (16) {
object(DateInterval)#7 (15) {
["y"]=>
int(0)
["m"]=>
@@ -147,8 +141,6 @@ object(DatePeriod)#6 (6) {
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -173,7 +165,7 @@ object(DatePeriod)#6 (6) {
["include_start_date"]=>
bool(true)
}
object(DateInterval)#8 (16) {
object(DateInterval)#8 (15) {
["y"]=>
int(7)
["m"]=>
@@ -186,8 +178,6 @@ object(DateInterval)#8 (16) {
int(3)
["s"]=>
int(2)
["f"]=>
float(0.876543)
["weekday"]=>
int(-1)
["weekday_behavior"]=>
@@ -222,7 +212,7 @@ object(DatePeriod)#9 (6) {
["end"]=>
NULL
["interval"]=>
object(DateInterval)#7 (16) {
object(DateInterval)#7 (15) {
["y"]=>
int(0)
["m"]=>
@@ -235,8 +225,6 @@ object(DatePeriod)#9 (6) {
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
-1
View File
@@ -27,7 +27,6 @@ di Object
[h] => 0
[i] => 0
[s] => 0
[f] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
+3 -9
View File
@@ -25,7 +25,7 @@ foreach($intervals as $iv) {
echo "==DONE==\n";
?>
--EXPECTF--
object(DateInterval)#%d (16) {
object(DateInterval)#%d (15) {
["y"]=>
int(1)
["m"]=>
@@ -38,8 +38,6 @@ object(DateInterval)#%d (16) {
int(30)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -59,7 +57,7 @@ object(DateInterval)#%d (16) {
["have_special_relative"]=>
int(0)
}
object(DateInterval)#%d (16) {
object(DateInterval)#%d (15) {
["y"]=>
int(0)
["m"]=>
@@ -72,8 +70,6 @@ object(DateInterval)#%d (16) {
int(30)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -93,7 +89,7 @@ object(DateInterval)#%d (16) {
["have_special_relative"]=>
int(0)
}
object(DateInterval)#%d (16) {
object(DateInterval)#%d (15) {
["y"]=>
int(0)
["m"]=>
@@ -106,8 +102,6 @@ object(DateInterval)#%d (16) {
int(30)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
+2 -6
View File
@@ -51,7 +51,7 @@ object(DatePeriod)#1 (6) {
["end"]=>
NULL
["interval"]=>
object(DateInterval)#5 (16) {
object(DateInterval)#5 (15) {
["y"]=>
int(0)
["m"]=>
@@ -64,8 +64,6 @@ object(DatePeriod)#1 (6) {
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -112,7 +110,7 @@ object(DatePeriod)#5 (6) {
["end"]=>
NULL
["interval"]=>
object(DateInterval)#8 (16) {
object(DateInterval)#8 (15) {
["y"]=>
int(0)
["m"]=>
@@ -125,8 +123,6 @@ object(DatePeriod)#5 (6) {
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
+2 -6
View File
@@ -13,7 +13,7 @@ var_dump($di0, $di1);
?>
==DONE==
--EXPECT--
object(DateInterval)#1 (16) {
object(DateInterval)#1 (15) {
["y"]=>
int(2)
["m"]=>
@@ -26,8 +26,6 @@ object(DateInterval)#1 (16) {
int(8)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -47,7 +45,7 @@ object(DateInterval)#1 (16) {
["have_special_relative"]=>
int(0)
}
object(DateInterval)#2 (16) {
object(DateInterval)#2 (15) {
["y"]=>
int(2)
["m"]=>
@@ -60,8 +58,6 @@ object(DateInterval)#2 (16) {
int(8)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
+1 -3
View File
@@ -12,7 +12,7 @@ var_dump($di);
?>
==DONE==
--EXPECTF--
object(DateInterval)#%d (16) {
object(DateInterval)#%d (15) {
["y"]=>
int(2)
["m"]=>
@@ -25,8 +25,6 @@ object(DateInterval)#%d (16) {
int(8)
["s"]=>
int(0)
["f"]=>
float(-1)
["weekday"]=>
int(10)
["weekday_behavior"]=>
+1 -5
View File
@@ -15,14 +15,13 @@ var_dump($df,
$df->h,
$df->i,
$df->s,
$df->f,
$df->invert,
$df->days);
?>
==DONE==
--EXPECTF--
object(DateInterval)#%d (16) {
object(DateInterval)#%d (15) {
["y"]=>
int(0)
["m"]=>
@@ -35,8 +34,6 @@ object(DateInterval)#%d (16) {
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -62,7 +59,6 @@ int(2)
int(0)
int(0)
int(0)
float(0)
int(0)
int(2)
==DONE==
+1 -3
View File
@@ -12,7 +12,7 @@ var_dump($di);
?>
==DONE==
--EXPECTF--
object(DateInterval)#%d (16) {
object(DateInterval)#%d (15) {
["y"]=>
int(2)
["m"]=>
@@ -43,7 +43,5 @@ object(DateInterval)#%d (16) {
int(9)
["have_special_relative"]=>
int(0)
["f"]=>
float(-1)
}
==DONE==
-49
View File
@@ -1,49 +0,0 @@
--TEST--
Bug #53437 DateInterval unserialize bad data, 64 bit
--SKIPIF--
<?php if (PHP_INT_SIZE != 8) { die('skip true 64 bit only'); } ?>
--FILE--
<?php
$s = 'O:12:"DateInterval":16:{s:1:"y";s:1:"2";s:1:"m";s:1:"0";s:1:"d";s:3:"bla";s:1:"h";s:1:"6";s:1:"i";s:1:"8";s:1:"s";s:1:"0";s:1:"f";d:0.123654;s:7:"weekday";i:10;s:16:"weekday_behavior";i:10;s:17:"first_last_day_of";i:0;s:6:"invert";i:0;s:4:"days";s:4:"aoeu";s:12:"special_type";i:0;s:14:"special_amount";s:21:"234523452345234532455";s:21:"have_weekday_relative";i:21474836489;s:21:"have_special_relative";s:3:"bla";}';
$di = unserialize($s);
var_dump($di);
?>
==DONE==
--EXPECTF--
object(DateInterval)#%d (16) {
["y"]=>
int(2)
["m"]=>
int(0)
["d"]=>
int(0)
["h"]=>
int(6)
["i"]=>
int(8)
["s"]=>
int(0)
["f"]=>
float(0.123654)
["weekday"]=>
int(10)
["weekday_behavior"]=>
int(10)
["first_last_day_of"]=>
int(0)
["invert"]=>
int(0)
["days"]=>
int(0)
["special_type"]=>
int(0)
["special_amount"]=>
int(9223372036854775807)
["have_weekday_relative"]=>
int(9)
["have_special_relative"]=>
int(0)
}
==DONE==
-2
View File
@@ -21,8 +21,6 @@ object(DateInterval)#1 (%d) {
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
-46
View File
@@ -1,46 +0,0 @@
--TEST--
Bug #64887: Allow DateTime modification with subsecond items
--INI--
date.timezone=UTC
--FILE--
<?php
$tests = [
'+1 ms',
'-2 msec',
'+3 msecs',
'-4 millisecond',
'+5 milliseconds',
'-6 usec',
'+7 usecs',
'-8 microsecond',
'+9 microseconds',
'-10 µs',
'+11 µsec',
'-12 µsecs',
'+8 msec -2 µsec',
];
$datetime = new DateTimeImmutable( "2016-10-07 13:25:50" );
foreach ( $tests as $test )
{
echo $datetime->modify( $test )->format( 'Y-m-d H:i:s.u' ), "\n";
}
?>
--EXPECT--
2016-10-07 13:25:50.001000
2016-10-07 13:25:49.998000
2016-10-07 13:25:50.003000
2016-10-07 13:25:49.996000
2016-10-07 13:25:50.005000
2016-10-07 13:25:49.999994
2016-10-07 13:25:50.000007
2016-10-07 13:25:49.999992
2016-10-07 13:25:50.000009
2016-10-07 13:25:49.999990
2016-10-07 13:25:50.000011
2016-10-07 13:25:49.999988
2016-10-07 13:25:50.007998
-48
View File
@@ -1,48 +0,0 @@
--TEST--
Bug #73091 (Unserializing DateInterval object may lead to __toString invocation)
--FILE--
<?php
class foo {
function __toString() {
var_dump(0);
return 'may be a bug';
}
}
var_dump(unserialize('O:12:"DateInterval":1:{s:4:"days";O:3:"foo":0:{}}'));
?>
--EXPECTF--
object(DateInterval)#%d (16) {
["days"]=>
int(-1)
["y"]=>
int(-1)
["m"]=>
int(-1)
["d"]=>
int(-1)
["h"]=>
int(-1)
["i"]=>
int(-1)
["s"]=>
int(-1)
["f"]=>
float(-1)
["weekday"]=>
int(-1)
["weekday_behavior"]=>
int(-1)
["first_last_day_of"]=>
int(-1)
["invert"]=>
int(0)
["special_type"]=>
int(0)
["special_amount"]=>
int(-1)
["have_weekday_relative"]=>
int(0)
["have_special_relative"]=>
int(0)
}
+2 -4
View File
@@ -11,7 +11,7 @@ var_dump($start);
var_dump($end);
var_dump($int);
?>
--EXPECTF--
--EXPECT--
object(DateTime)#1 (3) {
["date"]=>
string(26) "2010-10-04 02:18:48.000000"
@@ -28,7 +28,7 @@ object(DateTime)#2 (3) {
["timezone"]=>
string(3) "EDT"
}
object(DateInterval)#%d (16) {
object(DateInterval)#3 (15) {
["y"]=>
int(0)
["m"]=>
@@ -41,8 +41,6 @@ object(DateInterval)#%d (16) {
int(19)
["s"]=>
int(40)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -8,7 +8,7 @@ $i = date_interval_create_from_date_string(null); //returns a empty object
var_dump($i);
?>
--EXPECTF--
object(DateInterval)#%d (16) {
object(DateInterval)#1 (15) {
["y"]=>
int(0)
["m"]=>
@@ -21,8 +21,6 @@ object(DateInterval)#%d (16) {
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -41,4 +39,4 @@ object(DateInterval)#%d (16) {
int(0)
["have_special_relative"]=>
int(0)
}
}
@@ -1,8 +1,9 @@
--TEST--
Test date_interval_create_from_date_string() function : with 2 parameters (wrong).
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--FILE--
<?php
$i = date_interval_create_from_date_string('1 year', 'wrong');
?>
--EXPECTF--
Warning: date_interval_create_from_date_string() expects exactly 1 parameter, 2 given in %s on line %d
Warning: date_interval_create_from_date_string() expects exactly 1 parameter, 2 given in %s on line %d
Loaded 100 of 314 files, more files were not shown because too many files have changed in this diff. Show more