Compare commits

..
158 changed files with 9509 additions and 11492 deletions

No files matched your search

+1 -1
View File
@@ -24,7 +24,7 @@ environment:
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
PHP_BUILD_OBJ_DIR: c:\obj
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
PHP_BUILD_SDK_BRANCH: php-sdk-2.0.0beta2
PHP_BUILD_SDK_BRANCH: php-sdk-2.0.0beta1
# ext and env setup for tests
#MYSQL_TEST_PASSWD: Password12!
#MYSQL_TEST_USER: root
+1 -1
View File
@@ -53,7 +53,7 @@ install-headers:
paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
done; \
$(mkinstalldirs) $$paths && \
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
for i in `echo $(INSTALL_HEADERS)`; do \
if test "$(PHP_PECL_EXTENSION)"; then \
src=`echo $$i | $(SED) -e "s#ext/$(PHP_PECL_EXTENSION)/##g"`; \
+1 -124
View File
@@ -1,129 +1,6 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
30 Mar 2017, PHP 7.1.4RC1
- Core:
. Fixed bug #74149 (static embed SAPI linkage error). (krakjoe)
. Fixed bug #73370 (falsely exits with "Out of Memory" when using
USE_ZEND_ALLOC=0). (Nikita)
. Fixed bug #73960 (Leak with instance method calling static method with
referenced return). (Nikita)
. Fixed bug #69676 (Resolution of self::FOO in class constants not correct).
(Nikita)
. Fixed bug #74265 (Build problems after 7.0.17 release: undefined reference
to `isfinite'). (Nikita)
. Fixed bug #74302 (yield fromLABEL is over-greedy). (Sara)
- Apache:
. Reverted patch for bug #61471, fixes bug #74318. (Anatol)
- Date:
. Fixed bug #72096 (Swatch time value incorrect for dates before 1970). (mcq8)
- DOM:
. Fixed bug #74004 (LIBXML_NOWARNING flag ingnored on loadHTML*).
(somedaysummer)
- iconv:
. Fixed bug #74230 (iconv fails to fail on surrogates). (Anatol)
- Opcache:
. Fixed bug #74250 (OPcache compilation performance regression in PHP 5.6/7
with huge classes). (Nikita)
- OpenSSL:
. Fixed bug #72333 (fwrite() on non-blocking SSL sockets doesn't work).
(Jakub Zelenka)
- PDO MySQL:
. Fixed bug #71003 (Expose MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT to PDO
interface). (Thomas Orozco)
- SPL:
. Fixed bug #74058 (ArrayObject can not notice changes). (Andrew Nester)
- Sqlite:
. Implemented FR #74217 (Allow creation of deterministic sqlite functions).
(Andrew Nester)
- Streams:
. Fixed bug #74216 (Correctly fail on invalid IP address ports). (Sara)
- Zlib:
. Fixed bug #74240 (deflate_add can allocate too much memory). (Matt Bonneau)
16 Mar 2017, PHP 7.1.3
- Core:
. Fixed bug #74157 (Segfault with nested generators). (Laruence)
. Fixed bug #74164 (PHP hangs when an invalid value is dynamically passed to
typehinted by-ref arg). (Laruence)
. Fixed bug #74093 (Maximum execution time of n+2 seconds exceed not written
in error_log). (Laruence)
. Fixed bug #73989 (PHP 7.1 Segfaults within Symfony test suite).
(Dmitry, Laruence)
. Fixed bug #74084 (Out of bound read - zend_mm_alloc_small). (Laruence)
. Fixed bug #73807 (Performance problem with processing large post request).
(Nikita)
. Fixed bug #73998 (array_key_exists fails on arrays created by
get_object_vars). (mhagstrand)
. Fixed bug #73954 (NAN check fails on Alpine Linux with musl). (Andrea)
. Fixed bug #73677 (Generating phar.phar core dump with gcc ASAN enabled
build). (ondrej)
- Apache:
. Fixed bug #61471 (Incomplete POST does not timeout but is passed to PHP).
(Zheng Shao)
- Date:
. Fixed bug #73837 ("new DateTime()" sometimes returns 1 second ago value).
(Derick)
- FPM:
. Fixed bug #69860 (php-fpm process accounting is broken with keepalive).
(Denis Yeldandi)
- Hash:
. Fixed bug #73127 (gost-crypto hash incorrect if input data contains long
0xFF sequence). (Grundik)
- GD:
. Fixed bug #74031 (ReflectionFunction for imagepng is missing last two
parameters). (finwe)
- Mysqlnd:
. Fixed bug #74021 (fetch_array broken data. Data more then MEDIUMBLOB).
(Andrew Nester, Nikita)
- Opcache:
. Fixed bug #74019 (Segfault with list). (Laruence)
- OpenSSL:
. Fixed bug #74022 (PHP Fast CGI crashes when reading from a pfx file).
(Anatol)
. Fixed bug #74099 (Memory leak with openssl_encrypt()). (Andrew Nester)
. Fixed bug #74159 (Writing a large buffer to a non-blocking encrypted stream
fails with "bad write retry"). (trowski)
- PDO_OCI:
. Fixed bug #54379 (PDO_OCI: UTF-8 output gets truncated). (gureedo / Oracle)
- Standard:
. Fixed bug #74005 (mail.add_x_header causes RFC-breaking lone line feed).
(Anatol)
. Fixed bug #74041 (substr_count with length=0 broken). (Nikita)
. Fixed bug #73118 (is_callable callable name reports misleading value for
anonymous classes). (Adam Saponara)
. Fixed bug #74105 (PHP on Linux should use /dev/urandom when getrandom is
not available). (Benjamin Robin)
- Streams:
. Fixed bug #73496 (Invalid memory access in zend_inline_hash_func).
(Laruence)
. Fixed bug #74090 (stream_get_contents maxlength>-1 returns empty string).
(Anatol)
16 Feb 2017, PHP 7.1.2
02 Feb 2017, PHP 7.1.2RC1
- Core:
. Improved GENERATOR_CREATE opcode handler. (Bob, Dmitry)
+1 -1
View File
@@ -100,7 +100,7 @@ AC_FUNC_ALLOCA
AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite fpclass sigsetjmp)
AC_ZEND_BROKEN_SPRINTF
AC_CHECK_DECLS([isfinite, isnan, isinf], [], [], [[#include <math.h>]])
AC_CHECK_FUNCS(finite isfinite isinf isnan)
ZEND_FP_EXCEPT
+8 -8
View File
@@ -64,33 +64,33 @@ int zend_sprintf(char *buffer, const char *format, ...);
/* To enable the is_nan, is_infinite and is_finite PHP functions */
#ifdef NETWARE
#define HAVE_DECL_ISNAN 1
#define HAVE_DECL_ISINF 1
#define HAVE_DECL_ISFINITE 1
#define HAVE_ISNAN 1
#define HAVE_ISINF 1
#define HAVE_ISFINITE 1
#endif
#ifndef zend_isnan
#if HAVE_DECL_ISNAN
#ifdef HAVE_ISNAN
#define zend_isnan(a) isnan(a)
#elif defined(HAVE_FPCLASS)
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
#else
#define zend_isnan(a) ((a) != (a))
#define zend_isnan(a) 0
#endif
#endif
#if HAVE_DECL_ISINF
#ifdef HAVE_ISINF
#define zend_isinf(a) isinf(a)
#elif defined(INFINITY)
/* Might not work, but is required by ISO C99 */
#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
#define zend_isinf(a) (((a)==INFINITY)?1:0)
#elif defined(HAVE_FPCLASS)
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
#else
#define zend_isinf(a) 0
#endif
#if HAVE_DECL_ISFINITE
#if defined(HAVE_ISFINITE) || defined(isfinite)
#define zend_finite(a) isfinite(a)
#elif defined(HAVE_FINITE)
#define zend_finite(a) finite(a)
-22
View File
@@ -1,22 +0,0 @@
--TEST--
Bug #69676: Resolution of self::FOO in class constants not correct (variation)
--FILE--
<?php
class Foo {
const A = 'Foo::A';
const B = self::A . ' and ' . self::C;
const C = 'Foo::C';
}
class Bar extends Foo {
const A = 'Bar::A';
const C = 'Bar::C';
}
var_dump(Bar::B);
?>
--EXPECT--
string(17) "Foo::A and Foo::C"
-69
View File
@@ -1,69 +0,0 @@
--TEST--
Bug #69676: Resolution of self::FOO in class constants not correct (variation)
--FILE--
<?php
class P {
const N = 'P';
}
class A extends P {
const selfN = self::N;
const parentN = parent::N;
const N = 'A';
}
class B extends A {
const N = 'B';
}
var_dump(B::selfN); // A
var_dump(B::parentN); // P
class A2 {
const selfN = self::N;
const N = 'A2';
}
class B2 extends A2 {
const indSelfN = self::selfN;
const N = 'B2';
}
class C2 extends B2 {
const N = 'C2';
}
var_dump(C2::indSelfN); // A2
class A3 {
const selfN = self::N;
const N = 'A3';
}
class B3 extends A3 {
const exprSelfN = "expr" . self::selfN;
const N = 'B3';
}
class C3 extends B3 {
const N = 'C3';
}
var_dump(C3::exprSelfN); // exprA3
class A4 {
const selfN = self::N;
const N = 'A4';
}
class B4 extends A4 {
const N = 'B4';
public $prop = self::selfN;
}
class C4 extends B4 {
const N = 'C4';
}
var_dump((new C4)->prop); // A4
?>
--EXPECT--
string(1) "A"
string(1) "P"
string(2) "A2"
string(6) "exprA3"
string(2) "A4"
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Bug #73954 (NAN check fails on Alpine Linux with musl)
--FILE--
<?php
var_dump(NAN);
var_dump(is_nan(NAN));
function takes_int(int $int) {
}
takes_int(log(tan(3.14)));
?>
--EXPECTF--
float(NAN)
bool(true)
Fatal error: Uncaught TypeError: Argument 1 passed to takes_int() must be of the type integer, float given, called in %s on line 9 and defined in %s:6
Stack trace:
#0 %s(9): takes_int(NAN)
#1 {main}
thrown in %s on line 6
-16
View File
@@ -1,16 +0,0 @@
--TEST--
Bug #73960: Leak with instance method calling static method with referenced return
--FILE--
<?php
$value = 'one';
$array = array($value);
$array = $ref =& $array;
var_dump($array);
?>
--EXPECT--
array(1) {
[0]=>
string(3) "one"
}
-28
View File
@@ -1,28 +0,0 @@
--TEST--
Bug #73989 (PHP 7.1 Segfaults within Symfony test suite)
--FILE--
<?php
class Cycle
{
private $thing;
public function __construct()
{
$obj = $this;
$this->thing = function() use($obj) {};
}
public function __destruct()
{
($this->thing)();
}
}
for ($i = 0; $i < 10000; ++$i) {
$obj = new Cycle();
}
echo "OK\n";
?>
--EXPECT--
OK
-19
View File
@@ -1,19 +0,0 @@
--TEST--
Bug #73998 (array_key_exists fails on arrays created by get_object_vars)
--DESCRIPTION--
Properties of objects with numeric names should be accessible
--FILE--
<?php
$a = new stdClass;
$a->{1234} = "Numeric";
$a->a1234 = "String";
$properties = get_object_vars($a);
var_dump(array_key_exists(1234, $properties));
echo "Value: {$properties[1234]}\n";
?>
--EXPECT--
bool(true)
Value: Numeric
-19
View File
@@ -1,19 +0,0 @@
--TEST--
Bug #74084 (Out of bound read - zend_mm_alloc_small)
--INI--
error_reporting=0
--FILE--
<?php
$$A += $$B->a = &$$C;
unset($$A);
$$A -= $$B->a = &$$C;
unset($$A);
$$A *= $$B->a = &$$C;
unset($$A);
$$A /= $$B->a = &$$C;
unset($$A);
$$A **= $$B->a = &$$C;
var_dump($$A);
?>
--EXPECT--
int(1)
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #74093 (Maximum execution time of n+2 seconds exceed not written in error_log)
--SKIPIF--
<?php
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
if (PHP_ZTS) die("skip only for no-zts build");
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip not for Windows");
?>
--INI--
memory_limit=1G
max_execution_time=1
hard_timeout=1
--FILE--
<?php
$a1 = range(1, 1000000);
$a2 = range(100000, 1999999);
array_intersect($a1, $a2);
?>
--EXPECTF--
Fatal error: Maximum execution time of 1+1 seconds exceeded %s
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #74164 (PHP hangs when an invalid value is dynamically passed to typehinted by-ref arg)
--FILE--
<?php
namespace Foo;
set_error_handler(function ($type, $msg) {
throw new \Exception($msg);
});
call_user_func(function (array &$ref) {var_dump("xxx");}, 'not_an_array_variable');
?>
--EXPECTF--
Fatal error: Uncaught Exception: Parameter 1 to Foo\{closure}() expected to be a reference, value given in %sbug74164.php:%d
Stack trace:
#0 [internal function]: Foo\{closure}(%s)
#1 %sbug74164.php(%d): call_user_func(%s)
#2 {main}
thrown in %sbug74164.php on line %d
-10
View File
@@ -1,10 +0,0 @@
--TEST--
Use of non-literals in declare ticks values crashes compiler
--FILE--
<?php
declare(ticks = UNKNOWN_CONST) {
echo 'Done';
}
--EXPECTF--
Fatal error: declare(ticks) value must be a literal in %sdeclare_006.php on line 2
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Bug #74157 (Segfault with nested generators)
--FILE--
<?php
function a() {
$a = $b = $c = 2;
foreach(range(1, 5) as $v) {
yield $v;
}
return;
}
foreach (a(range(1, 3)) as $a) {
var_dump($a);
}
?>
--EXPECTF--
int(1)
int(2)
int(3)
int(4)
int(5)
@@ -1,24 +0,0 @@
--TEST--
yield from parses too greedily
--FILE--
<?php
function from1234($x) {
return $x;
}
function bar() {
yield 24;
}
function foo() {
yield from1234(42);
yield from(bar());
}
foreach (foo() as $value) {
var_dump($value);
}
--EXPECT--
int(42)
int(24)
-1
View File
@@ -580,7 +580,6 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals) /* {{
#ifdef ZEND_WIN32
zend_get_windows_version_info(&executor_globals->windows_version_info);
#endif
executor_globals->valid_symbol_table = 0;
}
/* }}} */
+1 -1
View File
@@ -1132,7 +1132,7 @@ ZEND_API int zend_update_class_constants(zend_class_entry *class_type) /* {{{ */
ZEND_HASH_FOREACH_PTR(&class_type->constants_table, c) {
val = &c->value;
if (Z_CONSTANT_P(val)) {
if (UNEXPECTED(zval_update_constant_ex(val, c->ce) != SUCCESS)) {
if (UNEXPECTED(zval_update_constant_ex(val, class_type) != SUCCESS)) {
return FAILURE;
}
}
+2 -2
View File
@@ -2818,7 +2818,7 @@ static ZEND_COLD ZEND_NORETURN void zend_out_of_memory(void)
ZEND_API void * __zend_malloc(size_t len)
{
void *tmp = malloc(len);
if (EXPECTED(tmp || !len)) {
if (EXPECTED(tmp)) {
return tmp;
}
zend_out_of_memory();
@@ -2834,7 +2834,7 @@ ZEND_API void * __zend_calloc(size_t nmemb, size_t len)
ZEND_API void * __zend_realloc(void *p, size_t len)
{
p = realloc(p, len);
if (EXPECTED(p || !len)) {
if (EXPECTED(p)) {
return p;
}
zend_out_of_memory();
+3 -14
View File
@@ -57,21 +57,17 @@ ZEND_API zend_ast *zend_ast_create_znode(znode *node) {
return (zend_ast *) ast;
}
ZEND_API zend_ast *zend_ast_create_zval_with_lineno(zval *zv, zend_ast_attr attr, uint32_t lineno) {
ZEND_API zend_ast *zend_ast_create_zval_ex(zval *zv, zend_ast_attr attr) {
zend_ast_zval *ast;
ast = zend_ast_alloc(sizeof(zend_ast_zval));
ast->kind = ZEND_AST_ZVAL;
ast->attr = attr;
ZVAL_COPY_VALUE(&ast->val, zv);
ast->val.u2.lineno = lineno;
ast->val.u2.lineno = CG(zend_lineno);
return (zend_ast *) ast;
}
ZEND_API zend_ast *zend_ast_create_zval_ex(zval *zv, zend_ast_attr attr) {
return zend_ast_create_zval_with_lineno(zv, attr, CG(zend_lineno));
}
ZEND_API zend_ast *zend_ast_create_decl(
zend_ast_kind kind, uint32_t flags, uint32_t start_lineno, zend_string *doc_comment,
zend_string *name, zend_ast *child0, zend_ast *child1, zend_ast *child2, zend_ast *child3
@@ -159,14 +155,7 @@ ZEND_API zend_ast *zend_ast_create_list(uint32_t init_children, zend_ast_kind ki
uint32_t i;
va_start(va, kind);
for (i = 0; i < init_children; ++i) {
zend_ast *child = va_arg(va, zend_ast *);
ast = zend_ast_list_add(ast, child);
if (child != NULL) {
uint32_t lineno = zend_ast_get_lineno(child);
if (lineno < ast->lineno) {
ast->lineno = lineno;
}
}
ast = zend_ast_list_add(ast, va_arg(va, zend_ast *));
}
va_end(va);
}
-1
View File
@@ -189,7 +189,6 @@ typedef struct _zend_ast_decl {
typedef void (*zend_ast_process_t)(zend_ast *ast);
extern ZEND_API zend_ast_process_t zend_ast_process;
ZEND_API zend_ast *zend_ast_create_zval_with_lineno(zval *zv, zend_ast_attr attr, uint32_t lineno);
ZEND_API zend_ast *zend_ast_create_zval_ex(zval *zv, zend_ast_attr attr);
ZEND_API zend_ast *zend_ast_create_ex(zend_ast_kind kind, zend_ast_attr attr, ...);
+2 -14
View File
@@ -1223,8 +1223,6 @@ ZEND_FUNCTION(get_object_vars)
HashTable *properties;
zend_string *key;
zend_object *zobj;
zend_ulong index;
zend_bool fast_copy = 0;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_OBJECT(obj)
@@ -1243,17 +1241,7 @@ ZEND_FUNCTION(get_object_vars)
zobj = Z_OBJ_P(obj);
if (!zobj->ce->default_properties_count && properties == zobj->properties && !ZEND_HASH_GET_APPLY_COUNT(properties)) {
fast_copy = 1;
/* Check if the object has a numeric property, See Bug 73998 */
ZEND_HASH_FOREACH_STR_KEY(properties, key) {
if (key && ZEND_HANDLE_NUMERIC(key, index)) {
fast_copy = 0;
break;
}
} ZEND_HASH_FOREACH_END();
}
if (fast_copy) {
/* fast copy */
if (EXPECTED(zobj->handlers == &std_object_handlers)) {
if (EXPECTED(!(GC_FLAGS(properties) & IS_ARRAY_IMMUTABLE))) {
GC_REFCOUNT(properties)++;
@@ -1279,7 +1267,7 @@ ZEND_FUNCTION(get_object_vars)
zend_unmangle_property_name_ex(key, &class_name, &prop_name, &prop_len);
zend_hash_str_add_new(Z_ARRVAL_P(return_value), prop_name, prop_len, value);
} else {
zend_symbtable_add_new(Z_ARRVAL_P(return_value), key, value);
zend_hash_add_new(Z_ARRVAL_P(return_value), key, value);
}
}
}
+2 -8
View File
@@ -1690,7 +1690,6 @@ int zendlex(zend_parser_stack_elem *elem) /* {{{ */
{
zval zv;
int retval;
uint32_t start_lineno;
if (CG(increment_lineno)) {
CG(zend_lineno)++;
@@ -1699,7 +1698,6 @@ int zendlex(zend_parser_stack_elem *elem) /* {{{ */
again:
ZVAL_UNDEF(&zv);
start_lineno = CG(zend_lineno);
retval = lex_scan(&zv);
if (EG(exception)) {
return T_ERROR;
@@ -1723,7 +1721,7 @@ again:
break;
}
if (Z_TYPE(zv) != IS_UNDEF) {
elem->ast = zend_ast_create_zval_with_lineno(&zv, 0, start_lineno);
elem->ast = zend_ast_create_zval(&zv);
}
return retval;
@@ -4967,12 +4965,8 @@ void zend_compile_declare(zend_ast *ast) /* {{{ */
zend_ast *declare_ast = declares->child[i];
zend_ast *name_ast = declare_ast->child[0];
zend_ast *value_ast = declare_ast->child[1];
zend_string *name = zend_ast_get_str(name_ast);
if (value_ast->kind != ZEND_AST_ZVAL) {
zend_error_noreturn(E_COMPILE_ERROR, "declare(%s) value must be a literal", ZSTR_VAL(name));
}
if (zend_string_equals_literal_ci(name, "ticks")) {
zval value_zv;
zend_const_expr_to_zval(&value_zv, value_ast);
+2 -3
View File
@@ -327,7 +327,6 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
size_t const_name_len = name_len - class_name_len - 2;
zend_string *constant_name = zend_string_init(colon + 1, const_name_len, 0);
zend_string *class_name = zend_string_init(name, class_name_len, 0);
zend_class_constant *c = NULL;
zval *ret_constant = NULL;
if (zend_string_equals_literal_ci(class_name, "self")) {
@@ -356,7 +355,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
ce = zend_fetch_class(class_name, flags);
}
if (ce) {
c = zend_hash_find_ptr(&ce->constants_table, constant_name);
zend_class_constant *c = zend_hash_find_ptr(&ce->constants_table, constant_name);
if (c == NULL) {
if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) {
zend_throw_error(NULL, "Undefined class constant '%s::%s'", ZSTR_VAL(class_name), ZSTR_VAL(constant_name));
@@ -381,7 +380,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
}
MARK_CONSTANT_VISITED(ret_constant);
}
if (UNEXPECTED(zval_update_constant_ex(ret_constant, c->ce) != SUCCESS)) {
if (UNEXPECTED(zval_update_constant_ex(ret_constant, ce) != SUCCESS)) {
RESET_CONSTANT_VISITED(ret_constant);
ret_constant = NULL;
goto failure;
+2 -2
View File
@@ -521,8 +521,8 @@ static void _build_trace_args(zval *arg, smart_str *str) /* {{{ */
break;
case IS_DOUBLE: {
double dval = Z_DVAL_P(arg);
char *s_tmp;
size_t l_tmp = zend_spprintf(&s_tmp, MAX_LENGTH_OF_DOUBLE + EG(precision) + 1, "%.*G", (int) EG(precision), dval); /* SAFE */
char *s_tmp = emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
int l_tmp = zend_sprintf(s_tmp, "%.*G", (int) EG(precision), dval); /* SAFE */
smart_str_appendl(str, s_tmp, l_tmp);
smart_str_appends(str, ", ");
efree(s_tmp);
-4
View File
@@ -81,10 +81,6 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval
return variable_ptr;
}
if (ZEND_CONST_COND(value_type & (IS_VAR|IS_CV), 1) && variable_ptr == value) {
if (value_type == IS_VAR && ref) {
ZEND_ASSERT(GC_REFCOUNT(ref) > 1);
--GC_REFCOUNT(ref);
}
return variable_ptr;
}
garbage = Z_COUNTED_P(variable_ptr);
+1 -19
View File
@@ -761,7 +761,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
if (fci->object &&
(!EG(objects_store).object_buckets ||
!IS_OBJ_VALID(EG(objects_store).object_buckets[fci->object->handle]))) {
zend_vm_stack_free_call_frame(call);
if (EG(current_execute_data) == &dummy_execute_data) {
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
}
@@ -771,7 +770,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
if (func->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) {
if (func->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_throw_error(NULL, "Cannot call abstract method %s::%s()", ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
zend_vm_stack_free_call_frame(call);
if (EG(current_execute_data) == &dummy_execute_data) {
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
}
@@ -782,13 +780,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
func->common.scope ? ZSTR_VAL(func->common.scope->name) : "",
func->common.scope ? "::" : "",
ZSTR_VAL(func->common.function_name));
if (UNEXPECTED(EG(exception))) {
zend_vm_stack_free_call_frame(call);
if (EG(current_execute_data) == &dummy_execute_data) {
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
}
return FAILURE;
}
}
}
@@ -809,15 +800,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
func->common.scope ? ZSTR_VAL(func->common.scope->name) : "",
func->common.scope ? "::" : "",
ZSTR_VAL(func->common.function_name));
if (UNEXPECTED(EG(exception))) {
ZEND_CALL_NUM_ARGS(call) = i;
zend_vm_stack_free_args(call);
zend_vm_stack_free_call_frame(call);
if (EG(current_execute_data) == &dummy_execute_data) {
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
}
return FAILURE;
}
}
}
} else {
@@ -1221,7 +1203,7 @@ static void zend_timeout_handler(int dummy) /* {{{ */
if (output_len > 0) {
write(2, log_buffer, MIN(output_len, sizeof(log_buffer)));
}
_exit(124);
_exit(1);
}
#endif
+52 -74
View File
@@ -75,12 +75,26 @@
/* one (0) is reserved */
#define GC_ROOT_BUFFER_MAX_ENTRIES 10001
#define GC_FAKE_BUFFER_FLAG 0x80
#define GC_TYPE_MASK 0x7f
#define GC_HAS_DESTRUCTORS (1<<0)
#ifndef ZEND_GC_DEBUG
# define ZEND_GC_DEBUG 0
#endif
#define GC_NUM_ADDITIONAL_ENTRIES \
((4096 - ZEND_MM_OVERHEAD - sizeof(void*) * 2) / sizeof(gc_root_buffer))
typedef struct _gc_addtional_bufer gc_additional_buffer;
struct _gc_addtional_bufer {
uint32_t used;
gc_additional_buffer *next;
gc_root_buffer buf[GC_NUM_ADDITIONAL_ENTRIES];
};
#ifdef ZTS
ZEND_API int gc_globals_id;
#else
@@ -89,6 +103,9 @@ ZEND_API zend_gc_globals gc_globals;
ZEND_API int (*gc_collect_cycles)(void);
#define GC_REMOVE_FROM_ROOTS(current) \
gc_remove_from_roots((current))
#if ZEND_GC_DEBUG > 1
# define GC_TRACE(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__);
# define GC_TRACE_REF(ref, format, ...) \
@@ -156,12 +173,6 @@ static zend_always_inline void gc_remove_from_roots(gc_root_buffer *root)
GC_BENCH_DEC(root_buf_length);
}
static zend_always_inline void gc_remove_from_additional_roots(gc_root_buffer *root)
{
root->next->prev = root->prev;
root->prev->next = root->next;
}
static void root_buffer_dtor(zend_gc_globals *gc_globals)
{
if (gc_globals->buf) {
@@ -188,8 +199,6 @@ static void gc_globals_ctor_ex(zend_gc_globals *gc_globals)
gc_globals->gc_runs = 0;
gc_globals->collected = 0;
gc_globals->additional_buffer = NULL;
#if GC_BENCH
gc_globals->root_buf_length = 0;
gc_globals->root_buf_peak = 0;
@@ -245,8 +254,6 @@ ZEND_API void gc_reset(void)
GC_G(first_unused) = NULL;
GC_G(last_unused) = NULL;
}
GC_G(additional_buffer) = NULL;
}
ZEND_API void gc_init(void)
@@ -319,45 +326,21 @@ ZEND_API void ZEND_FASTCALL gc_possible_root(zend_refcounted *ref)
GC_BENCH_PEAK(root_buf_peak, root_buf_length);
}
static zend_always_inline gc_root_buffer* gc_find_additional_buffer(zend_refcounted *ref)
{
gc_additional_buffer *additional_buffer = GC_G(additional_buffer);
/* We have to check each additional_buffer to find which one holds the ref */
while (additional_buffer) {
uint32_t idx = GC_ADDRESS(GC_INFO(ref)) - GC_ROOT_BUFFER_MAX_ENTRIES;
if (idx < additional_buffer->used) {
gc_root_buffer *root = additional_buffer->buf + idx;
if (root->ref == ref) {
return root;
}
}
additional_buffer = additional_buffer->next;
}
ZEND_ASSERT(0);
return NULL;
}
ZEND_API void ZEND_FASTCALL gc_remove_from_buffer(zend_refcounted *ref)
{
gc_root_buffer *root;
ZEND_ASSERT(GC_ADDRESS(GC_INFO(ref)));
ZEND_ASSERT(GC_ADDRESS(GC_INFO(ref)) < GC_ROOT_BUFFER_MAX_ENTRIES);
GC_BENCH_INC(zval_remove_from_buffer);
if (EXPECTED(GC_ADDRESS(GC_INFO(ref)) < GC_ROOT_BUFFER_MAX_ENTRIES)) {
root = GC_G(buf) + GC_ADDRESS(GC_INFO(ref));
gc_remove_from_roots(root);
} else {
root = gc_find_additional_buffer(ref);
gc_remove_from_additional_roots(root);
}
root = GC_G(buf) + GC_ADDRESS(GC_INFO(ref));
if (GC_REF_GET_COLOR(ref) != GC_BLACK) {
GC_TRACE_SET_COLOR(ref, GC_PURPLE);
}
GC_INFO(ref) = 0;
GC_REMOVE_FROM_ROOTS(root);
/* updete next root that is going to be freed */
if (GC_G(next_to_free) == root) {
@@ -708,7 +691,7 @@ static void gc_scan_roots(void)
}
}
static void gc_add_garbage(zend_refcounted *ref)
static void gc_add_garbage(zend_refcounted *ref, gc_additional_buffer **additional_buffer)
{
gc_root_buffer *buf = GC_G(unused);
@@ -731,23 +714,25 @@ static void gc_add_garbage(zend_refcounted *ref)
#endif
} else {
/* If we don't have free slots in the buffer, allocate a new one and
* set it's address above GC_ROOT_BUFFER_MAX_ENTRIES that have special
* set it's address to GC_ROOT_BUFFER_MAX_ENTRIES that have special
* meaning.
*/
if (!GC_G(additional_buffer) || GC_G(additional_buffer)->used == GC_NUM_ADDITIONAL_ENTRIES) {
if (!*additional_buffer || (*additional_buffer)->used == GC_NUM_ADDITIONAL_ENTRIES) {
gc_additional_buffer *new_buffer = emalloc(sizeof(gc_additional_buffer));
new_buffer->used = 0;
new_buffer->next = GC_G(additional_buffer);
GC_G(additional_buffer) = new_buffer;
new_buffer->next = *additional_buffer;
*additional_buffer = new_buffer;
}
buf = GC_G(additional_buffer)->buf + GC_G(additional_buffer)->used;
buf = (*additional_buffer)->buf + (*additional_buffer)->used;
(*additional_buffer)->used++;
#if 1
/* optimization: color is already GC_BLACK (0) */
GC_INFO(ref) = GC_ROOT_BUFFER_MAX_ENTRIES + GC_G(additional_buffer)->used;
GC_INFO(ref) = GC_ROOT_BUFFER_MAX_ENTRIES;
#else
GC_REF_SET_ADDRESS(ref, GC_ROOT_BUFFER_MAX_ENTRIES) + GC_G(additional_buffer)->used;
GC_REF_SET_ADDRESS(ref, GC_ROOT_BUFFER_MAX_ENTRIES);
#endif
GC_G(additional_buffer)->used++;
/* modify type to prevent indirect destruction */
GC_TYPE(ref) |= GC_FAKE_BUFFER_FLAG;
}
if (buf) {
buf->ref = ref;
@@ -758,7 +743,7 @@ static void gc_add_garbage(zend_refcounted *ref)
}
}
static int gc_collect_white(zend_refcounted *ref, uint32_t *flags)
static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_additional_buffer **additional_buffer)
{
int count = 0;
HashTable *ht;
@@ -791,7 +776,7 @@ tail_call:
#else
if (!GC_ADDRESS(GC_INFO(ref))) {
#endif
gc_add_garbage(ref);
gc_add_garbage(ref, additional_buffer);
}
if (obj->handlers->dtor_obj &&
((obj->handlers->dtor_obj != zend_objects_destroy_object) ||
@@ -815,7 +800,7 @@ tail_call:
if (Z_REFCOUNTED_P(zv)) {
ref = Z_COUNTED_P(zv);
GC_REFCOUNT(ref)++;
count += gc_collect_white(ref, flags);
count += gc_collect_white(ref, flags, additional_buffer);
/* count non-refcounted for compatibility ??? */
} else if (Z_TYPE_P(zv) != IS_UNDEF) {
count++;
@@ -837,7 +822,7 @@ tail_call:
#else
if (!GC_ADDRESS(GC_INFO(ref))) {
#endif
gc_add_garbage(ref);
gc_add_garbage(ref, additional_buffer);
}
ht = (zend_array*)ref;
} else if (GC_TYPE(ref) == IS_REFERENCE) {
@@ -877,7 +862,7 @@ tail_call:
if (Z_REFCOUNTED_P(zv)) {
ref = Z_COUNTED_P(zv);
GC_REFCOUNT(ref)++;
count += gc_collect_white(ref, flags);
count += gc_collect_white(ref, flags, additional_buffer);
/* count non-refcounted for compatibility ??? */
} else if (Z_TYPE_P(zv) != IS_UNDEF) {
count++;
@@ -895,7 +880,7 @@ tail_call:
return count;
}
static int gc_collect_roots(uint32_t *flags)
static int gc_collect_roots(uint32_t *flags, gc_additional_buffer **additional_buffer)
{
int count = 0;
gc_root_buffer *current = GC_G(roots).next;
@@ -904,12 +889,8 @@ static int gc_collect_roots(uint32_t *flags)
while (current != &GC_G(roots)) {
gc_root_buffer *next = current->next;
if (GC_REF_GET_COLOR(current->ref) == GC_BLACK) {
if (EXPECTED(GC_ADDRESS(GC_INFO(current->ref)) < GC_ROOT_BUFFER_MAX_ENTRIES)) {
gc_remove_from_roots(current);
} else {
gc_remove_from_additional_roots(current);
}
GC_INFO(current->ref) = 0; /* reset GC_ADDRESS() and keep GC_BLACK */
GC_REMOVE_FROM_ROOTS(current);
}
current = next;
}
@@ -917,7 +898,7 @@ static int gc_collect_roots(uint32_t *flags)
current = GC_G(roots).next;
while (current != &GC_G(roots)) {
if (GC_REF_GET_COLOR(current->ref) == GC_WHITE) {
count += gc_collect_white(current->ref, flags);
count += gc_collect_white(current->ref, flags, additional_buffer);
}
current = current->next;
}
@@ -953,15 +934,12 @@ static void gc_remove_nested_data_from_buffer(zend_refcounted *ref, gc_root_buff
tail_call:
if (root ||
(GC_ADDRESS(GC_INFO(ref)) != 0 &&
GC_REF_GET_COLOR(ref) == GC_BLACK)) {
GC_REF_GET_COLOR(ref) == GC_BLACK &&
GC_ADDRESS(GC_INFO(ref)) != GC_ROOT_BUFFER_MAX_ENTRIES)) {
GC_TRACE_REF(ref, "removing from buffer");
if (root) {
if (EXPECTED(GC_ADDRESS(GC_INFO(root->ref)) < GC_ROOT_BUFFER_MAX_ENTRIES)) {
gc_remove_from_roots(root);
} else {
gc_remove_from_additional_roots(root);
}
GC_INFO(ref) = 0;
GC_REMOVE_FROM_ROOTS(root);
root = NULL;
} else {
GC_REMOVE_FROM_BUFFER(ref);
@@ -1055,7 +1033,7 @@ ZEND_API int zend_gc_collect_cycles(void)
zend_refcounted *p;
gc_root_buffer to_free;
uint32_t gc_flags = 0;
gc_additional_buffer *additional_buffer_snapshot;
gc_additional_buffer *additional_buffer;
#if ZEND_GC_DEBUG
zend_bool orig_gc_full;
#endif
@@ -1079,8 +1057,8 @@ ZEND_API int zend_gc_collect_cycles(void)
#endif
GC_TRACE("Collecting roots");
additional_buffer_snapshot = GC_G(additional_buffer);
count = gc_collect_roots(&gc_flags);
additional_buffer = NULL;
count = gc_collect_roots(&gc_flags, &additional_buffer);
#if ZEND_GC_DEBUG
GC_G(gc_full) = orig_gc_full;
#endif
@@ -1124,7 +1102,7 @@ ZEND_API int zend_gc_collect_cycles(void)
while (current != &to_free) {
p = current->ref;
GC_G(next_to_free) = current->next;
if (GC_TYPE(p) == IS_OBJECT) {
if ((GC_TYPE(p) & GC_TYPE_MASK) == IS_OBJECT) {
zend_object *obj = (zend_object*)p;
if (IS_OBJ_VALID(EG(objects_store).object_buckets[obj->handle]) &&
@@ -1161,7 +1139,7 @@ ZEND_API int zend_gc_collect_cycles(void)
p = current->ref;
GC_G(next_to_free) = current->next;
GC_TRACE_REF(p, "destroying");
if (GC_TYPE(p) == IS_OBJECT) {
if ((GC_TYPE(p) & GC_TYPE_MASK) == IS_OBJECT) {
zend_object *obj = (zend_object*)p;
if (EG(objects_store).object_buckets &&
@@ -1180,7 +1158,7 @@ ZEND_API int zend_gc_collect_cycles(void)
EG(objects_store).free_list_head = obj->handle;
p = current->ref = (zend_refcounted*)(((char*)obj) - obj->handlers->offset);
}
} else if (GC_TYPE(p) == IS_ARRAY) {
} else if ((GC_TYPE(p) & GC_TYPE_MASK) == IS_ARRAY) {
zend_array *arr = (zend_array*)p;
GC_TYPE(arr) = IS_NULL;
@@ -1202,10 +1180,10 @@ ZEND_API int zend_gc_collect_cycles(void)
current = next;
}
while (GC_G(additional_buffer) != additional_buffer_snapshot) {
gc_additional_buffer *next = GC_G(additional_buffer)->next;
efree(GC_G(additional_buffer));
GC_G(additional_buffer) = next;
while (additional_buffer != NULL) {
gc_additional_buffer *next = additional_buffer->next;
efree(additional_buffer);
additional_buffer = next;
}
GC_TRACE("Collection finished");
-13
View File
@@ -67,17 +67,6 @@ typedef struct _gc_root_buffer {
uint32_t refcount;
} gc_root_buffer;
#define GC_NUM_ADDITIONAL_ENTRIES \
((4096 - ZEND_MM_OVERHEAD - sizeof(void*) * 2) / sizeof(gc_root_buffer))
typedef struct _gc_additional_bufer gc_additional_buffer;
struct _gc_additional_bufer {
uint32_t used;
gc_additional_buffer *next;
gc_root_buffer buf[GC_NUM_ADDITIONAL_ENTRIES];
};
typedef struct _zend_gc_globals {
zend_bool gc_enabled;
zend_bool gc_active;
@@ -104,8 +93,6 @@ typedef struct _zend_gc_globals {
uint32_t zval_marked_grey;
#endif
gc_additional_buffer *additional_buffer;
} zend_gc_globals;
#ifdef ZTS
-10
View File
@@ -337,16 +337,6 @@ static zend_always_inline int zend_hash_str_exists_ind(const HashTable *ht, cons
Z_TYPE_P(Z_INDIRECT_P(zv)) != IS_UNDEF);
}
static zend_always_inline zval *zend_symbtable_add_new(HashTable *ht, zend_string *key, zval *pData)
{
zend_ulong idx;
if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_add_new(ht, idx, pData);
} else {
return zend_hash_add_new(ht, key, pData);
}
}
static zend_always_inline zval *zend_symtable_update(HashTable *ht, zend_string *key, zval *pData)
{
+2
View File
@@ -36,6 +36,8 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
int result;
zend_fcall_info fci;
zval retval;
HashTable *function_table;
zval params[2];
if (param_count > 0) {
+4963 -5151
View File
File diff suppressed because it is too large. Load diff
+1 -2
View File
@@ -1142,8 +1142,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
RETURN_TOKEN(T_RETURN);
}
<ST_IN_SCRIPTING>"yield"{WHITESPACE}"from"[^a-zA-Z0-9_\x80-\xff] {
yyless(yyleng - 1);
<ST_IN_SCRIPTING>"yield"{WHITESPACE}"from" {
HANDLE_NEWLINES(yytext, yyleng);
RETURN_TOKEN(T_YIELD_FROM);
}
+1 -1
View File
@@ -1,4 +1,4 @@
/* Generated by re2c 0.16 */
/* Generated by re2c 0.13.5 */
#line 3 "Zend/zend_language_scanner_defs.h"
enum YYCONDTYPE {
+18 -48
View File
@@ -951,13 +951,8 @@ ZEND_API int ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2) /* {
} else if (!converted) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_ADD, add_function);
if (EXPECTED(op1 != op2)) {
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
} else {
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
op2 = op1;
}
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
converted = 1;
} else {
zend_throw_error(NULL, "Unsupported operand types");
@@ -998,13 +993,8 @@ ZEND_API int ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2) /* {
} else if (!converted) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_SUB, sub_function);
if (EXPECTED(op1 != op2)) {
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
} else {
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
op2 = op1;
}
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
converted = 1;
} else {
zend_throw_error(NULL, "Unsupported operand types");
@@ -1050,13 +1040,8 @@ ZEND_API int ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2) /* {
} else if (!converted) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_MUL, mul_function);
if (EXPECTED(op1 != op2)) {
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
} else {
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
op2 = op1;
}
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
converted = 1;
} else {
zend_throw_error(NULL, "Unsupported operand types");
@@ -1133,27 +1118,17 @@ ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {
} else if (!converted) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_POW, pow_function);
if (EXPECTED(op1 != op2)) {
if (Z_TYPE_P(op1) == IS_ARRAY) {
ZVAL_LONG(result, 0);
return SUCCESS;
} else {
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
}
if (Z_TYPE_P(op2) == IS_ARRAY) {
ZVAL_LONG(result, 1L);
return SUCCESS;
} else {
zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
}
if (Z_TYPE_P(op1) == IS_ARRAY) {
ZVAL_LONG(result, 0);
return SUCCESS;
} else {
if (Z_TYPE_P(op1) == IS_ARRAY) {
ZVAL_LONG(result, 0);
return SUCCESS;
} else {
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
}
op2 = op1;
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
}
if (Z_TYPE_P(op2) == IS_ARRAY) {
ZVAL_LONG(result, 1L);
return SUCCESS;
} else {
zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
}
converted = 1;
} else {
@@ -1218,13 +1193,8 @@ ZEND_API int ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* {
} else if (!converted) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_DIV, div_function);
if (EXPECTED(op1 != op2)) {
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
} else {
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
op2 = op1;
}
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
converted = 1;
} else {
zend_throw_error(NULL, "Unsupported operand types");
+5 -13
View File
@@ -131,12 +131,6 @@
#if defined(HAVE_LIBDL) && !defined(ZEND_WIN32)
# if defined(__has_feature)
# if __has_feature(address_sanitizer)
# define __SANITIZE_ADDRESS__
# endif
# endif
# ifndef RTLD_LAZY
# define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
# endif
@@ -147,7 +141,7 @@
# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT)
# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__)
# elif defined(RTLD_DEEPBIND)
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_DEEPBIND)
# else
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
@@ -245,13 +239,11 @@ char *alloca();
# define ZEND_FASTCALL
#endif
#ifndef restrict
# if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004
# else
# define __restrict__
# endif
# define restrict __restrict__
#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004
#else
# define __restrict__
#endif
#define restrict __restrict__
#if (defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)) || __has_attribute(noreturn)
# define HAVE_NORETURN
+2 -14
View File
@@ -86,17 +86,12 @@ void zend_signal_handler_defer(int signo, siginfo_t *siginfo, void *context)
{
int errno_save = errno;
zend_signal_queue_t *queue, *qtmp;
zend_bool is_handling_safe = 1;
#ifdef ZTS
ZEND_TSRMLS_CACHE_UPDATE();
/* A signal could hit after TSRM shutdown, in this case globals are already freed. */
if (NULL == TSRMLS_CACHE || NULL == TSRMG_BULK_STATIC(zend_signal_globals_id, zend_signal_globals_t *)) {
is_handling_safe = 0;
}
#endif
if (EXPECTED(is_handling_safe && SIGG(active))) {
if (EXPECTED(SIGG(active))) {
if (UNEXPECTED(SIGG(depth) == 0)) { /* try to handle signal */
if (UNEXPECTED(SIGG(blocked))) {
SIGG(blocked) = 0;
@@ -179,14 +174,7 @@ static void zend_signal_handler(int signo, siginfo_t *siginfo, void *context)
int errno_save = errno;
struct sigaction sa;
sigset_t sigset;
zend_signal_entry_t p_sig;
#ifdef ZTS
if (NULL == TSRMLS_CACHE || NULL == TSRMG_BULK_STATIC(zend_signal_globals_id, zend_signal_globals_t *)) {
p_sig.flags = 0;
p_sig.handler = SIG_DFL;
} else
#endif
p_sig = SIGG(handlers)[signo-1];
zend_signal_entry_t p_sig = SIGG(handlers)[signo-1];
if (p_sig.handler == SIG_DFL) { /* raise default handler */
if (sigaction(signo, NULL, &sa) == 0) {
-2
View File
@@ -88,9 +88,7 @@ END_EXTERN_C()
ZEND_API void zend_signal_handler_unblock(void);
void zend_signal_activate(void);
void zend_signal_deactivate(void);
BEGIN_EXTERN_C()
void zend_signal_startup(void);
END_EXTERN_C()
void zend_signal_init(void);
ZEND_API int zend_signal(int signo, void (*handler)(int));
+3 -4
View File
@@ -940,10 +940,9 @@ static zend_always_inline uint32_t zval_delref_p(zval* pz) {
#define SEPARATE_STRING(zv) do { \
zval *_zv = (zv); \
if (Z_REFCOUNT_P(_zv) > 1) { \
if (Z_REFCOUNTED_P(_zv)) { \
Z_DELREF_P(_zv); \
} \
if (Z_REFCOUNTED_P(_zv) && \
Z_REFCOUNT_P(_zv) > 1) { \
Z_DELREF_P(_zv); \
zval_copy_ctor_func(_zv); \
} \
} while (0)
+2 -2
View File
@@ -4093,7 +4093,7 @@ ZEND_VM_HANDLER(41, ZEND_GENERATOR_CREATE, ANY, ANY)
* is allocated on heap.
*/
num_args = EX_NUM_ARGS();
if (EXPECTED(num_args <= EX(func)->op_array.num_args)) {
if (EXPECTED(num_args <= EX(func)->op_array.last_var)) {
used_stack = (ZEND_CALL_FRAME_SLOT + EX(func)->op_array.last_var + EX(func)->op_array.T) * sizeof(zval);
gen_execute_data = (zend_execute_data*)emalloc(used_stack);
used_stack = (ZEND_CALL_FRAME_SLOT + EX(func)->op_array.last_var) * sizeof(zval);
@@ -5191,7 +5191,7 @@ ZEND_VM_HANDLER(181, ZEND_FETCH_CLASS_CONSTANT, VAR|CONST|UNUSED|CLASS_FETCH, CO
}
value = &c->value;
if (Z_CONSTANT_P(value)) {
zval_update_constant_ex(value, c->ce);
zval_update_constant_ex(value, ce);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
+4 -4
View File
@@ -1179,7 +1179,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_CREATE_SPEC_HANDLER(
* is allocated on heap.
*/
num_args = EX_NUM_ARGS();
if (EXPECTED(num_args <= EX(func)->op_array.num_args)) {
if (EXPECTED(num_args <= EX(func)->op_array.last_var)) {
used_stack = (ZEND_CALL_FRAME_SLOT + EX(func)->op_array.last_var + EX(func)->op_array.T) * sizeof(zval);
gen_execute_data = (zend_execute_data*)emalloc(used_stack);
used_stack = (ZEND_CALL_FRAME_SLOT + EX(func)->op_array.last_var) * sizeof(zval);
@@ -5797,7 +5797,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_CONS
}
value = &c->value;
if (Z_CONSTANT_P(value)) {
zval_update_constant_ex(value, c->ce);
zval_update_constant_ex(value, ce);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -19985,7 +19985,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_VAR_
}
value = &c->value;
if (Z_CONSTANT_P(value)) {
zval_update_constant_ex(value, c->ce);
zval_update_constant_ex(value, ce);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -29790,7 +29790,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_UNUS
}
value = &c->value;
if (Z_CONSTANT_P(value)) {
zval_update_constant_ex(value, c->ce);
zval_update_constant_ex(value, ce);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
+3 -2
View File
@@ -12,11 +12,12 @@ if %errorlevel% neq 0 exit /b 3
if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
set BRANCH=%APPVEYOR_REPO_BRANCH:~4,3%
set STABILITY=stable
) else (
set BRANCH=master
set STABILITY=staging
)
set STABILITY=staging
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VC%-%PHP_SDK_ARCH%
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%PHP_SDK_VC%-%PHP_SDK_ARCH%-%BRANCH%
rem SDK is cached, deps info is cached as well
echo Updating dependencies in %DEPS_DIR%
call phpsdk_deps --update --branch %BRANCH% --stability %STABILITY% --deps %DEPS_DIR%
+1 -1
View File
@@ -11,7 +11,7 @@ if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
set BRANCH=master
set STABILITY=staging
)
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VC%-%PHP_SDK_ARCH%
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%PHP_SDK_VC%-%PHP_SDK_ARCH%-%BRANCH%
rem setup MySQL related exts
set MYSQL_PWD=Password12!
+9 -9
View File
@@ -69,33 +69,33 @@ int zend_sprintf(char *buffer, const char *format, ...);
/* To enable the is_nan, is_infinite and is_finite PHP functions */
#ifdef NETWARE
#define HAVE_DECL_ISNAN 1
#define HAVE_DECL_ISINF 1
#define HAVE_DECL_ISFINITE 1
#define HAVE_ISNAN 1
#define HAVE_ISINF 1
#define HAVE_ISFINITE 1
#endif
#ifndef zend_isnan
#if HAVE_DECL_ISNAN
#ifdef HAVE_ISNAN
#define zend_isnan(a) isnan(a)
#elif defined(HAVE_FPCLASS)
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
#else
#define zend_isnan(a) ((a) != (a))
#define zend_isnan(a) 0
#endif
#endif
#if HAVE_DECL_ISINF
#ifdef HAVE_ISINF
#define zend_isinf(a) isinf(a)
#elif defined(INFINITY)
/* Might not work, but is required by ISO C99 */
#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
#define zend_isinf(a) (((a)==INFINITY)?1:0)
#elif defined(HAVE_FPCLASS)
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
#else
#define zend_isinf(a) 0
#endif
#if HAVE_DECL_ISFINITE
#if defined(HAVE_ISFINITE) || defined(isfinite)
#define zend_finite(a) isfinite(a)
#elif defined(HAVE_FINITE)
#define zend_finite(a) finite(a)
@@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=7
PHP_MINOR_VERSION=1
PHP_RELEASE_VERSION=4
PHP_RELEASE_VERSION=2
PHP_EXTRA_VERSION="RC1"
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 -1
View File
@@ -40,7 +40,7 @@ SPNEGO => Yes
SSL => Yes
SSPI => Yes
TLS-SRP => No
HTTP2 => Yes
HTTP2 => No
GSSAPI => No
KERBEROS5 => Yes
UNIX_SOCKETS => No
+3600 -3673
View File
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -166,7 +166,7 @@ static void do_adjust_for_weekday(timelib_time* time)
{
/* To make "this week" work, where the current DOW is a "sunday" */
if (current_dow == 0 && time->relative.weekday != 0) {
time->relative.weekday -= 7;
time->relative.weekday = -6;
}
/* To make "sunday this week" work, where the current DOW is not a
@@ -369,7 +369,7 @@ static timelib_sll do_years(timelib_sll year)
return res;
}
static timelib_sll do_months(timelib_ull month, timelib_sll year)
static timelib_sll do_months(timelib_ull month, timelib_ull year)
{
if (timelib_is_leap(year)) {
return ((month_tab_leap[month - 1] + 1) * SECS_PER_DAY);
@@ -478,7 +478,7 @@ void timelib_update_ts(timelib_time* time, timelib_tzinfo* tzi)
time->sse = res;
time->sse_uptodate = 1;
time->have_relative = time->relative.have_weekday_relative = time->relative.have_special_relative = time->relative.first_last_day_of = 0;
time->have_relative = time->relative.have_weekday_relative = time->relative.have_special_relative = 0;
}
#if 0
-1
View File
@@ -189,7 +189,6 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
timelib_unixtime2gmt(tm, ts - (tm->z * 60) + (tm->dst * 3600));
tm->sse = ts;
tm->z = z;
tm->dst = dst;
break;
+14 -21
View File
@@ -1153,12 +1153,11 @@ static zend_string *date_format(char *format, size_t format_len, timelib_time *t
case 'a': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "pm" : "am"); break;
case 'A': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "PM" : "AM"); break;
case 'B': {
int retval = ((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10);
if (retval < 0) {
retval += 864000;
int retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
while (retval < 0) {
retval += 1000;
}
/* Make sure to do this on a positive int to avoid rounding errors */
retval = (retval / 864) % 1000;
retval = retval % 1000;
length = slprintf(buffer, 32, "%03d", retval);
break;
}
@@ -1349,12 +1348,11 @@ PHPAPI int php_idate(char format, time_t ts, int localtime)
/* Swatch Beat a.k.a. Internet Time */
case 'B':
retval = ((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10);
if (retval < 0) {
retval += 864000;
retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
while (retval < 0) {
retval += 1000;
}
/* Make sure to do this on a positive int to avoid rounding errors */
retval = (retval / 864) % 1000;
retval = retval % 1000;
break;
/* time */
@@ -2548,20 +2546,18 @@ static void update_errors_warnings(timelib_error_container *last_errors) /* {{{
static void php_date_set_time_fraction(timelib_time *time, int microseconds)
{
time->f = (double) microseconds / 1000000;
time->f = microseconds / 1000000;
}
static void php_date_get_current_time_with_fraction(time_t *sec, suseconds_t *usec)
static void php_date_set_current_time_fraction(timelib_time *time)
{
#if HAVE_GETTIMEOFDAY
struct timeval tp = {0}; /* For setting microseconds */
gettimeofday(&tp, NULL);
*sec = tp.tv_sec;
*usec = tp.tv_usec;
timelib_set_fraction_from_timeval(time, tp);
#else
*sec = time(NULL);
*usec = 0;
time->f = 0;
#endif
}
@@ -2573,8 +2569,6 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
int type = TIMELIB_ZONETYPE_ID, new_dst = 0;
char *new_abbr = NULL;
timelib_sll new_offset = 0;
time_t sec;
suseconds_t usec;
if (dateobj->time) {
timelib_time_dtor(dateobj->time);
@@ -2639,9 +2633,8 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
now->tz_abbr = new_abbr;
break;
}
php_date_get_current_time_with_fraction(&sec, &usec);
timelib_unixtime2local(now, (timelib_sll) sec);
php_date_set_time_fraction(now, usec);
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);
+11 -11
View File
@@ -43,20 +43,20 @@ foreach ($tests as $test) {
print "wanted = Monday 00:00:00\n\n";
}
?>
--EXPECTF--
--EXPECT--
Europe/Andorra
ts = Monday 2037-10-19 17:17:17 CEST
result = Monday 2037-10-26 00:00:00 CET
wanted = Monday 00:00:00
Asia/Dubai
ts = Thursday 1970-01-01 17:17:17 %s
result = Monday 1970-01-05 00:00:00 %s
ts = Thursday 1970-01-01 17:17:17 GST
result = Monday 1970-01-05 00:00:00 GST
wanted = Monday 00:00:00
Asia/Kabul
ts = Thursday 1970-01-01 17:17:17 %s
result = Monday 1970-01-05 00:00:00 %s
ts = Thursday 1970-01-01 17:17:17 AFT
result = Monday 1970-01-05 00:00:00 AFT
wanted = Monday 00:00:00
America/Antigua
@@ -130,8 +130,8 @@ result = Monday 1971-01-04 00:00:00 AST
wanted = Monday 00:00:00
Asia/Dacca
ts = Friday 1971-01-01 17:17:17 %s
result = Monday 1971-01-04 00:00:00 %s
ts = Friday 1971-01-01 17:17:17 DACT
result = Monday 1971-01-04 00:00:00 DACT
wanted = Monday 00:00:00
Europe/Brussels
@@ -150,13 +150,13 @@ result = Monday 1983-04-18 01:00:00 CEST
wanted = Monday 00:00:00
America/Buenos_Aires
ts = Monday 1974-09-30 17:17:17 %s
result = Monday 1974-10-07 00:00:00 %s
ts = Monday 1974-09-30 17:17:17 ART
result = Monday 1974-10-07 00:00:00 ART
wanted = Monday 00:00:00
America/Rosario
ts = Monday 1974-09-30 17:17:17 %s
result = Monday 1974-10-07 00:00:00 %s
ts = Monday 1974-09-30 17:17:17 ART
result = Monday 1974-10-07 00:00:00 ART
wanted = Monday 00:00:00
Europe/Vienna
+27 -27
View File
@@ -41,7 +41,7 @@ foreach ($timezones as $timezone) {
echo "\n";
}
?>
--EXPECTF--
--EXPECT--
America/Chicago
1076824799 [2004-02-14 23:59:59 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
1076824800 [2004-02-15 00:00:00 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
@@ -88,31 +88,31 @@ Asia/Jerusalem
1083099600 [2004-04-28 00:00:00 IDT] [2004-04-07 00:00:00 +21 days]
Asia/Singapore
1076774399 [2004-02-14 23:59:59 %s] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
1076774400 [2004-02-15 00:00:00 %s] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
1076774401 [2004-02-15 00:00:01 %s] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
1079452800 [2004-03-17 00:00:00 %s] [2004-04-07 00:00:00 -21 days]
1080316800 [2004-03-27 00:00:00 %s] [2004-04-07 00:00:00 11 days ago]
1080410400 [2004-03-28 02:00:00 %s] [2004-04-07 00:00:00 -10 day +2 hours]
1081180800 [2004-04-06 00:00:00 %s] [2004-04-07 00:00:00 -1 day]
1081267200 [2004-04-07 00:00:00 %s] [2004-04-07 00:00:00]
1081270800 [2004-04-07 01:00:00 %s] [2004-04-07 00:00:00 +1 hour]
1081274400 [2004-04-07 02:00:00 %s] [2004-04-07 00:00:00 +2 hour]
1081353600 [2004-04-08 00:00:00 %s] [2004-04-07 00:00:00 +1 day]
1081353600 [2004-04-08 00:00:00 %s] [2004-04-07 00:00:00 1 day]
1083081600 [2004-04-28 00:00:00 %s] [2004-04-07 00:00:00 +21 days]
1076774399 [2004-02-14 23:59:59 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
1076774400 [2004-02-15 00:00:00 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
1076774401 [2004-02-15 00:00:01 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
1079452800 [2004-03-17 00:00:00 SGT] [2004-04-07 00:00:00 -21 days]
1080316800 [2004-03-27 00:00:00 SGT] [2004-04-07 00:00:00 11 days ago]
1080410400 [2004-03-28 02:00:00 SGT] [2004-04-07 00:00:00 -10 day +2 hours]
1081180800 [2004-04-06 00:00:00 SGT] [2004-04-07 00:00:00 -1 day]
1081267200 [2004-04-07 00:00:00 SGT] [2004-04-07 00:00:00]
1081270800 [2004-04-07 01:00:00 SGT] [2004-04-07 00:00:00 +1 hour]
1081274400 [2004-04-07 02:00:00 SGT] [2004-04-07 00:00:00 +2 hour]
1081353600 [2004-04-08 00:00:00 SGT] [2004-04-07 00:00:00 +1 day]
1081353600 [2004-04-08 00:00:00 SGT] [2004-04-07 00:00:00 1 day]
1083081600 [2004-04-28 00:00:00 SGT] [2004-04-07 00:00:00 +21 days]
America/Sao_Paulo
1076810399 [2004-02-14 23:59:59 %s] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
1076814000 [2004-02-15 00:00:00 %s] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
1076814001 [2004-02-15 00:00:01 %s] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
1079492400 [2004-03-17 00:00:00 %s] [2004-04-07 00:00:00 -21 days]
1080356400 [2004-03-27 00:00:00 %s] [2004-04-07 00:00:00 11 days ago]
1080450000 [2004-03-28 02:00:00 %s] [2004-04-07 00:00:00 -10 day +2 hours]
1081220400 [2004-04-06 00:00:00 %s] [2004-04-07 00:00:00 -1 day]
1081306800 [2004-04-07 00:00:00 %s] [2004-04-07 00:00:00]
1081310400 [2004-04-07 01:00:00 %s] [2004-04-07 00:00:00 +1 hour]
1081314000 [2004-04-07 02:00:00 %s] [2004-04-07 00:00:00 +2 hour]
1081393200 [2004-04-08 00:00:00 %s] [2004-04-07 00:00:00 +1 day]
1081393200 [2004-04-08 00:00:00 %s] [2004-04-07 00:00:00 1 day]
1083121200 [2004-04-28 00:00:00 %s] [2004-04-07 00:00:00 +21 days]
1076810399 [2004-02-14 23:59:59 BRST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
1076814000 [2004-02-15 00:00:00 BRT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
1076814001 [2004-02-15 00:00:01 BRT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
1079492400 [2004-03-17 00:00:00 BRT] [2004-04-07 00:00:00 -21 days]
1080356400 [2004-03-27 00:00:00 BRT] [2004-04-07 00:00:00 11 days ago]
1080450000 [2004-03-28 02:00:00 BRT] [2004-04-07 00:00:00 -10 day +2 hours]
1081220400 [2004-04-06 00:00:00 BRT] [2004-04-07 00:00:00 -1 day]
1081306800 [2004-04-07 00:00:00 BRT] [2004-04-07 00:00:00]
1081310400 [2004-04-07 01:00:00 BRT] [2004-04-07 00:00:00 +1 hour]
1081314000 [2004-04-07 02:00:00 BRT] [2004-04-07 00:00:00 +2 hour]
1081393200 [2004-04-08 00:00:00 BRT] [2004-04-07 00:00:00 +1 day]
1081393200 [2004-04-08 00:00:00 BRT] [2004-04-07 00:00:00 1 day]
1083121200 [2004-04-28 00:00:00 BRT] [2004-04-07 00:00:00 +21 days]
+10 -10
View File
@@ -34,18 +34,18 @@ echo date("Y-m-d H:i:s T\n", $l);
1099364400
1099364400
1099447200
2004-11-01 00:00:00 -03
2004-11-02 01:00:00 -02
2004-11-02 01:00:00 -02
2004-11-02 01:00:00 -02
2004-11-03 00:00:00 -02
2004-11-01 00:00:00 BRT
2004-11-02 01:00:00 BRST
2004-11-02 01:00:00 BRST
2004-11-02 01:00:00 BRST
2004-11-03 00:00:00 BRST
1108778400
1108868400
1108868400
1108868400
1108954800
2005-02-19 00:00:00 -02
2005-02-20 00:00:00 -03
2005-02-20 00:00:00 -03
2005-02-20 00:00:00 -03
2005-02-21 00:00:00 -03
2005-02-19 00:00:00 BRST
2005-02-20 00:00:00 BRT
2005-02-20 00:00:00 BRT
2005-02-20 00:00:00 BRT
2005-02-21 00:00:00 BRT
+26 -26
View File
@@ -200,23 +200,23 @@ print "wanted=Thursday 00:00:00\n\n";
?>
--EXPECT--
TZ=America/Mendoza - wrong day.
tStamp=Sunday 1992-10-18 17:17:17 -02 1
result=Sunday 1992-10-25 00:00:00 -02 1
tStamp=Sunday 1992-10-18 17:17:17 ARST 1
result=Sunday 1992-10-25 00:00:00 ARST 1
wanted=Sunday 00:00:00
TZ=America/Catamarca - wrong day.
tStamp=Sunday 1990-10-21 17:17:17 -02 1
result=Sunday 1990-10-28 00:00:00 -02 1
tStamp=Sunday 1990-10-21 17:17:17 ARST 1
result=Sunday 1990-10-28 00:00:00 ARST 1
wanted=Sunday 00:00:00
TZ=America/Cordoba - wrong day.
tStamp=Sunday 1990-10-21 17:17:17 -02 1
result=Sunday 1990-10-28 00:00:00 -02 1
tStamp=Sunday 1990-10-21 17:17:17 ARST 1
result=Sunday 1990-10-28 00:00:00 ARST 1
wanted=Sunday 00:00:00
TZ=America/Rosario - wrong day.
tStamp=Tuesday 1991-10-15 17:17:17 -04 0
result=Tuesday 1991-10-22 00:00:00 -02 1
tStamp=Tuesday 1991-10-15 17:17:17 WART 0
result=Tuesday 1991-10-22 00:00:00 ARST 1
wanted=Tuesday 00:00:00
TZ=Europe/Vienna - wrong day - giving unexpected results, at
@@ -231,8 +231,8 @@ result=Monday 1992-09-28 00:00:00 +04 0
wanted=Monday 00:00:00
TZ=America/Noronha - wrong day.
tStamp=Friday 1999-10-01 17:17:17 -02 0
result=Friday 1999-10-08 00:00:00 -01 1
tStamp=Friday 1999-10-01 17:17:17 FNT 0
result=Friday 1999-10-08 00:00:00 FNST 1
wanted=Friday 00:00:00
TZ=America/Havana - wrong day.
@@ -256,13 +256,13 @@ result=Friday 2003-04-04 00:00:00 EEST 1
wanted=Friday 00:00:00
TZ=Pacific/Kwajalein - wrong day.
tStamp=Friday 1993-08-13 17:17:17 -12 0
result=Saturday 1993-08-21 00:00:00 +12 0
tStamp=Friday 1993-08-13 17:17:17 KWAT 0
result=Saturday 1993-08-21 00:00:00 MHT 0
wanted=Friday 00:00:00
TZ=Asia/Ulan_Bator - wrong day.
tStamp=Saturday 2001-09-22 17:17:17 +09 1
result=Saturday 2001-09-29 00:00:00 +09 1
tStamp=Saturday 2001-09-22 17:17:17 ULAST 1
result=Saturday 2001-09-29 00:00:00 ULAST 1
wanted=Saturday 00:00:00
TZ=America/Cancun - wrong day.
@@ -286,18 +286,18 @@ result=Thursday 2002-04-11 00:00:00 MDT 1
wanted=Thursday 00:00:00
TZ=Asia/Kuala_Lumpur - wrong day.
tStamp=Monday 1981-12-28 17:17:17 +0730 0
result=Monday 1982-01-04 00:00:00 +08 0
tStamp=Monday 1981-12-28 17:17:17 MALT 0
result=Monday 1982-01-04 00:00:00 MYT 0
wanted=Monday 00:00:00
TZ=Pacific/Chatham - wrong day.
tStamp=Monday 1974-10-28 17:17:17 +1245 0
result=Monday 1974-11-04 00:00:00 +1345 1
tStamp=Monday 1974-10-28 17:17:17 CHAST 0
result=Monday 1974-11-04 00:00:00 CHADT 1
wanted=Monday 00:00:00
TZ=America/Lima - wrong day.
tStamp=Thursday 1985-12-26 17:17:17 -05 0
result=Thursday 1986-01-02 00:00:00 -04 1
tStamp=Thursday 1985-12-26 17:17:17 PET 0
result=Thursday 1986-01-02 00:00:00 PEST 1
wanted=Thursday 00:00:00
TZ=Asia/Karachi - wrong day.
@@ -306,16 +306,16 @@ result=Friday 2002-04-12 00:00:00 PKST 1
wanted=Friday 00:00:00
TZ=America/Asuncion - wrong day.
tStamp=Wednesday 2002-02-27 17:17:17 -03 1
result=Wednesday 2002-03-06 00:00:00 -03 1
tStamp=Wednesday 2002-02-27 17:17:17 PYST 1
result=Wednesday 2002-03-06 00:00:00 PYST 1
wanted=Wednesday 00:00:00
TZ=Asia/Singapore - wrong day.
tStamp=Thursday 1981-12-31 17:17:17 +0730 0
result=Thursday 1982-01-07 00:00:00 +08 0
tStamp=Thursday 1981-12-31 17:17:17 SGT 0
result=Thursday 1982-01-07 00:00:00 SGT 0
wanted=Thursday 00:00:00
TZ=America/Montevideo - wrong day.
tStamp=Thursday 2004-09-16 17:17:17 -03 0
result=Thursday 2004-09-23 00:00:00 -02 1
tStamp=Thursday 2004-09-16 17:17:17 UYT 0
result=Thursday 2004-09-23 00:00:00 UYST 1
wanted=Thursday 00:00:00
+12 -12
View File
@@ -76,13 +76,13 @@ print "wanted=Friday 00:00:00\n\n";
?>
--EXPECT--
TZ=Pacific/Rarotonga - wrong day.
tStamp=Thursday 1970-01-01 17:17:17 -1030 0
result=Tuesday 1970-01-06 00:00:00 -1030 0
tStamp=Thursday 1970-01-01 17:17:17 CKT 0
result=Tuesday 1970-01-06 00:00:00 CKT 0
wanted=Tuesday 00:00:00
TZ=Atlantic/South_Georgia - wrong day.
tStamp=Thursday 1970-01-01 17:17:17 -02 0
result=Tuesday 1970-01-06 00:00:00 -02 0
tStamp=Thursday 1970-01-01 17:17:17 GST 0
result=Tuesday 1970-01-06 00:00:00 GST 0
wanted=Tuesday 00:00:00
TZ=America/Port-au-Prince - wrong day.
@@ -91,13 +91,13 @@ result=Monday 2005-04-04 00:00:00 EDT 1
wanted=Monday 00:00:00
TZ=Pacific/Enderbury - wrong day, off by 2 days.
tStamp=Thursday 1970-01-01 17:17:17 -12 0
result=Monday 1970-01-05 00:00:00 -12 0
tStamp=Thursday 1970-01-01 17:17:17 PHOT 0
result=Monday 1970-01-05 00:00:00 PHOT 0
wanted=Monday 00:00:00
TZ=Pacific/Kiritimati - wrong day, off by 2 days.
tStamp=Thursday 1970-01-01 17:17:17 -1040 0
result=Monday 1970-01-05 00:00:00 -1040 0
tStamp=Thursday 1970-01-01 17:17:17 LINT 0
result=Monday 1970-01-05 00:00:00 LINT 0
wanted=Monday 00:00:00
TZ=America/Managua - wrong day.
@@ -106,13 +106,13 @@ result=Tuesday 2005-04-12 00:00:00 CDT 1
wanted=Tuesday 00:00:00
TZ=Pacific/Pitcairn - wrong day.
tStamp=Thursday 1970-01-01 17:17:17 -0830 0
result=Wednesday 1970-01-07 00:00:00 -0830 0
tStamp=Thursday 1970-01-01 17:17:17 PNT 0
result=Wednesday 1970-01-07 00:00:00 PNT 0
wanted=Wednesday 00:00:00
TZ=Pacific/Fakaofo - wrong day.
tStamp=Thursday 1970-01-01 17:17:17 -11 0
result=Saturday 1970-01-03 00:00:00 -11 0
tStamp=Thursday 1970-01-01 17:17:17 TKT 0
result=Saturday 1970-01-03 00:00:00 TKT 0
wanted=Saturday 00:00:00
TZ=Pacific/Johnston - wrong day.
+2 -2
View File
@@ -23,8 +23,8 @@ print "wanted=Sunday 00:00:00\n\n";
--EXPECT--
TZ=America/Jujuy - Is it OK for this to be 2 AM, rather than 1
AM as per most DST transitions?
tStamp=Monday 1990-10-15 17:17:17 -04 0
result=Monday 1990-10-22 00:00:00 -04 0
tStamp=Monday 1990-10-15 17:17:17 WART 0
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?
+47 -47
View File
@@ -116,11 +116,11 @@ print "wanted=Monday 00:00:00\n\n";
print "TZ=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? yes\n";
date_default_timezone_set('Africa/Monrovia');
$tStamp = mktime (17, 17, 17, 1, 730, 1970);
$tStamp = mktime (17, 17, 17, 1, 845, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Friday", $tStamp);
$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Friday 00:44:30\n\n";
print "wanted=Monday 00:44:30\n\n";
print "TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?. yes\n";
date_default_timezone_set('Asia/Katmandu');
@@ -208,7 +208,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday 00:30:00\n\n";
?>
--EXPECTF--
--EXPECT--
TZ=Africa/Bujumbura - *Note*: Unexpected, as does not appear to
have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 CAT 0
@@ -216,14 +216,14 @@ result=Wednesday 1970-01-07 00:00:00 CAT 0
wanted=Wednesday 00:00:00
TZ=Asia/Thimbu - Is it OK for this to be 0:30 AM? yes
tStamp=Thursday 1987-09-24 17:17:17 +0530 0
result=Thursday 1987-10-01 00:30:00 +06 0
tStamp=Thursday 1987-09-24 17:17:17 IST 0
result=Thursday 1987-10-01 00:30:00 BTT 0
wanted=Thursday 00:30:00
TZ=Indian/Cocos - Is it OK for this to be 6:30 AM? Note: does not
appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 +0630 0
result=Thursday 1970-01-08 00:00:00 +0630 0
tStamp=Thursday 1970-01-01 17:17:17 CCT 0
result=Thursday 1970-01-08 00:00:00 CCT 0
wanted=Thursday 00:00:00
TZ=Africa/Lubumbashi - Is it OK for this to be 2 AM? Note: does
@@ -233,110 +233,110 @@ result=Saturday 1970-01-03 00:00:00 CAT 0
wanted=Saturday 00:00:00
TZ=Asia/Kashgar - Is it OK for this to be 3 AM? yes
tStamp=Thursday 1980-04-24 17:17:17 +06 0
result=Thursday 1980-05-01 00:00:00 +06 0
tStamp=Thursday 1980-04-24 17:17:17 XJT 0
result=Thursday 1980-05-01 00:00:00 XJT 0
wanted=Thursday 03:00:00
TZ=Indian/Christmas - Is it OK for this to be 7 AM? Note: does
not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 +07 0
result=Sunday 1970-01-04 00:00:00 +07 0
tStamp=Thursday 1970-01-01 17:17:17 CXT 0
result=Sunday 1970-01-04 00:00:00 CXT 0
wanted=Sunday 00:00:00
TZ=America/Santo_Domingo - Is it OK for this to be 0:30 AM? yes
tStamp=Sunday 1970-10-18 17:17:17 EST 0
result=Sunday 1970-10-25 00:30:00 -0430 1
result=Sunday 1970-10-25 00:30:00 EHDT 1
wanted=Sunday 00:30:00
TZ=Pacific/Truk - Is it OK for this to be 10 AM? Note: does not
appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 +10 0
result=Tuesday 1970-01-06 00:00:00 +10 0
tStamp=Thursday 1970-01-01 17:17:17 CHUT 0
result=Tuesday 1970-01-06 00:00:00 CHUT 0
wanted=Tuesday 00:00:00
TZ=Pacific/Ponape - Is it OK for this to be 11 AM? Note: does
not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 +11 0
result=Monday 1970-01-05 00:00:00 +11 0
tStamp=Thursday 1970-01-01 17:17:17 PONT 0
result=Monday 1970-01-05 00:00:00 PONT 0
wanted=Monday 00:00:00
TZ=America/Scoresbysund - Is it OK for this to be 2 AM? yes
tStamp=Sunday 1981-03-22 17:17:17 -02 0
result=Sunday 1981-03-29 02:00:00 +00 1
tStamp=Sunday 1981-03-22 17:17:17 CGT 0
result=Sunday 1981-03-29 02:00:00 EGST 1
wanted=Sunday 02:00:00
TZ=America/Guyana - Is it OK for this to be 0:45 AM? yes
tStamp=Thursday 1975-07-24 17:17:17 -0345 0
result=Thursday 1975-07-31 00:45:00 -03 0
tStamp=Thursday 1975-07-24 17:17:17 GYT 0
result=Thursday 1975-07-31 00:45:00 GYT 0
wanted=Thursday 00:45:00
TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? yes
tStamp=Tuesday 1977-10-25 17:17:17 +0330 0
result=Tuesday 1977-11-01 00:30:00 +04 0
tStamp=Tuesday 1977-10-25 17:17:17 IRST 0
result=Tuesday 1977-11-01 00:30:00 IRST 0
wanted=Tuesday 00:30:00
TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does
not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 +12 0
result=Monday 1970-01-05 00:00:00 +12 0
tStamp=Thursday 1970-01-01 17:17:17 GILT 0
result=Monday 1970-01-05 00:00:00 GILT 0
wanted=Monday 00:00:00
TZ=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? yes
tStamp=Friday 1971-12-31 17:17:17 MMT 0
result=Friday 1972-01-07 00:44:30 GMT 0
wanted=Friday 00:44:30
tStamp=Monday 1972-04-24 17:17:17 LRT 0
result=Monday 1972-05-01 00:44:30 GMT 0
wanted=Monday 00:44:30
TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?. yes
tStamp=Wednesday 1985-12-25 17:17:17 +0530 0
result=Wednesday 1986-01-01 00:15:00 +0545 0
tStamp=Wednesday 1985-12-25 17:17:17 IST 0
result=Wednesday 1986-01-01 00:15:00 NPT 0
wanted=Wednesday 00:15:00
TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes
tStamp=Tuesday 1979-04-24 17:17:17 +1130 0
result=Tuesday 1979-05-01 00:30:00 +12 0
tStamp=Tuesday 1979-04-24 17:17:17 NRT 0
result=Tuesday 1979-05-01 00:30:00 NRT 0
wanted=Tuesday 00:30:00
TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? yes
tStamp=Sunday 1978-09-24 17:17:17 -1130 0
result=Sunday 1978-10-01 00:30:00 -11 0
tStamp=Sunday 1978-09-24 17:17:17 NUT 0
result=Sunday 1978-10-01 00:30:00 NUT 0
wanted=Sunday 00:30:00
TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST
or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 +10 0
result=Thursday 1970-01-08 00:00:00 +10 0
tStamp=Thursday 1970-01-01 17:17:17 PGT 0
result=Thursday 1970-01-08 00:00:00 PGT 0
wanted=Thursday 00:00:00
TZ=America/Miquelon - Is it OK for this to be 1 AM ? yes
tStamp=Thursday 1980-04-24 17:17:17 AST 0
result=Thursday 1980-05-01 01:00:00 -03 0
result=Thursday 1980-05-01 01:00:00 PMST 0
wanted=Thursday 01:00:00
TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or
timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 +09 0
result=Saturday 1970-01-03 00:00:00 +09 0
tStamp=Thursday 1970-01-01 17:17:17 PWT 0
result=Saturday 1970-01-03 00:00:00 PWT 0
wanted=Saturday 00:00:00
TZ=Pacific/Funafuti - Is it OK for this to be midday? Note: does
not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 +12 0
result=Wednesday 1970-01-07 00:00:00 +12 0
tStamp=Thursday 1970-01-01 17:17:17 TVT 0
result=Wednesday 1970-01-07 00:00:00 TVT 0
wanted=Wednesday 00:00:00
TZ=Pacific/Wake - Is it OK for this to be midday? Note: does not
appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 +12 0
result=Tuesday 1970-01-06 00:00:00 +12 0
tStamp=Thursday 1970-01-01 17:17:17 WAKT 0
result=Tuesday 1970-01-06 00:00:00 WAKT 0
wanted=Tuesday 00:00:00
TZ=Pacific/Wallis - Is it OK for this to be midday? Note: does
not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 +12 0
result=Tuesday 1970-01-06 00:00:00 +12 0
tStamp=Thursday 1970-01-01 17:17:17 WFT 0
result=Tuesday 1970-01-06 00:00:00 WFT 0
wanted=Tuesday 00:00:00
TZ=America/Paramaribo - Is it OK for this to be 0:30 AM? yes
tStamp=Monday 1984-09-24 17:17:17 -0330 0
result=Monday 1984-10-01 00:30:00 -03 0
tStamp=Monday 1984-09-24 17:17:17 SRT 0
result=Monday 1984-10-01 00:30:00 SRT 0
wanted=Monday 00:30:00
-34
View File
@@ -1,34 +0,0 @@
--TEST--
Bug #72096: Swatch time value incorrect for dates before 1970
--INI--
date.timezone=UTC
--FILE--
<?php
for ($unix = 1461283200; $unix <= 1461369600; $unix += 8000) {
echo "Time:", gmdate('Y-m-d H:i:s = B', $unix), PHP_EOL;
echo "Time:", gmdate('Y-m-d H:i:s = B', $unix - 82 * 365 * 24 * 3600), PHP_EOL;
}
?>
--EXPECT--
Time:2016-04-22 00:00:00 = 041
Time:1934-05-13 00:00:00 = 041
Time:2016-04-22 02:13:20 = 134
Time:1934-05-13 02:13:20 = 134
Time:2016-04-22 04:26:40 = 226
Time:1934-05-13 04:26:40 = 226
Time:2016-04-22 06:40:00 = 319
Time:1934-05-13 06:40:00 = 319
Time:2016-04-22 08:53:20 = 412
Time:1934-05-13 08:53:20 = 412
Time:2016-04-22 11:06:40 = 504
Time:1934-05-13 11:06:40 = 504
Time:2016-04-22 13:20:00 = 597
Time:1934-05-13 13:20:00 = 597
Time:2016-04-22 15:33:20 = 689
Time:1934-05-13 15:33:20 = 689
Time:2016-04-22 17:46:40 = 782
Time:1934-05-13 17:46:40 = 782
Time:2016-04-22 20:00:00 = 875
Time:1934-05-13 20:00:00 = 875
Time:2016-04-22 22:13:20 = 967
Time:1934-05-13 22:13:20 = 967
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #72719: Relative datetime format ignores weekday on sundays only
--FILE--
<?php
echo (new DateTimeImmutable('Monday next week 13:00'))->format('l'), "\n";
echo (new DateTimeImmutable('Tuesday next week 14:00'))->format('l'), "\n";
echo (new DateTimeImmutable('Wednesday next week 14:00'))->format('l'), "\n";
echo (new DateTimeImmutable('Thursday next week 15:00'))->format('l'), "\n";
echo (new DateTimeImmutable('Friday next week 16:00'))->format('l'), "\n";
echo (new DateTimeImmutable('Saturday next week 17:00'))->format('l'), "\n";
echo (new DateTimeImmutable('Sunday next week 18:00'))->format('l'), "\n";
?>
--EXPECT--
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
-22
View File
@@ -1,22 +0,0 @@
--TEST--
Bug #73294: DateTime wrong when date string is negative
--FILE--
<?php
for ( $i = -1050; $i <= -1000; $i++ )
{
$M = "06";
$D = "22";
$dt = new DateTime("{$i}-{$M}-{$D} 00:00:00");
$expected = "{$i}-{$M}-{$D} 00:00:00";
$result = $dt->format('Y-m-d H:i:s');
if ( $expected != $result )
{
echo "Wrong: Should have been {$expected}, was {$result}\n";
}
}
?>
==DONE==
--EXPECT--
==DONE==
-24
View File
@@ -1,24 +0,0 @@
--TEST--
Bug #73489: wrong timestamp when call setTimeZone multi times with UTC offset
--FILE--
<?php
// example 1 - Timestamp is changing
$datetime = new DateTime('2016-11-09 20:00:00', new DateTimeZone('UTC'));
var_dump($datetime->getTimestamp());
$datetime->setTimeZone(new DateTimeZone('-03:00'));
$datetime->setTimeZone(new DateTimeZone('-03:00'));
var_dump($datetime->getTimestamp());
// example 2 - Timestamp keeps if you use getTimestamp() before second setTimeZone() calls
$datetime = new DateTime('2016-11-09 20:00:00', new DateTimeZone('UTC'));
var_dump($datetime->getTimestamp());
$datetime->setTimeZone(new DateTimeZone('-03:00'));
$datetime->getTimestamp();
$datetime->setTimeZone(new DateTimeZone('-03:00'));
var_dump($datetime->getTimestamp());
?>
--EXPECT--
int(1478721600)
int(1478721600)
int(1478721600)
int(1478721600)
-17
View File
@@ -1,17 +0,0 @@
--TEST--
Bug #73837: Milliseconds in DateTime()
--FILE--
<?php
$collect = [];
for ( $i = 0; $i < 1000; $i++ )
{
$a = new DateTime();
$key = "s" . $a->format( "u" );
$collect[$key] = true;
}
echo ( count( $collect ) > 990 ) ? "microseconds differ\n" : "microseconds do not differ enough\n";
?>
--EXPECT--
microseconds differ
-63
View File
@@ -1,63 +0,0 @@
--TEST--
Bug #73858: diff() of two relative/described DateTimes is wrong
--FILE--
<?php
/*
In the "verbose setup method" I'm trying setup the DateTime object myself
to see if it's the format string which is parsed in correctly or if it's the DateTime
object which is breaking stuff. From the testing it appears DateTime is broken somehow.
*/
$ss = 'february first day of last month midnight';
$es = 'february first day of this month midnight - 1 second';
$s = new DateTime($ss);
$e = new DateTime($es);
$d= $e->diff($s);
var_dump($d->days); // 0 ... but should be 30
$s = (new DateTime(null))->setTimestamp(strtotime($ss)); // verbose setup method
$e = (new DateTime(null))->setTimestamp(strtotime($es)); // verbose setup method
$d = $e->diff($s);
var_dump($d->days); // 30 ... and should be 30
/*
Next we will try mix/match the code to see what happens, surprisingly it seems that the end date ($e)
is the important one, if it uses the verbose method it returns the correct values.
*/
$s = (new DateTime(null))->setTimestamp(strtotime($ss)); // verbose setup method
$e = new DateTime($es);
$d= $e->diff($s);
var_dump($d->days); // 0 ... but should be 30
$s = new DateTime($ss);
$e = (new DateTime(null))->setTimestamp(strtotime($es)); // verbose setup method
$d= $e->diff($s);
var_dump($d->days); // 30 ... and should be 30
/*
This test just proves that the $e date is important BUT NOT because it's the one we call the diff() method
on, that's just coincidental that seems to imply that the "- 1 second" in the date string is the problem.
*/
$s = new DateTime($ss);
$e = (new DateTime(null))->setTimestamp(strtotime($es)); // verbose setup method
$d= $s->diff($e);
var_dump($d->days); // 30 ... and should be 30
/*
[Workaround]
This final test seems to prove that the input string is important and that the "- 1 secord" has a negative knock-on
effect on the results of the diff. By modifying the datetime with ->modify everything works as expected ...
it just means you have to be careful of how we work with DateTimes .
*/
$s = new DateTime($ss);
$e = new DateTime('february first day of this month midnight');
$e->modify('- 1 second');
var_dump($e->diff($s)->days); // 30 ... and should be 30
?>
--EXPECT--
int(30)
int(30)
int(30)
int(30)
int(30)
int(30)
-12
View File
@@ -1,12 +0,0 @@
--TEST--
Bug #73942: $date->modify('Friday this week') doesn't return a Friday if $date is a Sunday
--FILE--
<?php
$date1 = "2017-01-08"; // this is a Sunday
$date = new \DateTime($date1);
$date->modify('Friday this week');
$dateFormat = $date->format('Y-m-d');
echo $dateFormat, "\n";
?>
--EXPECT--
2017-01-06
-24
View File
@@ -1,24 +0,0 @@
--TEST--
Bug #74057: wrong day when using "this week" in strtotime
--FILE--
<?php
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Sun 2017-01-01")))."\n";
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Mon 2017-01-02")))."\n";
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Tue 2017-01-03")))."\n";
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Wed 2017-01-04")))."\n";
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Thu 2017-01-05")))."\n";
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Fri 2017-01-06")))."\n";
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Sat 2017-01-07")))."\n";
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Sun 2017-01-08")))."\n";
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Mon 2017-01-09")))."\n";
?>
--EXPECT--
Sat 2016-12-31
Sat 2017-01-07
Sat 2017-01-07
Sat 2017-01-07
Sat 2017-01-07
Sat 2017-01-07
Sat 2017-01-07
Sat 2017-01-07
Sat 2017-01-14
+2 -2
View File
@@ -22,8 +22,8 @@ $ts->modify("+ 1 hour 1 second");
echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
?>
--EXPECT--
Thu, 19 Aug 1993 23:59:59 -12
Sat, 21 Aug 1993 00:00:00 +12
Thu, 19 Aug 1993 23:59:59 KWAT
Sat, 21 Aug 1993 00:00:00 MHT
Sun, 27 Mar 2005 01:59:59 CET
Sun, 27 Mar 2005 03:00:00 CEST
Sun, 30 Oct 2005 01:59:59 CEST
+4 -4
View File
@@ -2038,16 +2038,16 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
RETURN_FALSE;
}
if (options) {
htmlCtxtUseOptions(ctxt, (int)options);
}
ctxt->vctxt.error = php_libxml_ctx_error;
ctxt->vctxt.warning = php_libxml_ctx_warning;
if (ctxt->sax != NULL) {
ctxt->sax->error = php_libxml_ctx_error;
ctxt->sax->warning = php_libxml_ctx_warning;
}
if (options) {
htmlCtxtUseOptions(ctxt, (int)options);
}
htmlParseDocument(ctxt);
newdoc = ctxt->myDoc;
htmlFreeParserCtxt(ctxt);
-14
View File
@@ -1,14 +0,0 @@
--TEST--
Bug #74004 (DOMDocument->loadHTML and ->loadHTMLFile do not heed LIBXML_NOWARNING and LIBXML_NOERROR options)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$doc=new DOMDocument();
$doc->loadHTML("<tag-throw></tag-throw>",LIBXML_NOERROR);
?>
===DONE===
--EXPECT--
===DONE===
+10 -24
View File
@@ -6,8 +6,8 @@ $context = stream_context_create(array('ssl' => array('local_cert' => dirname(__
for ($i=0; $i<10 && !$socket; ++$i) {
$port = rand(50000, 65535);
$socket = @stream_socket_server("tcp://127.0.0.1:$port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
@$socket = stream_socket_server("tcp://127.0.0.1:$port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
}
//set anther random port that is not the same as $port
do{
@@ -402,34 +402,20 @@ if ($pid) {
}elseif (preg_match('/^PASV/', $buf, $matches)) {
$pasv=true;
$host = "127.0.0.1";
$i=0;
do {
if (!empty($ssl)) {
$soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
} else {
$soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port");
}
/* Could bind port, Try another port */
if (!$soc) {
$pasv_port = rand(50000, 65535);
}
$i++;
} while ($i<10 && !$soc);
if (!$soc) {
echo "$errstr ($errno)\n";
die("could not bind passive port\n");
}
$p2 = $pasv_port % ((int) 1 << 8);
$p1 = ($pasv_port-$p2)/((int) 1 << 8);
$host = "127.0.0.1";
if (!empty($ssl)) {
$soc = stream_socket_server("tcp://127.0.0.1:$pasv_port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
} else {
$soc = stream_socket_server("tcp://127.0.0.1:$pasv_port");
}
fputs($s, "227 Entering Passive Mode. (127,0,0,1,{$p1},{$p2})\r\n");
$pasvs = stream_socket_accept($soc,10);
} elseif (preg_match('/^EPSV/', $buf, $matches)) {
}elseif (preg_match('/^EPSV/', $buf, $matches)) {
fputs($s, "550 Extended passsive mode not supported.\r\n");
} elseif (preg_match('/^SITE EXEC/', $buf, $matches)) {
fputs($s, "200 OK\r\n");
-2
View File
@@ -368,8 +368,6 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_imagepng, 0, 0, 1)
ZEND_ARG_INFO(0, im)
ZEND_ARG_INFO(0, to)
ZEND_ARG_INFO(0, quality)
ZEND_ARG_INFO(0, filters)
ZEND_END_ARG_INFO()
#endif
-10
View File
@@ -1,10 +0,0 @@
--TEST--
(Bug #74031) ReflectionFunction for imagepng returns wrong number of parameters
--FILE--
<?php
$ref = new ReflectionFunction('imagepng');
var_dump(count($ref->getParameters()));
?>
--EXPECT--
int(4)
+3 -2
View File
@@ -227,13 +227,14 @@ static inline void Gost(PHP_GOST_CTX *context, uint32_t data[8])
static inline void GostTransform(PHP_GOST_CTX *context, const unsigned char input[32])
{
int i, j;
uint32_t data[8], temp = 0;
uint32_t data[8], temp = 0, save = 0;
for (i = 0, j = 0; i < 8; ++i, j += 4) {
data[i] = ((uint32_t) input[j]) | (((uint32_t) input[j + 1]) << 8) |
(((uint32_t) input[j + 2]) << 16) | (((uint32_t) input[j + 3]) << 24);
save = context->state[i + 8];
context->state[i + 8] += data[i] + temp;
temp = context->state[i + 8] < data[i] ? 1 : (context->state[i + 8] == data[i] ? temp : 0);
temp = ((context->state[i + 8] < data[i]) || (context->state[i + 8] < save)) ? 1 : 0;
}
Gost(context, data);
-27
View File
@@ -1,27 +0,0 @@
--TEST--
Bug #73127 (gost-crypto hash incorrect if input data contains long 0xFF sequence)
--FILE--
<?php // $Id$
$test1 = str_repeat("\xFF", 40);
$test2 = str_repeat("\x00", 40);
echo hash('gost-crypto', $test1),
"\n",
hash('gost', $test1),
"\n",
hash('gost-crypto', $test2),
"\n",
hash('gost', $test2),
"\n",
hash('gost-crypto', ''),
"\n",
hash('gost', '')
;
?>
--EXPECT--
231d8bb980d3faa30fee6ec475df5669cf6c24bbce22f46d6737470043a99f8e
9eaf96ba62f90fae6707f1d4274d1a9d6680f5a121d4387815aa3a6ec42439c5
bbf1f3179409c853cd3e396d67b0e10a266c218a4fd19f149c39aa4f6d37a007
a0be0b90fea5a5b50c90c9429d07bb98fa0c06f0c30210e94c7d80c3125c67ac
981e5f3ca30c841487830f84fb433e13ac1101569b9c13584ac483234cd656c0
ce85b99cc46752fffee35cab9a7b0278abb4c2d2055cff685af4912c49490f8d
-22
View File
@@ -1,22 +0,0 @@
--TEST--
Bug #74230 iconv fails to fail on surrogates
--SKIPIF--
<?php if(!extension_loaded('iconv')) print 'skip'; ?>
--FILE--
<?php
$high = "\xED\xa1\x92"; // codepoint D852
$low = "\xED\xBD\xA2"; // codepoint DF62
$pair = $high.$low;
var_dump(
@\iconv('UTF-8', 'UTF-8', $high) === false,
@\iconv('UTF-8', 'UTF-8', $low) === false,
@\iconv('UTF-8', 'UTF-8', $pair) === false
);
?>
--EXPECT--
bool(true)
bool(true)
bool(true)
-27
View File
@@ -1,27 +0,0 @@
--TEST--
Bug #73800 (sporadic segfault with MYSQLI_OPT_INT_AND_FLOAT_NATIVE)
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
if (PHP_INT_SIZE != 8) die('skip requires 64-bit');
?>
--FILE--
<?php
require_once("connect.inc");
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$link->query('SET @@global.max_allowed_packet = 67108864');
$link->close();
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$link->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1);
$res = $link->query("SELECT RPAD('1',9000000,'1') as a,RPAD('1',9000000,'1') as b, 9223372036854775807 as c");
$r = $res->fetch_array();
var_dump($r['c']);
?>
--EXPECT--
int(9223372036854775807)
-25
View File
@@ -1,25 +0,0 @@
--TEST--
Bug #74021 (fetch_array broken data. Data more then MEDIUMBLOB)
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$link->query('SET @@global.max_allowed_packet = 67108864');
$link->close();
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$res = $link->query("SELECT RPAD('1',9000000,'1') as a,RPAD('1',9000000,'1') as b");
$r = $res->fetch_array();
var_dump(md5($r['a']));
var_dump(md5($r['b']));
?>
--EXPECT--
string(32) "42ca0fd16ab6b6d4b9d47dc0a4a8b12a"
string(32) "42ca0fd16ab6b6d4b9d47dc0a4a8b12a"
+4 -5
View File
@@ -1466,7 +1466,6 @@ php_mysqlnd_read_row_ex(MYSQLND_PFC * pfc,
MYSQLND_PACKET_HEADER header;
zend_uchar * p = NULL;
zend_bool first_iteration = TRUE;
size_t prealloc_more_bytes;
DBG_ENTER("php_mysqlnd_read_row_ex");
@@ -1482,9 +1481,8 @@ php_mysqlnd_read_row_ex(MYSQLND_PFC * pfc,
We're allocating an extra byte, as php_mysqlnd_rowp_read_text_protocol_aux
needs to be able to append a terminating \0 for atoi/atof.
*/
prealloc_more_bytes = 1;
*data_size = 1;
*data_size = 0;
while (1) {
if (FAIL == mysqlnd_read_header(pfc, vio, &header, stats, error_info)) {
ret = FAIL;
@@ -1495,7 +1493,7 @@ php_mysqlnd_read_row_ex(MYSQLND_PFC * pfc,
if (first_iteration) {
first_iteration = FALSE;
*buffer = pool->get_chunk(pool, *data_size + prealloc_more_bytes);
*buffer = pool->get_chunk(pool, *data_size);
if (!*buffer) {
ret = FAIL;
break;
@@ -1510,7 +1508,7 @@ php_mysqlnd_read_row_ex(MYSQLND_PFC * pfc,
/*
We have to realloc the buffer.
*/
if (FAIL == pool->resize_chunk(pool, *buffer, *data_size + prealloc_more_bytes)) {
if (FAIL == pool->resize_chunk(pool, *buffer, *data_size)) {
SET_OOM_ERROR(error_info);
ret = FAIL;
break;
@@ -1533,6 +1531,7 @@ php_mysqlnd_read_row_ex(MYSQLND_PFC * pfc,
pool->free_chunk(pool, *buffer);
*buffer = NULL;
}
(*data_size)--;
DBG_RETURN(ret);
}
/* }}} */
-4
View File
@@ -1722,7 +1722,6 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, zend_long max_table_le
}
bind = emalloc(sizeof(php_oci_bind));
ZVAL_UNDEF(&bind->parameter);
bind->array.elements = (text *)safe_emalloc(max_table_length * (maxlength + 1), sizeof(text), 0);
memset(bind->array.elements, 0, max_table_length * (maxlength + 1) * sizeof(text));
bind->array.current_length = zend_hash_num_elements(Z_ARRVAL_P(var));
@@ -1782,7 +1781,6 @@ php_oci_bind *php_oci_bind_array_helper_number(zval *var, zend_long max_table_le
hash = HASH_OF(var);
bind = emalloc(sizeof(php_oci_bind));
ZVAL_UNDEF(&bind->parameter);
bind->array.elements = (ub4 *)safe_emalloc(max_table_length, sizeof(ub4), 0);
bind->array.current_length = zend_hash_num_elements(Z_ARRVAL_P(var));
bind->array.old_length = bind->array.current_length;
@@ -1822,7 +1820,6 @@ php_oci_bind *php_oci_bind_array_helper_double(zval *var, zend_long max_table_le
hash = HASH_OF(var);
bind = emalloc(sizeof(php_oci_bind));
ZVAL_UNDEF(&bind->parameter);
bind->array.elements = (double *)safe_emalloc(max_table_length, sizeof(double), 0);
bind->array.current_length = zend_hash_num_elements(Z_ARRVAL_P(var));
bind->array.old_length = bind->array.current_length;
@@ -1863,7 +1860,6 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, zend_long max_table_leng
hash = HASH_OF(var);
bind = emalloc(sizeof(php_oci_bind));
ZVAL_UNDEF(&bind->parameter);
bind->array.elements = (OCIDate *)safe_emalloc(max_table_length, sizeof(OCIDate), 0);
bind->array.current_length = zend_hash_num_elements(Z_ARRVAL_P(var));
bind->array.old_length = bind->array.current_length;
-5
View File
@@ -1794,11 +1794,6 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx)
return;
}
if (cfg.blocks_count * (op_array->last_var + op_array->T) > 64 * 1024 * 1024) {
zend_arena_release(&ctx->arena, checkpoint);
return;
}
if (ctx->debug_level & ZEND_DUMP_BEFORE_BLOCK_PASS) {
zend_dump_op_array(op_array, ZEND_DUMP_CFG, "before block pass", &cfg);
}
-23
View File
@@ -266,29 +266,6 @@ int zend_build_call_graph(zend_arena **arena, zend_script *script, uint32_t buil
}
/* }}} */
zend_call_info **zend_build_call_map(zend_arena **arena, zend_func_info *info, zend_op_array *op_array) /* {{{ */
{
zend_call_info **map, *call;
if (!info->callee_info) {
/* Don't build call map if function contains no calls */
return NULL;
}
map = zend_arena_calloc(arena, sizeof(zend_call_info *), op_array->last);
for (call = info->callee_info; call; call = call->next_callee) {
int i;
map[call->caller_init_opline - op_array->opcodes] = call;
map[call->caller_call_opline - op_array->opcodes] = call;
for (i = 0; i < call->num_args; i++) {
if (call->arg_info[i].opline) {
map[call->arg_info[i].opline - op_array->opcodes] = call;
}
}
}
return map;
}
/* }}} */
/*
* Local variables:
* tab-width: 4
-2
View File
@@ -51,7 +51,6 @@ struct _zend_func_info {
zend_ssa ssa; /* Static Single Assignmnt Form */
zend_call_info *caller_info; /* where this function is called from */
zend_call_info *callee_info; /* which functions are called from this one */
zend_call_info **call_map; /* Call info associated with init/call/send opnum */
int num_args; /* (-1 - unknown) */
zend_recv_arg_info *arg_info;
zend_ssa_var_info return_info;
@@ -70,7 +69,6 @@ typedef struct _zend_call_graph {
BEGIN_EXTERN_C()
int zend_build_call_graph(zend_arena **arena, zend_script *script, uint32_t build_flags, zend_call_graph *call_graph);
zend_call_info **zend_build_call_map(zend_arena **arena, zend_func_info *info, zend_op_array *op_array);
int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_flags, zend_op_array *op_array, zend_func_info *func_info);
END_EXTERN_C()
+54 -69
View File
@@ -749,51 +749,31 @@ static int dominates(zend_basic_block *blocks, int a, int b) /* {{{ */
}
/* }}} */
typedef struct {
int id;
int level;
} block_info;
static int compare_block_level(const block_info *a, const block_info *b) {
return b->level - a->level;
}
static void swap_blocks(block_info *a, block_info *b) {
block_info tmp = *a;
*a = *b;
*b = tmp;
}
int zend_cfg_identify_loops(const zend_op_array *op_array, zend_cfg *cfg, uint32_t *flags) /* {{{ */
{
int i, j, k, n;
int depth, time;
int i, j, k;
int depth;
zend_basic_block *blocks = cfg->blocks;
int *entry_times, *exit_times;
int *dj_spanning_tree;
zend_worklist work;
int flag = ZEND_FUNC_NO_LOOPS;
block_info *sorted_blocks;
ALLOCA_FLAG(list_use_heap)
ALLOCA_FLAG(tree_use_heap)
ALLOCA_FLAG(sorted_blocks_use_heap)
ZEND_WORKLIST_ALLOCA(&work, cfg->blocks_count, list_use_heap);
dj_spanning_tree = do_alloca(sizeof(int) * cfg->blocks_count, tree_use_heap);
/* We don't materialize the DJ spanning tree explicitly, as we are only interested in ancestor
* queries. These are implemented by checking entry/exit times of the DFS search. */
entry_times = do_alloca(2 * sizeof(int) * cfg->blocks_count, tree_use_heap);
exit_times = entry_times + cfg->blocks_count;
memset(entry_times, -1, 2 * sizeof(int) * cfg->blocks_count);
for (i = 0; i < cfg->blocks_count; i++) {
dj_spanning_tree[i] = -1;
}
zend_worklist_push(&work, 0);
time = 0;
while (zend_worklist_len(&work)) {
next:
i = zend_worklist_peek(&work);
if (entry_times[i] == -1) {
entry_times[i] = time++;
}
/* Visit blocks immediately dominated by i. */
for (j = blocks[i].children; j >= 0; j = blocks[j].next_child) {
if (zend_worklist_push(&work, j)) {
dj_spanning_tree[j] = i;
goto next;
}
}
@@ -805,67 +785,72 @@ int zend_cfg_identify_loops(const zend_op_array *op_array, zend_cfg *cfg, uint32
} else if (blocks[succ].idom == i) {
continue;
} else if (zend_worklist_push(&work, succ)) {
dj_spanning_tree[succ] = i;
goto next;
}
}
exit_times[i] = time++;
zend_worklist_pop(&work);
}
/* Sort blocks by decreasing level, which is the order in which we want to process them */
sorted_blocks = do_alloca(sizeof(block_info) * cfg->blocks_count, sorted_blocks_use_heap);
for (i = 0; i < cfg->blocks_count; i++) {
sorted_blocks[i].id = i;
sorted_blocks[i].level = blocks[i].level;
}
zend_sort(sorted_blocks, cfg->blocks_count, sizeof(block_info),
(compare_func_t) compare_block_level, (swap_func_t) swap_blocks);
/* Identify loops. See Sreedhar et al, "Identifying Loops Using DJ
Graphs". */
for (n = 0; n < cfg->blocks_count; n++) {
i = sorted_blocks[n].id;
zend_bitset_clear(work.visited, zend_bitset_len(cfg->blocks_count));
for (j = 0; j < blocks[i].predecessors_count; j++) {
int pred = cfg->predecessors[blocks[i].predecessor_offset + j];
/* A join edge is one for which the predecessor does not
immediately dominate the successor. */
if (blocks[i].idom == pred) {
for (i = 0, depth = 0; i < cfg->blocks_count; i++) {
if (blocks[i].level > depth) {
depth = blocks[i].level;
}
}
for (; depth >= 0; depth--) {
for (i = 0; i < cfg->blocks_count; i++) {
if (blocks[i].level != depth) {
continue;
}
zend_bitset_clear(work.visited, zend_bitset_len(cfg->blocks_count));
for (j = 0; j < blocks[i].predecessors_count; j++) {
int pred = cfg->predecessors[blocks[i].predecessor_offset + j];
/* In a loop back-edge (back-join edge), the successor dominates
the predecessor. */
if (dominates(blocks, i, pred)) {
blocks[i].flags |= ZEND_BB_LOOP_HEADER;
flag &= ~ZEND_FUNC_NO_LOOPS;
zend_worklist_push(&work, pred);
} else {
/* Otherwise it's a cross-join edge. See if it's a branch
to an ancestor on the DJ spanning tree. */
if (entry_times[pred] > entry_times[i] && exit_times[pred] < exit_times[i]) {
blocks[i].flags |= ZEND_BB_IRREDUCIBLE_LOOP;
flag |= ZEND_FUNC_IRREDUCIBLE;
/* A join edge is one for which the predecessor does not
immediately dominate the successor. */
if (blocks[i].idom == pred) {
continue;
}
/* In a loop back-edge (back-join edge), the successor dominates
the predecessor. */
if (dominates(blocks, i, pred)) {
blocks[i].flags |= ZEND_BB_LOOP_HEADER;
flag &= ~ZEND_FUNC_NO_LOOPS;
zend_worklist_push(&work, pred);
} else {
/* Otherwise it's a cross-join edge. See if it's a branch
to an ancestor on the dominator spanning tree. */
int dj_parent = pred;
while (dj_parent >= 0) {
if (dj_parent == i) {
/* An sp-back edge: mark as irreducible. */
blocks[i].flags |= ZEND_BB_IRREDUCIBLE_LOOP;
flag |= ZEND_FUNC_IRREDUCIBLE;
flag &= ~ZEND_FUNC_NO_LOOPS;
break;
} else {
dj_parent = dj_spanning_tree[dj_parent];
}
}
}
}
}
while (zend_worklist_len(&work)) {
j = zend_worklist_pop(&work);
if (blocks[j].loop_header < 0 && j != i) {
blocks[j].loop_header = i;
for (k = 0; k < blocks[j].predecessors_count; k++) {
zend_worklist_push(&work, cfg->predecessors[blocks[j].predecessor_offset + k]);
while (zend_worklist_len(&work)) {
j = zend_worklist_pop(&work);
if (blocks[j].loop_header < 0 && j != i) {
blocks[j].loop_header = i;
for (k = 0; k < blocks[j].predecessors_count; k++) {
zend_worklist_push(&work, cfg->predecessors[blocks[j].predecessor_offset + k]);
}
}
}
}
}
free_alloca(sorted_blocks, sorted_blocks_use_heap);
free_alloca(entry_times, tree_use_heap);
free_alloca(dj_spanning_tree, tree_use_heap);
ZEND_WORKLIST_FREE_ALLOCA(&work, list_use_heap);
*flags |= flag;
+52 -49
View File
@@ -58,20 +58,6 @@
#define LOG_NEG_RANGE(...)
#endif
/* Pop elements in unspecified order from worklist until it is empty */
#define WHILE_WORKLIST(worklist, len, i) do { \
zend_bool _done = 0; \
while (!_done) { \
_done = 1; \
ZEND_BITSET_FOREACH(worklist, len, i) { \
zend_bitset_excl(worklist, i); \
_done = 0;
#define WHILE_WORKLIST_END() \
} ZEND_BITSET_FOREACH_END(); \
} \
} while (0)
#define CHECK_SCC_VAR(var2) \
do { \
if (!ssa->vars[var2].no_val) { \
@@ -283,7 +269,9 @@ int zend_ssa_find_false_dependencies(const zend_op_array *op_array, zend_ssa *ss
}
}
WHILE_WORKLIST(worklist, zend_bitset_len(ssa_vars_count), i) {
while (!zend_bitset_empty(worklist, zend_bitset_len(ssa_vars_count))) {
i = zend_bitset_first(worklist, zend_bitset_len(ssa_vars_count));
zend_bitset_excl(worklist, i);
if (ssa_vars[i].definition_phi) {
/* mark all possible sources as used */
p = ssa_vars[i].definition_phi;
@@ -301,7 +289,7 @@ int zend_ssa_find_false_dependencies(const zend_op_array *op_array, zend_ssa *ss
}
}
}
} WHILE_WORKLIST_END();
}
free_alloca(worklist, use_heap);
@@ -1369,24 +1357,21 @@ int zend_inference_calc_range(const zend_op_array *op_array, zend_ssa *ssa, int
case ZEND_DO_ICALL:
case ZEND_DO_UCALL:
case ZEND_DO_FCALL_BY_NAME:
if (ssa->ops[line].result_def == var) {
if (ssa->ops[line].result_def == var && ZEND_FUNC_INFO(op_array)) {
zend_func_info *func_info = ZEND_FUNC_INFO(op_array);
zend_call_info *call_info;
if (!func_info || !func_info->call_map) {
break;
}
zend_call_info *call_info = func_info->callee_info;
call_info = func_info->call_map[opline - op_array->opcodes];
if (!call_info) {
break;
while (call_info && call_info->caller_call_opline != opline) {
call_info = call_info->next_callee;
}
if (call_info->callee_func->type == ZEND_USER_FUNCTION) {
func_info = ZEND_FUNC_INFO(&call_info->callee_func->op_array);
if (func_info && func_info->return_info.has_range) {
*tmp = func_info->return_info.range;
return 1;
if (call_info) {
if (call_info->callee_func->type == ZEND_USER_FUNCTION) {
func_info = ZEND_FUNC_INFO(&call_info->callee_func->op_array);
if (func_info && func_info->return_info.has_range) {
*tmp = func_info->return_info.range;
return 1;
}
}
}
//TODO: we can't use type inference for internal functions at this point ???
#if 0
uint32_t type;
@@ -1409,6 +1394,7 @@ int zend_inference_calc_range(const zend_op_array *op_array, zend_ssa *ssa, int
return 1;
}
#endif
}
}
break;
// FIXME: support for more opcodes
@@ -1580,7 +1566,9 @@ static void zend_infer_ranges_warmup(const zend_op_array *op_array, zend_ssa *ss
memset(visited, 0, sizeof(zend_ulong) * worklist_len);
WHILE_WORKLIST(worklist, worklist_len, j) {
while (!zend_bitset_empty(worklist, worklist_len)) {
j = zend_bitset_first(worklist, worklist_len);
zend_bitset_excl(worklist, j);
if (zend_inference_calc_range(op_array, ssa, j, 0, 0, &tmp)) {
#ifdef NEG_RANGE
if (!has_inner_cycles &&
@@ -1635,7 +1623,7 @@ static void zend_infer_ranges_warmup(const zend_op_array *op_array, zend_ssa *ss
FOR_EACH_VAR_USAGE(j, ADD_SCC_VAR_1);
}
}
} WHILE_WORKLIST_END();
}
}
free_alloca(worklist, use_heap);
}
@@ -1652,11 +1640,11 @@ static int zend_infer_ranges(const zend_op_array *op_array, zend_ssa *ssa) /* {{
ALLOCA_FLAG(use_heap);
worklist = do_alloca(
ZEND_MM_ALIGNED_SIZE(sizeof(zend_ulong) * worklist_len) +
ZEND_MM_ALIGNED_SIZE(sizeof(int) * ssa->vars_count) +
sizeof(zend_ulong) * worklist_len +
sizeof(int) * ssa->vars_count +
sizeof(int) * ssa->sccs, use_heap);
next_scc_var = (int*)((char*)worklist + ZEND_MM_ALIGNED_SIZE(sizeof(zend_ulong) * worklist_len));
scc_var = (int*)((char*)next_scc_var + ZEND_MM_ALIGNED_SIZE(sizeof(int) * ssa->vars_count));
next_scc_var = (int*)(worklist + worklist_len);
scc_var = next_scc_var + ssa->vars_count;
LOG_SSA_RANGE("Range Inference\n");
@@ -1698,11 +1686,13 @@ static int zend_infer_ranges(const zend_op_array *op_array, zend_ssa *ssa) /* {{
#endif
/* widening */
WHILE_WORKLIST(worklist, worklist_len, j) {
while (!zend_bitset_empty(worklist, worklist_len)) {
j = zend_bitset_first(worklist, worklist_len);
zend_bitset_excl(worklist, j);
if (zend_ssa_range_widening(op_array, ssa, j, scc)) {
FOR_EACH_VAR_USAGE(j, ADD_SCC_VAR);
}
} WHILE_WORKLIST_END();
}
/* Add all SCC entry variables into worklist for narrowing */
for (j = scc_var[scc]; j >= 0; j = next_scc_var[j]) {
@@ -1713,7 +1703,9 @@ static int zend_infer_ranges(const zend_op_array *op_array, zend_ssa *ssa) /* {{
}
/* narrowing */
WHILE_WORKLIST(worklist, worklist_len, j) {
while (!zend_bitset_empty(worklist, worklist_len)) {
j = zend_bitset_first(worklist, worklist_len);
zend_bitset_excl(worklist, j);
if (zend_ssa_range_narrowing(op_array, ssa, j, scc)) {
FOR_EACH_VAR_USAGE(j, ADD_SCC_VAR);
#ifdef SYM_RANGE
@@ -1725,7 +1717,7 @@ static int zend_infer_ranges(const zend_op_array *op_array, zend_ssa *ssa) /* {{
}
#endif
}
} WHILE_WORKLIST_END();
}
}
}
@@ -3134,10 +3126,13 @@ static void zend_update_type_info(const zend_op_array *op_array,
zend_func_info *func_info = ZEND_FUNC_INFO(op_array);
zend_call_info *call_info;
if (!func_info || !func_info->call_map) {
if (!func_info) {
goto unknown_opcode;
}
call_info = func_info->call_map[opline - op_array->opcodes];
call_info = func_info->callee_info;
while (call_info && call_info->caller_call_opline != opline) {
call_info = call_info->next_callee;
}
if (!call_info) {
goto unknown_opcode;
}
@@ -3274,7 +3269,9 @@ int zend_infer_types_ex(const zend_op_array *op_array, const zend_script *script
int i, j;
uint32_t tmp;
WHILE_WORKLIST(worklist, zend_bitset_len(ssa_vars_count), j) {
while (!zend_bitset_empty(worklist, zend_bitset_len(ssa_vars_count))) {
j = zend_bitset_first(worklist, zend_bitset_len(ssa_vars_count));
zend_bitset_excl(worklist, j);
if (ssa_vars[j].definition_phi) {
zend_ssa_phi *p = ssa_vars[j].definition_phi;
if (p->pi >= 0) {
@@ -3331,7 +3328,7 @@ int zend_infer_types_ex(const zend_op_array *op_array, const zend_script *script
i = ssa_vars[j].definition;
zend_update_type_info(op_array, ssa, script, worklist, i);
}
} WHILE_WORKLIST_END();
}
return SUCCESS;
}
@@ -3557,14 +3554,18 @@ static int is_recursive_tail_call(const zend_op_array *op_array,
{
zend_func_info *info = ZEND_FUNC_INFO(op_array);
if (info->ssa.ops && info->ssa.vars && info->call_map &&
if (info->ssa.ops && info->ssa.vars &&
info->ssa.ops[opline - op_array->opcodes].op1_use >= 0 &&
info->ssa.vars[info->ssa.ops[opline - op_array->opcodes].op1_use].definition >= 0) {
zend_op *op = op_array->opcodes + info->ssa.vars[info->ssa.ops[opline - op_array->opcodes].op1_use].definition;
if (op->opcode == ZEND_DO_UCALL) {
zend_call_info *call_info = info->call_map[op - op_array->opcodes];
zend_call_info *call_info = info->callee_info;
while (call_info && call_info->caller_call_opline != op) {
call_info = call_info->next_callee;
}
if (call_info && op_array == &call_info->callee_func->op_array) {
return 1;
}
@@ -3886,7 +3887,7 @@ void zend_inference_check_recursive_dependencies(zend_op_array *op_array)
zend_func_info *info = ZEND_FUNC_INFO(op_array);
zend_call_info *call_info;
zend_bitset worklist;
int worklist_len, i;
int worklist_len;
ALLOCA_FLAG(use_heap);
if (!info->ssa.var_info || !(info->flags & ZEND_FUNC_RECURSIVE)) {
@@ -3903,12 +3904,14 @@ void zend_inference_check_recursive_dependencies(zend_op_array *op_array)
}
call_info = call_info->next_callee;
}
WHILE_WORKLIST(worklist, worklist_len, i) {
while (!zend_bitset_empty(worklist, worklist_len)) {
int i = zend_bitset_first(worklist, worklist_len);
zend_bitset_excl(worklist, i);
if (!info->ssa.var_info[i].recursive) {
info->ssa.var_info[i].recursive = 1;
add_usages(op_array, &info->ssa, worklist, i);
}
} WHILE_WORKLIST_END();
}
free_alloca(worklist, use_heap);
}
+7 -23
View File
@@ -451,27 +451,12 @@ int zend_optimizer_replace_by_const(zend_op_array *op_array,
break;
/* In most cases IS_TMP_VAR operand may be used only once.
* The operands are usually destroyed by the opcode handler.
* ZEND_CASE and ZEND_FETCH_LIST are exceptions, they keeps operand
* unchanged, and allows its reuse. these instructions
* ZEND_CASE is an exception, that keeps operand unchanged,
* and allows its reuse. The number of ZEND_CASE instructions
* usually terminated by ZEND_FREE that finally kills the value.
*/
case ZEND_FETCH_LIST: {
zend_op *m = opline;
do {
if (m->opcode == ZEND_FETCH_LIST &&
ZEND_OP1_TYPE(m) == type &&
ZEND_OP1(m).var == var) {
zend_optimizer_update_op1_const(op_array, m, val);
}
m++;
} while (m->opcode != ZEND_FREE || ZEND_OP1_TYPE(m) != type || ZEND_OP1(m).var != var);
ZEND_ASSERT(m->opcode == ZEND_FREE && ZEND_OP1_TYPE(m) == type && ZEND_OP1(m).var == var);
MAKE_NOP(m);
zend_optimizer_remove_live_range(op_array, var);
return 1;
}
case ZEND_CASE:
case ZEND_FREE: {
case ZEND_FREE:
case ZEND_CASE: {
zend_op *m, *n;
int brk = op_array->last_live_range;
zend_bool in_switch = 0;
@@ -978,10 +963,9 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
}
for (i = 0; i < call_graph.op_arrays_count; i++) {
func_info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
if (func_info) {
func_info->call_map = zend_build_call_map(&ctx.arena, func_info, call_graph.op_arrays[i]);
if (call_graph.op_arrays[i]->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
if (call_graph.op_arrays[i]->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
func_info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
if (func_info) {
zend_init_func_return_info(call_graph.op_arrays[i], script, &func_info->return_info);
}
}
+8 -8
View File
@@ -77,12 +77,12 @@ static zend_ssa_phi *add_pi(
}
phi = zend_arena_calloc(arena, 1,
ZEND_MM_ALIGNED_SIZE(sizeof(zend_ssa_phi)) +
ZEND_MM_ALIGNED_SIZE(sizeof(int) * ssa->cfg.blocks[to].predecessors_count) +
sizeof(zend_ssa_phi) +
sizeof(int) * ssa->cfg.blocks[to].predecessors_count +
sizeof(void*) * ssa->cfg.blocks[to].predecessors_count);
phi->sources = (int*)(((char*)phi) + ZEND_MM_ALIGNED_SIZE(sizeof(zend_ssa_phi)));
phi->sources = (int*)(((char*)phi) + sizeof(zend_ssa_phi));
memset(phi->sources, 0xff, sizeof(int) * ssa->cfg.blocks[to].predecessors_count);
phi->use_chains = (zend_ssa_phi**)(((char*)phi->sources) + ZEND_MM_ALIGNED_SIZE(sizeof(int) * ssa->cfg.blocks[to].predecessors_count));
phi->use_chains = (zend_ssa_phi**)(((char*)phi->sources) + sizeof(int) * ssa->cfg.blocks[to].predecessors_count);
phi->pi = from;
phi->var = var;
@@ -947,13 +947,13 @@ int zend_build_ssa(zend_arena **arena, const zend_script *script, const zend_op_
if (!zend_bitset_empty(phi + j * set_size, set_size)) {
ZEND_BITSET_REVERSE_FOREACH(phi + j * set_size, set_size, i) {
zend_ssa_phi *phi = zend_arena_calloc(arena, 1,
ZEND_MM_ALIGNED_SIZE(sizeof(zend_ssa_phi)) +
ZEND_MM_ALIGNED_SIZE(sizeof(int) * blocks[j].predecessors_count) +
sizeof(zend_ssa_phi) +
sizeof(int) * blocks[j].predecessors_count +
sizeof(void*) * blocks[j].predecessors_count);
phi->sources = (int*)(((char*)phi) + ZEND_MM_ALIGNED_SIZE(sizeof(zend_ssa_phi)));
phi->sources = (int*)(((char*)phi) + sizeof(zend_ssa_phi));
memset(phi->sources, 0xff, sizeof(int) * blocks[j].predecessors_count);
phi->use_chains = (zend_ssa_phi**)(((char*)phi->sources) + ZEND_MM_ALIGNED_SIZE(sizeof(int) * ssa->cfg.blocks[j].predecessors_count));
phi->use_chains = (zend_ssa_phi**)(((char*)phi->sources) + sizeof(int) * ssa->cfg.blocks[j].predecessors_count);
phi->pi = -1;
phi->var = i;
+2 -2
View File
@@ -77,10 +77,10 @@ typedef struct _zend_worklist {
} zend_worklist;
#define ZEND_WORKLIST_ALLOCA(w, _len, use_heap) do { \
(w)->stack.buf = (int*)do_alloca(ZEND_MM_ALIGNED_SIZE(sizeof(int) * _len) + sizeof(zend_ulong) * zend_bitset_len(_len), use_heap); \
(w)->stack.buf = (int*)do_alloca(sizeof(int) * _len + sizeof(zend_ulong) * zend_bitset_len(_len), use_heap); \
(w)->stack.len = 0; \
(w)->stack.capacity = _len; \
(w)->visited = (zend_bitset)((char*)(w)->stack.buf + ZEND_MM_ALIGNED_SIZE(sizeof(int) * _len)); \
(w)->visited = (zend_bitset)((w)->stack.buf + _len); \
memset((w)->visited, 0, sizeof(zend_ulong) * zend_bitset_len(_len)); \
} while (0)
-25
View File
@@ -1,25 +0,0 @@
--TEST--
Bug #74019 (Segfault with list)
--INI--
opcache.enable=1
opcache.enable_cli=1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
class A {
public function seg() {
list($a, $b) = A::CONSTS;
var_dump($a, $b);
return;
}
const CONSTS = [1, 2];
}
$a = new A;
$a->seg();
?>
--EXPECT--
int(1)
int(2)
-27
View File
@@ -1,27 +0,0 @@
--TEST--
Bug #74152 (if statement says true to a null variable)
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$foo = 'foo';
$bar = null;
switch ($foo) {
default:
case 'foo':
if ($bar) {
echo 'true';
} else {
echo 'false';
}
}
?>
--EXPECT--
false
-35
View File
@@ -359,25 +359,6 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
zend_file_cache_serialize_hash(ht, script, info, buf, zend_file_cache_serialize_zval);
}
if (op_array->scope && !IS_SERIALIZED(op_array->opcodes)) {
if (UNEXPECTED(zend_shared_alloc_get_xlat_entry(op_array->opcodes))) {
op_array->refcount = (uint32_t*)(intptr_t)-1;
SERIALIZE_PTR(op_array->literals);
SERIALIZE_PTR(op_array->opcodes);
SERIALIZE_PTR(op_array->arg_info);
SERIALIZE_PTR(op_array->vars);
SERIALIZE_STR(op_array->function_name);
SERIALIZE_STR(op_array->filename);
SERIALIZE_PTR(op_array->live_range);
SERIALIZE_PTR(op_array->scope);
SERIALIZE_STR(op_array->doc_comment);
SERIALIZE_PTR(op_array->try_catch_array);
SERIALIZE_PTR(op_array->prototype);
return;
}
zend_shared_alloc_register_xlat_entry(op_array->opcodes, op_array->opcodes);
}
if (op_array->literals && !IS_SERIALIZED(op_array->literals)) {
zval *p, *end;
@@ -956,22 +937,6 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
script, buf, zend_file_cache_unserialize_zval, ZVAL_PTR_DTOR);
}
if (op_array->refcount) {
op_array->refcount = NULL;
UNSERIALIZE_PTR(op_array->literals);
UNSERIALIZE_PTR(op_array->opcodes);
UNSERIALIZE_PTR(op_array->arg_info);
UNSERIALIZE_PTR(op_array->vars);
UNSERIALIZE_STR(op_array->function_name);
UNSERIALIZE_STR(op_array->filename);
UNSERIALIZE_PTR(op_array->live_range);
UNSERIALIZE_PTR(op_array->scope);
UNSERIALIZE_STR(op_array->doc_comment);
UNSERIALIZE_PTR(op_array->try_catch_array);
UNSERIALIZE_PTR(op_array->prototype);
return;
}
if (op_array->literals && !IS_UNSERIALIZED(op_array->literals)) {
zval *p, *end;
+41 -40
View File
@@ -2935,53 +2935,52 @@ PHP_FUNCTION(openssl_pkcs12_read)
zval_dtor(zout);
array_init(zout);
if (cert) {
bio_out = BIO_new(BIO_s_mem());
if (PEM_write_bio_X509(bio_out, cert)) {
BUF_MEM *bio_buf;
BIO_get_mem_ptr(bio_out, &bio_buf);
ZVAL_STRINGL(&zcert, bio_buf->data, bio_buf->length);
add_assoc_zval(zout, "cert", &zcert);
} else {
php_openssl_store_errors();
}
BIO_free(bio_out);
bio_out = BIO_new(BIO_s_mem());
if (PEM_write_bio_PrivateKey(bio_out, pkey, NULL, NULL, 0, 0, NULL)) {
BUF_MEM *bio_buf;
BIO_get_mem_ptr(bio_out, &bio_buf);
ZVAL_STRINGL(&zpkey, bio_buf->data, bio_buf->length);
add_assoc_zval(zout, "pkey", &zpkey);
} else {
php_openssl_store_errors();
}
BIO_free(bio_out);
array_init(&zextracerts);
for (i=0;;i++) {
zval zextracert;
X509* aCA = sk_X509_pop(ca);
if (!aCA) break;
bio_out = BIO_new(BIO_s_mem());
if (PEM_write_bio_X509(bio_out, cert)) {
if (PEM_write_bio_X509(bio_out, aCA)) {
BUF_MEM *bio_buf;
BIO_get_mem_ptr(bio_out, &bio_buf);
ZVAL_STRINGL(&zcert, bio_buf->data, bio_buf->length);
add_assoc_zval(zout, "cert", &zcert);
} else {
php_openssl_store_errors();
ZVAL_STRINGL(&zextracert, bio_buf->data, bio_buf->length);
add_index_zval(&zextracerts, i, &zextracert);
}
BIO_free(bio_out);
X509_free(aCA);
}
if (pkey) {
bio_out = BIO_new(BIO_s_mem());
if (PEM_write_bio_PrivateKey(bio_out, pkey, NULL, NULL, 0, 0, NULL)) {
BUF_MEM *bio_buf;
BIO_get_mem_ptr(bio_out, &bio_buf);
ZVAL_STRINGL(&zpkey, bio_buf->data, bio_buf->length);
add_assoc_zval(zout, "pkey", &zpkey);
} else {
php_openssl_store_errors();
}
BIO_free(bio_out);
}
if (ca && sk_X509_num(ca)) {
array_init(&zextracerts);
for (i = 0; i < sk_X509_num(ca); i++) {
zval zextracert;
X509* aCA = sk_X509_pop(ca);
if (!aCA) break;
bio_out = BIO_new(BIO_s_mem());
if (PEM_write_bio_X509(bio_out, aCA)) {
BUF_MEM *bio_buf;
BIO_get_mem_ptr(bio_out, &bio_buf);
ZVAL_STRINGL(&zextracert, bio_buf->data, bio_buf->length);
add_index_zval(&zextracerts, i, &zextracert);
}
X509_free(aCA);
}
if(ca) {
sk_X509_free(ca);
add_assoc_zval(zout, "extracerts", &zextracerts);
} else {
zval_dtor(&zextracerts);
}
RETVAL_TRUE;
@@ -6309,7 +6308,8 @@ static int php_openssl_cipher_update(const EVP_CIPHER *cipher_type,
*poutbuf = zend_string_alloc((int)data_len + EVP_CIPHER_block_size(cipher_type), 0);
if (!EVP_CipherUpdate(cipher_ctx, (unsigned char*)ZSTR_VAL(*poutbuf),
if ((!enc || data_len > 0) &&
!EVP_CipherUpdate(cipher_ctx, (unsigned char*)ZSTR_VAL(*poutbuf),
&i, (unsigned char *)data, (int)data_len)) {
/* we don't show warning when we fail but if we ever do, then it should look like this:
if (mode->is_single_run_aead && !enc) {
@@ -6365,6 +6365,7 @@ PHP_FUNCTION(openssl_encrypt)
php_error_docref(NULL, E_WARNING, "Failed to create cipher context");
RETURN_FALSE;
}
php_openssl_load_cipher_mode(&mode, cipher_type);
if (php_openssl_cipher_init(cipher_type, cipher_ctx, &mode,
+2 -3
View File
@@ -18,8 +18,7 @@ for ($z = "", $i = 0; $i < 1024; $i++) {
usleep($i);
}
$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf');
$privkey = openssl_pkey_new($conf);
$privkey = openssl_pkey_new();
if ($privkey === false)
die("failed to create private key");
@@ -31,7 +30,7 @@ if ($key_file_name === false)
echo "Export key to file\n";
openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf) or die("failed to export to file $key_file_name");
openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase) or die("failed to export to file $key_file_name");
echo "Load key from file - array syntax\n";
+1 -8
View File
@@ -4,19 +4,12 @@ Bug #65538: SSL context "cafile" disallows URL stream wrappers
<?php
if (!extension_loaded('openssl')) die('skip, openssl required');
if (getenv("SKIP_ONLINE_TESTS")) die("skip online test");
?>
--FILE--
<?php
$clientCtx = stream_context_create(['ssl' => [
// We don't get any ca list from php.net but it does not matter as we
// care about the fact that the external stream is not allowed.
// We can't use http://curl.haxx.se/ca/cacert.pem for this test
// as it is redirected to https which means the test would depend
// on system cafile when opening stream.
'cafile' => 'http://www.php.net',
'cafile' => 'http://curl.haxx.se/ca/cacert.pem'
]]);
file_get_contents('https://github.com', false, $clientCtx);
?>
--EXPECTF--
Warning: remote cafile streams are disabled for security purposes in %s on line %d
-68
View File
@@ -1,68 +0,0 @@
--TEST--
Bug #72333: fwrite() on non-blocking SSL sockets doesn't work
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$serverCode = <<<'CODE'
$context = stream_context_create(['ssl' => ['local_cert' => __DIR__ . '/bug54992.pem']]);
$flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
$fp = stream_socket_server("ssl://127.0.0.1:10011", $errornum, $errorstr, $flags, $context);
phpt_notify();
$conn = stream_socket_accept($fp);
$total = 100000;
$result = fread($conn, $total);
stream_set_blocking($conn, false);
usleep(50000);
$read = [$conn];
while (stream_select($read, $write, $except, 1)) {
$result = fread($conn, 100000);
if (!$result) {
break;
}
$total += strlen($result);
if ($total >= 4000000) {
break;
}
}
phpt_wait();
CODE;
$clientCode = <<<'CODE'
$context = stream_context_create(['ssl' => ['verify_peer' => false, 'peer_name' => 'bug54992.local']]);
phpt_wait();
$fp = stream_socket_client("ssl://127.0.0.1:10011", $errornum, $errorstr, 3000, STREAM_CLIENT_CONNECT, $context);
stream_set_blocking($fp, false);
function blocking_fwrite($fp, $buf) {
$write = [$fp];
$total = 0;
while (stream_select($read, $write, $except, 1)) {
$result = fwrite($fp, $buf);
if (!$result) {
break;
}
$total += $result;
if ($total >= strlen($buf)) {
return $total;
}
$buf = substr($buf, $total);
}
}
$str1 = str_repeat("a", 4000000);
blocking_fwrite($fp, $str1);
phpt_notify();
echo "done";
CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECT--
done
Binary file not shown.
-19
View File
@@ -1,19 +0,0 @@
--TEST--
Bug #74022 PHP Fast CGI crashes when reading from a pfx file with valid password
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
?>
--FILE--
<?php
$pfx = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug74022.pfx";
$cert_store = file_get_contents($pfx);
var_dump(openssl_pkcs12_read($cert_store, $cert_info, "csos"));
var_dump(openssl_error_string());
?>
===DONE===
--EXPECTF--
bool(true)
bool(false)
===DONE===
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #74099 Memory leak with openssl_encrypt()
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
?>
--FILE--
<?php
$aad = random_bytes(32);
$iv = random_bytes(16);
$key = random_bytes(32);
$plaintext = '';
$tag = null;
$ciphertext = openssl_encrypt($plaintext, 'aes-256-gcm', $key, \OPENSSL_RAW_DATA, $iv, $tag, $aad);
var_dump($ciphertext);
?>
--EXPECTF--
string(0) ""
-112
View File
@@ -1,112 +0,0 @@
--TEST--
Bug #74159: Writing a large buffer to non-blocking encrypted streams fails
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
if (OPENSSL_VERSION_NUMBER < 0x10001001) die("skip OpenSSLv1.0.1 required");
?>
--FILE--
<?php
// the server code is doing many readings in a short interval which is
// not really reliable on more powerful machine but cover different
// scenarios which might be useful. More reliable test is bug72333.phpt
$serverCode = <<<'CODE'
$serverUri = "ssl://127.0.0.1:10012";
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
$serverCtx = stream_context_create(['ssl' => [
'local_cert' => __DIR__ . '/bug54992.pem',
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER,
]]);
$server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
phpt_notify();
$client = stream_socket_accept($server, 1);
if (!$client) {
exit();
}
$data = '';
while (strlen($data) < 0xfffff) {
$buffer = fread($client, 8192);
if (empty($buffer)) {
exit();
}
$data .= $buffer;
usleep(100);
}
fclose($client);
CODE;
$clientCode = <<<'CODE'
function streamRead($stream) : int {
return strlen(fread($stream, 8192));
}
function streamWrite($stream, $data) : int {
return fwrite($stream, $data);
}
function waitForWrite(...$streams) : bool {
$read = null;
$except = null;
while($streams && !($n = stream_select($read, $streams, $except, 1)));
return $n > 0;
}
function waitForRead(...$streams) : bool {
$write = null;
$except = null;
while ($streams && !($n = stream_select($streams, $write, $except, 1)));
return $n > 0;
}
set_error_handler(function ($errno, $errstr) {
exit("$errstr\n");
});
$serverUri = "tcp://127.0.0.1:10012";
$clientFlags = STREAM_CLIENT_CONNECT;
$clientCtx = stream_context_create(['ssl' => [
'verify_peer' => true,
'cafile' => __DIR__ . '/bug54992-ca.pem',
'peer_name' => 'bug54992.local',
]]);
phpt_wait();
$fp = stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx);
stream_set_blocking($fp, false);
while (0 === ($n = stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)));
$data = str_repeat("a", 0xfffff);
$written = 0;
$total = $written;
while(!empty($data)) {
$written = streamWrite($fp, $data);
$total += $written;
$data = substr($data, $written);
waitForWrite($fp);
}
printf("Written %d bytes\n", $total);
while(waitForRead($fp)) {
streamRead($fp);
if (feof($fp)) {
break;
}
}
exit("DONE\n");
CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECTF--
Written 1048575 bytes
DONE
+2 -3
View File
@@ -22,8 +22,7 @@ for ($z = "", $i = 0; $i < 1024; $i++) {
usleep($i);
}
$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf');
$privkey = openssl_pkey_new($conf);
$privkey = openssl_pkey_new();
if ($privkey === false)
die("failed to create private key");
@@ -35,7 +34,7 @@ if ($key_file_name === false)
echo "Export key to file\n";
openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf) or die("failed to export to file $key_file_name");
openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase) or die("failed to export to file $key_file_name");
echo "Load key from file - array syntax\n";
+4 -11
View File
@@ -1635,7 +1635,10 @@ int php_openssl_setup_crypto(php_stream *stream,
}
#ifdef SSL_MODE_RELEASE_BUFFERS
SSL_set_mode(sslsock->ssl_handle, SSL_get_mode(sslsock->ssl_handle) | SSL_MODE_RELEASE_BUFFERS);
do {
long mode = SSL_get_mode(sslsock->ssl_handle);
SSL_set_mode(sslsock->ssl_handle, mode | SSL_MODE_RELEASE_BUFFERS);
} while (0);
#endif
if (cparam->inputs.session) {
@@ -1771,16 +1774,6 @@ static int php_openssl_enable_crypto(php_stream *stream,
if (SUCCESS == php_set_sock_blocking(sslsock->s.socket, 0)) {
sslsock->s.is_blocked = 0;
/* The following mode are added only if we are able to change socket
* to non blocking mode which is also used for read and write */
SSL_set_mode(
sslsock->ssl_handle,
(
SSL_get_mode(sslsock->ssl_handle) |
SSL_MODE_ENABLE_PARTIAL_WRITE |
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER
)
);
}
timeout = sslsock->is_client ? &sslsock->connect_timeout : &sslsock->s.timeout;
-12
View File
@@ -735,18 +735,6 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
}
}
#endif
#ifdef PDO_USE_MYSQLND
{
zend_long ssl_verify_cert = pdo_attr_lval(driver_options,
PDO_MYSQL_ATTR_SSL_VERIFY_SERVER_CERT, -1);
if (ssl_verify_cert != -1) {
connect_opts |= ssl_verify_cert ?
CLIENT_SSL_VERIFY_SERVER_CERT:
CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
}
}
#endif
}
#ifdef PDO_MYSQL_HAS_CHARSET
Loaded 100 of 158 files, more files were not shown because too many files have changed in this diff. Show more