mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-14 04:30:50 +00:00
Compare commits
79
Commits
php-7.0.16
...
php-7.0.17
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89a97812aa | ||
|
|
387ea8b983 | ||
|
|
b6616f7e9c | ||
|
|
e60263d269 | ||
|
|
511a4b0918 | ||
|
|
46a418f450 | ||
|
|
7ac1122ff5 | ||
|
|
c564924d31 | ||
|
|
008fb28eaf | ||
|
|
bbfa1b6419 | ||
|
|
eac8166bd4 | ||
|
|
9450e23b32 | ||
|
|
ff8a6b1232 | ||
|
|
cc10515056 | ||
|
|
e9873d9853 | ||
|
|
330a7b62c3 | ||
|
|
1d4eead995 | ||
|
|
015a80ef7b | ||
|
|
9eaf551c86 | ||
|
|
593a4d8fe9 | ||
|
|
bd7e5c1548 | ||
|
|
c836ad1c7e | ||
|
|
1623ef10c9 | ||
|
|
513582814b | ||
|
|
61e59db99d | ||
|
|
cf3ef36323 | ||
|
|
708973c9bd | ||
|
|
3b91ed112f | ||
|
|
5432d6f982 | ||
|
|
e79754dee3 | ||
|
|
89a5bd6750 | ||
|
|
3917350531 | ||
|
|
eb1373e509 | ||
|
|
f0519f4837 | ||
|
|
26fdebc63b | ||
|
|
01c1afa79f | ||
|
|
ee25eb0eae | ||
|
|
981c58705a | ||
|
|
7e5cf2aa19 | ||
|
|
9814be4bc2 | ||
|
|
db7c0badd4 | ||
|
|
185304a61e | ||
|
|
80c8d84af3 | ||
|
|
7a0adb4cd2 | ||
|
|
714d825b62 | ||
|
|
044dd30440 | ||
|
|
fd521a22f7 | ||
|
|
8a8aa67844 | ||
|
|
9ea0949f43 | ||
|
|
21d7878690 | ||
|
|
dcaf4da8a6 | ||
|
|
9ffc6ca62f | ||
|
|
6988d070ea | ||
|
|
4df993d89d | ||
|
|
75ad2b301a | ||
|
|
0b56ba51d0 | ||
|
|
25271feeb0 | ||
|
|
8faf5f979c | ||
|
|
dd9cf23457 | ||
|
|
acda2563ce | ||
|
|
a15bffd105 | ||
|
|
570a273807 | ||
|
|
6fc0ae638a | ||
|
|
1d7f8eb693 | ||
|
|
74c95fb3fb | ||
|
|
3446e3b749 | ||
|
|
69a2e4ece2 | ||
|
|
3f89b630b4 | ||
|
|
15e9aa1706 | ||
|
|
8dfa428ccd | ||
|
|
15404bda13 | ||
|
|
2cd0d8b711 | ||
|
|
ec43a11581 | ||
|
|
d9ca5d9637 | ||
|
|
0e21d8066b | ||
|
|
aa9742d80d | ||
|
|
163bb87897 | ||
|
|
5b5130c4ff | ||
|
|
536b3ca1e1 |
No files matched your search
+1
-1
@@ -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,6 +1,77 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2017 PHP 7.0.16
|
||||
16 Mar 2017 PHP 7.0.17
|
||||
|
||||
- Core:
|
||||
. 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 #74039 (is_infinite(-INF) returns false). (Christian Schmidt)
|
||||
. 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 #72719 (Relative datetime format ignores weekday on sundays
|
||||
only). (Derick)
|
||||
. Fixed bug #73294 (DateTime wrong when date string is negative). (Derick)
|
||||
. Fixed bug #73489 (wrong timestamp when call setTimeZone multi times with
|
||||
UTC offset). (xiami, Derick)
|
||||
. Fixed bug #73858 (first/last day of' flag is not being reset). (Derick)
|
||||
. Fixed bug #73942 ($date->modify('Friday this week') doesn't return a Friday
|
||||
if $date is a Sunday). (Derick)
|
||||
. Fixed bug #74057 (wrong day when using "this week" in strtotime). (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 #74152 (if statement says true to a null variable). (Laruence)
|
||||
. Fixed bug #74019 (Segfault with list). (Laruence)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #74022 (PHP Fast CGI crashes when reading from a pfx file).
|
||||
(Anatol)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #74148 (ReflectionFunction incorrectly reports the number of
|
||||
arguments). (Laruence)
|
||||
. Fixed bug #74005 (mail.add_x_header causes RFC-breaking lone line feed).
|
||||
(Anatol)
|
||||
. 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.0.16
|
||||
|
||||
- Core:
|
||||
. Fixed bug #73916 (zend_print_flat_zval_r doesn't consider reference).
|
||||
@@ -13,7 +84,6 @@ PHP NEWS
|
||||
- DOM:
|
||||
. Fixed bug #54382 (getAttributeNodeNS doesn't get xmlns* attributes).
|
||||
(aboks)
|
||||
. Fixed bug #50989 (support for LIBXML_NOXMLDECL). (jhdxr)
|
||||
|
||||
- DTrace:
|
||||
. Fixed bug #73965 (DTrace reported as enabled when disabled). (Remi)
|
||||
|
||||
+1
-1
@@ -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_FUNCS(finite isfinite isinf isnan)
|
||||
AC_CHECK_DECLS([isfinite, isnan, isinf], [], [], [[#include <math.h>]])
|
||||
|
||||
ZEND_FP_EXCEPT
|
||||
|
||||
|
||||
+8
-8
@@ -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_ISNAN 1
|
||||
#define HAVE_ISINF 1
|
||||
#define HAVE_ISFINITE 1
|
||||
#define HAVE_DECL_ISNAN 1
|
||||
#define HAVE_DECL_ISINF 1
|
||||
#define HAVE_DECL_ISFINITE 1
|
||||
#endif
|
||||
|
||||
#ifndef zend_isnan
|
||||
#ifdef HAVE_ISNAN
|
||||
#ifdef HAVE_DECL_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) 0
|
||||
#define zend_isnan(a) ((a) != (a))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ISINF
|
||||
#ifdef HAVE_DECL_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)?1:0)
|
||||
#define zend_isinf(a) (((a)==INFINITY || (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 defined(HAVE_ISFINITE) || defined(isfinite)
|
||||
#if defined(HAVE_DECL_ISFINITE)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(HAVE_FINITE)
|
||||
#define zend_finite(a) finite(a)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
--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
|
||||
@@ -0,0 +1,28 @@
|
||||
--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
|
||||
@@ -0,0 +1,19 @@
|
||||
--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
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
--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)
|
||||
@@ -567,6 +567,7 @@ 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;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -1146,6 +1146,8 @@ 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)
|
||||
@@ -1164,7 +1166,17 @@ 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 */
|
||||
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) {
|
||||
if (EXPECTED(zobj->handlers == &std_object_handlers)) {
|
||||
if (EXPECTED(!(GC_FLAGS(properties) & IS_ARRAY_IMMUTABLE))) {
|
||||
GC_REFCOUNT(properties)++;
|
||||
@@ -1190,7 +1202,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_hash_add_new(Z_ARRVAL_P(return_value), key, value);
|
||||
zend_symbtable_add_new(Z_ARRVAL_P(return_value), key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,8 +556,8 @@ static void _build_trace_args(zval *arg, smart_str *str) /* {{{ */
|
||||
break;
|
||||
case IS_DOUBLE: {
|
||||
double dval = Z_DVAL_P(arg);
|
||||
char *s_tmp = emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
|
||||
int l_tmp = zend_sprintf(s_tmp, "%.*G", (int) EG(precision), dval); /* SAFE */
|
||||
char *s_tmp;
|
||||
size_t l_tmp = zend_spprintf(&s_tmp, MAX_LENGTH_OF_DOUBLE + EG(precision) + 1, "%.*G", (int) EG(precision), dval); /* SAFE */
|
||||
smart_str_appendl(str, s_tmp, l_tmp);
|
||||
smart_str_appends(str, ", ");
|
||||
efree(s_tmp);
|
||||
|
||||
+71
-52
@@ -25,26 +25,12 @@
|
||||
/* 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
|
||||
@@ -53,9 +39,6 @@ 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, ...) \
|
||||
@@ -123,6 +106,12 @@ 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) {
|
||||
@@ -149,6 +138,8 @@ 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;
|
||||
@@ -204,6 +195,8 @@ 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)
|
||||
@@ -276,21 +269,42 @@ 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) {
|
||||
gc_root_buffer *root = additional_buffer->buf + (GC_ADDRESS(GC_INFO(ref)) - GC_ROOT_BUFFER_MAX_ENTRIES);
|
||||
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);
|
||||
|
||||
root = GC_G(buf) + GC_ADDRESS(GC_INFO(ref));
|
||||
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);
|
||||
}
|
||||
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) {
|
||||
@@ -641,7 +655,7 @@ static void gc_scan_roots(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void gc_add_garbage(zend_refcounted *ref, gc_additional_buffer **additional_buffer)
|
||||
static void gc_add_garbage(zend_refcounted *ref)
|
||||
{
|
||||
gc_root_buffer *buf = GC_G(unused);
|
||||
|
||||
@@ -664,25 +678,23 @@ static void gc_add_garbage(zend_refcounted *ref, gc_additional_buffer **addition
|
||||
#endif
|
||||
} else {
|
||||
/* If we don't have free slots in the buffer, allocate a new one and
|
||||
* set it's address to GC_ROOT_BUFFER_MAX_ENTRIES that have special
|
||||
* set it's address above GC_ROOT_BUFFER_MAX_ENTRIES that have special
|
||||
* meaning.
|
||||
*/
|
||||
if (!*additional_buffer || (*additional_buffer)->used == GC_NUM_ADDITIONAL_ENTRIES) {
|
||||
if (!GC_G(additional_buffer) || GC_G(additional_buffer)->used == GC_NUM_ADDITIONAL_ENTRIES) {
|
||||
gc_additional_buffer *new_buffer = emalloc(sizeof(gc_additional_buffer));
|
||||
new_buffer->used = 0;
|
||||
new_buffer->next = *additional_buffer;
|
||||
*additional_buffer = new_buffer;
|
||||
new_buffer->next = GC_G(additional_buffer);
|
||||
GC_G(additional_buffer) = new_buffer;
|
||||
}
|
||||
buf = (*additional_buffer)->buf + (*additional_buffer)->used;
|
||||
(*additional_buffer)->used++;
|
||||
buf = GC_G(additional_buffer)->buf + GC_G(additional_buffer)->used;
|
||||
#if 1
|
||||
/* optimization: color is already GC_BLACK (0) */
|
||||
GC_INFO(ref) = GC_ROOT_BUFFER_MAX_ENTRIES;
|
||||
GC_INFO(ref) = GC_ROOT_BUFFER_MAX_ENTRIES + GC_G(additional_buffer)->used;
|
||||
#else
|
||||
GC_REF_SET_ADDRESS(ref, GC_ROOT_BUFFER_MAX_ENTRIES);
|
||||
GC_REF_SET_ADDRESS(ref, GC_ROOT_BUFFER_MAX_ENTRIES) + GC_G(additional_buffer)->used;
|
||||
#endif
|
||||
/* modify type to prevent indirect destruction */
|
||||
GC_TYPE(ref) |= GC_FAKE_BUFFER_FLAG;
|
||||
GC_G(additional_buffer)->used++;
|
||||
}
|
||||
if (buf) {
|
||||
GC_REFCOUNT(ref)++;
|
||||
@@ -694,7 +706,7 @@ static void gc_add_garbage(zend_refcounted *ref, gc_additional_buffer **addition
|
||||
}
|
||||
}
|
||||
|
||||
static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_additional_buffer **additional_buffer)
|
||||
static int gc_collect_white(zend_refcounted *ref, uint32_t *flags)
|
||||
{
|
||||
int count = 0;
|
||||
HashTable *ht;
|
||||
@@ -727,7 +739,7 @@ tail_call:
|
||||
#else
|
||||
if (!GC_ADDRESS(GC_INFO(ref))) {
|
||||
#endif
|
||||
gc_add_garbage(ref, additional_buffer);
|
||||
gc_add_garbage(ref);
|
||||
}
|
||||
if (obj->handlers->dtor_obj &&
|
||||
((obj->handlers->dtor_obj != zend_objects_destroy_object) ||
|
||||
@@ -751,7 +763,7 @@ tail_call:
|
||||
if (Z_REFCOUNTED_P(zv)) {
|
||||
ref = Z_COUNTED_P(zv);
|
||||
GC_REFCOUNT(ref)++;
|
||||
count += gc_collect_white(ref, flags, additional_buffer);
|
||||
count += gc_collect_white(ref, flags);
|
||||
/* count non-refcounted for compatibility ??? */
|
||||
} else if (Z_TYPE_P(zv) != IS_UNDEF) {
|
||||
count++;
|
||||
@@ -773,7 +785,7 @@ tail_call:
|
||||
#else
|
||||
if (!GC_ADDRESS(GC_INFO(ref))) {
|
||||
#endif
|
||||
gc_add_garbage(ref, additional_buffer);
|
||||
gc_add_garbage(ref);
|
||||
}
|
||||
ht = (zend_array*)ref;
|
||||
} else if (GC_TYPE(ref) == IS_REFERENCE) {
|
||||
@@ -813,7 +825,7 @@ tail_call:
|
||||
if (Z_REFCOUNTED_P(zv)) {
|
||||
ref = Z_COUNTED_P(zv);
|
||||
GC_REFCOUNT(ref)++;
|
||||
count += gc_collect_white(ref, flags, additional_buffer);
|
||||
count += gc_collect_white(ref, flags);
|
||||
/* count non-refcounted for compatibility ??? */
|
||||
} else if (Z_TYPE_P(zv) != IS_UNDEF) {
|
||||
count++;
|
||||
@@ -831,7 +843,7 @@ tail_call:
|
||||
return count;
|
||||
}
|
||||
|
||||
static int gc_collect_roots(uint32_t *flags, gc_additional_buffer **additional_buffer)
|
||||
static int gc_collect_roots(uint32_t *flags)
|
||||
{
|
||||
int count = 0;
|
||||
gc_root_buffer *current = GC_G(roots).next;
|
||||
@@ -840,8 +852,12 @@ static int gc_collect_roots(uint32_t *flags, gc_additional_buffer **additional_b
|
||||
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;
|
||||
}
|
||||
@@ -850,7 +866,7 @@ static int gc_collect_roots(uint32_t *flags, gc_additional_buffer **additional_b
|
||||
while (current != &GC_G(roots)) {
|
||||
GC_REFCOUNT(current->ref)++;
|
||||
if (GC_REF_GET_COLOR(current->ref) == GC_WHITE) {
|
||||
count += gc_collect_white(current->ref, flags, additional_buffer);
|
||||
count += gc_collect_white(current->ref, flags);
|
||||
}
|
||||
current = current->next;
|
||||
}
|
||||
@@ -886,13 +902,16 @@ 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_ADDRESS(GC_INFO(ref)) != GC_ROOT_BUFFER_MAX_ENTRIES)) {
|
||||
GC_REF_GET_COLOR(ref) == GC_BLACK)) {
|
||||
GC_TRACE_REF(ref, "removing from buffer");
|
||||
GC_REFCOUNT(ref)--;
|
||||
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);
|
||||
@@ -986,7 +1005,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;
|
||||
gc_additional_buffer *additional_buffer_snapshot;
|
||||
#if ZEND_GC_DEBUG
|
||||
zend_bool orig_gc_full;
|
||||
#endif
|
||||
@@ -1010,8 +1029,8 @@ ZEND_API int zend_gc_collect_cycles(void)
|
||||
#endif
|
||||
|
||||
GC_TRACE("Collecting roots");
|
||||
additional_buffer = NULL;
|
||||
count = gc_collect_roots(&gc_flags, &additional_buffer);
|
||||
additional_buffer_snapshot = GC_G(additional_buffer);
|
||||
count = gc_collect_roots(&gc_flags);
|
||||
#if ZEND_GC_DEBUG
|
||||
GC_G(gc_full) = orig_gc_full;
|
||||
#endif
|
||||
@@ -1055,7 +1074,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) & GC_TYPE_MASK) == IS_OBJECT) {
|
||||
if (GC_TYPE(p) == IS_OBJECT) {
|
||||
zend_object *obj = (zend_object*)p;
|
||||
|
||||
if (IS_OBJ_VALID(EG(objects_store).object_buckets[obj->handle]) &&
|
||||
@@ -1092,7 +1111,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) & GC_TYPE_MASK) == IS_OBJECT) {
|
||||
if (GC_TYPE(p) == IS_OBJECT) {
|
||||
zend_object *obj = (zend_object*)p;
|
||||
|
||||
if (EG(objects_store).object_buckets &&
|
||||
@@ -1111,7 +1130,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) & GC_TYPE_MASK) == IS_ARRAY) {
|
||||
} else if (GC_TYPE(p) == IS_ARRAY) {
|
||||
zend_array *arr = (zend_array*)p;
|
||||
|
||||
GC_TYPE(arr) = IS_NULL;
|
||||
@@ -1133,10 +1152,10 @@ ZEND_API int zend_gc_collect_cycles(void)
|
||||
current = next;
|
||||
}
|
||||
|
||||
while (additional_buffer != NULL) {
|
||||
gc_additional_buffer *next = additional_buffer->next;
|
||||
efree(additional_buffer);
|
||||
additional_buffer = 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;
|
||||
}
|
||||
|
||||
GC_TRACE("Collection finished");
|
||||
|
||||
@@ -67,6 +67,17 @@ 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;
|
||||
@@ -93,6 +104,8 @@ typedef struct _zend_gc_globals {
|
||||
uint32_t zval_marked_grey;
|
||||
#endif
|
||||
|
||||
gc_additional_buffer *additional_buffer;
|
||||
|
||||
} zend_gc_globals;
|
||||
|
||||
#ifdef ZTS
|
||||
|
||||
@@ -310,6 +310,16 @@ 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)
|
||||
{
|
||||
|
||||
+48
-19
@@ -926,8 +926,13 @@ 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);
|
||||
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
if (EXPECTED(op1 != op2)) {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
op2 = op1;
|
||||
}
|
||||
converted = 1;
|
||||
} else {
|
||||
zend_throw_error(NULL, "Unsupported operand types");
|
||||
@@ -979,8 +984,13 @@ 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);
|
||||
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
if (EXPECTED(op1 != op2)) {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
op2 = op1;
|
||||
}
|
||||
converted = 1;
|
||||
} else {
|
||||
zend_throw_error(NULL, "Unsupported operand types");
|
||||
@@ -1026,8 +1036,13 @@ 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);
|
||||
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
if (EXPECTED(op1 != op2)) {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
op2 = op1;
|
||||
}
|
||||
converted = 1;
|
||||
} else {
|
||||
zend_throw_error(NULL, "Unsupported operand types");
|
||||
@@ -1104,17 +1119,27 @@ 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 (Z_TYPE_P(op1) == IS_ARRAY) {
|
||||
ZVAL_LONG(result, 0);
|
||||
return SUCCESS;
|
||||
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);
|
||||
}
|
||||
if (Z_TYPE_P(op2) == IS_ARRAY) {
|
||||
ZVAL_LONG(result, 1L);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
}
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
}
|
||||
if (Z_TYPE_P(op2) == IS_ARRAY) {
|
||||
ZVAL_LONG(result, 1L);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
if (Z_TYPE_P(op1) == IS_ARRAY) {
|
||||
ZVAL_LONG(result, 0);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
}
|
||||
op2 = op1;
|
||||
}
|
||||
converted = 1;
|
||||
} else {
|
||||
@@ -1178,9 +1203,13 @@ ZEND_API int ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* {
|
||||
op2 = Z_REFVAL_P(op2);
|
||||
} else if (!converted) {
|
||||
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_DIV, div_function);
|
||||
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
if (EXPECTED(op1 != op2)) {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
op2 = op1;
|
||||
}
|
||||
converted = 1;
|
||||
} else {
|
||||
zend_throw_error(NULL, "Unsupported operand types");
|
||||
|
||||
+13
-5
@@ -131,6 +131,12 @@
|
||||
|
||||
#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
|
||||
@@ -141,7 +147,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)
|
||||
# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__)
|
||||
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_DEEPBIND)
|
||||
# else
|
||||
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
|
||||
@@ -239,11 +245,13 @@ char *alloca();
|
||||
# define ZEND_FASTCALL
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004
|
||||
#else
|
||||
# define __restrict__
|
||||
#ifndef restrict
|
||||
# if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004
|
||||
# else
|
||||
# define __restrict__
|
||||
# endif
|
||||
# define restrict __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
|
||||
|
||||
+4
-3
@@ -912,9 +912,10 @@ static zend_always_inline uint32_t zval_delref_p(zval* pz) {
|
||||
|
||||
#define SEPARATE_STRING(zv) do { \
|
||||
zval *_zv = (zv); \
|
||||
if (Z_REFCOUNTED_P(_zv) && \
|
||||
Z_REFCOUNT_P(_zv) > 1) { \
|
||||
Z_DELREF_P(_zv); \
|
||||
if (Z_REFCOUNT_P(_zv) > 1) { \
|
||||
if (Z_REFCOUNTED_P(_zv)) { \
|
||||
Z_DELREF_P(_zv); \
|
||||
} \
|
||||
zval_copy_ctor_func(_zv); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@@ -899,12 +899,9 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
int bufindex = 0, isabsolute = 0;
|
||||
wchar_t * reparsetarget;
|
||||
BOOL isVolume = FALSE;
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
char printname[MAX_PATH];
|
||||
int printname_len;
|
||||
#endif
|
||||
char substitutename[MAX_PATH];
|
||||
int substitutename_len;
|
||||
int printname_len, substitutename_len;
|
||||
int substitutename_off = 0;
|
||||
|
||||
if(++(*ll) > LINK_MAX) {
|
||||
@@ -931,7 +928,6 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
|
||||
if(pbuffer->ReparseTag == IO_REPARSE_TAG_SYMLINK) {
|
||||
reparsetarget = pbuffer->SymbolicLinkReparseBuffer.ReparseTarget;
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
printname_len = pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR);
|
||||
isabsolute = (pbuffer->SymbolicLinkReparseBuffer.Flags == 0) ? 1 : 0;
|
||||
if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
|
||||
@@ -944,7 +940,6 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
};
|
||||
printname_len = pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR);
|
||||
printname[printname_len] = 0;
|
||||
#endif
|
||||
|
||||
substitutename_len = pbuffer->MountPointReparseBuffer.SubstituteNameLength / sizeof(WCHAR);
|
||||
if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
|
||||
@@ -960,7 +955,6 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
else if(pbuffer->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) {
|
||||
isabsolute = 1;
|
||||
reparsetarget = pbuffer->MountPointReparseBuffer.ReparseTarget;
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
printname_len = pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR);
|
||||
if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
|
||||
reparsetarget + pbuffer->MountPointReparseBuffer.PrintNameOffset / sizeof(WCHAR),
|
||||
@@ -971,7 +965,6 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
return -1;
|
||||
};
|
||||
printname[pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR)] = 0;
|
||||
#endif
|
||||
|
||||
substitutename_len = pbuffer->MountPointReparseBuffer.SubstituteNameLength / sizeof(WCHAR);
|
||||
if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
|
||||
|
||||
+4
-2
@@ -2337,13 +2337,15 @@ AC_DEFUN([PHP_SETUP_OPENSSL],[
|
||||
|
||||
dnl If pkg-config is found try using it
|
||||
if test "$PHP_OPENSSL_DIR" = "yes" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then
|
||||
if $PKG_CONFIG --atleast-version=0.9.8 openssl; then
|
||||
if $PKG_CONFIG --atleast-version=1.1 openssl; then
|
||||
AC_MSG_ERROR([OpenSSL version >= 1.1 is not supported.])
|
||||
elif $PKG_CONFIG --atleast-version=0.9.8 openssl; then
|
||||
found_openssl=yes
|
||||
OPENSSL_LIBS=`$PKG_CONFIG --libs openssl`
|
||||
OPENSSL_INCS=`$PKG_CONFIG --cflags-only-I openssl`
|
||||
OPENSSL_INCDIR=`$PKG_CONFIG --variable=includedir openssl`
|
||||
else
|
||||
AC_MSG_ERROR([OpenSSL version 0.9.8 or greater required.])
|
||||
AC_MSG_ERROR([OpenSSL version >= 0.9.8 and < 1.1 required.])
|
||||
fi
|
||||
|
||||
if test -n "$OPENSSL_LIBS"; then
|
||||
|
||||
+10
-10
@@ -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_ISNAN 1
|
||||
#define HAVE_ISINF 1
|
||||
#define HAVE_ISFINITE 1
|
||||
#define HAVE_DECL_ISNAN 1
|
||||
#define HAVE_DECL_ISINF 1
|
||||
#define HAVE_DECL_ISFINITE 1
|
||||
#endif
|
||||
|
||||
#ifndef zend_isnan
|
||||
#ifdef HAVE_ISNAN
|
||||
#ifdef HAVE_DECL_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) 0
|
||||
#define zend_isnan(a) ((a) != (a))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ISINF
|
||||
#ifdef HAVE_DECL_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)?1:0)
|
||||
#define zend_isinf(a) (((a)==INFINITY || (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 defined(HAVE_ISFINITE) || defined(isfinite)
|
||||
#if defined(HAVE_DECL_ISFINITE)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(HAVE_FINITE)
|
||||
#define zend_finite(a) finite(a)
|
||||
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=7
|
||||
PHP_MINOR_VERSION=0
|
||||
PHP_RELEASE_VERSION=16
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=17
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
@@ -154,7 +154,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 = -6;
|
||||
time->relative.weekday -= 7;
|
||||
}
|
||||
|
||||
/* To make "sunday this week" work, where the current DOW is not a
|
||||
@@ -354,7 +354,7 @@ static timelib_sll do_years(timelib_sll year)
|
||||
return res;
|
||||
}
|
||||
|
||||
static timelib_sll do_months(timelib_ull month, timelib_ull year)
|
||||
static timelib_sll do_months(timelib_ull month, timelib_sll year)
|
||||
{
|
||||
if (timelib_is_leap(year)) {
|
||||
return ((month_tab_leap[month - 1] + 1) * SECS_PER_DAY);
|
||||
@@ -463,7 +463,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 = 0;
|
||||
time->have_relative = time->relative.have_weekday_relative = time->relative.have_special_relative = time->relative.first_last_day_of = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -189,6 +189,7 @@ 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;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--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
|
||||
@@ -0,0 +1,22 @@
|
||||
--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==
|
||||
@@ -0,0 +1,24 @@
|
||||
--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)
|
||||
@@ -0,0 +1,63 @@
|
||||
--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)
|
||||
@@ -0,0 +1,12 @@
|
||||
--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
|
||||
@@ -0,0 +1,24 @@
|
||||
--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
|
||||
+33
-29
@@ -26,7 +26,6 @@
|
||||
#include "php.h"
|
||||
#if HAVE_LIBXML && HAVE_DOM
|
||||
#include "php_dom.h"
|
||||
#include <libxml/xmlsave.h>
|
||||
#include <libxml/SAX.h>
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#include <libxml/relaxng.h>
|
||||
@@ -1617,54 +1616,59 @@ PHP_FUNCTION(dom_document_savexml)
|
||||
dom_doc_propsptr doc_props;
|
||||
int size, format, saveempty = 0;
|
||||
zend_long options = 0;
|
||||
xmlSaveCtxtPtr xscp;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|O!l", &id, dom_document_class_entry, &nodep, dom_node_class_entry, &options) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
options = options | XML_SAVE_AS_XML;
|
||||
|
||||
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
|
||||
|
||||
doc_props = dom_get_doc_props(intern->document);
|
||||
format = doc_props->formatoutput;
|
||||
if (format) {
|
||||
options = options | XML_SAVE_FORMAT;
|
||||
}
|
||||
|
||||
buf = xmlBufferCreate();
|
||||
if (!buf) {
|
||||
php_error_docref(NULL, E_WARNING, "Could not fetch buffer");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
xscp = xmlSaveToBuffer(buf, docp->encoding, options);
|
||||
|
||||
if (nodep != NULL) {
|
||||
/* Dump contents of Node */
|
||||
DOM_GET_OBJ(node, nodep, xmlNodePtr, nodeobj);
|
||||
if (node->doc != docp) {
|
||||
php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(intern->document));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
buf = xmlBufferCreate();
|
||||
if (!buf) {
|
||||
php_error_docref(NULL, E_WARNING, "Could not fetch buffer");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (options & LIBXML_SAVE_NOEMPTYTAG) {
|
||||
saveempty = xmlSaveNoEmptyTags;
|
||||
xmlSaveNoEmptyTags = 1;
|
||||
}
|
||||
xmlNodeDump(buf, docp, node, 0, format);
|
||||
if (options & LIBXML_SAVE_NOEMPTYTAG) {
|
||||
xmlSaveNoEmptyTags = saveempty;
|
||||
}
|
||||
mem = (xmlChar*) xmlBufferContent(buf);
|
||||
if (!mem) {
|
||||
xmlBufferFree(buf);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if(xmlSaveTree(xscp, node) < 0) {
|
||||
xmlBufferFree(buf);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
if(xmlSaveDoc(xscp, docp) < 0) {
|
||||
xmlBufferFree(buf);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
xmlSaveClose(xscp);
|
||||
mem = (xmlChar*) xmlBufferContent(buf);
|
||||
if (!mem) {
|
||||
RETVAL_STRING((char *) mem);
|
||||
xmlBufferFree(buf);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
if (options & LIBXML_SAVE_NOEMPTYTAG) {
|
||||
saveempty = xmlSaveNoEmptyTags;
|
||||
xmlSaveNoEmptyTags = 1;
|
||||
}
|
||||
/* Encoding is handled from the encoding property set on the document */
|
||||
xmlDocDumpFormatMemory(docp, &mem, &size, format);
|
||||
if (options & LIBXML_SAVE_NOEMPTYTAG) {
|
||||
xmlSaveNoEmptyTags = saveempty;
|
||||
}
|
||||
if (!size || !mem) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETVAL_STRINGL((char *) mem, size);
|
||||
xmlFree(mem);
|
||||
}
|
||||
RETVAL_STRING((char *) mem);
|
||||
xmlBufferFree(buf);
|
||||
}
|
||||
/* }}} end dom_document_savexml */
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
DOM Document: saveXML with createElement and formatOutput
|
||||
--CREDITS--
|
||||
CHU Zhaowei <jhdxr@php.net>
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$dom = new domDocument('1.0', 'UTF-8');
|
||||
$dom->formatOutput = true;
|
||||
|
||||
$root = $dom->createElement('root');
|
||||
$dom->appendChild($root);
|
||||
|
||||
$child1 = $dom->createElement('testsuite');
|
||||
$root->appendChild($child1);
|
||||
|
||||
$child11 = $dom->createElement('testcase');
|
||||
$child11->setAttribute('name', 'leaf1');
|
||||
$child12 = $dom->createElement('testcase');
|
||||
$child12->setAttribute('name', 'leaf2');
|
||||
$child1->appendChild($child11);
|
||||
$child1->appendChild($child12);
|
||||
|
||||
echo $dom->saveXml();
|
||||
--EXPECT--
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<testsuite>
|
||||
<testcase name="leaf1"/>
|
||||
<testcase name="leaf2"/>
|
||||
</testsuite>
|
||||
</root>
|
||||
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
Bug #50989 add support LIBXML_NOXMLDECL for DOMDocument::saveXML()
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$dom = new DomDocument();
|
||||
$dom->loadXML("<foo />");
|
||||
|
||||
print $dom->saveXML(null,LIBXML_NOXMLDECL);
|
||||
--EXPECT--
|
||||
<foo/>
|
||||
@@ -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,20 +402,34 @@ if ($pid) {
|
||||
|
||||
}elseif (preg_match('/^PASV/', $buf, $matches)) {
|
||||
$pasv=true;
|
||||
$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");
|
||||
$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);
|
||||
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");
|
||||
|
||||
@@ -368,6 +368,8 @@ ZEND_END_ARG_INFO()
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_imagepng, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, im)
|
||||
ZEND_ARG_INFO(0, filename)
|
||||
ZEND_ARG_INFO(0, quality)
|
||||
ZEND_ARG_INFO(0, filters)
|
||||
ZEND_END_ARG_INFO()
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--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)
|
||||
@@ -227,14 +227,13 @@ static inline void Gost(PHP_GOST_CTX *context, php_hash_uint32 data[8])
|
||||
static inline void GostTransform(PHP_GOST_CTX *context, const unsigned char input[32])
|
||||
{
|
||||
int i, j;
|
||||
php_hash_uint32 data[8], temp = 0, save = 0;
|
||||
php_hash_uint32 data[8], temp = 0;
|
||||
|
||||
for (i = 0, j = 0; i < 8; ++i, j += 4) {
|
||||
data[i] = ((php_hash_uint32) input[j]) | (((php_hash_uint32) input[j + 1]) << 8) |
|
||||
(((php_hash_uint32) input[j + 2]) << 16) | (((php_hash_uint32) input[j + 3]) << 24);
|
||||
save = context->state[i + 8];
|
||||
context->state[i + 8] += data[i] + temp;
|
||||
temp = ((context->state[i + 8] < data[i]) || (context->state[i + 8] < save)) ? 1 : 0;
|
||||
temp = context->state[i + 8] < data[i] ? 1 : (context->state[i + 8] == data[i] ? temp : 0);
|
||||
}
|
||||
|
||||
Gost(context, data);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
--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
|
||||
@@ -0,0 +1,27 @@
|
||||
--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)
|
||||
@@ -0,0 +1,25 @@
|
||||
--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"
|
||||
@@ -1458,7 +1458,7 @@ php_mysqlnd_read_row_ex(MYSQLND_CONN_DATA * conn, MYSQLND_MEMORY_POOL * result_s
|
||||
zero-length byte, don't read the body, there is no such.
|
||||
*/
|
||||
|
||||
*data_size = prealloc_more_bytes;
|
||||
*data_size = 0;
|
||||
while (1) {
|
||||
if (FAIL == mysqlnd_read_header(conn->net, &header, conn->stats, conn->error_info)) {
|
||||
ret = FAIL;
|
||||
@@ -1469,7 +1469,8 @@ php_mysqlnd_read_row_ex(MYSQLND_CONN_DATA * conn, MYSQLND_MEMORY_POOL * result_s
|
||||
|
||||
if (first_iteration) {
|
||||
first_iteration = FALSE;
|
||||
*buffer = result_set_memory_pool->get_chunk(result_set_memory_pool, *data_size);
|
||||
*buffer = result_set_memory_pool->get_chunk(
|
||||
result_set_memory_pool, *data_size + prealloc_more_bytes);
|
||||
if (!*buffer) {
|
||||
ret = FAIL;
|
||||
break;
|
||||
@@ -1484,7 +1485,7 @@ php_mysqlnd_read_row_ex(MYSQLND_CONN_DATA * conn, MYSQLND_MEMORY_POOL * result_s
|
||||
/*
|
||||
We have to realloc the buffer.
|
||||
*/
|
||||
if (FAIL == (*buffer)->resize_chunk((*buffer), *data_size)) {
|
||||
if (FAIL == (*buffer)->resize_chunk((*buffer), *data_size + prealloc_more_bytes)) {
|
||||
SET_OOM_ERROR(*conn->error_info);
|
||||
ret = FAIL;
|
||||
break;
|
||||
@@ -1507,7 +1508,6 @@ php_mysqlnd_read_row_ex(MYSQLND_CONN_DATA * conn, MYSQLND_MEMORY_POOL * result_s
|
||||
(*buffer)->free_chunk((*buffer));
|
||||
*buffer = NULL;
|
||||
}
|
||||
*data_size -= prealloc_more_bytes;
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -561,6 +561,17 @@ static void zend_rebuild_access_path(zend_cfg *cfg, zend_op_array *op_array, int
|
||||
convert_to_string((v)); \
|
||||
}
|
||||
|
||||
static int is_predecessor_smart_branch(zend_op *start, zend_op *predecessor) {
|
||||
do {
|
||||
if (predecessor == start) {
|
||||
return 0;
|
||||
}
|
||||
predecessor--;
|
||||
} while (predecessor->opcode == ZEND_NOP);
|
||||
|
||||
return zend_is_smart_branch(predecessor);
|
||||
}
|
||||
|
||||
static void strip_nop(zend_code_block *block, zend_op_array *op_array, zend_optimizer_ctx *ctx)
|
||||
{
|
||||
zend_op *opline = block->start_opline;
|
||||
@@ -602,8 +613,7 @@ static void strip_nop(zend_code_block *block, zend_op_array *op_array, zend_opti
|
||||
&& ((opline + 1)->opcode == ZEND_JMPZ
|
||||
|| (opline + 1)->opcode == ZEND_JMPNZ)
|
||||
&& (opline + 1)->op1_type & (IS_CV|IS_CONST)
|
||||
&& opline > op_array->opcodes
|
||||
&& zend_is_smart_branch(opline - 1)) {
|
||||
&& is_predecessor_smart_branch(op_array->opcodes, opline)) {
|
||||
/* don't remove NOP, that splits incorrect smart branch */
|
||||
opline++;
|
||||
break;
|
||||
|
||||
@@ -406,12 +406,26 @@ 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 is an exception, that keeps operand unchanged,
|
||||
* and allows its reuse. The number of ZEND_CASE instructions
|
||||
* ZEND_CASE and ZEND_FETCH_LIST are exceptions, they keeps operand
|
||||
* unchanged, and allows its reuse. these instructions
|
||||
* usually terminated by ZEND_FREE that finally kills the value.
|
||||
*/
|
||||
case ZEND_FREE:
|
||||
case ZEND_CASE: {
|
||||
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);
|
||||
return 1;
|
||||
}
|
||||
case ZEND_CASE:
|
||||
case ZEND_FREE: {
|
||||
zend_op *m, *n;
|
||||
int brk = op_array->last_brk_cont;
|
||||
zend_bool in_switch = 0;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--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)
|
||||
@@ -0,0 +1,27 @@
|
||||
--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
|
||||
+46
-42
@@ -2638,56 +2638,60 @@ PHP_FUNCTION(openssl_pkcs12_read)
|
||||
zval_dtor(zout);
|
||||
array_init(zout);
|
||||
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
BIO_free(bio_out);
|
||||
|
||||
array_init(&zextracerts);
|
||||
|
||||
for (i=0;;i++) {
|
||||
zval zextracert;
|
||||
X509* aCA = sk_X509_pop(ca);
|
||||
if (!aCA) break;
|
||||
|
||||
/* fix for bug 69882 */
|
||||
{
|
||||
int err = ERR_peek_error();
|
||||
if (err == OPENSSL_ERROR_X509_PRIVATE_KEY_VALUES_MISMATCH) {
|
||||
ERR_get_error();
|
||||
}
|
||||
}
|
||||
|
||||
if (cert) {
|
||||
bio_out = BIO_new(BIO_s_mem());
|
||||
if (PEM_write_bio_X509(bio_out, aCA)) {
|
||||
if (PEM_write_bio_X509(bio_out, cert)) {
|
||||
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);
|
||||
|
||||
ZVAL_STRINGL(&zcert, bio_buf->data, bio_buf->length);
|
||||
add_assoc_zval(zout, "cert", &zcert);
|
||||
}
|
||||
BIO_free(bio_out);
|
||||
|
||||
X509_free(aCA);
|
||||
}
|
||||
if(ca) {
|
||||
|
||||
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);
|
||||
}
|
||||
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;
|
||||
|
||||
/* fix for bug 69882 */
|
||||
{
|
||||
int err = ERR_peek_error();
|
||||
if (err == OPENSSL_ERROR_X509_PRIVATE_KEY_VALUES_MISMATCH) {
|
||||
ERR_get_error();
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
BIO_free(bio_out);
|
||||
|
||||
X509_free(aCA);
|
||||
}
|
||||
|
||||
sk_X509_free(ca);
|
||||
add_assoc_zval(zout, "extracerts", &zextracerts);
|
||||
} else {
|
||||
zval_dtor(&zextracerts);
|
||||
}
|
||||
|
||||
RETVAL_TRUE;
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
--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===
|
||||
+12
-2
@@ -1174,7 +1174,7 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
|
||||
return ctx.sdl;
|
||||
}
|
||||
|
||||
#define WSDL_CACHE_VERSION 0x0e
|
||||
#define WSDL_CACHE_VERSION 0x0f
|
||||
|
||||
#define WSDL_CACHE_GET(ret,type,buf) memcpy(&ret,*buf,sizeof(type)); *buf += sizeof(type);
|
||||
#define WSDL_CACHE_GET_INT(ret,buf) ret = ((unsigned char)(*buf)[0])|((unsigned char)(*buf)[1]<<8)|((unsigned char)(*buf)[2]<<16)|((int)(*buf)[3]<<24); *buf += 4;
|
||||
@@ -3204,7 +3204,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
|
||||
PHP_MD5Update(&context, (unsigned char*)uri, uri_len);
|
||||
PHP_MD5Final(digest, &context);
|
||||
make_digest(md5str, digest);
|
||||
key = emalloc(len+sizeof("/wsdl-")-1+user_len+sizeof(md5str));
|
||||
key = emalloc(len+sizeof("/wsdl-")-1+user_len+2+sizeof(md5str));
|
||||
memcpy(key,SOAP_GLOBAL(cache_dir),len);
|
||||
memcpy(key+len,"/wsdl-",sizeof("/wsdl-")-1);
|
||||
len += sizeof("/wsdl-")-1;
|
||||
@@ -3213,6 +3213,16 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
|
||||
len += user_len-1;
|
||||
key[len++] = '-';
|
||||
}
|
||||
if (WSDL_CACHE_VERSION <= 0x9f) {
|
||||
key[len++] = (WSDL_CACHE_VERSION >> 8) + '0';
|
||||
} else {
|
||||
key[len++] = (WSDL_CACHE_VERSION >> 8) - 10 + 'a';
|
||||
}
|
||||
if ((WSDL_CACHE_VERSION & 0xf) <= 0x9) {
|
||||
key[len++] = (WSDL_CACHE_VERSION & 0xf) + '0';
|
||||
} else {
|
||||
key[len++] = (WSDL_CACHE_VERSION & 0xf) - 10 + 'a';
|
||||
}
|
||||
memcpy(key+len,md5str,sizeof(md5str));
|
||||
|
||||
if ((sdl = get_sdl_from_cache(key, uri, t-SOAP_GLOBAL(cache_ttl), &cached)) != NULL) {
|
||||
|
||||
+3
-3
@@ -378,14 +378,14 @@ static void autoload_func_info_dtor(zval *element)
|
||||
if (!Z_ISUNDEF(alfi->obj)) {
|
||||
zval_ptr_dtor(&alfi->obj);
|
||||
}
|
||||
if (!Z_ISUNDEF(alfi->closure)) {
|
||||
zval_ptr_dtor(&alfi->closure);
|
||||
}
|
||||
if (alfi->func_ptr &&
|
||||
UNEXPECTED(alfi->func_ptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
|
||||
zend_string_release(alfi->func_ptr->common.function_name);
|
||||
zend_free_trampoline(alfi->func_ptr);
|
||||
}
|
||||
if (!Z_ISUNDEF(alfi->closure)) {
|
||||
zval_ptr_dtor(&alfi->closure);
|
||||
}
|
||||
efree(alfi);
|
||||
}
|
||||
|
||||
|
||||
@@ -1193,6 +1193,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_fputcsv, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, fields) /* ARRAY_INFO(0, fields, 1) */
|
||||
ZEND_ARG_INFO(0, delimiter)
|
||||
ZEND_ARG_INFO(0, enclosure)
|
||||
ZEND_ARG_INFO(0, escape_char)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetcsv, 0, 0, 1)
|
||||
|
||||
@@ -349,7 +349,8 @@ dnl Check for available functions
|
||||
dnl
|
||||
dnl log2 could be used to improve the log function, however it requires C99. The check for log2 should be turned on,
|
||||
dnl as soon as we support C99.
|
||||
AC_CHECK_FUNCS(getcwd getwd asinh acosh atanh log1p hypot glob strfmon nice fpclass isinf isnan mempcpy strpncpy)
|
||||
AC_CHECK_FUNCS(getcwd getwd asinh acosh atanh log1p hypot glob strfmon nice fpclass mempcpy strpncpy)
|
||||
AC_CHECK_DECLS([isnan, isinf], [], [], [[#include <math.h>]])
|
||||
AC_FUNC_FNMATCH
|
||||
|
||||
dnl
|
||||
@@ -420,7 +421,7 @@ AC_TRY_RUN([
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_ISNAN
|
||||
#ifdef HAVE_DECL_ISNAN
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
@@ -451,11 +452,11 @@ AC_TRY_RUN([
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_ISINF
|
||||
#ifdef HAVE_DECL_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)?1:0)
|
||||
#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
|
||||
#else
|
||||
@@ -485,11 +486,11 @@ AC_TRY_RUN([
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_ISINF
|
||||
#ifdef HAVE_DECL_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)?1:0)
|
||||
#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
|
||||
#else
|
||||
@@ -520,7 +521,7 @@ AC_TRY_RUN([
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_ISNAN
|
||||
#ifdef HAVE_DECL_ISNAN
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
|
||||
+55
-51
@@ -93,14 +93,13 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw)
|
||||
}
|
||||
#elif HAVE_DECL_ARC4RANDOM_BUF && ((defined(__OpenBSD__) && OpenBSD >= 201405) || (defined(__NetBSD__) && __NetBSD_Version__ >= 700000001))
|
||||
arc4random_buf(bytes, size);
|
||||
#elif defined(__linux__) && defined(SYS_getrandom)
|
||||
/* Linux getrandom(2) syscall */
|
||||
#else
|
||||
size_t read_bytes = 0;
|
||||
size_t amount_to_read = 0;
|
||||
ssize_t n;
|
||||
|
||||
#if defined(__linux__) && defined(SYS_getrandom)
|
||||
/* Linux getrandom(2) syscall */
|
||||
/* Keep reading until we get enough entropy */
|
||||
do {
|
||||
while (read_bytes < size) {
|
||||
/* Below, (bytes + read_bytes) is pointer arithmetic.
|
||||
|
||||
bytes read_bytes size
|
||||
@@ -110,11 +109,17 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw)
|
||||
amount_to_read
|
||||
|
||||
*/
|
||||
amount_to_read = size - read_bytes;
|
||||
size_t amount_to_read = size - read_bytes;
|
||||
n = syscall(SYS_getrandom, bytes + read_bytes, amount_to_read, 0);
|
||||
|
||||
if (n == -1) {
|
||||
if (errno == EINTR || errno == EAGAIN) {
|
||||
if (errno == ENOSYS) {
|
||||
/* This can happen if PHP was compiled against a newer kernel where getrandom()
|
||||
* is available, but then runs on an older kernel without getrandom(). If this
|
||||
* happens we simply fall back to reading from /dev/urandom. */
|
||||
ZEND_ASSERT(read_bytes == 0);
|
||||
break;
|
||||
} else if (errno == EINTR || errno == EAGAIN) {
|
||||
/* Try again */
|
||||
continue;
|
||||
}
|
||||
@@ -130,53 +135,52 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw)
|
||||
}
|
||||
|
||||
read_bytes += (size_t) n;
|
||||
} while (read_bytes < size);
|
||||
#else
|
||||
int fd = RANDOM_G(fd);
|
||||
struct stat st;
|
||||
size_t read_bytes = 0;
|
||||
ssize_t n;
|
||||
|
||||
if (fd < 0) {
|
||||
#if HAVE_DEV_URANDOM
|
||||
fd = open("/dev/urandom", O_RDONLY);
|
||||
}
|
||||
#endif
|
||||
if (fd < 0) {
|
||||
if (should_throw) {
|
||||
zend_throw_exception(zend_ce_exception, "Cannot open source device", 0);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
/* Does the file exist and is it a character device? */
|
||||
if (fstat(fd, &st) != 0 ||
|
||||
# ifdef S_ISNAM
|
||||
!(S_ISNAM(st.st_mode) || S_ISCHR(st.st_mode))
|
||||
# else
|
||||
!S_ISCHR(st.st_mode)
|
||||
# endif
|
||||
) {
|
||||
close(fd);
|
||||
if (should_throw) {
|
||||
zend_throw_exception(zend_ce_exception, "Error reading from source device", 0);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
RANDOM_G(fd) = fd;
|
||||
}
|
||||
|
||||
while (read_bytes < size) {
|
||||
n = read(fd, bytes + read_bytes, size - read_bytes);
|
||||
if (n <= 0) {
|
||||
break;
|
||||
}
|
||||
read_bytes += n;
|
||||
}
|
||||
|
||||
if (read_bytes < size) {
|
||||
if (should_throw) {
|
||||
zend_throw_exception(zend_ce_exception, "Could not gather sufficient random data", 0);
|
||||
int fd = RANDOM_G(fd);
|
||||
struct stat st;
|
||||
|
||||
if (fd < 0) {
|
||||
#if HAVE_DEV_URANDOM
|
||||
fd = open("/dev/urandom", O_RDONLY);
|
||||
#endif
|
||||
if (fd < 0) {
|
||||
if (should_throw) {
|
||||
zend_throw_exception(zend_ce_exception, "Cannot open source device", 0);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
/* Does the file exist and is it a character device? */
|
||||
if (fstat(fd, &st) != 0 ||
|
||||
# ifdef S_ISNAM
|
||||
!(S_ISNAM(st.st_mode) || S_ISCHR(st.st_mode))
|
||||
# else
|
||||
!S_ISCHR(st.st_mode)
|
||||
# endif
|
||||
) {
|
||||
close(fd);
|
||||
if (should_throw) {
|
||||
zend_throw_exception(zend_ce_exception, "Error reading from source device", 0);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
RANDOM_G(fd) = fd;
|
||||
}
|
||||
|
||||
for (read_bytes = 0; read_bytes < size; read_bytes += (size_t) n) {
|
||||
n = read(fd, bytes + read_bytes, size - read_bytes);
|
||||
if (n <= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (read_bytes < size) {
|
||||
if (should_throw) {
|
||||
zend_throw_exception(zend_ce_exception, "Could not gather sufficient random data", 0);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Test is_callable() function : usage variations - anonymous class method
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
new class {
|
||||
function __construct() {
|
||||
$fname = null;
|
||||
if (is_callable([$this, 'f'], false, $fname)) {
|
||||
call_user_func($fname);
|
||||
} else {
|
||||
echo "dang\n";
|
||||
}
|
||||
}
|
||||
function f() {
|
||||
echo "nice\n";
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
nice
|
||||
@@ -1,5 +1,9 @@
|
||||
--TEST--
|
||||
Test is_callable() function : usage variations - undefined functions
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('json')) die("skip requires ext/json");
|
||||
?>
|
||||
--INI--
|
||||
precision=14
|
||||
error_reporting = E_ALL & ~E_NOTICE | E_STRICT
|
||||
@@ -21,10 +25,10 @@ function check_iscallable( $functions ) {
|
||||
var_dump( is_callable($func) ); //given only $var argument
|
||||
var_dump( is_callable($func, TRUE) ); //given $var and $syntax argument
|
||||
var_dump( is_callable($func, TRUE, $callable_name) );
|
||||
echo $callable_name, "\n";
|
||||
echo json_encode($callable_name) . "\n";
|
||||
var_dump( is_callable($func, FALSE) ); //given $var and $syntax argument
|
||||
var_dump( is_callable($func, FALSE, $callable_name) );
|
||||
echo $callable_name, "\n";
|
||||
echo json_encode($callable_name) . "\n";
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
@@ -65,144 +69,144 @@ check_iscallable($undef_functions);
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
""
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
""
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
""
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
""
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
" "
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
" "
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
" "
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
" "
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
12356
|
||||
"12356"
|
||||
bool(false)
|
||||
bool(false)
|
||||
12356
|
||||
"12356"
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
"\u0000"
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
"\u0000"
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
\0
|
||||
"\\0"
|
||||
bool(false)
|
||||
bool(false)
|
||||
\0
|
||||
"\\0"
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
hello world
|
||||
"hello world"
|
||||
bool(false)
|
||||
bool(false)
|
||||
hello world
|
||||
"hello world"
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
hello world
|
||||
"hello world"
|
||||
bool(false)
|
||||
bool(false)
|
||||
hello world
|
||||
"hello world"
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
welcome
|
||||
"welcome\u0000"
|
||||
bool(false)
|
||||
bool(false)
|
||||
welcome
|
||||
"welcome\u0000"
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
welcome\0
|
||||
"welcome\\0"
|
||||
bool(false)
|
||||
bool(false)
|
||||
welcome\0
|
||||
"welcome\\0"
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
==%%%***$$$@@@!!
|
||||
"==%%%***$$$@@@!!"
|
||||
bool(false)
|
||||
bool(false)
|
||||
==%%%***$$$@@@!!
|
||||
"==%%%***$$$@@@!!"
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
false
|
||||
"false"
|
||||
bool(false)
|
||||
bool(false)
|
||||
false
|
||||
"false"
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
8
|
||||
"8"
|
||||
bool(false)
|
||||
bool(false)
|
||||
8
|
||||
"8"
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
\t
|
||||
"\\t"
|
||||
bool(false)
|
||||
bool(false)
|
||||
\t
|
||||
"\\t"
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
\007
|
||||
"\\007"
|
||||
bool(false)
|
||||
bool(false)
|
||||
\007
|
||||
"\\007"
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
123
|
||||
"123"
|
||||
bool(false)
|
||||
bool(false)
|
||||
123
|
||||
"123"
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
echo()
|
||||
"echo()"
|
||||
bool(false)
|
||||
bool(false)
|
||||
echo()
|
||||
===DONE===
|
||||
"echo()"
|
||||
===DONE===
|
||||
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #74039: is_infinite(-INF) returns false
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(is_finite(INF));
|
||||
var_dump(is_infinite(INF));
|
||||
var_dump(is_nan(INF));
|
||||
|
||||
var_dump(is_finite(-INF));
|
||||
var_dump(is_infinite(-INF));
|
||||
var_dump(is_nan(-INF));
|
||||
|
||||
var_dump(is_finite(NAN));
|
||||
var_dump(is_infinite(NAN));
|
||||
var_dump(is_nan(NAN));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
@@ -14,5 +14,5 @@ $poc = 'O:8:"stdClass":1:{i:0;O:3:"obj":1:{s:4:"ryat";R:1;}}';
|
||||
var_dump(unserialize($poc));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(73588229205)
|
||||
--EXPECTF--
|
||||
%s(73588229205)
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #74090 stream_get_contents maxlength>-1 returns empty string on windows
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); }
|
||||
if (getenv("SKIP_SLOW_TESTS")) { die('skip: slow test'); }
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$data = base64_decode("1oIBAAABAAAAAAAAB2V4YW1wbGUDb3JnAAABAAE=");
|
||||
$fd = stream_socket_client("udp://8.8.8.8:53", $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);
|
||||
stream_set_blocking($fd, 0);
|
||||
stream_socket_sendto($fd,$data);
|
||||
sleep(1);
|
||||
$ret = stream_get_contents($fd,65565);
|
||||
var_dump(strlen($ret) > 0);
|
||||
stream_socket_shutdown($fd,STREAM_SHUT_RDWR);
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
==DONE==
|
||||
+1
-7
@@ -384,13 +384,7 @@ PHP_FUNCTION(is_callable)
|
||||
if (ZEND_NUM_ARGS() > 2) {
|
||||
retval = zend_is_callable_ex(var, NULL, check_flags, &name, NULL, &error);
|
||||
zval_dtor(callable_name);
|
||||
//??? is it necessary to be consistent with old PHP ("\0" support)
|
||||
if (UNEXPECTED(ZSTR_LEN(name)) != strlen(ZSTR_VAL(name))) {
|
||||
ZVAL_STRINGL(callable_name, ZSTR_VAL(name), strlen(ZSTR_VAL(name)));
|
||||
zend_string_release(name);
|
||||
} else {
|
||||
ZVAL_STR(callable_name, name);
|
||||
}
|
||||
ZVAL_STR(callable_name, name);
|
||||
} else {
|
||||
retval = zend_is_callable_ex(var, NULL, check_flags, NULL, NULL, &error);
|
||||
}
|
||||
|
||||
+180
-240
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.14.3 */
|
||||
/* Generated by re2c 0.16 */
|
||||
#line 1 "ext/standard/url_scanner_ex.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "php_ini.h"
|
||||
#include "php_globals.h"
|
||||
#include "php_string.h"
|
||||
#define STATE_TAG SOME_OTHER_STATE_TAG
|
||||
#include "basic_functions.h"
|
||||
#include "url.h"
|
||||
@@ -100,7 +101,7 @@ PHP_INI_BEGIN()
|
||||
STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=,fieldset=", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals)
|
||||
PHP_INI_END()
|
||||
|
||||
#line 107 "ext/standard/url_scanner_ex.re"
|
||||
#line 108 "ext/standard/url_scanner_ex.re"
|
||||
|
||||
|
||||
#define YYFILL(n) goto done
|
||||
@@ -119,7 +120,8 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
|
||||
* Don't modify "//example.com" full path, unless
|
||||
* HTTP_HOST matches.
|
||||
*/
|
||||
if (ZSTR_VAL(url->s)[0] == '/' && ZSTR_VAL(url->s)[1] == '/') {
|
||||
if (ZSTR_LEN(url->s) > 2 && ZSTR_VAL(url->s)[0] == '/' && ZSTR_VAL(url->s)[1] == '/') {
|
||||
const char *end_chars = "/\"'?>\r\n";
|
||||
zval *tmp = NULL, *http_host = NULL;
|
||||
size_t target_len, host_len;
|
||||
if ((!(tmp = zend_hash_str_find(&EG(symbol_table), ZEND_STRL("_SERVER"))))
|
||||
@@ -129,10 +131,13 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
|
||||
smart_str_append_smart_str(dest, url);
|
||||
return;
|
||||
}
|
||||
|
||||
/* HTTP_HOST could be "example.com:8888", etc. */
|
||||
/* Need to find end of URL in buffer */
|
||||
host_len = strcspn(Z_STRVAL_P(http_host), ":");
|
||||
target_len = strcspn(ZSTR_VAL(url->s)+2, "/\"'?>\r\n");
|
||||
target_len = php_strcspn(
|
||||
ZSTR_VAL(url->s) + 2, (char *) end_chars,
|
||||
ZSTR_VAL(url->s) + ZSTR_LEN(url->s), (char *) end_chars + strlen(end_chars));
|
||||
if (host_len
|
||||
&& host_len == target_len
|
||||
&& strncasecmp(Z_STRVAL_P(http_host), ZSTR_VAL(url->s)+2, host_len)) {
|
||||
@@ -145,7 +150,7 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
|
||||
|
||||
scan:
|
||||
|
||||
#line 149 "ext/standard/url_scanner_ex.c"
|
||||
#line 154 "ext/standard/url_scanner_ex.c"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const unsigned char yybm[] = {
|
||||
@@ -182,40 +187,41 @@ scan:
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
};
|
||||
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy8;
|
||||
goto yy2;
|
||||
}
|
||||
if (yych <= '#') goto yy6;
|
||||
if (yych >= ';') goto yy4;
|
||||
++YYCURSOR;
|
||||
#line 151 "ext/standard/url_scanner_ex.re"
|
||||
{ smart_str_append_smart_str(dest, url); return; }
|
||||
#line 197 "ext/standard/url_scanner_ex.c"
|
||||
yy4:
|
||||
++YYCURSOR;
|
||||
#line 152 "ext/standard/url_scanner_ex.re"
|
||||
{ sep = separator; goto scan; }
|
||||
#line 202 "ext/standard/url_scanner_ex.c"
|
||||
yy6:
|
||||
++YYCURSOR;
|
||||
#line 153 "ext/standard/url_scanner_ex.re"
|
||||
{ bash = p - 1; goto done; }
|
||||
#line 207 "ext/standard/url_scanner_ex.c"
|
||||
yy8:
|
||||
if (yych <= '#') goto yy5;
|
||||
if (yych <= ':') goto yy7;
|
||||
goto yy9;
|
||||
yy2:
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy8;
|
||||
goto yy2;
|
||||
}
|
||||
#line 154 "ext/standard/url_scanner_ex.re"
|
||||
#line 159 "ext/standard/url_scanner_ex.re"
|
||||
{ goto scan; }
|
||||
#line 217 "ext/standard/url_scanner_ex.c"
|
||||
#line 208 "ext/standard/url_scanner_ex.c"
|
||||
yy5:
|
||||
++YYCURSOR;
|
||||
#line 158 "ext/standard/url_scanner_ex.re"
|
||||
{ bash = p - 1; goto done; }
|
||||
#line 213 "ext/standard/url_scanner_ex.c"
|
||||
yy7:
|
||||
++YYCURSOR;
|
||||
#line 156 "ext/standard/url_scanner_ex.re"
|
||||
{ smart_str_append_smart_str(dest, url); return; }
|
||||
#line 218 "ext/standard/url_scanner_ex.c"
|
||||
yy9:
|
||||
++YYCURSOR;
|
||||
#line 157 "ext/standard/url_scanner_ex.re"
|
||||
{ sep = separator; goto scan; }
|
||||
#line 223 "ext/standard/url_scanner_ex.c"
|
||||
}
|
||||
#line 155 "ext/standard/url_scanner_ex.re"
|
||||
#line 160 "ext/standard/url_scanner_ex.re"
|
||||
|
||||
done:
|
||||
|
||||
@@ -400,7 +406,7 @@ state_plain_begin:
|
||||
state_plain:
|
||||
start = YYCURSOR;
|
||||
|
||||
#line 404 "ext/standard/url_scanner_ex.c"
|
||||
#line 410 "ext/standard/url_scanner_ex.c"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const unsigned char yybm[] = {
|
||||
@@ -440,30 +446,32 @@ state_plain:
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy15;
|
||||
goto yy13;
|
||||
}
|
||||
++YYCURSOR;
|
||||
#line 339 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; }
|
||||
#line 449 "ext/standard/url_scanner_ex.c"
|
||||
yy15:
|
||||
goto yy16;
|
||||
yy13:
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy15;
|
||||
goto yy13;
|
||||
}
|
||||
#line 340 "ext/standard/url_scanner_ex.re"
|
||||
#line 345 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); goto state_plain; }
|
||||
#line 459 "ext/standard/url_scanner_ex.c"
|
||||
#line 462 "ext/standard/url_scanner_ex.c"
|
||||
yy16:
|
||||
++YYCURSOR;
|
||||
#line 344 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; }
|
||||
#line 467 "ext/standard/url_scanner_ex.c"
|
||||
}
|
||||
#line 341 "ext/standard/url_scanner_ex.re"
|
||||
#line 346 "ext/standard/url_scanner_ex.re"
|
||||
|
||||
|
||||
state_tag:
|
||||
start = YYCURSOR;
|
||||
|
||||
#line 467 "ext/standard/url_scanner_ex.c"
|
||||
#line 475 "ext/standard/url_scanner_ex.c"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const unsigned char yybm[] = {
|
||||
@@ -500,39 +508,27 @@ state_tag:
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
if (yych <= '@') {
|
||||
if (yych != ':') goto yy22;
|
||||
} else {
|
||||
if (yych <= 'Z') goto yy20;
|
||||
if (yych <= '`') goto yy22;
|
||||
if (yych >= '{') goto yy22;
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy22;
|
||||
}
|
||||
yy20:
|
||||
++YYCURSOR;
|
||||
yych = *YYCURSOR;
|
||||
goto yy25;
|
||||
yy21:
|
||||
#line 346 "ext/standard/url_scanner_ex.re"
|
||||
{ handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; }
|
||||
#line 352 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); goto state_plain_begin; }
|
||||
#line 520 "ext/standard/url_scanner_ex.c"
|
||||
yy22:
|
||||
++YYCURSOR;
|
||||
#line 347 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); goto state_plain_begin; }
|
||||
#line 525 "ext/standard/url_scanner_ex.c"
|
||||
yy24:
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
yy25:
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy24;
|
||||
goto yy22;
|
||||
}
|
||||
goto yy21;
|
||||
#line 351 "ext/standard/url_scanner_ex.re"
|
||||
{ handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; }
|
||||
#line 530 "ext/standard/url_scanner_ex.c"
|
||||
}
|
||||
#line 348 "ext/standard/url_scanner_ex.re"
|
||||
#line 353 "ext/standard/url_scanner_ex.re"
|
||||
|
||||
|
||||
state_next_arg_begin:
|
||||
@@ -541,7 +537,7 @@ state_next_arg_begin:
|
||||
state_next_arg:
|
||||
start = YYCURSOR;
|
||||
|
||||
#line 545 "ext/standard/url_scanner_ex.c"
|
||||
#line 541 "ext/standard/url_scanner_ex.c"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const unsigned char yybm[] = {
|
||||
@@ -580,78 +576,57 @@ state_next_arg:
|
||||
};
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
yych = *YYCURSOR;
|
||||
if (yych <= '.') {
|
||||
if (yych <= '\f') {
|
||||
if (yych <= 0x08) goto yy36;
|
||||
if (yych <= '\v') goto yy32;
|
||||
goto yy36;
|
||||
} else {
|
||||
if (yych <= '\r') goto yy32;
|
||||
if (yych == ' ') goto yy32;
|
||||
goto yy36;
|
||||
}
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy29;
|
||||
}
|
||||
if (yych <= '>') {
|
||||
if (yych == '/') goto yy32;
|
||||
if (yych >= '>') goto yy33;
|
||||
} else {
|
||||
if (yych <= '@') {
|
||||
if (yych <= '/') goto yy28;
|
||||
if (yych == '>') goto yy30;
|
||||
goto yy36;
|
||||
if (yych <= 'Z') {
|
||||
if (yych >= 'A') goto yy35;
|
||||
} else {
|
||||
if (yych <= 'Z') goto yy34;
|
||||
if (yych <= '`') goto yy36;
|
||||
if (yych <= 'z') goto yy34;
|
||||
goto yy36;
|
||||
if (yych <= '`') goto yy27;
|
||||
if (yych <= 'z') goto yy35;
|
||||
}
|
||||
}
|
||||
yy27:
|
||||
++YYCURSOR;
|
||||
yy28:
|
||||
++YYCURSOR;
|
||||
if ((yych = *YYCURSOR) == '>') goto yy39;
|
||||
yy29:
|
||||
#line 359 "ext/standard/url_scanner_ex.re"
|
||||
#line 364 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); goto state_plain_begin; }
|
||||
#line 612 "ext/standard/url_scanner_ex.c"
|
||||
yy30:
|
||||
++YYCURSOR;
|
||||
yy31:
|
||||
#line 356 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
|
||||
#line 618 "ext/standard/url_scanner_ex.c"
|
||||
yy32:
|
||||
++YYCURSOR;
|
||||
yych = *YYCURSOR;
|
||||
goto yy38;
|
||||
yy33:
|
||||
#line 357 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); goto state_next_arg; }
|
||||
#line 626 "ext/standard/url_scanner_ex.c"
|
||||
yy34:
|
||||
++YYCURSOR;
|
||||
#line 358 "ext/standard/url_scanner_ex.re"
|
||||
{ --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
|
||||
#line 631 "ext/standard/url_scanner_ex.c"
|
||||
yy36:
|
||||
yych = *++YYCURSOR;
|
||||
goto yy29;
|
||||
yy37:
|
||||
#line 599 "ext/standard/url_scanner_ex.c"
|
||||
yy29:
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
yy38:
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy37;
|
||||
goto yy29;
|
||||
}
|
||||
goto yy33;
|
||||
yy39:
|
||||
#line 362 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); goto state_next_arg; }
|
||||
#line 609 "ext/standard/url_scanner_ex.c"
|
||||
yy32:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != '>') goto yy28;
|
||||
yy33:
|
||||
++YYCURSOR;
|
||||
yych = *YYCURSOR;
|
||||
goto yy31;
|
||||
#line 361 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
|
||||
#line 617 "ext/standard/url_scanner_ex.c"
|
||||
yy35:
|
||||
++YYCURSOR;
|
||||
#line 363 "ext/standard/url_scanner_ex.re"
|
||||
{ --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
|
||||
#line 622 "ext/standard/url_scanner_ex.c"
|
||||
}
|
||||
#line 360 "ext/standard/url_scanner_ex.re"
|
||||
#line 365 "ext/standard/url_scanner_ex.re"
|
||||
|
||||
|
||||
state_arg:
|
||||
start = YYCURSOR;
|
||||
|
||||
#line 655 "ext/standard/url_scanner_ex.c"
|
||||
#line 630 "ext/standard/url_scanner_ex.c"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const unsigned char yybm[] = {
|
||||
@@ -688,42 +663,35 @@ state_arg:
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
if (yych <= '@') goto yy44;
|
||||
if (yych <= 'Z') goto yy42;
|
||||
if (yych <= '`') goto yy44;
|
||||
if (yych >= '{') goto yy44;
|
||||
yy42:
|
||||
if (yych <= '@') goto yy39;
|
||||
if (yych <= 'Z') goto yy41;
|
||||
if (yych <= '`') goto yy39;
|
||||
if (yych <= 'z') goto yy41;
|
||||
yy39:
|
||||
++YYCURSOR;
|
||||
yych = *YYCURSOR;
|
||||
goto yy47;
|
||||
yy43:
|
||||
#line 365 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; }
|
||||
#line 705 "ext/standard/url_scanner_ex.c"
|
||||
yy44:
|
||||
++YYCURSOR;
|
||||
#line 366 "ext/standard/url_scanner_ex.re"
|
||||
#line 371 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; }
|
||||
#line 710 "ext/standard/url_scanner_ex.c"
|
||||
yy46:
|
||||
#line 677 "ext/standard/url_scanner_ex.c"
|
||||
yy41:
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
yy47:
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy46;
|
||||
goto yy41;
|
||||
}
|
||||
goto yy43;
|
||||
#line 370 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; }
|
||||
#line 687 "ext/standard/url_scanner_ex.c"
|
||||
}
|
||||
#line 367 "ext/standard/url_scanner_ex.re"
|
||||
#line 372 "ext/standard/url_scanner_ex.re"
|
||||
|
||||
|
||||
state_before_val:
|
||||
start = YYCURSOR;
|
||||
|
||||
#line 727 "ext/standard/url_scanner_ex.c"
|
||||
#line 695 "ext/standard/url_scanner_ex.c"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const unsigned char yybm[] = {
|
||||
@@ -762,54 +730,44 @@ state_before_val:
|
||||
};
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
yych = *YYCURSOR;
|
||||
if (yych == ' ') goto yy50;
|
||||
if (yych == '=') goto yy52;
|
||||
goto yy54;
|
||||
yy50:
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych == ' ') goto yy57;
|
||||
if (yych == '=') goto yy55;
|
||||
yy51:
|
||||
#line 373 "ext/standard/url_scanner_ex.re"
|
||||
if (yych == ' ') goto yy48;
|
||||
if (yych == '=') goto yy49;
|
||||
++YYCURSOR;
|
||||
yy47:
|
||||
#line 378 "ext/standard/url_scanner_ex.re"
|
||||
{ --YYCURSOR; goto state_next_arg_begin; }
|
||||
#line 776 "ext/standard/url_scanner_ex.c"
|
||||
#line 740 "ext/standard/url_scanner_ex.c"
|
||||
yy48:
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych == ' ') goto yy52;
|
||||
if (yych != '=') goto yy47;
|
||||
yy49:
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy49;
|
||||
}
|
||||
#line 377 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; }
|
||||
#line 754 "ext/standard/url_scanner_ex.c"
|
||||
yy52:
|
||||
++YYCURSOR;
|
||||
yych = *YYCURSOR;
|
||||
goto yy56;
|
||||
yy53:
|
||||
#line 372 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; }
|
||||
#line 784 "ext/standard/url_scanner_ex.c"
|
||||
yy54:
|
||||
yych = *++YYCURSOR;
|
||||
goto yy51;
|
||||
yy55:
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
yy56:
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy55;
|
||||
}
|
||||
goto yy53;
|
||||
yy57:
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
if (yych == ' ') goto yy57;
|
||||
if (yych == '=') goto yy55;
|
||||
if (yych == ' ') goto yy52;
|
||||
if (yych == '=') goto yy49;
|
||||
YYCURSOR = YYMARKER;
|
||||
goto yy51;
|
||||
goto yy47;
|
||||
}
|
||||
#line 374 "ext/standard/url_scanner_ex.re"
|
||||
#line 379 "ext/standard/url_scanner_ex.re"
|
||||
|
||||
|
||||
|
||||
state_val:
|
||||
start = YYCURSOR;
|
||||
|
||||
#line 813 "ext/standard/url_scanner_ex.c"
|
||||
#line 771 "ext/standard/url_scanner_ex.c"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const unsigned char yybm[] = {
|
||||
@@ -817,7 +775,7 @@ state_val:
|
||||
224, 192, 192, 224, 224, 192, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
192, 224, 64, 224, 224, 224, 224, 128,
|
||||
192, 224, 128, 224, 224, 224, 224, 64,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 0, 224,
|
||||
@@ -848,87 +806,69 @@ state_val:
|
||||
};
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
yych = *YYCURSOR;
|
||||
if (yych <= ' ') {
|
||||
if (yych <= '\f') {
|
||||
if (yych <= 0x08) goto yy65;
|
||||
if (yych <= '\n') goto yy67;
|
||||
goto yy65;
|
||||
} else {
|
||||
if (yych <= '\r') goto yy67;
|
||||
if (yych <= 0x1F) goto yy65;
|
||||
goto yy67;
|
||||
}
|
||||
} else {
|
||||
if (yych <= '&') {
|
||||
if (yych != '"') goto yy65;
|
||||
} else {
|
||||
if (yych <= '\'') goto yy64;
|
||||
if (yych == '>') goto yy67;
|
||||
goto yy65;
|
||||
}
|
||||
}
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych != '>') goto yy76;
|
||||
yy63:
|
||||
#line 383 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); goto state_next_arg_begin; }
|
||||
#line 876 "ext/standard/url_scanner_ex.c"
|
||||
yy64:
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych == '>') goto yy63;
|
||||
goto yy71;
|
||||
yy65:
|
||||
++YYCURSOR;
|
||||
yych = *YYCURSOR;
|
||||
goto yy69;
|
||||
yy66:
|
||||
#line 382 "ext/standard/url_scanner_ex.re"
|
||||
{ handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; }
|
||||
#line 888 "ext/standard/url_scanner_ex.c"
|
||||
yy67:
|
||||
yych = *++YYCURSOR;
|
||||
goto yy63;
|
||||
yy68:
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
yy69:
|
||||
if (yybm[0+yych] & 32) {
|
||||
goto yy68;
|
||||
goto yy57;
|
||||
}
|
||||
goto yy66;
|
||||
yy70:
|
||||
if (yych <= ' ') goto yy60;
|
||||
if (yych <= '"') goto yy62;
|
||||
if (yych <= '\'') goto yy63;
|
||||
goto yy60;
|
||||
yy57:
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
yy71:
|
||||
if (yybm[0+yych] & 32) {
|
||||
goto yy57;
|
||||
}
|
||||
#line 387 "ext/standard/url_scanner_ex.re"
|
||||
{ handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; }
|
||||
#line 826 "ext/standard/url_scanner_ex.c"
|
||||
yy60:
|
||||
++YYCURSOR;
|
||||
yy61:
|
||||
#line 388 "ext/standard/url_scanner_ex.re"
|
||||
{ passthru(STD_ARGS); goto state_next_arg_begin; }
|
||||
#line 832 "ext/standard/url_scanner_ex.c"
|
||||
yy62:
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych == '>') goto yy61;
|
||||
goto yy65;
|
||||
yy63:
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych == '>') goto yy61;
|
||||
goto yy70;
|
||||
yy64:
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
yy65:
|
||||
if (yybm[0+yych] & 64) {
|
||||
goto yy70;
|
||||
goto yy64;
|
||||
}
|
||||
if (yych <= '\'') goto yy73;
|
||||
yy72:
|
||||
if (yych <= '"') goto yy67;
|
||||
yy66:
|
||||
YYCURSOR = YYMARKER;
|
||||
goto yy63;
|
||||
yy73:
|
||||
goto yy61;
|
||||
yy67:
|
||||
++YYCURSOR;
|
||||
#line 381 "ext/standard/url_scanner_ex.re"
|
||||
{ handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
|
||||
#line 917 "ext/standard/url_scanner_ex.c"
|
||||
yy75:
|
||||
#line 385 "ext/standard/url_scanner_ex.re"
|
||||
{ handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
|
||||
#line 857 "ext/standard/url_scanner_ex.c"
|
||||
yy69:
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
yy76:
|
||||
yy70:
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy75;
|
||||
goto yy69;
|
||||
}
|
||||
if (yych >= '#') goto yy72;
|
||||
if (yych >= '(') goto yy66;
|
||||
++YYCURSOR;
|
||||
#line 380 "ext/standard/url_scanner_ex.re"
|
||||
{ handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
|
||||
#line 930 "ext/standard/url_scanner_ex.c"
|
||||
#line 386 "ext/standard/url_scanner_ex.re"
|
||||
{ handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
|
||||
#line 870 "ext/standard/url_scanner_ex.c"
|
||||
}
|
||||
#line 384 "ext/standard/url_scanner_ex.re"
|
||||
#line 389 "ext/standard/url_scanner_ex.re"
|
||||
|
||||
|
||||
stop:
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "php_ini.h"
|
||||
#include "php_globals.h"
|
||||
#include "php_string.h"
|
||||
#define STATE_TAG SOME_OTHER_STATE_TAG
|
||||
#include "basic_functions.h"
|
||||
#include "url.h"
|
||||
@@ -122,7 +123,8 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
|
||||
* Don't modify "//example.com" full path, unless
|
||||
* HTTP_HOST matches.
|
||||
*/
|
||||
if (ZSTR_VAL(url->s)[0] == '/' && ZSTR_VAL(url->s)[1] == '/') {
|
||||
if (ZSTR_LEN(url->s) > 2 && ZSTR_VAL(url->s)[0] == '/' && ZSTR_VAL(url->s)[1] == '/') {
|
||||
const char *end_chars = "/\"'?>\r\n";
|
||||
zval *tmp = NULL, *http_host = NULL;
|
||||
size_t target_len, host_len;
|
||||
if ((!(tmp = zend_hash_str_find(&EG(symbol_table), ZEND_STRL("_SERVER"))))
|
||||
@@ -132,10 +134,13 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
|
||||
smart_str_append_smart_str(dest, url);
|
||||
return;
|
||||
}
|
||||
|
||||
/* HTTP_HOST could be "example.com:8888", etc. */
|
||||
/* Need to find end of URL in buffer */
|
||||
host_len = strcspn(Z_STRVAL_P(http_host), ":");
|
||||
target_len = strcspn(ZSTR_VAL(url->s)+2, "/\"'?>\r\n");
|
||||
target_len = php_strcspn(
|
||||
ZSTR_VAL(url->s) + 2, (char *) end_chars,
|
||||
ZSTR_VAL(url->s) + ZSTR_LEN(url->s), (char *) end_chars + strlen(end_chars));
|
||||
if (host_len
|
||||
&& host_len == target_len
|
||||
&& strncasecmp(Z_STRVAL_P(http_host), ZSTR_VAL(url->s)+2, host_len)) {
|
||||
|
||||
@@ -25,5 +25,5 @@ var_dump($zip->close());
|
||||
@unlink(__DIR__ . '/bug70322.zip');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ZipArchive::close(): Read error: No such file or directory in %s%ebug70322.php on line %d
|
||||
Warning: ZipArchive::close(): %s: No such file or directory in %s%ebug70322.php on line %d
|
||||
bool(false)
|
||||
+6
-4
@@ -462,6 +462,11 @@ void fcgi_terminate(void)
|
||||
in_shutdown = 1;
|
||||
}
|
||||
|
||||
void fcgi_request_set_keep(fcgi_request *req, int new_value)
|
||||
{
|
||||
req->keep = new_value;
|
||||
}
|
||||
|
||||
#ifndef HAVE_ATTRIBUTE_WEAK
|
||||
void fcgi_set_logger(fcgi_logger lg) {
|
||||
fcgi_log = lg;
|
||||
@@ -1426,8 +1431,6 @@ int fcgi_accept_request(fcgi_request *req)
|
||||
struct pollfd fds;
|
||||
int ret;
|
||||
|
||||
req->hook.on_read();
|
||||
|
||||
fds.fd = req->fd;
|
||||
fds.events = POLLIN;
|
||||
fds.revents = 0;
|
||||
@@ -1440,8 +1443,6 @@ int fcgi_accept_request(fcgi_request *req)
|
||||
}
|
||||
fcgi_close(req, 1, 0);
|
||||
#else
|
||||
req->hook.on_read();
|
||||
|
||||
if (req->fd < FD_SETSIZE) {
|
||||
struct timeval tv = {5,0};
|
||||
fd_set set;
|
||||
@@ -1468,6 +1469,7 @@ int fcgi_accept_request(fcgi_request *req)
|
||||
} else if (in_shutdown) {
|
||||
return -1;
|
||||
}
|
||||
req->hook.on_read();
|
||||
if (fcgi_read_request(req)) {
|
||||
#ifdef _WIN32
|
||||
if (is_impersonate && !req->tcp) {
|
||||
|
||||
@@ -102,6 +102,7 @@ int fcgi_accept_request(fcgi_request *req);
|
||||
int fcgi_finish_request(fcgi_request *req, int force_close);
|
||||
const char *fcgi_get_last_client_ip();
|
||||
void fcgi_set_in_shutdown(int new_value);
|
||||
void fcgi_request_set_keep(fcgi_request *req, int new_value);
|
||||
|
||||
#ifndef HAVE_ATTRIBUTE_WEAK
|
||||
typedef void (*fcgi_logger)(int type, const char *fmt, ...);
|
||||
|
||||
@@ -239,11 +239,14 @@ typedef struct post_var_data {
|
||||
char *ptr;
|
||||
char *end;
|
||||
uint64_t cnt;
|
||||
|
||||
/* Bytes in ptr that have already been scanned for '&' */
|
||||
size_t already_scanned;
|
||||
} post_var_data_t;
|
||||
|
||||
static zend_bool add_post_var(zval *arr, post_var_data_t *var, zend_bool eof)
|
||||
{
|
||||
char *ksep, *vsep, *val;
|
||||
char *start, *ksep, *vsep, *val;
|
||||
size_t klen, vlen;
|
||||
size_t new_vlen;
|
||||
|
||||
@@ -251,9 +254,11 @@ static zend_bool add_post_var(zval *arr, post_var_data_t *var, zend_bool eof)
|
||||
return 0;
|
||||
}
|
||||
|
||||
vsep = memchr(var->ptr, '&', var->end - var->ptr);
|
||||
start = var->ptr + var->already_scanned;
|
||||
vsep = memchr(start, '&', var->end - start);
|
||||
if (!vsep) {
|
||||
if (!eof) {
|
||||
var->already_scanned = var->end - var->ptr;
|
||||
return 0;
|
||||
} else {
|
||||
vsep = var->end;
|
||||
@@ -286,6 +291,7 @@ static zend_bool add_post_var(zval *arr, post_var_data_t *var, zend_bool eof)
|
||||
efree(val);
|
||||
|
||||
var->ptr = vsep + (vsep != var->end);
|
||||
var->already_scanned = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -305,7 +311,7 @@ static inline int add_post_vars(zval *arr, post_var_data_t *vars, zend_bool eof)
|
||||
}
|
||||
}
|
||||
|
||||
if (!eof) {
|
||||
if (!eof && ZSTR_VAL(vars->str.s) != vars->ptr) {
|
||||
memmove(ZSTR_VAL(vars->str.s), vars->ptr, ZSTR_LEN(vars->str.s) = vars->end - vars->ptr);
|
||||
}
|
||||
return SUCCESS;
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
/* edit configure.in to change version number */
|
||||
#define PHP_MAJOR_VERSION 7
|
||||
#define PHP_MINOR_VERSION 0
|
||||
#define PHP_RELEASE_VERSION 16
|
||||
#define PHP_EXTRA_VERSION "-dev"
|
||||
#define PHP_VERSION "7.0.16-dev"
|
||||
#define PHP_VERSION_ID 70016
|
||||
#define PHP_RELEASE_VERSION 17
|
||||
#define PHP_EXTRA_VERSION ""
|
||||
#define PHP_VERSION "7.0.17"
|
||||
#define PHP_VERSION_ID 70017
|
||||
@@ -252,10 +252,10 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval
|
||||
HashTable *filter_hash = (FG(stream_filters) ? FG(stream_filters) : &stream_filters_hash);
|
||||
php_stream_filter_factory *factory = NULL;
|
||||
php_stream_filter *filter = NULL;
|
||||
int n;
|
||||
size_t n;
|
||||
char *period;
|
||||
|
||||
n = (int)strlen(filtername);
|
||||
n = strlen(filtername);
|
||||
|
||||
if (NULL != (factory = zend_hash_str_find_ptr(filter_hash, filtername, n))) {
|
||||
filter = factory->create_filter(filtername, filterparams, persistent);
|
||||
@@ -263,7 +263,7 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval
|
||||
/* try a wildcard */
|
||||
char *wildname;
|
||||
|
||||
wildname = emalloc(n+3);
|
||||
wildname = safe_emalloc(1, n, 3);
|
||||
memcpy(wildname, filtername, n+1);
|
||||
period = wildname + (period - filtername);
|
||||
while (period && !filter) {
|
||||
|
||||
@@ -53,6 +53,10 @@
|
||||
# undef EWOULDBLOCK
|
||||
# endif
|
||||
# define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
# ifdef EMSGSIZE
|
||||
# undef EMSGSIZE
|
||||
# endif
|
||||
# define EMSGSIZE WSAEMSGSIZE
|
||||
#endif
|
||||
|
||||
/* This functions transforms the first char to 'w' if it's not 'r', 'a' or 'w'
|
||||
|
||||
@@ -336,7 +336,7 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void
|
||||
ret = recv(sock->socket, &buf, sizeof(buf), MSG_PEEK);
|
||||
err = php_socket_errno();
|
||||
if (0 == ret || /* the counterpart did properly shutdown*/
|
||||
(0 > ret && err != EWOULDBLOCK && err != EAGAIN)) { /* there was an unrecoverable error */
|
||||
(0 > ret && err != EWOULDBLOCK && err != EAGAIN && err != EMSGSIZE)) { /* there was an unrecoverable error */
|
||||
alive = 0;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -873,7 +873,7 @@ HELP;
|
||||
|
||||
junit_save_xml();
|
||||
|
||||
if (getenv('REPORT_EXIT_STATUS') == 1 and $sum_results['FAILED']) {
|
||||
if (getenv('REPORT_EXIT_STATUS') == 1 && ($sum_results['FAILED'] || $sum_results['BORKED'])) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -1009,7 +1009,7 @@ save_or_mail_results();
|
||||
|
||||
junit_save_xml();
|
||||
|
||||
if (getenv('REPORT_EXIT_STATUS') == 1 and $sum_results['FAILED']) {
|
||||
if (getenv('REPORT_EXIT_STATUS') == 1 && ($sum_results['FAILED'] || $sum_results['BORKED'])) {
|
||||
exit(1);
|
||||
}
|
||||
exit(0);
|
||||
|
||||
@@ -73,6 +73,7 @@ typedef struct {
|
||||
zend_bool engine;
|
||||
zend_bool xbithack;
|
||||
zend_bool last_modified;
|
||||
zend_bool post_read_error;
|
||||
} php_apache2_info_struct;
|
||||
|
||||
extern zend_module_entry apache2_module_entry;
|
||||
|
||||
@@ -63,6 +63,33 @@
|
||||
#define PHP_SOURCE_MAGIC_TYPE "application/x-httpd-php-source"
|
||||
#define PHP_SCRIPT "php7-script"
|
||||
|
||||
/* if apache's version is newer than 2.2.31 or 2.4.16 */
|
||||
#if MODULE_MAGIC_COOKIE == 0x41503232UL && AP_MODULE_MAGIC_AT_LEAST(20051115,40) || \
|
||||
MODULE_MAGIC_COOKIE == 0x41503234UL && AP_MODULE_MAGIC_AT_LEAST(20120211,47)
|
||||
#define php_ap_map_http_request_error ap_map_http_request_error
|
||||
#else
|
||||
static int php_ap_map_http_request_error(apr_status_t rv, int status)
|
||||
{
|
||||
switch (rv) {
|
||||
case AP_FILTER_ERROR: {
|
||||
return AP_FILTER_ERROR;
|
||||
}
|
||||
case APR_ENOSPC: {
|
||||
return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
||||
}
|
||||
case APR_ENOTIMPL: {
|
||||
return HTTP_NOT_IMPLEMENTED;
|
||||
}
|
||||
case APR_ETIMEDOUT: {
|
||||
return HTTP_REQUEST_TIME_OUT;
|
||||
}
|
||||
default: {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* A way to specify the location of the php.ini dir in an apache directive */
|
||||
char *apache2_php_ini_path_override = NULL;
|
||||
#if defined(PHP_WIN32) && defined(ZTS)
|
||||
@@ -184,6 +211,7 @@ php_apache_sapi_read_post(char *buf, size_t count_bytes)
|
||||
php_struct *ctx = SG(server_context);
|
||||
request_rec *r;
|
||||
apr_bucket_brigade *brigade;
|
||||
apr_status_t ret;
|
||||
|
||||
r = ctx->r;
|
||||
brigade = ctx->brigade;
|
||||
@@ -195,7 +223,7 @@ php_apache_sapi_read_post(char *buf, size_t count_bytes)
|
||||
* need to make sure that if data is available we fill the buffer completely.
|
||||
*/
|
||||
|
||||
while (ap_get_brigade(r->input_filters, brigade, AP_MODE_READBYTES, APR_BLOCK_READ, len) == APR_SUCCESS) {
|
||||
while ((ret=ap_get_brigade(r->input_filters, brigade, AP_MODE_READBYTES, APR_BLOCK_READ, len)) == APR_SUCCESS) {
|
||||
apr_brigade_flatten(brigade, buf, &len);
|
||||
apr_brigade_cleanup(brigade);
|
||||
tlen += len;
|
||||
@@ -206,6 +234,15 @@ php_apache_sapi_read_post(char *buf, size_t count_bytes)
|
||||
len = count_bytes - tlen;
|
||||
}
|
||||
|
||||
if (ret != APR_SUCCESS) {
|
||||
AP2(post_read_error) = 1;
|
||||
if (APR_STATUS_IS_TIMEUP(ret)) {
|
||||
SG(sapi_headers).http_response_code = php_ap_map_http_request_error(ret, HTTP_REQUEST_TIME_OUT);
|
||||
} else {
|
||||
SG(sapi_headers).http_response_code = php_ap_map_http_request_error(ret, HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
return tlen;
|
||||
}
|
||||
|
||||
@@ -487,6 +524,7 @@ static int php_apache_request_ctor(request_rec *r, php_struct *ctx)
|
||||
SG(request_info).proto_num = r->proto_num;
|
||||
SG(request_info).request_uri = apr_pstrdup(r->pool, r->uri);
|
||||
SG(request_info).path_translated = apr_pstrdup(r->pool, r->filename);
|
||||
AP2(post_read_error) = 0;
|
||||
r->no_local_copy = 1;
|
||||
|
||||
content_length = (char *) apr_table_get(r->headers_in, "Content-Length");
|
||||
@@ -656,6 +694,13 @@ zend_first_try {
|
||||
brigade = ctx->brigade;
|
||||
}
|
||||
|
||||
if (AP2(post_read_error)) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "Error while attempting to read POST data: %d", SG(sapi_headers).http_response_code);
|
||||
apr_brigade_cleanup(brigade);
|
||||
PHPAP_INI_OFF;
|
||||
return SG(sapi_headers).http_response_code;
|
||||
}
|
||||
|
||||
if (AP2(last_modified)) {
|
||||
ap_update_mtime(r, r->finfo.mtime);
|
||||
ap_set_last_modified(r);
|
||||
|
||||
@@ -10,11 +10,15 @@ install-fpm: $(SAPI_FPM_PATH)
|
||||
@$(mkinstalldirs) $(INSTALL_ROOT)$(localstatedir)/run
|
||||
@$(INSTALL) -m 0755 $(SAPI_FPM_PATH) $(INSTALL_ROOT)$(sbindir)/$(program_prefix)php-fpm$(program_suffix)$(EXEEXT)
|
||||
|
||||
@echo "Installing PHP FPM config: $(INSTALL_ROOT)$(sysconfdir)/" && \
|
||||
$(mkinstalldirs) $(INSTALL_ROOT)$(sysconfdir)/php-fpm.d || :
|
||||
@$(INSTALL_DATA) sapi/fpm/php-fpm.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.conf.default || :
|
||||
@$(INSTALL_DATA) sapi/fpm/www.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.d/www.conf.default || :
|
||||
|
||||
@if test -f "$(INSTALL_ROOT)$(sysconfdir)/php-fpm.conf"; then \
|
||||
echo "Installing PHP FPM defconfig: skipping"; \
|
||||
else \
|
||||
echo "Installing PHP FPM defconfig: $(INSTALL_ROOT)$(sysconfdir)/" && \
|
||||
$(mkinstalldirs) $(INSTALL_ROOT)$(sysconfdir)/php-fpm.d; \
|
||||
$(INSTALL_DATA) sapi/fpm/php-fpm.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.conf.default; \
|
||||
$(INSTALL_DATA) sapi/fpm/www.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.d/www.conf.default; \
|
||||
fi
|
||||
|
||||
@echo "Installing PHP FPM man page: $(INSTALL_ROOT)$(mandir)/man8/"
|
||||
@$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man8
|
||||
@$(INSTALL_DATA) sapi/fpm/php-fpm.8 $(INSTALL_ROOT)$(mandir)/man8/php-fpm$(program_suffix).8
|
||||
|
||||
@@ -1996,7 +1996,8 @@ fastcgi_request_done:
|
||||
|
||||
requests++;
|
||||
if (UNEXPECTED(max_requests && (requests == max_requests))) {
|
||||
fcgi_finish_request(request, 1);
|
||||
fcgi_request_set_keep(request, 0);
|
||||
fcgi_finish_request(request, 0);
|
||||
break;
|
||||
}
|
||||
/* end of fastcgi loop */
|
||||
|
||||
@@ -14,7 +14,7 @@ set_time_limit($t);
|
||||
function f()
|
||||
{
|
||||
echo "call";
|
||||
busy_wait(4);
|
||||
busy_wait(5);
|
||||
}
|
||||
|
||||
register_shutdown_function("f");
|
||||
|
||||
@@ -14,7 +14,7 @@ set_time_limit($t);
|
||||
function f()
|
||||
{
|
||||
echo "call";
|
||||
busy_wait(4);
|
||||
busy_wait(5);
|
||||
}
|
||||
|
||||
register_shutdown_function("f");
|
||||
|
||||
+13
-4
@@ -29,6 +29,14 @@ MCFILE=$(BUILD_DIR)\wsyslog.rc
|
||||
BUILD_DIR_DEV_NAME=php-$(PHP_VERSION_STRING)-devel-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE)
|
||||
BUILD_DIR_DEV=$(BUILD_DIR)\$(BUILD_DIR_DEV_NAME)
|
||||
|
||||
!if "$(DEBUGGER)" == "1"
|
||||
DEBUGGER_CMD=devenv
|
||||
DEBUGGER_ARGS=/debugexe
|
||||
!else
|
||||
DEBUGGER_CMD=
|
||||
DEBUGGER_ARGS=
|
||||
!endif
|
||||
|
||||
all: generated_files $(EXT_TARGETS) $(PECL_TARGETS) $(SAPI_TARGETS)
|
||||
|
||||
build_dirs: $(BUILD_DIR) $(BUILD_DIRS_SUB) $(BUILD_DIR_DEV)
|
||||
@@ -151,18 +159,19 @@ clean-pgo: clean-all
|
||||
-del /f /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
|
||||
-del /f /q $(BUILD_DIR)\php-test-pack-$(PHP_VERSION_STRING).zip
|
||||
|
||||
|
||||
!if $(PHP_TEST_INI_PATH) == ""
|
||||
test: set-tmp-env
|
||||
"$(BUILD_DIR)\php.exe" -d open_basedir= -d output_buffering=0 run-tests.php $(TESTS) -p "$(BUILD_DIR)\php.exe"
|
||||
$(DEBUGGER_CMD) $(DEBUGGER_ARGS) "$(BUILD_DIR)\php.exe" -d open_basedir= -d output_buffering=0 run-tests.php $(TESTS) -p "$(BUILD_DIR)\php.exe"
|
||||
|
||||
run: set-tmp-env
|
||||
"$(BUILD_DIR)\php.exe" $(ARGS)
|
||||
$(DEBUGGER_CMD) $(DEBUGGER_ARGS) "$(BUILD_DIR)\php.exe" $(ARGS)
|
||||
!else
|
||||
test: set-tmp-env
|
||||
"$(BUILD_DIR)\php.exe" -n -c $(PHP_TEST_INI_PATH) -d open_basedir= -d output_buffering=0 -d memory_limit=-1 run-tests.php -p "$(BUILD_DIR)\php.exe" -n -c $(PHP_TEST_INI_PATH) $(TESTS)
|
||||
$(DEBUGGER_CMD) $(DEBUGGER_ARGS) "$(BUILD_DIR)\php.exe" -n -c $(PHP_TEST_INI_PATH) -d open_basedir= -d output_buffering=0 -d memory_limit=-1 run-tests.php -p "$(BUILD_DIR)\php.exe" -n -c $(PHP_TEST_INI_PATH) $(TESTS)
|
||||
|
||||
run: set-tmp-env
|
||||
"$(BUILD_DIR)\php.exe" -n -c $(PHP_TEST_INI_PATH) $(ARGS)
|
||||
$(DEBUGGER_CMD) $(DEBUGGER_ARGS) "$(BUILD_DIR)\php.exe" -n -c $(PHP_TEST_INI_PATH) $(ARGS)
|
||||
!endif
|
||||
|
||||
build-snap: set-tmp-env generated_files
|
||||
|
||||
+28
-13
@@ -49,6 +49,8 @@
|
||||
#include "ext/standard/php_string.h"
|
||||
#include "ext/date/php_date.h"
|
||||
|
||||
#define SENDMAIL_DEBUG 0
|
||||
|
||||
/*enum
|
||||
{
|
||||
DO_CONNECT = WM_USER +1
|
||||
@@ -171,7 +173,7 @@ static zend_string *php_win32_mail_trim_header(char *header)
|
||||
regex = zend_string_init(PHP_WIN32_MAIL_RMVDBL_PATTERN, sizeof(PHP_WIN32_MAIL_RMVDBL_PATTERN)-1, 0);
|
||||
|
||||
result2 = php_pcre_replace(regex,
|
||||
result, result->val, (int)result->len,
|
||||
result, ZSTR_VAL(result), (int)ZSTR_LEN(result),
|
||||
&replace,
|
||||
0,
|
||||
-1,
|
||||
@@ -206,7 +208,7 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
|
||||
{
|
||||
int ret;
|
||||
char *RPath = NULL;
|
||||
zend_string *headers_lc = NULL; /* headers_lc is only created if we've a header at all */
|
||||
zend_string *headers_lc = NULL, *headers_trim = NULL; /* headers_lc is only created if we've a header at all */
|
||||
char *pos1 = NULL, *pos2 = NULL;
|
||||
|
||||
if (host == NULL) {
|
||||
@@ -221,19 +223,16 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
|
||||
|
||||
if (headers) {
|
||||
char *pos = NULL;
|
||||
size_t i;
|
||||
|
||||
/* Use PCRE to trim the header into the right format */
|
||||
if (NULL == (headers_lc = php_win32_mail_trim_header(headers))) {
|
||||
if (NULL == (headers_trim = php_win32_mail_trim_header(headers))) {
|
||||
*error = W32_SM_PCRE_ERROR;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* Create a lowercased header for all the searches so we're finally case
|
||||
* insensitive when searching for a pattern. */
|
||||
for (i = 0; i < headers_lc->len; i++) {
|
||||
headers_lc->val[i] = tolower(headers_lc->val[i]);
|
||||
}
|
||||
headers_lc = zend_string_tolower(headers_trim);
|
||||
}
|
||||
|
||||
/* Fall back to sendmail_from php.ini setting */
|
||||
@@ -243,14 +242,14 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
|
||||
RPath = estrdup(INI_STR("sendmail_from"));
|
||||
} else if (headers_lc) {
|
||||
int found = 0;
|
||||
char *lookup = headers_lc->val;
|
||||
char *lookup = ZSTR_VAL(headers_lc);
|
||||
|
||||
while (lookup) {
|
||||
pos1 = strstr(lookup, "from:");
|
||||
|
||||
if (!pos1) {
|
||||
break;
|
||||
} else if (pos1 != headers_lc->val && *(pos1-1) != '\n') {
|
||||
} else if (pos1 != ZSTR_VAL(headers_lc) && *(pos1-1) != '\n') {
|
||||
if (strlen(pos1) >= sizeof("from:")) {
|
||||
lookup = pos1 + sizeof("from:");
|
||||
continue;
|
||||
@@ -290,6 +289,7 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
|
||||
efree(RPath);
|
||||
}
|
||||
if (headers) {
|
||||
zend_string_free(headers_trim);
|
||||
zend_string_free(headers_lc);
|
||||
}
|
||||
/* 128 is safe here, the specifier in snprintf isn't longer than that */
|
||||
@@ -302,12 +302,13 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
|
||||
PW32G(mail_host), !INI_INT("smtp_port") ? 25 : INI_INT("smtp_port"));
|
||||
return FAILURE;
|
||||
} else {
|
||||
ret = SendText(RPath, Subject, mailTo, mailCc, mailBcc, data, headers, headers_lc->val, error_message);
|
||||
ret = SendText(RPath, Subject, mailTo, mailCc, mailBcc, data, headers ? ZSTR_VAL(headers_trim) : NULL, headers ? ZSTR_VAL(headers_lc) : NULL, error_message);
|
||||
TSMClose();
|
||||
if (RPath) {
|
||||
efree(RPath);
|
||||
}
|
||||
if (headers) {
|
||||
zend_string_free(headers_trim);
|
||||
zend_string_free(headers_lc);
|
||||
}
|
||||
if (ret != SUCCESS) {
|
||||
@@ -633,8 +634,8 @@ static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char
|
||||
|
||||
/* send message contents in 1024 chunks */
|
||||
{
|
||||
char c, *e2, *e = data_cln->val + data_cln->len;
|
||||
p = data_cln->val;
|
||||
char c, *e2, *e = ZSTR_VAL(data_cln) + ZSTR_LEN(data_cln);
|
||||
p = ZSTR_VAL(data_cln);
|
||||
|
||||
while (e - p > 1024) {
|
||||
e2 = p + 1024;
|
||||
@@ -711,7 +712,7 @@ static int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders)
|
||||
time_t tNow = time(NULL);
|
||||
zend_string *dt = php_format_date("r", 1, tNow, 1);
|
||||
|
||||
snprintf(header_buffer, MAIL_BUFFER_SIZE, "Date: %s\r\n", dt->val);
|
||||
snprintf(header_buffer, MAIL_BUFFER_SIZE, "Date: %s\r\n", ZSTR_VAL(dt));
|
||||
zend_string_free(dt);
|
||||
}
|
||||
|
||||
@@ -780,6 +781,10 @@ static int MailConnect()
|
||||
#endif
|
||||
SOCKADDR_IN sock_in;
|
||||
|
||||
#if SENDMAIL_DEBUG
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
/* Create Socket */
|
||||
if ((PW32G(mail_socket) = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) {
|
||||
return (FAILED_TO_OBTAIN_SOCKET_HANDLE);
|
||||
@@ -866,6 +871,12 @@ static int Post(LPCSTR msg)
|
||||
int slen;
|
||||
int index = 0;
|
||||
|
||||
#if SENDMAIL_DEBUG
|
||||
if (msg)
|
||||
printf("POST: '%s'\n", msg);
|
||||
return (SUCCESS);
|
||||
#endif
|
||||
|
||||
while (len > 0) {
|
||||
if ((slen = send(PW32G(mail_socket), msg + index, len, 0)) < 1)
|
||||
return (FAILED_TO_SEND);
|
||||
@@ -894,6 +905,10 @@ static int Ack(char **server_response)
|
||||
int Index = 0;
|
||||
int Received = 0;
|
||||
|
||||
#if SENDMAIL_DEBUG
|
||||
return (SUCCESS);
|
||||
#endif
|
||||
|
||||
again:
|
||||
|
||||
if ((rlen = recv(PW32G(mail_socket), buf + Index, ((MAIL_BUFFER_SIZE) - 1) - Received, 0)) < 1) {
|
||||
|
||||
Reference in new issue
Block a user