From 8d39266c45d5384a5744d97897ed01b4170120ec Mon Sep 17 00:00:00 2001 From: Mark Spruiell Date: Fri, 9 Feb 2018 08:11:29 -0800 Subject: [PATCH] ICE-8636 - fixes for PHP 7.2 compatibility --- php/src/php7/Operation.cpp | 24 +++++++++++++----------- php/src/php7/Types.cpp | 12 ++++++++++++ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/php/src/php7/Operation.cpp b/php/src/php7/Operation.cpp index 1c1d2a44ab..05625d0037 100644 --- a/php/src/php7/Operation.cpp +++ b/php/src/php7/Operation.cpp @@ -384,22 +384,24 @@ IcePHP::OperationI::convertParam(zval* p, int pos) void IcePHP::OperationI::getArgInfo(zend_internal_arg_info& arg, const ParamInfoPtr& info, bool out) { - arg.name = 0; - arg.class_name = 0; - arg.allow_null = 1; - - if(!info->optional) + const zend_uchar pass_by_ref = out ? 1 : 0; + const zend_bool allow_null = 1; + if(!info->optional && (SequenceInfoPtr::dynamicCast(info->type) || DictionaryInfoPtr::dynamicCast(info->type))) { - const bool isArray = SequenceInfoPtr::dynamicCast(info->type) || DictionaryInfoPtr::dynamicCast(info->type); - arg.type_hint = isArray ? IS_ARRAY : 0; - + zend_internal_arg_info ai[] = + { + ZEND_ARG_ARRAY_INFO(pass_by_ref, 0, allow_null) + }; + arg = ai[0]; } else { - arg.type_hint = 0; + zend_internal_arg_info ai[] = + { + ZEND_ARG_CALLABLE_INFO(pass_by_ref, 0, allow_null) + }; + arg = ai[0]; } - - arg.pass_by_reference = out ? 1 : 0; } // diff --git a/php/src/php7/Types.cpp b/php/src/php7/Types.cpp index 0dc3093fa5..f08f8447a6 100644 --- a/php/src/php7/Types.cpp +++ b/php/src/php7/Types.cpp @@ -323,6 +323,9 @@ IcePHP::SlicedDataUtil::setMember(zval* obj, const Ice::SlicedDataPtr& slicedDat zval slices; array_init(&slices); +#ifdef HT_ALLOW_COW_VIOLATION + HT_ALLOW_COW_VIOLATION(Z_ARRVAL(slices)); // Allow circular references. +#endif AutoDestroy slicesDestroyer(&slices); if(add_property_zval(&sd, STRCAST("slices"), &slices) != SUCCESS) @@ -388,6 +391,9 @@ IcePHP::SlicedDataUtil::setMember(zval* obj, const Ice::SlicedDataPtr& slicedDat // zval objects; array_init(&objects); +#ifdef HT_ALLOW_COW_VIOLATION + HT_ALLOW_COW_VIOLATION(Z_ARRVAL(objects)); // Allow circular references. +#endif AutoDestroy objectsDestroyer(&objects); if(add_property_zval(&slice, STRCAST("objects"), &objects) != SUCCESS) { @@ -1615,6 +1621,9 @@ IcePHP::SequenceInfo::unmarshal(const Ice::InputStreamPtr& is, const UnmarshalCa zval zv; array_init(&zv); +#ifdef HT_ALLOW_COW_VIOLATION + HT_ALLOW_COW_VIOLATION(Z_ARRVAL(zv)); // Allow circular references. +#endif AutoDestroy destroy(&zv); Ice::Int sz = is->readSize(); @@ -2256,6 +2265,9 @@ IcePHP::DictionaryInfo::unmarshal(const Ice::InputStreamPtr& is, const Unmarshal zval zv; array_init(&zv); +#ifdef HT_ALLOW_COW_VIOLATION + HT_ALLOW_COW_VIOLATION(Z_ARRVAL(zv)); // Allow circular references. +#endif AutoDestroy destroy(&zv); Ice::Int sz = is->readSize();