Merge branch 'master' into zppFailOnOverflow

This commit is contained in:
Andrea Faulds 2014-11-08 18:28:43 +00:00
commit d22f3b18ea
33 changed files with 4052 additions and 2951 deletions

View File

@ -1211,7 +1211,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
for (i = 0; i < class_type->default_properties_count; i++) {
if (Z_TYPE(class_type->default_properties_table[i]) != IS_UNDEF) {
zval_update_class_constant(&class_type->default_properties_table[i], 0, i TSRMLS_CC);
zval_update_class_constant(&class_type->default_properties_table[i], 0, OBJ_PROP_TO_OFFSET(i) TSRMLS_CC);
}
}
@ -1255,8 +1255,9 @@ ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properti
if (property_info != ZEND_WRONG_PROPERTY_INFO &&
property_info &&
(property_info->flags & ZEND_ACC_STATIC) == 0) {
ZVAL_COPY_VALUE(&object->properties_table[property_info->offset], prop);
ZVAL_INDIRECT(prop, &object->properties_table[property_info->offset]);
zval *slot = OBJ_PROP(object, property_info->offset);
ZVAL_COPY_VALUE(slot, prop);
ZVAL_INDIRECT(prop, slot);
}
} ZEND_HASH_FOREACH_END();
}
@ -1274,11 +1275,12 @@ ZEND_API void object_properties_load(zend_object *object, HashTable *properties
if (property_info != ZEND_WRONG_PROPERTY_INFO &&
property_info &&
(property_info->flags & ZEND_ACC_STATIC) == 0) {
zval_ptr_dtor(&object->properties_table[property_info->offset]);
ZVAL_COPY_VALUE(&object->properties_table[property_info->offset], prop);
zval_add_ref(&object->properties_table[property_info->offset]);
zval *slot = OBJ_PROP(object, property_info->offset);
zval_ptr_dtor(slot);
ZVAL_COPY_VALUE(slot, prop);
zval_add_ref(slot);
if (object->properties) {
ZVAL_INDIRECT(&tmp, &object->properties_table[property_info->offset]);
ZVAL_INDIRECT(&tmp, slot);
zend_hash_update(object->properties, key, &tmp);
}
} else {
@ -3622,13 +3624,14 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z
if ((property_info_ptr = zend_hash_find_ptr(&ce->properties_info, name)) != NULL &&
(property_info_ptr->flags & ZEND_ACC_STATIC) == 0) {
property_info->offset = property_info_ptr->offset;
zval_ptr_dtor(&ce->default_properties_table[property_info->offset]);
zval_ptr_dtor(&ce->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)]);
zend_hash_del(&ce->properties_info, name);
} else {
property_info->offset = ce->default_properties_count++;
property_info->offset = OBJ_PROP_TO_OFFSET(ce->default_properties_count);
ce->default_properties_count++;
ce->default_properties_table = perealloc(ce->default_properties_table, sizeof(zval) * ce->default_properties_count, ce->type == ZEND_INTERNAL_CLASS);
}
ZVAL_COPY_VALUE(&ce->default_properties_table[property_info->offset], property);
ZVAL_COPY_VALUE(&ce->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)], property);
}
if (ce->type & ZEND_INTERNAL_CLASS) {
switch(Z_TYPE_P(property)) {

View File

@ -954,12 +954,10 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
continue;
}
prop = NULL;
if (prop_info->offset >= 0) {
if (statics && (prop_info->flags & ZEND_ACC_STATIC) != 0) {
prop = &ce->default_static_members_table[prop_info->offset];
} else if (!statics && (prop_info->flags & ZEND_ACC_STATIC) == 0) {
prop = &ce->default_properties_table[prop_info->offset];
}
if (statics && (prop_info->flags & ZEND_ACC_STATIC) != 0) {
prop = &ce->default_static_members_table[prop_info->offset];
} else if (!statics && (prop_info->flags & ZEND_ACC_STATIC) == 0) {
prop = &ce->default_properties_table[OBJ_PROP_TO_NUM(prop_info->offset)];
}
if (!prop || Z_TYPE_P(prop) == IS_UNDEF) {
continue;

View File

@ -227,13 +227,23 @@ typedef struct _zend_try_catch_element {
char *zend_visibility_string(uint32_t fn_flags);
typedef struct _zend_property_info {
uint32_t offset; /* property offset for object properties or
property index for static properties */
uint32_t flags;
int offset;
zend_string *name;
zend_string *doc_comment;
zend_class_entry *ce;
} zend_property_info;
#define OBJ_PROP(obj, offset) \
((zval*)((char*)(obj) + offset))
#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))
#define OBJ_PROP_TO_NUM(offset) \
((offset - OBJ_PROP_TO_OFFSET(0)) / sizeof(zval))
typedef struct _zend_arg_info {
const char *name; // TODO: convert into zend_string ???
uint32_t name_len;

View File

@ -47,7 +47,9 @@ typedef unsigned int uint;
#define HAVE_CLASS_ISTDIOSTREAM
#define istdiostream stdiostream
#if _MSC_VER < 1900
#define snprintf _snprintf
#endif
#if _MSC_VER < 1500
#define vsnprintf _vsnprintf
#endif

View File

@ -1292,7 +1292,7 @@ ZEND_API void zend_fetch_dimension_by_zval(zval *result, zval *container, zval *
zend_fetch_dimension_address_read_R(result, container, dim, IS_TMP_VAR TSRMLS_CC);
}
static zend_always_inline void zend_fetch_property_address(zval *result, zval *container, uint32_t container_op_type, zval *prop_ptr, void **cache_slot, int type TSRMLS_DC)
static zend_always_inline void zend_fetch_property_address(zval *result, zval *container, uint32_t container_op_type, zval *prop_ptr, uint32_t prop_op_type, void **cache_slot, int type TSRMLS_DC)
{
if (container_op_type != IS_UNUSED) {
ZVAL_DEREF(container);
@ -1316,6 +1316,26 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
}
}
}
if (prop_op_type == IS_CONST &&
EXPECTED(Z_OBJCE_P(container) == CACHED_PTR_EX(cache_slot))) {
zend_property_info *prop_info = CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(container);
zval *retval;
if (EXPECTED(prop_info)) {
retval = OBJ_PROP(zobj, prop_info->offset);
if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
ZVAL_INDIRECT(result, retval);
return;
}
} else if (EXPECTED(zobj->properties != NULL)) {
retval = zend_hash_find(zobj->properties, Z_STR_P(prop_ptr));
if (EXPECTED(retval)) {
ZVAL_INDIRECT(result, retval);
return;
}
}
}
if (EXPECTED(Z_OBJ_HT_P(container)->get_property_ptr_ptr)) {
zval *ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, cache_slot TSRMLS_CC);
if (NULL == ptr) {

View File

@ -100,7 +100,7 @@ static const uint32_t uninitialized_bucket = {INVALID_IDX};
ZEND_API void _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
{
/* Use big enough power of 2 */
#ifdef PHP_WIN32
#if defined(PHP_WIN32) && !defined(__clang__)
if (nSize <= 8) {
ht->nTableSize = 8;
} else if (nSize >= 0x80000000) {
@ -269,14 +269,12 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s
IS_CONSISTENT(ht);
CHECK_INIT(ht, 0);
if (ht->u.flags & HASH_FLAG_PACKED) {
if (UNEXPECTED(ht->nTableMask == 0)) {
CHECK_INIT(ht, 0);
goto add_to_hash;
} else if (ht->u.flags & HASH_FLAG_PACKED) {
zend_hash_packed_to_hash(ht);
}
h = zend_string_hash_val(key);
if ((flag & HASH_ADD_NEW) == 0) {
} else if ((flag & HASH_ADD_NEW) == 0) {
p = zend_hash_find_bucket(ht, key);
if (p) {
@ -302,6 +300,7 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s
ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
add_to_hash:
HANDLE_BLOCK_INTERRUPTIONS();
idx = ht->nNumUsed++;
ht->nNumOfElements++;
@ -309,7 +308,7 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s
ht->nInternalPointer = idx;
}
p = ht->arData + idx;
p->h = h;
p->h = h = zend_string_hash_val(key);
p->key = key;
zend_string_addref(key);
ZVAL_COPY_VALUE(&p->val, pData);
@ -423,9 +422,15 @@ static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht,
#endif
IS_CONSISTENT(ht);
CHECK_INIT(ht, h < ht->nTableSize);
if (ht->u.flags & HASH_FLAG_PACKED) {
if (UNEXPECTED(ht->nTableMask == 0)) {
CHECK_INIT(ht, h < ht->nTableSize);
if (h < ht->nTableSize) {
p = ht->arData + h;
goto add_to_packed;
}
goto add_to_hash;
} else if (ht->u.flags & HASH_FLAG_PACKED) {
if (h < ht->nNumUsed) {
p = ht->arData + h;
if (Z_TYPE(p->val) != IS_UNDEF) {
@ -453,6 +458,7 @@ static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht,
goto convert_to_hash;
}
add_to_packed:
HANDLE_BLOCK_INTERRUPTIONS();
/* incremental initialization of empty Buckets */
if ((flag & (HASH_ADD_NEW|HASH_ADD_NEXT)) == (HASH_ADD_NEW|HASH_ADD_NEXT)) {
@ -477,7 +483,6 @@ static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht,
p->h = h;
p->key = NULL;
ZVAL_COPY_VALUE(&p->val, pData);
Z_NEXT(p->val) = INVALID_IDX;
HANDLE_UNBLOCK_INTERRUPTIONS();
@ -485,9 +490,7 @@ static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht,
convert_to_hash:
zend_hash_packed_to_hash(ht);
}
if ((flag & HASH_ADD_NEW) == 0) {
} else if ((flag & HASH_ADD_NEW) == 0) {
p = zend_hash_index_find_bucket(ht, h);
if (p) {
if (flag & HASH_ADD) {
@ -509,6 +512,7 @@ convert_to_hash:
ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
add_to_hash:
HANDLE_BLOCK_INTERRUPTIONS();
idx = ht->nNumUsed++;
ht->nNumOfElements++;

View File

@ -602,9 +602,12 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) {
zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name->val, key->val, zend_visibility_string(parent_info->flags), parent_ce->name->val, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
} else if ((child_info->flags & ZEND_ACC_STATIC) == 0) {
zval_ptr_dtor(&(ce->default_properties_table[parent_info->offset]));
ce->default_properties_table[parent_info->offset] = ce->default_properties_table[child_info->offset];
ZVAL_UNDEF(&ce->default_properties_table[child_info->offset]);
int parent_num = OBJ_PROP_TO_NUM(parent_info->offset);
int child_num = OBJ_PROP_TO_NUM(child_info->offset);
zval_ptr_dtor(&(ce->default_properties_table[parent_num]));
ce->default_properties_table[parent_num] = ce->default_properties_table[child_num];
ZVAL_UNDEF(&ce->default_properties_table[child_num]);
child_info->offset = parent_info->offset;
}
return 0; /* Don't copy from parent */
@ -797,7 +800,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
if (property_info->flags & ZEND_ACC_STATIC) {
property_info->offset += parent_ce->default_static_members_count;
} else {
property_info->offset += parent_ce->default_properties_count;
property_info->offset += parent_ce->default_properties_count * sizeof(zval);
}
}
} ZEND_HASH_FOREACH_END();
@ -1421,8 +1424,8 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
|| (Z_LVAL(compare_result) != 0);
} else {
not_compatible = (FAILURE == compare_function(&compare_result,
&ce->default_properties_table[coliding_prop->offset],
&ce->traits[i]->default_properties_table[property_info->offset] TSRMLS_CC))
&ce->default_properties_table[OBJ_PROP_TO_NUM(coliding_prop->offset)],
&ce->traits[i]->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)] TSRMLS_CC))
|| (Z_LVAL(compare_result) != 0);
}
} else {
@ -1454,7 +1457,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
if (flags & ZEND_ACC_STATIC) {
prop_value = &ce->traits[i]->default_static_members_table[property_info->offset];
} else {
prop_value = &ce->traits[i]->default_properties_table[property_info->offset];
prop_value = &ce->traits[i]->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)];
}
if (Z_REFCOUNTED_P(prop_value)) Z_ADDREF_P(prop_value);

View File

@ -80,11 +80,10 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
if (/*prop_info->ce == ce &&*/
(prop_info->flags & ZEND_ACC_STATIC) == 0 &&
prop_info->offset >= 0 &&
Z_TYPE(zobj->properties_table[prop_info->offset]) != IS_UNDEF) {
Z_TYPE_P(OBJ_PROP(zobj, prop_info->offset)) != IS_UNDEF) {
zval zv;
ZVAL_INDIRECT(&zv, &zobj->properties_table[prop_info->offset]);
ZVAL_INDIRECT(&zv, OBJ_PROP(zobj, prop_info->offset));
zend_hash_add_new(zobj->properties, prop_info->name, &zv);
}
} ZEND_HASH_FOREACH_END();
@ -94,11 +93,10 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */
if (prop_info->ce == ce &&
(prop_info->flags & ZEND_ACC_STATIC) == 0 &&
(prop_info->flags & ZEND_ACC_PRIVATE) != 0 &&
prop_info->offset >= 0 &&
Z_TYPE(zobj->properties_table[prop_info->offset]) != IS_UNDEF) {
Z_TYPE_P(OBJ_PROP(zobj, prop_info->offset)) != IS_UNDEF) {
zval zv;
ZVAL_INDIRECT(&zv, &zobj->properties_table[prop_info->offset]);
ZVAL_INDIRECT(&zv, OBJ_PROP(zobj, prop_info->offset));
zend_hash_add(zobj->properties, prop_info->name, &zv);
}
} ZEND_HASH_FOREACH_END();
@ -288,7 +286,7 @@ static zend_always_inline zend_bool is_derived_class(zend_class_entry *child_cla
}
/* }}} */
static zend_always_inline zend_property_info *zend_get_property_info_quick(zend_class_entry *ce, zend_string *member, int silent, void **cache_slot TSRMLS_DC) /* {{{ */
static zend_always_inline zend_property_info *zend_get_property_info_quick(zend_class_entry *ce, zend_string *member, int silent, int allow_static, void **cache_slot TSRMLS_DC) /* {{{ */
{
zval *zv;
zend_property_info *property_info = NULL;
@ -324,8 +322,13 @@ static zend_always_inline zend_property_info *zend_get_property_info_quick(zend_
if (EXPECTED(zend_verify_property_access(property_info, ce TSRMLS_CC) != 0)) {
if (UNEXPECTED(!(flags & ZEND_ACC_CHANGED))
|| UNEXPECTED((flags & ZEND_ACC_PRIVATE))) {
if (UNEXPECTED((flags & ZEND_ACC_STATIC) != 0) && !silent) {
zend_error(E_STRICT, "Accessing static property %s::$%s as non static", ce->name->val, member->val);
if (UNEXPECTED((flags & ZEND_ACC_STATIC) != 0)) {
if (!silent) {
zend_error(E_STRICT, "Accessing static property %s::$%s as non static", ce->name->val, member->val);
}
if (!allow_static) {
return NULL;
}
}
goto exit;
}
@ -342,7 +345,9 @@ static zend_always_inline zend_property_info *zend_get_property_info_quick(zend_
&& (zv = zend_hash_find(&EG(scope)->properties_info, member)) != NULL
&& ((zend_property_info*)Z_PTR_P(zv))->flags & ZEND_ACC_PRIVATE) {
property_info = (zend_property_info*)Z_PTR_P(zv);
goto exit;
if (!allow_static && UNEXPECTED((property_info->flags & ZEND_ACC_STATIC) != 0)) {
return NULL;
}
} else if (UNEXPECTED(property_info == NULL)) {
exit_dynamic:
if (cache_slot) {
@ -354,9 +359,6 @@ exit_dynamic:
if (!silent) {
zend_error_noreturn(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(flags), ce->name->val, member->val);
}
if (cache_slot) {
CACHE_POLYMORPHIC_PTR_EX(cache_slot, ce, ZEND_WRONG_PROPERTY_INFO);
}
return ZEND_WRONG_PROPERTY_INFO;
}
@ -370,7 +372,7 @@ exit:
ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent TSRMLS_DC) /* {{{ */
{
return zend_get_property_info_quick(ce, member, silent, NULL TSRMLS_CC);
return zend_get_property_info_quick(ce, member, silent, 1, NULL TSRMLS_CC);
}
/* }}} */
@ -388,7 +390,7 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_inf
} else {
member = zend_string_copy(prop_info_name);
}
property_info = zend_get_property_info_quick(zobj->ce, member, 1, NULL TSRMLS_CC);
property_info = zend_get_property_info_quick(zobj->ce, member, 1, 1, NULL TSRMLS_CC);
zend_string_release(member);
if (property_info == NULL) {
/* undefined public property */
@ -451,13 +453,11 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
#endif
/* make zend_get_property_info silent if we have getter - we may want to use it */
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (type == BP_VAR_IS) || (zobj->ce->__get != NULL), cache_slot TSRMLS_CC);
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (type == BP_VAR_IS) || (zobj->ce->__get != NULL), 0, cache_slot TSRMLS_CC);
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
if (EXPECTED(property_info != NULL) &&
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
retval = &zobj->properties_table[property_info->offset];
if (EXPECTED(property_info != NULL)) {
retval = OBJ_PROP(zobj, property_info->offset);
if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
goto exit;
}
@ -534,13 +534,11 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, v
cache_slot = NULL;
}
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__set != NULL), cache_slot TSRMLS_CC);
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__set != NULL), 0, cache_slot TSRMLS_CC);
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
if (EXPECTED(property_info != NULL) &&
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
variable_ptr = &zobj->properties_table[property_info->offset];
if (EXPECTED(property_info != NULL)) {
variable_ptr = OBJ_PROP(zobj, property_info->offset);
if (Z_TYPE_P(variable_ptr) != IS_UNDEF) {
goto found;
}
@ -638,12 +636,12 @@ write_std_property:
if (EXPECTED(property_info != NULL) &&
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
ZVAL_COPY_VALUE(&zobj->properties_table[property_info->offset], value);
ZVAL_COPY_VALUE(OBJ_PROP(zobj, property_info->offset), value);
} else {
if (!zobj->properties) {
rebuild_object_properties(zobj);
}
zend_hash_update(zobj->properties, Z_STR_P(member), value);
zend_hash_add_new(zobj->properties, Z_STR_P(member), value);
}
}
@ -754,13 +752,11 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type,
fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), name->val);
#endif
property_info = zend_get_property_info_quick(zobj->ce, name, (zobj->ce->__get != NULL), cache_slot TSRMLS_CC);
property_info = zend_get_property_info_quick(zobj->ce, name, (zobj->ce->__get != NULL), 0, cache_slot TSRMLS_CC);
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
if (EXPECTED(property_info != NULL) &&
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
retval = &zobj->properties_table[property_info->offset];
if (EXPECTED(property_info != NULL)) {
retval = OBJ_PROP(zobj, property_info->offset);
if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
if (EXPECTED(!zobj->ce->__get) ||
UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET)) {
@ -816,15 +812,15 @@ static void zend_std_unset_property(zval *object, zval *member, void **cache_slo
cache_slot = NULL;
}
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__unset != NULL), cache_slot TSRMLS_CC);
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__unset != NULL), 0, cache_slot TSRMLS_CC);
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
if (EXPECTED(property_info != NULL) &&
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
if (EXPECTED(property_info != NULL)) {
zval *slot = OBJ_PROP(zobj, property_info->offset);
if (Z_TYPE(zobj->properties_table[property_info->offset]) != IS_UNDEF) {
zval_ptr_dtor(&zobj->properties_table[property_info->offset]);
ZVAL_UNDEF(&zobj->properties_table[property_info->offset]);
if (Z_TYPE_P(slot) != IS_UNDEF) {
zval_ptr_dtor(slot);
ZVAL_UNDEF(slot);
goto exit;
}
} else if (EXPECTED(zobj->properties != NULL) &&
@ -1413,13 +1409,11 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists,
cache_slot = NULL;
}
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), 1, cache_slot TSRMLS_CC);
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), 1, 0, cache_slot TSRMLS_CC);
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
if (EXPECTED(property_info != NULL) &&
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
value = &zobj->properties_table[property_info->offset];
if (EXPECTED(property_info != NULL)) {
value = OBJ_PROP(zobj, property_info->offset);
if (Z_TYPE_P(value) != IS_UNDEF) {
goto found;
}

View File

@ -74,6 +74,10 @@
# include <alloca.h>
#endif
#if defined(ZEND_WIN32)
#include <intrin.h>
#endif
/* Only use this macro if you know for sure that all of the switches values
are covered by its case statements */
#if ZEND_DEBUG
@ -196,8 +200,10 @@ char *alloca();
#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004 && defined(__i386__)
# define ZEND_FASTCALL __attribute__((fastcall))
#elif defined(_MSC_VER) && defined(_M_IX86)
#elif defined(_MSC_VER) && defined(_M_IX86) && _MSC_VER <= 1700
# define ZEND_FASTCALL __fastcall
#elif defined(_MSC_VER) && _MSC_VER >= 1800
# define ZEND_FASTCALL __vectorcall
#else
# define ZEND_FASTCALL
#endif

View File

@ -1324,11 +1324,33 @@ ZEND_VM_HANDLER(82, ZEND_FETCH_OBJ_R, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
zval *retval;
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
do {
if (OP2_TYPE == IS_CONST &&
EXPECTED(Z_OBJCE_P(container) == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) {
zend_property_info *prop_info = CACHED_PTR(Z_CACHE_SLOT_P(offset) + 1);
zend_object *zobj = Z_OBJ_P(container);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
}
if (EXPECTED(prop_info)) {
retval = OBJ_PROP(zobj, prop_info->offset);
if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
break;
}
} else if (EXPECTED(zobj->properties != NULL)) {
retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
if (EXPECTED(retval)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
break;
}
}
}
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
}
} while (0);
}
FREE_OP2();
@ -1352,7 +1374,7 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W TSRMLS_CC);
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, OP2_TYPE, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W TSRMLS_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@ -1376,7 +1398,7 @@ ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW TSRMLS_CC);
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, OP2_TYPE, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW TSRMLS_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@ -1393,6 +1415,8 @@ ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV
zval *container;
zend_free_op free_op2;
zval *offset;
zval *retval;
zend_property_info *prop_info;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_DEREF(BP_VAR_IS);
@ -1405,11 +1429,33 @@ ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV
zval *retval;
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
do {
if (OP2_TYPE == IS_CONST &&
EXPECTED(Z_OBJCE_P(container) == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) {
zend_property_info *prop_info = CACHED_PTR(Z_CACHE_SLOT_P(offset) + 1);
zend_object *zobj = Z_OBJ_P(container);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
}
if (EXPECTED(prop_info)) {
retval = OBJ_PROP(zobj, prop_info->offset);
if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
break;
}
} else if (EXPECTED(zobj->properties != NULL)) {
retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
if (EXPECTED(retval)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
break;
}
}
}
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
}
} while (0);
}
FREE_OP2();
@ -1438,7 +1484,7 @@ ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|
if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W TSRMLS_CC);
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, OP2_TYPE, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W TSRMLS_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@ -1464,7 +1510,7 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET TSRMLS_CC);
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, OP2_TYPE, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET TSRMLS_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@ -2070,7 +2116,7 @@ ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV)
if (CACHED_PTR(Z_CACHE_SLOT_P(class_name))) {
Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
} else {
Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, 0 TSRMLS_CC);
Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
CACHE_PTR(Z_CACHE_SLOT_P(class_name), Z_CE_P(EX_VAR(opline->result.var)));
}
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,6 @@ var_dump(curl_setopt($ch, CURLOPT_URL, $url));
?>
Done
--EXPECTF--
Warning: curl_setopt(): Curl option contains invalid characters (\0) in %s/bug68089.php on line 4
Warning: curl_setopt(): Curl option contains invalid characters (\0) in %s%ebug68089.php on line 4
bool(false)
Done

View File

@ -83,6 +83,9 @@ if (PHP_GD != "no") {
/D USE_GD_IOCTX \
/D MSWIN32 \
");
if (ICC_TOOLSET) {
ADD_FLAG("LDFLAGS_GD", "/nodefaultlib:libcmt");
}
PHP_INSTALL_HEADERS("", "ext/gd ext/gd/libgd" );
} else {

View File

@ -875,12 +875,12 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri
int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle TSRMLS_DC)
{
if (ZCG(accel_directives).revalidate_freq &&
(persistent_script->dynamic_members.revalidate >= ZCSG(revalidate_at))) {
persistent_script->dynamic_members.revalidate >= ZCG(request_time)) {
return SUCCESS;
} else if (do_validate_timestamps(persistent_script, file_handle TSRMLS_CC) == FAILURE) {
return FAILURE;
} else {
persistent_script->dynamic_members.revalidate = ZCSG(revalidate_at);
persistent_script->dynamic_members.revalidate = ZCG(request_time) + ZCG(accel_directives).revalidate_freq;
return SUCCESS;
}
}
@ -1421,7 +1421,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han
* otherwise we have a race-condition.
*/
new_persistent_script->timestamp = timestamp;
new_persistent_script->dynamic_members.revalidate = ZCSG(revalidate_at);
new_persistent_script->dynamic_members.revalidate = ZCG(request_time) + ZCG(accel_directives).revalidate_freq;
}
if (file_handle->opened_path) {
@ -1891,13 +1891,6 @@ static void accel_activate(void)
zend_accel_error(ACCEL_LOG_WARNING, "Internal functions count changed - was %d, now %d", ZCG(internal_functions_count), zend_hash_num_elements(&ZCG(function_table)));
}
if (ZCG(accel_directives).validate_timestamps) {
time_t now = ZCG(request_time);
if (now > ZCSG(revalidate_at) + (time_t)ZCG(accel_directives).revalidate_freq) {
ZCSG(revalidate_at) = now;
}
}
ZCG(cwd) = NULL;
SHM_PROTECT();
@ -2347,10 +2340,6 @@ static int accel_startup(zend_extension *extension)
accelerator_orig_zend_resolve_path = zend_resolve_path;
zend_resolve_path = persistent_zend_resolve_path;
if (ZCG(accel_directives).validate_timestamps) {
ZCSG(revalidate_at) = zend_accel_get_time() + ZCG(accel_directives).revalidate_freq;
}
/* Override chdir() function */
if ((func = zend_hash_str_find_ptr(CG(function_table), "chdir", sizeof("chdir")-1)) != NULL &&
func->type == ZEND_INTERNAL_FUNCTION) {

View File

@ -270,7 +270,6 @@ typedef struct _zend_accel_shared_globals {
LONGLONG restart_in;
#endif
zend_bool restart_in_progress;
time_t revalidate_at;
/* Interned Strings Support */
char *interned_strings_start;
char *interned_strings_top;

View File

@ -668,7 +668,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
} else {
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
}
memset(offsets, 0, size_offsets*sizeof(int));
/* Allocate match sets array and initialize the values. */
if (global && subpats && subpats_order == PREG_PATTERN_ORDER) {
match_sets = (zval *)safe_emalloc(num_subpats, sizeof(zval), 0);

View File

@ -376,15 +376,10 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
/* We need to manually convert to a pg native boolean value */
if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL &&
((param->param_type & PDO_PARAM_INPUT_OUTPUT) != PDO_PARAM_INPUT_OUTPUT)) {
zval *parameter;
if (Z_ISREF(param->parameter)) {
parameter = Z_REFVAL(param->parameter);
} else {
parameter = &param->parameter;
}
SEPARATE_ZVAL(&param->parameter);
param->param_type = PDO_PARAM_STR;
ZVAL_STRINGL(parameter, Z_TYPE_P(parameter) == IS_TRUE ? "t" : "f", 1);
convert_to_boolean(&param->parameter);
ZVAL_STRINGL(&param->parameter, Z_TYPE_P(&param->parameter) == IS_TRUE ? "t" : "f", 1);
}
}
return 1;

View File

@ -34,6 +34,19 @@ $query->execute();
$errors[] = $query->errorInfo();
var_dump($value);
// Try with strings - Bug #68351
$value = '0';
$query->bindParam(':foo', $value, PDO::PARAM_BOOL);
$query->execute();
$errors[] = $query->errorInfo();
var_dump($query->fetchColumn());
$value = "abc";
$query->bindParam(':foo', $value, PDO::PARAM_BOOL);
$query->execute();
$errors[] = $query->errorInfo();
var_dump($query->fetchColumn());
$expect = 'No errors found';
foreach ($errors as $error)
@ -48,4 +61,6 @@ echo $expect;
--EXPECTF--
bool(true)
bool(false)
bool(true)
bool(false)
No errors found

View File

@ -3363,7 +3363,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
if (statics && (prop_info->flags & ZEND_ACC_STATIC) != 0) {
prop = &ce->default_static_members_table[prop_info->offset];
} else if (!statics && (prop_info->flags & ZEND_ACC_STATIC) == 0) {
prop = &ce->default_properties_table[prop_info->offset];
prop = &ce->default_properties_table[OBJ_PROP_TO_NUM(prop_info->offset)];
}
}
if (!prop) {

View File

@ -506,17 +506,8 @@ static void php_session_initialize(TSRMLS_D) /* {{{ */
PS(session_status) = php_session_active;
}
if (val) {
PHP_MD5_CTX context;
/* Store read data's MD5 hash */
PHP_MD5Init(&context);
PHP_MD5Update(&context, val->val, val->len);
PHP_MD5Final(PS(session_data_hash), &context);
php_session_decode(val->val, val->len TSRMLS_CC);
zend_string_release(val);
} else {
memset(PS(session_data_hash),'\0', 16);
}
if (!PS(use_cookies) && PS(send_cookie)) {
@ -538,19 +529,7 @@ static void php_session_save_current_state(TSRMLS_D) /* {{{ */
val = php_session_encode(TSRMLS_C);
if (val) {
PHP_MD5_CTX context;
unsigned char digest[16];
/* Generate data's MD5 hash */
PHP_MD5Init(&context);
PHP_MD5Update(&context, val->val, val->len);
PHP_MD5Final(digest, &context);
/* Write only when save is required */
if (memcmp(digest, PS(session_data_hash), 16)) {
ret = PS(mod)->s_write(&PS(mod_data), PS(id), val TSRMLS_CC);
} else {
ret = SUCCESS;
}
ret = PS(mod)->s_write(&PS(mod_data), PS(id), val TSRMLS_CC);
zend_string_release(val);
} else {
ret = PS(mod)->s_write(&PS(mod_data), PS(id), STR_EMPTY_ALLOC() TSRMLS_CC);
@ -1971,7 +1950,6 @@ static PHP_FUNCTION(session_regenerate_id)
RETURN_FALSE;
}
zend_string_release(PS(id));
memset(PS(session_data_hash),'\0', 16);
}
PS(id) = PS(mod)->s_create_sid(&PS(mod_data) TSRMLS_CC);

View File

@ -38,7 +38,8 @@ class MySession2 implements SessionHandlerInterface, SessionIdInterface {
}
public function write($id, $data) {
return file_put_contents($this->path . $id, $data);
// Empty $data = 0 = false
return (bool)file_put_contents($this->path . $id, $data);
}
public function destroy($id) {

View File

@ -32,7 +32,8 @@ class MySession2 {
}
public function write($id, $data) {
return file_put_contents($this->path . $id, $data);
// Empty $data = 0 = false
return (bool)file_put_contents($this->path . $id, $data);
}
public function destroy($id) {

View File

@ -5,6 +5,7 @@ session.save_path=
session.name=PHPSESSID
--SKIPIF--
<?php include('skipif.inc'); ?>
skip - Waiting RFC patch merge
--FILE--
<?php

View File

@ -34,6 +34,10 @@
#include "url_scanner_ex.h"
#if defined(_WIN32) && defined(__clang__)
#include <intrin.h>
#endif
extern zend_module_entry basic_functions_module;
#define basic_functions_module_ptr &basic_functions_module

View File

@ -339,16 +339,16 @@ static int flock_values[] = { LOCK_SH, LOCK_EX, LOCK_UN };
Portable file locking */
PHP_FUNCTION(flock)
{
zval *arg1, *arg3 = NULL;
zval *res, *wouldblock = NULL;
int act;
php_stream *stream;
zend_long operation = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z/", &arg1, &operation, &arg3) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z/", &res, &operation, &wouldblock) == FAILURE) {
return;
}
PHP_STREAM_TO_ZVAL(stream, arg1);
PHP_STREAM_TO_ZVAL(stream, res);
act = operation & 3;
if (act < 1 || act > 3) {
@ -356,16 +356,16 @@ PHP_FUNCTION(flock)
RETURN_FALSE;
}
if (arg3) {
zval_dtor(arg3);
ZVAL_LONG(arg3, 0);
if (wouldblock) {
zval_dtor(wouldblock);
ZVAL_LONG(wouldblock, 0);
}
/* flock_values contains all possible actions if (operation & 4) we won't block on the lock */
act = flock_values[act - 1] | (operation & PHP_LOCK_NB ? LOCK_NB : 0);
if (php_stream_lock(stream, act)) {
if (operation && errno == EWOULDBLOCK && arg3) {
ZVAL_LONG(arg3, 1);
if (operation && errno == EWOULDBLOCK && wouldblock) {
ZVAL_LONG(wouldblock, 1);
}
RETURN_FALSE;
}
@ -887,20 +887,20 @@ PHP_NAMED_FUNCTION(php_if_fopen)
Close an open file pointer */
PHPAPI PHP_FUNCTION(fclose)
{
zval *arg1;
zval *res;
php_stream *stream;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) {
RETURN_FALSE;
}
#else
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(arg1)
Z_PARAM_RESOURCE(res)
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
#endif
PHP_STREAM_TO_ZVAL(stream, arg1);
PHP_STREAM_TO_ZVAL(stream, res);
if ((stream->flags & PHP_STREAM_FLAG_NO_FCLOSE) != 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%pd is not a valid stream resource", stream->res->handle);
@ -965,14 +965,14 @@ PHP_FUNCTION(popen)
Close a file pointer opened by popen() */
PHP_FUNCTION(pclose)
{
zval *arg1;
zval *res;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) {
RETURN_FALSE;
}
PHP_STREAM_TO_ZVAL(stream, arg1);
PHP_STREAM_TO_ZVAL(stream, res);
FG(pclose_wait) = 1;
zend_list_close(stream->res);
@ -985,14 +985,14 @@ PHP_FUNCTION(pclose)
Test for end-of-file on a file pointer */
PHPAPI PHP_FUNCTION(feof)
{
zval *arg1;
zval *res;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) {
RETURN_FALSE;
}
PHP_STREAM_TO_ZVAL(stream, arg1);
PHP_STREAM_TO_ZVAL(stream, res);
if (php_stream_eof(stream)) {
RETURN_TRUE;
@ -1006,18 +1006,18 @@ PHPAPI PHP_FUNCTION(feof)
Get a line from file pointer */
PHPAPI PHP_FUNCTION(fgets)
{
zval *arg1;
zval *res;
zend_long len = 1024;
char *buf = NULL;
int argc = ZEND_NUM_ARGS();
size_t line_len = 0;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &res, &len) == FAILURE) {
RETURN_FALSE;
}
PHP_STREAM_TO_ZVAL(stream, arg1);
PHP_STREAM_TO_ZVAL(stream, res);
if (argc == 1) {
/* ask streams to give us a buffer of an appropriate size */
@ -1062,16 +1062,16 @@ exit_failed:
Get a character from file pointer */
PHPAPI PHP_FUNCTION(fgetc)
{
zval *arg1;
zval *res;
char buf[2];
int result;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) {
RETURN_FALSE;
}
PHP_STREAM_TO_ZVAL(stream, arg1);
PHP_STREAM_TO_ZVAL(stream, res);
result = php_stream_getc(stream);
@ -1193,39 +1193,33 @@ PHP_FUNCTION(fscanf)
Binary-safe file write */
PHPAPI PHP_FUNCTION(fwrite)
{
zval *arg1;
char *arg2;
size_t arg2len;
zval *res;
char *input;
size_t inputlen;
size_t ret;
size_t num_bytes;
zend_long arg3 = 0;
char *buffer = NULL;
zend_long maxlen = 0;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &arg2, &arg2len, &arg3) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &res, &input, &inputlen, &maxlen) == FAILURE) {
RETURN_FALSE;
}
if (ZEND_NUM_ARGS() == 2) {
num_bytes = arg2len;
num_bytes = inputlen;
} else if (maxlen <= 0) {
num_bytes = 0;
} else {
if (arg3 > 0) {
num_bytes = MIN((size_t)arg3, arg2len);
} else {
num_bytes = 0;
}
num_bytes = MIN((size_t) maxlen, inputlen);
}
if (!num_bytes) {
RETURN_LONG(0);
}
PHP_STREAM_TO_ZVAL(stream, arg1);
PHP_STREAM_TO_ZVAL(stream, res);
ret = php_stream_write(stream, buffer ? buffer : arg2, num_bytes);
if (buffer) {
efree(buffer);
}
ret = php_stream_write(stream, input, num_bytes);
RETURN_LONG(ret);
}
@ -1235,15 +1229,15 @@ PHPAPI PHP_FUNCTION(fwrite)
Flushes output */
PHPAPI PHP_FUNCTION(fflush)
{
zval *arg1;
zval *res;
int ret;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) {
RETURN_FALSE;
}
PHP_STREAM_TO_ZVAL(stream, arg1);
PHP_STREAM_TO_ZVAL(stream, res);
ret = php_stream_flush(stream);
if (ret) {
@ -1257,14 +1251,14 @@ PHPAPI PHP_FUNCTION(fflush)
Rewind the position of a file pointer */
PHPAPI PHP_FUNCTION(rewind)
{
zval *arg1;
zval *res;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) {
RETURN_FALSE;
}
PHP_STREAM_TO_ZVAL(stream, arg1);
PHP_STREAM_TO_ZVAL(stream, res);
if (-1 == php_stream_rewind(stream)) {
RETURN_FALSE;
@ -1277,15 +1271,15 @@ PHPAPI PHP_FUNCTION(rewind)
Get file pointer's read/write position */
PHPAPI PHP_FUNCTION(ftell)
{
zval *arg1;
zval *res;
zend_long ret;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) {
RETURN_FALSE;
}
PHP_STREAM_TO_ZVAL(stream, arg1);
PHP_STREAM_TO_ZVAL(stream, res);
ret = php_stream_tell(stream);
if (ret == -1) {
@ -1299,17 +1293,17 @@ PHPAPI PHP_FUNCTION(ftell)
Seek on a file pointer */
PHPAPI PHP_FUNCTION(fseek)
{
zval *arg1;
zend_long arg2, whence = SEEK_SET;
zval *res;
zend_long offset, whence = SEEK_SET;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &arg1, &arg2, &whence) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &res, &offset, &whence) == FAILURE) {
RETURN_FALSE;
}
PHP_STREAM_TO_ZVAL(stream, arg1);
PHP_STREAM_TO_ZVAL(stream, res);
RETURN_LONG(php_stream_seek(stream, arg2, (int)whence));
RETURN_LONG(php_stream_seek(stream, offset, (int) whence));
}
/* }}} */
@ -1411,7 +1405,7 @@ PHP_FUNCTION(readfile)
Return or change the umask */
PHP_FUNCTION(umask)
{
zend_long arg1 = 0;
zend_long mask = 0;
int oldumask;
oldumask = umask(077);
@ -1420,14 +1414,14 @@ PHP_FUNCTION(umask)
BG(umask) = oldumask;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &arg1) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mask) == FAILURE) {
RETURN_FALSE;
}
if (ZEND_NUM_ARGS() == 0) {
umask(oldumask);
} else {
umask((int)arg1);
umask((int) mask);
}
RETURN_LONG(oldumask);
@ -1438,15 +1432,15 @@ PHP_FUNCTION(umask)
Output all remaining data from a file pointer */
PHPAPI PHP_FUNCTION(fpassthru)
{
zval *arg1;
zval *res;
size_t size;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) {
RETURN_FALSE;
}
PHP_STREAM_TO_ZVAL(stream, arg1);
PHP_STREAM_TO_ZVAL(stream, res);
size = php_stream_passthru(stream);
RETURN_LONG(size);
@ -1780,15 +1774,15 @@ safe_to_copy:
Binary-safe file read */
PHPAPI PHP_FUNCTION(fread)
{
zval *arg1;
zval *res;
zend_long len;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &res, &len) == FAILURE) {
RETURN_FALSE;
}
PHP_STREAM_TO_ZVAL(stream, arg1);
PHP_STREAM_TO_ZVAL(stream, res);
if (len <= 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0");

View File

@ -55,7 +55,7 @@ typedef char * caddr_t;
typedef unsigned int uint;
typedef unsigned long ulong;
#if !NSAPI
typedef long pid_t;
typedef int pid_t;
#endif
/* missing in vc5 math.h */

View File

@ -478,8 +478,8 @@ static int init_request_info( TSRMLS_D )
SG(request_info).content_length = LSAPI_GetReqBodyLen();
SG(request_info).path_translated = estrdup( LSAPI_GetScriptFileName());
/* It is not reset by zend engine, set it to 0. */
SG(sapi_headers).http_response_code = 0;
/* It is not reset by zend engine, set it to 200. */
SG(sapi_headers).http_response_code = 200;
pAuth = LSAPI_GetHeader( H_AUTHORIZATION );
php_handle_auth_data(pAuth TSRMLS_CC);

View File

@ -89,7 +89,8 @@ $(PHPDLL_RES): win32\build\template.rc
win32\build\template.rc
$(BUILD_DIR)\$(PHPDLL): generated_files $(PHPDEF) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(PHPDLL_RES) $(MCFILE)
@$(CC) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) /link /out:$(BUILD_DIR)\$(PHPDLL) $(PHP7_PGD_OPTION) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS)
# @$(CC) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) /link /out:$(BUILD_DIR)\$(PHPDLL) $(PHP7_PGD_OPTION) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS)
@"$(LINK)" $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) /out:$(BUILD_DIR)\$(PHPDLL) $(PHP7_PGD_OPTION) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS)
-@$(_VC_MANIFEST_EMBED_DLL)
$(BUILD_DIR)\$(PHPLIB): $(BUILD_DIR)\$(PHPDLL)

View File

@ -3,33 +3,15 @@
// "Master" config file; think of it as a configure.in
// equivalent.
ARG_WITH("toolset", "Toolset to use for the compilation, supported: vs, clang, icc", "vs");
toolset_option_handle();
ARG_WITH('cygwin', 'Path to cygwin utilities on your system', '\\cygwin');
PHP_CL = PATH_PROG('cl', null, 'PHP_CL');
if (!PHP_CL) {
ERROR("MS C++ compiler is required");
}
/* For the record here: */
// 1200 is VC6
// 1300 is vs.net 2002
// 1310 is vs.net 2003
// 1400 is vs.net 2005
// 1500 is vs.net 2008
// 1600 is vs.net 2010
// Which version of the compiler do we have?
VCVERS = probe_binary(PHP_CL).substr(0, 5).replace('.', '');
STDOUT.WriteLine(" Detected compiler " + VC_VERSIONS[VCVERS]);
if (VCVERS < 1500) {
ERROR("Unsupported MS C++ Compiler, VC9 (2008) minimum is required");
}
AC_DEFINE('COMPILER', VC_VERSIONS[VCVERS], "Detected compiler version");
DEFINE("PHP_COMPILER_SHORT", VC_VERSIONS_SHORT[VCVERS]);
AC_DEFINE('PHP_COMPILER_ID', VC_VERSIONS_SHORT[VCVERS], "Compiler compatibility ID");
toolset_setup_compiler();
// do we use x64 or 80x86 version of compiler?
X64 = probe_binary(PHP_CL, 64, null, 'PHP_CL');
X64 = toolset_is_64();
if (X64) {
STDOUT.WriteLine(" Detected 64-bit compiler");
} else {
@ -38,52 +20,8 @@ if (X64) {
AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");
DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');
// cygwin now ships with link.exe. Avoid searching the cygwin path
// for this, as we want the MS linker, not the fileutil
PATH_PROG('link', WshShell.Environment("Process").Item("PATH"));
PATH_PROG('nmake');
// we don't want to define LIB, as that will override the default library path
// that is set in that env var
PATH_PROG('lib', null, 'MAKE_LIB');
if (!PATH_PROG('bison')) {
ERROR('bison is required')
}
// There's a minimum requirement for re2c..
MINRE2C = "0.13.4";
RE2C = PATH_PROG('re2c');
if (RE2C) {
var intvers, intmin;
var pattern = /\./g;
RE2CVERS = probe_binary(RE2C, "version");
STDOUT.WriteLine(' Detected re2c version ' + RE2CVERS);
intvers = RE2CVERS.replace(pattern, '') - 0;
intmin = MINRE2C.replace(pattern, '') - 0;
if (intvers < intmin) {
STDOUT.WriteLine('WARNING: The minimum RE2C version requirement is ' + MINRE2C);
STDOUT.WriteLine('Parsers will not be generated. Upgrade your copy at http://sf.net/projects/re2c');
DEFINE('RE2C', '');
} else {
DEFINE('RE2C_FLAGS', '');
}
} else {
STDOUT.WriteLine('Parsers will not be regenerated');
}
PATH_PROG('zip');
PATH_PROG('lemon');
// avoid picking up midnight commander from cygwin
PATH_PROG('mc', WshShell.Environment("Process").Item("PATH"));
// Try locating manifest tool
if (VCVERS > 1200) {
PATH_PROG('mt', WshShell.Environment("Process").Item("PATH"));
}
toolset_setup_linker();
toolset_setup_project_tools();
// stick objects somewhere outside of the source tree
ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
@ -130,45 +68,11 @@ DEFINE('PHP_PREFIX', PHP_PREFIX);
DEFINE("BASE_INCLUDES", "/I . /I main /I Zend /I TSRM /I ext ");
// CFLAGS for building the PHP dll
DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP7DLLTS_EXPORTS /D PHP_EXPORTS \
/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500");
DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
// General CFLAGS for building objects
DEFINE("CFLAGS", "/nologo /FD $(BASE_INCLUDES) /D _WINDOWS \
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 ");
if (VCVERS < 1400) {
// Enable automatic precompiled headers
ADD_FLAG('CFLAGS', ' /YX ');
if (PHP_DEBUG == "yes") {
// Set some debug/release specific options
ADD_FLAG('CFLAGS', ' /GZ ');
}
}
if (VCVERS >= 1400) {
// fun stuff: MS deprecated ANSI stdio and similar functions
// disable annoying warnings. In addition, time_t defaults
// to 64-bit. Ask for 32-bit.
if (X64) {
ADD_FLAG('CFLAGS', ' /wd4996 ');
} else {
ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 ');
}
if (PHP_DEBUG == "yes") {
// Set some debug/release specific options
ADD_FLAG('CFLAGS', ' /RTC1 ');
}
}
toolset_setup_common_cflags();
ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto');
var PHP_MP_DISABLED = true;
if (VCVERS >= 1500 && PHP_MP != 'disable') {
if (VS_TOOLSET && VCVERS >= 1500 && PHP_MP != 'disable') {
// no from disable-all
if(PHP_MP == 'auto' || PHP_MP == 'no') {
ADD_FLAG('CFLAGS', ' /MP ');
@ -184,19 +88,7 @@ if (VCVERS >= 1500 && PHP_MP != 'disable') {
}
// General link flags
if (VCVERS >= 1700) {
DEFINE("LDFLAGS", "/nologo ");
} else {
DEFINE("LDFLAGS", "/nologo /version:" +
PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION);
}
// General DLL link flags
DEFINE("DLL_LDFLAGS", "/dll ");
// PHP DLL link flags
DEFINE("PHP_LDFLAGS", "$(DLL_LDFLAGS)");
toolset_setup_common_ldlags();
// General libs
// urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib
@ -334,7 +226,7 @@ function add_extra_dirs()
for (i = 0; i < path.length; i++) {
f = FSO.GetAbsolutePathName(path[i]);
if (FSO.FolderExists(f)) {
if (VCVERS <= 1200 && f.indexOf(" ") >= 0) {
if (VS_TOOLSET && VCVERS <= 1200 && f.indexOf(" ") >= 0) {
ADD_FLAG("LDFLAGS", '/libpath:"\\"' + f + '\\"" ');
} else {
ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
@ -368,7 +260,8 @@ ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \
zend_float.c zend_string.c zend_generators.c zend_virtual_cwd.c zend_ast.c \
zend_inheritance.c");
if (VCVERS == 1200) {
/* XXX inspect this for other toolsets */
if (VS_TOOLSET && VCVERS == 1200) {
AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
}
@ -379,10 +272,10 @@ ADD_SOURCES("main", "main.c snprintf.c spprintf.c getopt.c fopen_wrappers.c \
ADD_SOURCES("win32", "inet.c fnmatch.c sockets.c");
// Newer versions have it
if (VCVERS <= 1300) {
if (VS_TOOLSET && VCVERS <= 1300) {
ADD_SOURCES("win32", "strtoi64.c");
}
if (VCVERS >= 1400) {
if (VS_TOOLSET && VCVERS >= 1400 || ICC_TOOLSET) {
AC_DEFINE('HAVE_STRNLEN', 1);
}

View File

@ -3,32 +3,15 @@
// "Master" config file; think of it as a configure.in
// equivalent.
ARG_WITH("toolset", "Toolset to use for the compilation, supported: vs, clang, icc", "vs");
toolset_option_handle()
var PHP_CYGWIN="notset";
PHP_CL = PATH_PROG('cl', null, 'PHP_CL');
if (!PHP_CL) {
ERROR("MS C++ compiler is required");
}
/* For the record here: */
// 1200 is VC6
// 1300 is vs.net 2002
// 1310 is vs.net 2003
// 1400 is vs.net 2005
// 1500 is vs.net 2008
// 1600 is vs.net 2010
// Which version of the compiler do we have?
VCVERS = probe_binary(PHP_CL).substr(0, 5).replace('.', '');
STDOUT.WriteLine(" Detected compiler " + VC_VERSIONS[VCVERS]);
if (VCVERS < 1500) {
ERROR("Unsupported MS C++ Compiler, VC9 (2008) minimum is required");
}
AC_DEFINE('COMPILER', VC_VERSIONS[VCVERS], "Detected compiler version");
DEFINE("PHP_COMPILER_SHORT", VC_VERSIONS_SHORT[VCVERS]);
AC_DEFINE('PHP_COMPILER_ID', VC_VERSIONS_SHORT[VCVERS], "Compiler compatibility ID");
toolset_setup_compiler();
// do we use x64 or 80x86 version of compiler?
X64 = probe_binary(PHP_CL, 64, null, 'PHP_CL');
X64 = toolset_is_64();
if (X64) {
STDOUT.WriteLine(" Detected 64-bit compiler");
} else {
@ -37,52 +20,8 @@ if (X64) {
AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");
DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');
// cygwin now ships with link.exe. Avoid searching the cygwin path
// for this, as we want the MS linker, not the fileutil
PATH_PROG('link', WshShell.Environment("Process").Item("PATH"));
PATH_PROG('nmake');
// we don't want to define LIB, as that will override the default library path
// that is set in that env var
PATH_PROG('lib', null, 'MAKE_LIB');
if (!PATH_PROG('bison')) {
ERROR('bison is required')
}
// There's a minimum requirement for re2c..
MINRE2C = "0.13.4";
RE2C = PATH_PROG('re2c');
if (RE2C) {
var intvers, intmin;
var pattern = /\./g;
RE2CVERS = probe_binary(RE2C, "version");
STDOUT.WriteLine(' Detected re2c version ' + RE2CVERS);
intvers = RE2CVERS.replace(pattern, '') - 0;
intmin = MINRE2C.replace(pattern, '') - 0;
if (intvers < intmin) {
STDOUT.WriteLine('WARNING: The minimum RE2C version requirement is ' + MINRE2C);
STDOUT.WriteLine('Parsers will not be generated. Upgrade your copy at http://sf.net/projects/re2c');
DEFINE('RE2C', '');
} else {
DEFINE('RE2C_FLAGS', '');
}
} else {
STDOUT.WriteLine('Parsers will not be regenerated');
}
PATH_PROG('zip');
PATH_PROG('lemon');
// avoid picking up midnight commander from cygwin
PATH_PROG('mc', WshShell.Environment("Process").Item("PATH"));
// Try locating manifest tool
if (VCVERS > 1200) {
PATH_PROG('mt', WshShell.Environment("Process").Item("PATH"));
}
toolset_setup_linker();
toolset_setup_project_tools();
// stick objects somewhere outside of the source tree
ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
@ -114,46 +53,12 @@ DEFINE('PHP_PREFIX', PHP_PREFIX);
DEFINE("BASE_INCLUDES", "/I " + PHP_DIR + "/include /I " + PHP_DIR + "/include/main /I " + PHP_DIR + "/include/Zend /I " + PHP_DIR + "/include/TSRM /I " + PHP_DIR + "/include/ext ");
// CFLAGS for building the PHP dll
DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP7DLLTS_EXPORTS /D PHP_EXPORTS \
/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500");
DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
// General CFLAGS for building objects
DEFINE("CFLAGS", "/nologo /FD $(BASE_INCLUDES) /D _WINDOWS \
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 ");
if (VCVERS < 1400) {
// Enable automatic precompiled headers
ADD_FLAG('CFLAGS', ' /YX ');
if (PHP_DEBUG == "yes") {
// Set some debug/release specific options
ADD_FLAG('CFLAGS', ' /GZ ');
}
}
if (VCVERS >= 1400) {
// fun stuff: MS deprecated ANSI stdio and similar functions
// disable annoying warnings. In addition, time_t defaults
// to 64-bit. Ask for 32-bit.
if (X64) {
ADD_FLAG('CFLAGS', ' /wd4996 ');
} else {
ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 ');
}
if (PHP_DEBUG == "yes") {
// Set some debug/release specific options
ADD_FLAG('CFLAGS', ' /RTC1 ');
}
}
toolset_setup_common_cflags();
ARG_WITH('prefix', 'PHP installation prefix', '');
ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto');
var PHP_MP_DISABLED = true;
if (VCVERS >= 1500 && PHP_MP != 'disable') {
if (VS_TOOLSET && VCVERS >= 1500 && PHP_MP != 'disable') {
// no from disable-all
if(PHP_MP == 'auto' || PHP_MP == 'no') {
ADD_FLAG('CFLAGS', ' /MP ');
@ -172,11 +77,8 @@ if (VCVERS >= 1500 && PHP_MP != 'disable') {
* files that make up the snapshot template? */
ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
// General DLL link flags
DEFINE("DLL_LDFLAGS", "/dll ");
// PHP DLL link flags
DEFINE("PHP_LDFLAGS", "$(DLL_LDFLAGS)");
// General link flags
toolset_setup_common_ldlags();
// General libs
// urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib
@ -334,11 +236,12 @@ STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
STDOUT.WriteLine("PHP Core: " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));
if (VCVERS == 1200) {
/* XXX inspect this for other toolsets */
if (VS_TOOLSET && VCVERS == 1200) {
AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
}
if (VCVERS >= 1400) {
if (ICC_TOOLSET || VS_TOOLSET && VCVERS >= 1400) {
AC_DEFINE('HAVE_STRNLEN', 1);
}

File diff suppressed because it is too large Load Diff

View File

@ -33,6 +33,10 @@
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
// Starting with vc14, many of the C11 features are now included, so we only
// need many of these typedefs and defines for older VS suites
#if _MSC_VER < 1900
#ifndef _MSC_STDINT_H_ // [
#define _MSC_STDINT_H_
@ -85,9 +89,6 @@ typedef __int64 int64_t;
#ifndef uint8_t
typedef unsigned __int8 uint8_t;
#endif
#ifndef u_char
typedef unsigned __int8 u_char;
#endif
typedef unsigned __int16 uint16_t;
#ifndef uint32_t
typedef unsigned __int32 uint32_t;
@ -254,3 +255,11 @@ static __inline int64_t llabs(int64_t i)
#endif // _MSC_STDINT_H_ ]
#else
#include <stdint.h>
#endif
#ifndef u_char
typedef unsigned __int8 u_char;
#endif

View File

@ -28,7 +28,7 @@ struct itimerval {
struct timeval it_value; /* current value */
};
#ifndef timespec
#if !defined(timespec) && _MSC_VER < 1900
struct timespec
{
time_t tv_sec; /* seconds */