Merge branch 'PHP-7.4'

This commit is contained in:
Nikita Popov 2019-09-14 00:25:39 +02:00
commit a86e04876b
5 changed files with 18 additions and 22 deletions

View File

@ -369,7 +369,7 @@ typedef struct _zend_property_info {
#define OBJ_PROP_NUM(obj, num) \
(&(obj)->properties_table[(num)])
#define OBJ_PROP_TO_OFFSET(num) \
((uint32_t)(zend_uintptr_t)OBJ_PROP_NUM(((zend_object*)NULL), num))
((uint32_t)(XtOffsetOf(zend_object, properties_table) + sizeof(zval) * (num)))
#define OBJ_PROP_TO_NUM(offset) \
((offset - OBJ_PROP_TO_OFFSET(0)) / sizeof(zval))

View File

@ -55,6 +55,7 @@
#endif
#include <stdarg.h>
#include <stddef.h>
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
@ -327,24 +328,19 @@ char *alloca();
#ifndef XtOffsetOf
# if defined(CRAY) || (defined(__ARMCC_VERSION) && !defined(LINUX))
# ifdef __STDC__
# define XtOffset(p_type, field) _Offsetof(p_type, field)
# else
# ifdef CRAY2
# define XtOffset(p_type, field) \
(sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
# else /* !CRAY2 */
# define XtOffset(p_type, field) ((unsigned int)&(((p_type)NULL)->field))
# endif /* !CRAY2 */
# endif /* __STDC__ */
# ifdef __STDC__
# define XtOffset(p_type, field) _Offsetof(p_type, field)
# else
# ifdef CRAY2
# define XtOffset(p_type, field) \
(sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
# else /* !CRAY2 */
# define XtOffset(p_type, field) ((unsigned int)&(((p_type)NULL)->field))
# endif /* !CRAY2 */
# endif /* __STDC__ */
# else /* ! (CRAY || __arm) */
# define XtOffset(p_type, field) \
((zend_long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
# define XtOffset(p_type, field) \
((zend_long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
# endif /* !CRAY */
# ifdef offsetof

View File

@ -449,9 +449,9 @@ static int php_read_APP(php_stream * stream, unsigned int marker, zval *info)
}
length -= 2; /* length includes itself */
buffer = emalloc(length);
buffer = emalloc((size_t)length);
if (php_stream_read(stream, buffer, (zend_long) length) != length) {
if (php_stream_read(stream, buffer, (size_t) length) != length) {
efree(buffer);
return 0;
}

View File

@ -656,7 +656,7 @@ static int php_url_scanner_ex_activate(int type)
ctx = &BG(url_adapt_output_ex);
}
memset(ctx, 0, ((size_t) &((url_adapt_state_ex_t *)0)->tags));
memset(ctx, 0, XtOffsetOf(url_adapt_state_ex_t, tags));
return SUCCESS;
}

View File

@ -272,7 +272,7 @@ static PHP_MSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */
{
/* deactivate symbol table caching to have these properly destroyed upon stack leaving (especially important for watchpoints) */
EG(symtable_cache_limit) = EG(symtable_cache) - 1;
EG(symtable_cache_limit) = EG(symtable_cache);
return SUCCESS;
} /* }}} */