diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-02-01 17:09:49 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-02-01 17:09:49 +0000 |
commit | abada90e3f84dc703b8ddc9efcbed8a946fadead (patch) | |
tree | 2c6f9dccd510ea97cb927a7bd635422efaae547a /php/src/IcePHP | |
parent | removing trace message (diff) | |
download | ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.bz2 ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.xz ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.zip |
Expanded tabs into spaces
Diffstat (limited to 'php/src/IcePHP')
-rw-r--r-- | php/src/IcePHP/Communicator.cpp | 12 | ||||
-rw-r--r-- | php/src/IcePHP/Marshal.cpp | 692 | ||||
-rw-r--r-- | php/src/IcePHP/Profile.cpp | 232 | ||||
-rw-r--r-- | php/src/IcePHP/Proxy.cpp | 294 | ||||
-rw-r--r-- | php/src/IcePHP/Proxy.h | 86 | ||||
-rw-r--r-- | php/src/IcePHP/Util.cpp | 62 |
6 files changed, 689 insertions, 689 deletions
diff --git a/php/src/IcePHP/Communicator.cpp b/php/src/IcePHP/Communicator.cpp index 52787e7a681..9d44ebb0a12 100644 --- a/php/src/IcePHP/Communicator.cpp +++ b/php/src/IcePHP/Communicator.cpp @@ -324,7 +324,7 @@ ZEND_FUNCTION(Ice_Communicator_identityToString) ice_object* obj = getObject(getThis() TSRMLS_CC); if(!obj) { - return; + return; } assert(obj->ptr); Ice::CommunicatorPtr* _this = static_cast<Ice::CommunicatorPtr*>(obj->ptr); @@ -357,7 +357,7 @@ ZEND_FUNCTION(Ice_Communicator_stringToIdentity) ice_object* obj = getObject(getThis() TSRMLS_CC); if(!obj) { - return; + return; } assert(obj->ptr); Ice::CommunicatorPtr* _this = static_cast<Ice::CommunicatorPtr*>(obj->ptr); @@ -527,7 +527,7 @@ handleAlloc(zend_class_entry* ce TSRMLS_DC) assert(obj); result.handle = zend_objects_store_put(obj, NULL, (zend_objects_free_object_storage_t)handleFreeStorage, - NULL TSRMLS_CC); + NULL TSRMLS_CC); result.handlers = &_handlers; return result; @@ -587,11 +587,11 @@ handleGetMethod(zval** zv, char* method, int len TSRMLS_DC) ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(*zv TSRMLS_CC)); if(!obj->ptr) { - if(ICE_G(profile) == NULL) - { + if(ICE_G(profile) == NULL) + { php_error_docref(NULL TSRMLS_CC, E_ERROR, "$ICE used before a profile was loaded"); return 0; - } + } try { diff --git a/php/src/IcePHP/Marshal.cpp b/php/src/IcePHP/Marshal.cpp index 7c29b94346f..b3501512285 100644 --- a/php/src/IcePHP/Marshal.cpp +++ b/php/src/IcePHP/Marshal.cpp @@ -390,7 +390,7 @@ IcePHP::Marshaler::createMarshaler(const Slice::TypePtr& type TSRMLS_DC) { string scoped = cl->scoped(); php_error_docref(NULL TSRMLS_CC, E_ERROR, "cannot use Slice %s %s because it has not been defined", - cl->isInterface() ? "interface" : "class", scoped.c_str()); + cl->isInterface() ? "interface" : "class", scoped.c_str()); return 0; } return new ObjectMarshaler(def TSRMLS_CC); @@ -560,7 +560,7 @@ IcePHP::PrimitiveMarshaler::marshal(zval* zv, const Ice::OutputStreamPtr& os, Ob { if(!validate(zv TSRMLS_CC)) { - return false; + return false; } switch(_type->kind()) @@ -747,7 +747,7 @@ IcePHP::SequenceMarshaler::SequenceMarshaler(const Slice::SequencePtr& type TSRM Slice::BuiltinPtr b = Slice::BuiltinPtr::dynamicCast(type); if(b && b->kind() != Slice::Builtin::KindObject && b->kind() != Slice::Builtin::KindObjectProxy) { - _builtin = b; + _builtin = b; } _elementMarshaler = createMarshaler(type->type() TSRMLS_CC); } @@ -757,9 +757,9 @@ IcePHP::SequenceMarshaler::marshal(zval* zv, const Ice::OutputStreamPtr& os, Obj { if(Z_TYPE_P(zv) != IS_ARRAY) { - string s = zendTypeToString(Z_TYPE_P(zv)); - php_error_docref(NULL TSRMLS_CC, E_ERROR, "expected array value but received %s", s.c_str()); - return false; + string s = zendTypeToString(Z_TYPE_P(zv)); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "expected array value but received %s", s.c_str()); + return false; } HashTable* arr = Z_ARRVAL_P(zv); @@ -770,198 +770,198 @@ IcePHP::SequenceMarshaler::marshal(zval* zv, const Ice::OutputStreamPtr& os, Obj if(_builtin) { - PrimitiveMarshalerPtr pm = PrimitiveMarshalerPtr::dynamicCast(_elementMarshaler); - assert(pm); - switch(_builtin->kind()) - { - case Slice::Builtin::KindBool: - { - Ice::BoolSeq seq(sz); - zval** val; - Ice::Int i = 0; - while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) - { - if(!pm->validate(*val TSRMLS_CC)) - { - return false; - } - seq[i++] = Z_BVAL_P(*val) ? true : false; - zend_hash_move_forward_ex(arr, &pos); - } - os->writeBoolSeq(seq); - break; - } - case Slice::Builtin::KindByte: - { - Ice::ByteSeq seq(sz); - zval** val; - Ice::Int i = 0; - while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) - { - if(!pm->validate(*val TSRMLS_CC)) - { - return false; - } - long l = Z_LVAL_P(*val); - assert(l >= 0 && l <= 255); - seq[i++] = static_cast<Ice::Byte>(l); - zend_hash_move_forward_ex(arr, &pos); - } - os->writeByteSeq(seq); - break; - } - case Slice::Builtin::KindShort: - { - Ice::ShortSeq seq(sz); - zval** val; - Ice::Int i = 0; - while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) - { - if(!pm->validate(*val TSRMLS_CC)) - { - return false; - } - long l = Z_LVAL_P(*val); - assert(l >= SHRT_MIN && l <= SHRT_MAX); - seq[i++] = static_cast<Ice::Short>(l); - zend_hash_move_forward_ex(arr, &pos); - } - os->writeShortSeq(seq); - break; - } - case Slice::Builtin::KindInt: - { - Ice::IntSeq seq(sz); - zval** val; - Ice::Int i = 0; - while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) - { - if(!pm->validate(*val TSRMLS_CC)) - { - return false; - } - long l = Z_LVAL_P(*val); - assert(l >= INT_MIN && l <= INT_MAX); - seq[i++] = static_cast<Ice::Int>(l); - zend_hash_move_forward_ex(arr, &pos); - } - os->writeIntSeq(seq); - break; - } - case Slice::Builtin::KindLong: - { - Ice::LongSeq seq(sz); - zval** val; - Ice::Int i = 0; - while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) - { - if(!pm->validate(*val TSRMLS_CC)) - { - return false; - } - // - // The platform's 'long' type may not be 64 bits, so we also accept - // a string argument for this type. - // - assert(Z_TYPE_P(*val) == IS_LONG || Z_TYPE_P(*val) == IS_STRING); - Ice::Long l; - if(Z_TYPE_P(*val) == IS_LONG) - { - l = Z_LVAL_P(*val); - } - else - { - string sval(Z_STRVAL_P(*val), Z_STRLEN_P(*val)); - IceUtil::stringToInt64(sval, l); - } - seq[i++] = l; - zend_hash_move_forward_ex(arr, &pos); - } - os->writeLongSeq(seq); - break; - } - case Slice::Builtin::KindFloat: - { - Ice::FloatSeq seq(sz); - zval** val; - Ice::Int i = 0; - while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) - { - if(!pm->validate(*val TSRMLS_CC)) - { - return false; - } - double d = Z_DVAL_P(*val); - seq[i++] = static_cast<Ice::Float>(d); - zend_hash_move_forward_ex(arr, &pos); - } - os->writeFloatSeq(seq); - break; - } - case Slice::Builtin::KindDouble: - { - Ice::DoubleSeq seq(sz); - zval** val; - Ice::Int i = 0; - while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) - { - if(!pm->validate(*val TSRMLS_CC)) - { - return false; - } - double d = Z_DVAL_P(*val); - seq[i++] = d; - zend_hash_move_forward_ex(arr, &pos); - } - os->writeDoubleSeq(seq); - break; - } - case Slice::Builtin::KindString: - { - Ice::StringSeq seq(sz); - zval** val; - Ice::Int i = 0; - while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) - { - if(!pm->validate(*val TSRMLS_CC)) - { - return false; - } - string s; - if(Z_TYPE_P(*val) == IS_STRING) - { - s = string(Z_STRVAL_P(*val), Z_STRLEN_P(*val)); - } - else - { - assert(Z_TYPE_P(*val) == IS_NULL); - } - seq[i++] = s; - zend_hash_move_forward_ex(arr, &pos); - } - os->writeStringSeq(seq); - break; - } - - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - assert(false); - } + PrimitiveMarshalerPtr pm = PrimitiveMarshalerPtr::dynamicCast(_elementMarshaler); + assert(pm); + switch(_builtin->kind()) + { + case Slice::Builtin::KindBool: + { + Ice::BoolSeq seq(sz); + zval** val; + Ice::Int i = 0; + while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) + { + if(!pm->validate(*val TSRMLS_CC)) + { + return false; + } + seq[i++] = Z_BVAL_P(*val) ? true : false; + zend_hash_move_forward_ex(arr, &pos); + } + os->writeBoolSeq(seq); + break; + } + case Slice::Builtin::KindByte: + { + Ice::ByteSeq seq(sz); + zval** val; + Ice::Int i = 0; + while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) + { + if(!pm->validate(*val TSRMLS_CC)) + { + return false; + } + long l = Z_LVAL_P(*val); + assert(l >= 0 && l <= 255); + seq[i++] = static_cast<Ice::Byte>(l); + zend_hash_move_forward_ex(arr, &pos); + } + os->writeByteSeq(seq); + break; + } + case Slice::Builtin::KindShort: + { + Ice::ShortSeq seq(sz); + zval** val; + Ice::Int i = 0; + while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) + { + if(!pm->validate(*val TSRMLS_CC)) + { + return false; + } + long l = Z_LVAL_P(*val); + assert(l >= SHRT_MIN && l <= SHRT_MAX); + seq[i++] = static_cast<Ice::Short>(l); + zend_hash_move_forward_ex(arr, &pos); + } + os->writeShortSeq(seq); + break; + } + case Slice::Builtin::KindInt: + { + Ice::IntSeq seq(sz); + zval** val; + Ice::Int i = 0; + while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) + { + if(!pm->validate(*val TSRMLS_CC)) + { + return false; + } + long l = Z_LVAL_P(*val); + assert(l >= INT_MIN && l <= INT_MAX); + seq[i++] = static_cast<Ice::Int>(l); + zend_hash_move_forward_ex(arr, &pos); + } + os->writeIntSeq(seq); + break; + } + case Slice::Builtin::KindLong: + { + Ice::LongSeq seq(sz); + zval** val; + Ice::Int i = 0; + while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) + { + if(!pm->validate(*val TSRMLS_CC)) + { + return false; + } + // + // The platform's 'long' type may not be 64 bits, so we also accept + // a string argument for this type. + // + assert(Z_TYPE_P(*val) == IS_LONG || Z_TYPE_P(*val) == IS_STRING); + Ice::Long l; + if(Z_TYPE_P(*val) == IS_LONG) + { + l = Z_LVAL_P(*val); + } + else + { + string sval(Z_STRVAL_P(*val), Z_STRLEN_P(*val)); + IceUtil::stringToInt64(sval, l); + } + seq[i++] = l; + zend_hash_move_forward_ex(arr, &pos); + } + os->writeLongSeq(seq); + break; + } + case Slice::Builtin::KindFloat: + { + Ice::FloatSeq seq(sz); + zval** val; + Ice::Int i = 0; + while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) + { + if(!pm->validate(*val TSRMLS_CC)) + { + return false; + } + double d = Z_DVAL_P(*val); + seq[i++] = static_cast<Ice::Float>(d); + zend_hash_move_forward_ex(arr, &pos); + } + os->writeFloatSeq(seq); + break; + } + case Slice::Builtin::KindDouble: + { + Ice::DoubleSeq seq(sz); + zval** val; + Ice::Int i = 0; + while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) + { + if(!pm->validate(*val TSRMLS_CC)) + { + return false; + } + double d = Z_DVAL_P(*val); + seq[i++] = d; + zend_hash_move_forward_ex(arr, &pos); + } + os->writeDoubleSeq(seq); + break; + } + case Slice::Builtin::KindString: + { + Ice::StringSeq seq(sz); + zval** val; + Ice::Int i = 0; + while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) + { + if(!pm->validate(*val TSRMLS_CC)) + { + return false; + } + string s; + if(Z_TYPE_P(*val) == IS_STRING) + { + s = string(Z_STRVAL_P(*val), Z_STRLEN_P(*val)); + } + else + { + assert(Z_TYPE_P(*val) == IS_NULL); + } + seq[i++] = s; + zend_hash_move_forward_ex(arr, &pos); + } + os->writeStringSeq(seq); + break; + } + + case Slice::Builtin::KindObject: + case Slice::Builtin::KindObjectProxy: + case Slice::Builtin::KindLocalObject: + assert(false); + } } else { - os->writeSize(sz); + os->writeSize(sz); - zval** val; - while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) - { - if(!_elementMarshaler->marshal(*val, os, m TSRMLS_CC)) - { - return false; - } - zend_hash_move_forward_ex(arr, &pos); - } + zval** val; + while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) + { + if(!_elementMarshaler->marshal(*val, os, m TSRMLS_CC)) + { + return false; + } + zend_hash_move_forward_ex(arr, &pos); + } } return true; @@ -974,156 +974,156 @@ IcePHP::SequenceMarshaler::unmarshal(zval* zv, const Ice::InputStreamPtr& is TSR if(_builtin) { - switch(_builtin->kind()) - { - case Slice::Builtin::KindBool: - { - pair<const bool*, const bool*> pr; - IceUtil::ScopedArray<bool> arr(is->readBoolSeq(pr)); - Ice::Int i = 0; - for(const bool* p = pr.first; p != pr.second; ++p, ++i) - { - zval* val; - MAKE_STD_ZVAL(val); - ZVAL_BOOL(val, *p ? 1 : 0); - add_index_zval(zv, i, val); - } - break; - } - case Slice::Builtin::KindByte: - { - pair<const Ice::Byte*, const Ice::Byte*> pr; - is->readByteSeq(pr); - Ice::Int i = 0; - for(const Ice::Byte* p = pr.first; p != pr.second; ++p, ++i) - { - zval* val; - MAKE_STD_ZVAL(val); - ZVAL_LONG(val, *p & 0xff); - add_index_zval(zv, i, val); - } - break; - } - case Slice::Builtin::KindShort: - { - pair<const Ice::Short*, const Ice::Short*> pr; - IceUtil::ScopedArray<Ice::Short> arr(is->readShortSeq(pr)); - Ice::Int i = 0; - for(const Ice::Short* p = pr.first; p != pr.second; ++p, ++i) - { - zval* val; - MAKE_STD_ZVAL(val); - ZVAL_LONG(val, *p); - add_index_zval(zv, i, val); - } - break; - } - case Slice::Builtin::KindInt: - { - pair<const Ice::Int*, const Ice::Int*> pr; - IceUtil::ScopedArray<Ice::Int> arr(is->readIntSeq(pr)); - Ice::Int i = 0; - for(const Ice::Int* p = pr.first; p != pr.second; ++p, ++i) - { - zval* val; - MAKE_STD_ZVAL(val); - ZVAL_LONG(val, *p); - add_index_zval(zv, i, val); - } - break; - } - case Slice::Builtin::KindLong: - { - pair<const Ice::Long*, const Ice::Long*> pr; - IceUtil::ScopedArray<Ice::Long> arr(is->readLongSeq(pr)); - Ice::Int i = 0; - for(const Ice::Long* p = pr.first; p != pr.second; ++p, ++i) - { - zval* val; - MAKE_STD_ZVAL(val); - // - // The platform's 'long' type may not be 64 bits, so we store 64-bit - // values as a string. - // - if(sizeof(Ice::Long) > sizeof(long) && (*p < LONG_MIN || *p > LONG_MAX)) - { - char buf[64]; + switch(_builtin->kind()) + { + case Slice::Builtin::KindBool: + { + pair<const bool*, const bool*> pr; + IceUtil::ScopedArray<bool> arr(is->readBoolSeq(pr)); + Ice::Int i = 0; + for(const bool* p = pr.first; p != pr.second; ++p, ++i) + { + zval* val; + MAKE_STD_ZVAL(val); + ZVAL_BOOL(val, *p ? 1 : 0); + add_index_zval(zv, i, val); + } + break; + } + case Slice::Builtin::KindByte: + { + pair<const Ice::Byte*, const Ice::Byte*> pr; + is->readByteSeq(pr); + Ice::Int i = 0; + for(const Ice::Byte* p = pr.first; p != pr.second; ++p, ++i) + { + zval* val; + MAKE_STD_ZVAL(val); + ZVAL_LONG(val, *p & 0xff); + add_index_zval(zv, i, val); + } + break; + } + case Slice::Builtin::KindShort: + { + pair<const Ice::Short*, const Ice::Short*> pr; + IceUtil::ScopedArray<Ice::Short> arr(is->readShortSeq(pr)); + Ice::Int i = 0; + for(const Ice::Short* p = pr.first; p != pr.second; ++p, ++i) + { + zval* val; + MAKE_STD_ZVAL(val); + ZVAL_LONG(val, *p); + add_index_zval(zv, i, val); + } + break; + } + case Slice::Builtin::KindInt: + { + pair<const Ice::Int*, const Ice::Int*> pr; + IceUtil::ScopedArray<Ice::Int> arr(is->readIntSeq(pr)); + Ice::Int i = 0; + for(const Ice::Int* p = pr.first; p != pr.second; ++p, ++i) + { + zval* val; + MAKE_STD_ZVAL(val); + ZVAL_LONG(val, *p); + add_index_zval(zv, i, val); + } + break; + } + case Slice::Builtin::KindLong: + { + pair<const Ice::Long*, const Ice::Long*> pr; + IceUtil::ScopedArray<Ice::Long> arr(is->readLongSeq(pr)); + Ice::Int i = 0; + for(const Ice::Long* p = pr.first; p != pr.second; ++p, ++i) + { + zval* val; + MAKE_STD_ZVAL(val); + // + // The platform's 'long' type may not be 64 bits, so we store 64-bit + // values as a string. + // + if(sizeof(Ice::Long) > sizeof(long) && (*p < LONG_MIN || *p > LONG_MAX)) + { + char buf[64]; #ifdef WIN32 - sprintf(buf, "%I64d", *p); + sprintf(buf, "%I64d", *p); #else - sprintf(buf, "%lld", *p); + sprintf(buf, "%lld", *p); #endif - ZVAL_STRING(val, buf, 1); - } - else - { - ZVAL_LONG(val, static_cast<long>(*p)); - } - add_index_zval(zv, i, val); - } - break; - } - case Slice::Builtin::KindFloat: - { - pair<const Ice::Float*, const Ice::Float*> pr; - IceUtil::ScopedArray<Ice::Float> arr(is->readFloatSeq(pr)); - Ice::Int i = 0; - for(const Ice::Float* p = pr.first; p != pr.second; ++p, ++i) - { - zval* val; - MAKE_STD_ZVAL(val); - ZVAL_DOUBLE(zv, *p); - add_index_zval(zv, i, val); - } - break; - } - case Slice::Builtin::KindDouble: - { - pair<const Ice::Double*, const Ice::Double*> pr; - IceUtil::ScopedArray<Ice::Double> arr(is->readDoubleSeq(pr)); - Ice::Int i = 0; - for(const Ice::Double* p = pr.first; p != pr.second; ++p, ++i) - { - zval* val; - MAKE_STD_ZVAL(val); - ZVAL_DOUBLE(zv, *p); - add_index_zval(zv, i, val); - } - break; - } - case Slice::Builtin::KindString: - { - Ice::StringSeq seq = is->readStringSeq(); - Ice::Int i = 0; - for(Ice::StringSeq::iterator p = seq.begin(); p != seq.end(); ++p, ++i) - { - zval* val; - MAKE_STD_ZVAL(val); - ZVAL_STRINGL(val, const_cast<char*>(p->c_str()), p->length(), 1); - add_index_zval(zv, i, val); - } - break; - } - - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - assert(false); - } + ZVAL_STRING(val, buf, 1); + } + else + { + ZVAL_LONG(val, static_cast<long>(*p)); + } + add_index_zval(zv, i, val); + } + break; + } + case Slice::Builtin::KindFloat: + { + pair<const Ice::Float*, const Ice::Float*> pr; + IceUtil::ScopedArray<Ice::Float> arr(is->readFloatSeq(pr)); + Ice::Int i = 0; + for(const Ice::Float* p = pr.first; p != pr.second; ++p, ++i) + { + zval* val; + MAKE_STD_ZVAL(val); + ZVAL_DOUBLE(zv, *p); + add_index_zval(zv, i, val); + } + break; + } + case Slice::Builtin::KindDouble: + { + pair<const Ice::Double*, const Ice::Double*> pr; + IceUtil::ScopedArray<Ice::Double> arr(is->readDoubleSeq(pr)); + Ice::Int i = 0; + for(const Ice::Double* p = pr.first; p != pr.second; ++p, ++i) + { + zval* val; + MAKE_STD_ZVAL(val); + ZVAL_DOUBLE(zv, *p); + add_index_zval(zv, i, val); + } + break; + } + case Slice::Builtin::KindString: + { + Ice::StringSeq seq = is->readStringSeq(); + Ice::Int i = 0; + for(Ice::StringSeq::iterator p = seq.begin(); p != seq.end(); ++p, ++i) + { + zval* val; + MAKE_STD_ZVAL(val); + ZVAL_STRINGL(val, const_cast<char*>(p->c_str()), p->length(), 1); + add_index_zval(zv, i, val); + } + break; + } + + case Slice::Builtin::KindObject: + case Slice::Builtin::KindObjectProxy: + case Slice::Builtin::KindLocalObject: + assert(false); + } } else { - Ice::Int sz = is->readSize(); - for(Ice::Int i = 0; i < sz; ++i) - { - zval* val; - MAKE_STD_ZVAL(val); - if(!_elementMarshaler->unmarshal(val, is TSRMLS_CC)) - { - return false; - } - add_index_zval(zv, i, val); - } + Ice::Int sz = is->readSize(); + for(Ice::Int i = 0; i < sz; ++i) + { + zval* val; + MAKE_STD_ZVAL(val); + if(!_elementMarshaler->unmarshal(val, is TSRMLS_CC)) + { + return false; + } + add_index_zval(zv, i, val); + } } return true; @@ -1172,7 +1172,7 @@ IcePHP::ProxyMarshaler::marshal(zval* zv, const Ice::OutputStreamPtr& os, Object { string s = def->scoped(); php_error_docref(NULL TSRMLS_CC, E_ERROR, "expected a proxy of type %s but received %s", - scoped.c_str(), s.c_str()); + scoped.c_str(), s.c_str()); return false; } } @@ -1297,7 +1297,7 @@ IcePHP::StructMarshaler::marshal(zval* zv, const Ice::OutputStreamPtr& os, Objec { string s = zendTypeToString(Z_TYPE_P(zv)); php_error_docref(NULL TSRMLS_CC, E_ERROR, "expected struct value of type %s but received %s", _class->name, - s.c_str()); + s.c_str()); return false; } @@ -1308,7 +1308,7 @@ IcePHP::StructMarshaler::marshal(zval* zv, const Ice::OutputStreamPtr& os, Objec if(ce != _class) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "expected struct value of type %s but received %s", _class->name, - ce->name); + ce->name); return false; } @@ -1371,7 +1371,7 @@ IcePHP::EnumMarshaler::marshal(zval* zv, const Ice::OutputStreamPtr& os, ObjectM { string s = zendTypeToString(Z_TYPE_P(zv)); php_error_docref(NULL TSRMLS_CC, E_ERROR, "expected long value for enum %s but received %s", _class->name, - s.c_str()); + s.c_str()); return false; } @@ -2003,7 +2003,7 @@ IcePHP::ObjectReader::setValue(zend_class_entry* ce, const string& scoped, zval* { Ice::UnexpectedObjectException ex(__FILE__, __LINE__); ex.type = _type ? _type->scoped() : "::Ice::Object"; - ex.expectedType = scoped; + ex.expectedType = scoped; throw ex; } @@ -2052,7 +2052,7 @@ IcePHP::ObjectMarshaler::marshal(zval* zv, const Ice::OutputStreamPtr& os, Objec { string s = zendTypeToString(Z_TYPE_P(zv)); php_error_docref(NULL TSRMLS_CC, E_ERROR, "expected object value of type %s but received %s", - _class ? _class->name : "ice_object", s.c_str()); + _class ? _class->name : "ice_object", s.c_str()); return false; } @@ -2074,7 +2074,7 @@ IcePHP::ObjectMarshaler::marshal(zval* zv, const Ice::OutputStreamPtr& os, Objec if(parent == NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "expected object value of type %s but received %s", _class->name, - ce->name); + ce->name); return false; } } @@ -2218,7 +2218,7 @@ IcePHP::PHPObjectFactory::create(const string& scoped) if(!checkClass(ce, base)) { php_error_docref(NULL TSRMLS_CC, E_ERROR, - "object returned by factory does not implement Ice_ObjectImpl"); + "object returned by factory does not implement Ice_ObjectImpl"); throw AbortMarshaling(); } diff --git a/php/src/IcePHP/Profile.cpp b/php/src/IcePHP/Profile.cpp index eb90ed7a935..51acd6ac310 100644 --- a/php/src/IcePHP/Profile.cpp +++ b/php/src/IcePHP/Profile.cpp @@ -316,16 +316,16 @@ parseSlice(const string& argStr, Slice::UnitPtr& unit TSRMLS_DC) vector<string> args; try { - args = IceUtil::Options::split(argStr); + args = IceUtil::Options::split(argStr); } catch(const IceUtil::Exception& ex) { - ostringstream ostr; - ex.ice_print(ostr); - string msg = ostr.str(); - php_error_docref(NULL TSRMLS_CC, E_ERROR, "error occurred while parsing Slice options in `%s':\n%s", - argStr.c_str(), msg.c_str()); - return false; + ostringstream ostr; + ex.ice_print(ostr); + string msg = ostr.str(); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "error occurred while parsing Slice options in `%s':\n%s", + argStr.c_str(), msg.c_str()); + return false; } IceUtil::Options opts; @@ -339,22 +339,22 @@ parseSlice(const string& argStr, Slice::UnitPtr& unit TSRMLS_DC) vector<string> files; try { - args.insert(args.begin(), ""); // dummy argv[0] - files = opts.parse(args); - if(files.empty() && !argStr.empty()) - { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "no Slice files specified in `%s'", argStr.c_str()); - return false; - } + args.insert(args.begin(), ""); // dummy argv[0] + files = opts.parse(args); + if(files.empty() && !argStr.empty()) + { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "no Slice files specified in `%s'", argStr.c_str()); + return false; + } } catch(const IceUtil::Exception& ex) { - ostringstream ostr; - ex.ice_print(ostr); - string msg = ostr.str(); - php_error_docref(NULL TSRMLS_CC, E_ERROR, "error occurred while parsing Slice options in `%s':\n%s", - argStr.c_str(), msg.c_str()); - return false; + ostringstream ostr; + ex.ice_print(ostr); + string msg = ostr.str(); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "error occurred while parsing Slice options in `%s':\n%s", + argStr.c_str(), msg.c_str()); + return false; } string cppArgs; @@ -363,27 +363,27 @@ parseSlice(const string& argStr, Slice::UnitPtr& unit TSRMLS_DC) bool caseSensitive = false; if(opts.isSet("D")) { - vector<string> optargs = opts.argVec("D"); - for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - cppArgs += " -D" + *i; - } + vector<string> optargs = opts.argVec("D"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) + { + cppArgs += " -D" + *i; + } } if(opts.isSet("U")) { - vector<string> optargs = opts.argVec("U"); - for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - cppArgs += " -U" + *i; - } + vector<string> optargs = opts.argVec("U"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) + { + cppArgs += " -U" + *i; + } } if(opts.isSet("I")) { - vector<string> optargs = opts.argVec("I"); - for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - cppArgs += " -I" + *i; - } + vector<string> optargs = opts.argVec("I"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) + { + cppArgs += " -I" + *i; + } } debug = opts.isSet("d") || opts.isSet("debug"); caseSensitive = opts.isSet("case-sensitive"); @@ -445,27 +445,27 @@ createProfile(const string& name, const string& config, const string& options, c ostringstream ostr; ex.ice_print(ostr); php_error_docref(NULL TSRMLS_CC, E_ERROR, "unable to load Ice configuration file %s:\n%s", config.c_str(), - ostr.str().c_str()); + ostr.str().c_str()); return false; } } if(!options.empty()) { - vector<string> args; - try - { - args = IceUtil::Options::split(options); - } - catch(const IceUtil::Exception& ex) - { - ostringstream ostr; - ex.ice_print(ostr); - string msg = ostr.str(); - php_error_docref(NULL TSRMLS_CC, E_ERROR, "error occurred while parsing the options `%s':\n%s", - options.c_str(), msg.c_str()); - return false; - } + vector<string> args; + try + { + args = IceUtil::Options::split(options); + } + catch(const IceUtil::Exception& ex) + { + ostringstream ostr; + ex.ice_print(ostr); + string msg = ostr.str(); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "error occurred while parsing the options `%s':\n%s", + options.c_str(), msg.c_str()); + return false; + } properties->parseCommandLineOptions("", args); } @@ -522,26 +522,26 @@ createProfile(const string& name, const string& config, const string& options, c l = unit->lookupTypeNoBuiltin(scoped, false); if(l.empty()) { - Slice::ContainedList c = unit->lookupContained("Ice", false); - Slice::ModulePtr module; - if(c.empty()) - { - module = unit->createModule("Ice"); - } - else - { - module = Slice::ModulePtr::dynamicCast(c.front()); - if(!module) - { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "the symbol `::Ice' is defined in Slice but is not a module"); - return false; - } - } - Slice::EnumPtr en = module->createEnum("EndpointSelectionType", false); - Slice::EnumeratorList el; - el.push_back(module->createEnumerator("Random")); - el.push_back(module->createEnumerator("Ordered")); - en->setEnumerators(el); + Slice::ContainedList c = unit->lookupContained("Ice", false); + Slice::ModulePtr module; + if(c.empty()) + { + module = unit->createModule("Ice"); + } + else + { + module = Slice::ModulePtr::dynamicCast(c.front()); + if(!module) + { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "the symbol `::Ice' is defined in Slice but is not a module"); + return false; + } + } + Slice::EnumPtr en = module->createEnum("EndpointSelectionType", false); + Slice::EnumeratorList el; + el.push_back(module->createEnumerator("Random")); + el.push_back(module->createEnumerator("Ordered")); + en->setEnumerators(el); } // @@ -631,7 +631,7 @@ IcePHP::profileInit(TSRMLS_D) if(end == string::npos || s[s.length() - 1] != ']') { php_error_docref(NULL TSRMLS_CC, E_ERROR, "invalid profile section in file %s:\n%s\n", profiles, - line); + line); return false; } @@ -659,7 +659,7 @@ IcePHP::profileInit(TSRMLS_D) if(end == string::npos) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "invalid profile entry in file %s:\n%s\n", profiles, - line); + line); return false; } ++end; @@ -687,14 +687,14 @@ IcePHP::profileInit(TSRMLS_D) else { php_error_docref(NULL TSRMLS_CC, E_ERROR, "unknown profile entry in file %s:\n%s\n", profiles, - line); + line); return false; } if(currentName.empty()) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "no section for profile entry in file %s:\n%s\n", - profiles, line); + profiles, line); return false; } } @@ -723,7 +723,7 @@ IcePHP::profileShutdown(TSRMLS_D) ostringstream ostr; ex.ice_print(ostr); php_error_docref(NULL TSRMLS_CC, E_ERROR, "error while destroying Slice parse tree:\n%s\n", - ostr.str().c_str()); + ostr.str().c_str()); } delete p->second; @@ -741,22 +741,22 @@ do_load(const string& name, const Ice::StringSeq& args TSRMLS_DC) if(profile) { - // - // A profile has already been loaded; raise Ice_ProfileAlreadyLoadedException. - // - zend_class_entry* cls = findClass("Ice_ProfileAlreadyLoadedException" TSRMLS_CC); - assert(cls != NULL); - - zval* zex; - MAKE_STD_ZVAL(zex); - if(object_init_ex(zex, cls) != SUCCESS) - { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "unable to create exception %s", cls->name); - return false; - } - - zend_throw_exception_object(zex TSRMLS_CC); - return false; + // + // A profile has already been loaded; raise Ice_ProfileAlreadyLoadedException. + // + zend_class_entry* cls = findClass("Ice_ProfileAlreadyLoadedException" TSRMLS_CC); + assert(cls != NULL); + + zval* zex; + MAKE_STD_ZVAL(zex); + if(object_init_ex(zex, cls) != SUCCESS) + { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "unable to create exception %s", cls->name); + return false; + } + + zend_throw_exception_object(zex TSRMLS_CC); + return false; } string profileName = name; @@ -771,35 +771,35 @@ do_load(const string& name, const Ice::StringSeq& args TSRMLS_DC) // if(findClass("Ice_Exception" TSRMLS_CC) == NULL) { - if(zend_eval_string(const_cast<char*>(_coreTypes), NULL, "__core" TSRMLS_CC) == FAILURE) - { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "unable to create core types:\n%s\n", _coreTypes); - return false; - } + if(zend_eval_string(const_cast<char*>(_coreTypes), NULL, "__core" TSRMLS_CC) == FAILURE) + { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "unable to create core types:\n%s\n", _coreTypes); + return false; + } } map<string, Profile*>::iterator p = _profiles.find(profileName); if(p == _profiles.end()) { - zend_class_entry* cls = findClass("Ice_ProfileNotFoundException" TSRMLS_CC); - assert(cls != NULL); - - zval* zex; - MAKE_STD_ZVAL(zex); - if(object_init_ex(zex, cls) != SUCCESS) - { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "unable to create exception %s", cls->name); - return false; - } - - // - // Set the name member. - // - zend_update_property_string(cls, zex, "name", sizeof("name") - 1, - const_cast<char*>(profileName.c_str()) TSRMLS_CC); - - zend_throw_exception_object(zex TSRMLS_CC); - return false; + zend_class_entry* cls = findClass("Ice_ProfileNotFoundException" TSRMLS_CC); + assert(cls != NULL); + + zval* zex; + MAKE_STD_ZVAL(zex); + if(object_init_ex(zex, cls) != SUCCESS) + { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "unable to create exception %s", cls->name); + return false; + } + + // + // Set the name member. + // + zend_update_property_string(cls, zex, "name", sizeof("name") - 1, + const_cast<char*>(profileName.c_str()) TSRMLS_CC); + + zend_throw_exception_object(zex TSRMLS_CC); + return false; } profile = p->second; @@ -939,7 +939,7 @@ IcePHP::CodeVisitor::visitClassDecl(const Slice::ClassDeclPtr& p) { string scoped = p->scoped(); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s %s declared but not defined", - p->isInterface() ? "interface" : "class", scoped.c_str()); + p->isInterface() ? "interface" : "class", scoped.c_str()); } } diff --git a/php/src/IcePHP/Proxy.cpp b/php/src/IcePHP/Proxy.cpp index 384c7aea275..c0ce3bb19d3 100644 --- a/php/src/IcePHP/Proxy.cpp +++ b/php/src/IcePHP/Proxy.cpp @@ -347,7 +347,7 @@ fetchEndpoint(zval* zv, Ice::EndpointPtr& endpoint TSRMLS_DC) } ice_object* obj = static_cast<ice_object*>(p); assert(obj->ptr); - Ice::EndpointPtr* pe = static_cast<Ice::EndpointPtr*>(obj->ptr); + Ice::EndpointPtr* pe = static_cast<Ice::EndpointPtr*>(obj->ptr); endpoint = *pe; } return true; @@ -387,8 +387,8 @@ ZEND_FUNCTION(Ice_ObjectPrx___tostring) try { - string str = _this->toString(); - RETURN_STRINGL(const_cast<char*>(str.c_str()), str.length(), 1); + string str = _this->toString(); + RETURN_STRINGL(const_cast<char*>(str.c_str()), str.length(), 1); } catch(const IceUtil::Exception& ex) { @@ -844,16 +844,16 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_adapterId) try { - Ice::ObjectPrx prx = _this->getProxy()->ice_adapterId(id); - if(!createProxy(return_value, prx TSRMLS_CC)) - { - RETURN_NULL(); - } + Ice::ObjectPrx prx = _this->getProxy()->ice_adapterId(id); + if(!createProxy(return_value, prx TSRMLS_CC)) + { + RETURN_NULL(); + } } catch(const IceUtil::Exception& ex) { - throwException(ex TSRMLS_CC); - RETURN_NULL(); + throwException(ex TSRMLS_CC); + RETURN_NULL(); } } @@ -861,7 +861,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getEndpoints) { if(ZEND_NUM_ARGS() != 0) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -870,26 +870,26 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getEndpoints) try { - Ice::EndpointSeq endpoints = _this->getProxy()->ice_getEndpoints(); - - array_init(return_value); - uint idx = 0; - for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p, ++idx) - { - zval* elem; - MAKE_STD_ZVAL(elem); - if(!createEndpoint(elem, *p TSRMLS_CC)) - { - zval_ptr_dtor(&elem); - RETURN_NULL(); - } - add_index_zval(return_value, idx, elem); - } + Ice::EndpointSeq endpoints = _this->getProxy()->ice_getEndpoints(); + + array_init(return_value); + uint idx = 0; + for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p, ++idx) + { + zval* elem; + MAKE_STD_ZVAL(elem); + if(!createEndpoint(elem, *p TSRMLS_CC)) + { + zval_ptr_dtor(&elem); + RETURN_NULL(); + } + add_index_zval(return_value, idx, elem); + } } catch(const IceUtil::Exception& ex) { - throwException(ex TSRMLS_CC); - RETURN_NULL(); + throwException(ex TSRMLS_CC); + RETURN_NULL(); } } @@ -897,7 +897,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_endpoints) { if(ZEND_NUM_ARGS() != 1) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -908,7 +908,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_endpoints) if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &zv) == FAILURE) { - RETURN_NULL(); + RETURN_NULL(); } Ice::EndpointSeq seq; @@ -920,35 +920,35 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_endpoints) zend_hash_internal_pointer_reset_ex(arr, &pos); while(zend_hash_get_current_data_ex(arr, (void**)&val, &pos) != FAILURE) { - if(Z_TYPE_PP(val) != IS_OBJECT) - { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "expected an element of type Ice_Endpoint"); - RETURN_NULL(); - } + if(Z_TYPE_PP(val) != IS_OBJECT) + { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "expected an element of type Ice_Endpoint"); + RETURN_NULL(); + } - Ice::EndpointPtr endpoint; - if(!fetchEndpoint(*val, endpoint TSRMLS_CC)) - { - RETURN_NULL(); - } + Ice::EndpointPtr endpoint; + if(!fetchEndpoint(*val, endpoint TSRMLS_CC)) + { + RETURN_NULL(); + } - seq.push_back(endpoint); + seq.push_back(endpoint); - zend_hash_move_forward_ex(arr, &pos); + zend_hash_move_forward_ex(arr, &pos); } try { - Ice::ObjectPrx prx = _this->getProxy()->ice_endpoints(seq); - if(!createProxy(return_value, prx TSRMLS_CC)) - { - RETURN_NULL(); - } + Ice::ObjectPrx prx = _this->getProxy()->ice_endpoints(seq); + if(!createProxy(return_value, prx TSRMLS_CC)) + { + RETURN_NULL(); + } } catch(const IceUtil::Exception& ex) { - throwException(ex TSRMLS_CC); - RETURN_NULL(); + throwException(ex TSRMLS_CC); + RETURN_NULL(); } } @@ -956,7 +956,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getLocatorCacheTimeout) { if(ZEND_NUM_ARGS() != 0) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -965,13 +965,13 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getLocatorCacheTimeout) try { - Ice::Int timeout = _this->getProxy()->ice_getLocatorCacheTimeout(); - ZVAL_LONG(return_value, static_cast<long>(timeout)); + Ice::Int timeout = _this->getProxy()->ice_getLocatorCacheTimeout(); + ZVAL_LONG(return_value, static_cast<long>(timeout)); } catch(const IceUtil::Exception& ex) { - throwException(ex TSRMLS_CC); - RETURN_NULL(); + throwException(ex TSRMLS_CC); + RETURN_NULL(); } } @@ -979,7 +979,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_locatorCacheTimeout) { if(ZEND_NUM_ARGS() != 1) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -989,21 +989,21 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_locatorCacheTimeout) long l; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &l) != SUCCESS) { - RETURN_NULL(); + RETURN_NULL(); } try { - Ice::ObjectPrx prx = _this->getProxy()->ice_locatorCacheTimeout(l); - if(!createProxy(return_value, prx TSRMLS_CC)) - { - RETURN_NULL(); - } + Ice::ObjectPrx prx = _this->getProxy()->ice_locatorCacheTimeout(l); + if(!createProxy(return_value, prx TSRMLS_CC)) + { + RETURN_NULL(); + } } catch(const IceUtil::Exception& ex) { - throwException(ex TSRMLS_CC); - RETURN_NULL(); + throwException(ex TSRMLS_CC); + RETURN_NULL(); } } @@ -1011,7 +1011,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_isConnectionCached) { if(ZEND_NUM_ARGS() != 0) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -1020,13 +1020,13 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_isConnectionCached) try { - bool b = _this->getProxy()->ice_isConnectionCached(); - ZVAL_BOOL(return_value, b ? 1 : 0); + bool b = _this->getProxy()->ice_isConnectionCached(); + ZVAL_BOOL(return_value, b ? 1 : 0); } catch(const IceUtil::Exception& ex) { - throwException(ex TSRMLS_CC); - RETURN_NULL(); + throwException(ex TSRMLS_CC); + RETURN_NULL(); } } @@ -1034,7 +1034,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_connectionCached) { if(ZEND_NUM_ARGS() != 1) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -1044,21 +1044,21 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_connectionCached) zend_bool b; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &b) != SUCCESS) { - RETURN_NULL(); + RETURN_NULL(); } try { - Ice::ObjectPrx prx = _this->getProxy()->ice_connectionCached(b ? true : false); - if(!createProxy(return_value, prx TSRMLS_CC)) - { - RETURN_NULL(); - } + Ice::ObjectPrx prx = _this->getProxy()->ice_connectionCached(b ? true : false); + if(!createProxy(return_value, prx TSRMLS_CC)) + { + RETURN_NULL(); + } } catch(const IceUtil::Exception& ex) { - throwException(ex TSRMLS_CC); - RETURN_NULL(); + throwException(ex TSRMLS_CC); + RETURN_NULL(); } } @@ -1066,7 +1066,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getEndpointSelection) { if(ZEND_NUM_ARGS() != 0) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -1075,13 +1075,13 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getEndpointSelection) try { - Ice::EndpointSelectionType type = _this->getProxy()->ice_getEndpointSelection(); - ZVAL_LONG(return_value, type == Ice::Random ? 0 : 1); + Ice::EndpointSelectionType type = _this->getProxy()->ice_getEndpointSelection(); + ZVAL_LONG(return_value, type == Ice::Random ? 0 : 1); } catch(const IceUtil::Exception& ex) { - throwException(ex TSRMLS_CC); - RETURN_NULL(); + throwException(ex TSRMLS_CC); + RETURN_NULL(); } } @@ -1089,7 +1089,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_endpointSelection) { if(ZEND_NUM_ARGS() != 1) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -1099,27 +1099,27 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_endpointSelection) long l; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &l) != SUCCESS) { - RETURN_NULL(); + RETURN_NULL(); } if(l < 0 || l > 1) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "expecting Random or Ordered"); - RETURN_NULL(); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "expecting Random or Ordered"); + RETURN_NULL(); } try { - Ice::ObjectPrx prx = _this->getProxy()->ice_endpointSelection(l == 0 ? Ice::Random : Ice::Ordered); - if(!createProxy(return_value, prx TSRMLS_CC)) - { - RETURN_NULL(); - } + Ice::ObjectPrx prx = _this->getProxy()->ice_endpointSelection(l == 0 ? Ice::Random : Ice::Ordered); + if(!createProxy(return_value, prx TSRMLS_CC)) + { + RETURN_NULL(); + } } catch(const IceUtil::Exception& ex) { - throwException(ex TSRMLS_CC); - RETURN_NULL(); + throwException(ex TSRMLS_CC); + RETURN_NULL(); } } @@ -1127,7 +1127,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_isSecure) { if(ZEND_NUM_ARGS() != 0) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -1182,7 +1182,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_isPreferSecure) { if(ZEND_NUM_ARGS() != 0) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -1556,7 +1556,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_connectionId) try { char* id; - int idLen; + int idLen; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &idLen) != SUCCESS) { RETURN_NULL(); @@ -1633,7 +1633,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getConnection) { if(ZEND_NUM_ARGS() != 0) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -1642,16 +1642,16 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getConnection) try { - Ice::ConnectionPtr con = _this->getProxy()->ice_getConnection(); - if(!createConnection(return_value, con TSRMLS_CC)) - { - RETURN_NULL(); - } + Ice::ConnectionPtr con = _this->getProxy()->ice_getConnection(); + if(!createConnection(return_value, con TSRMLS_CC)) + { + RETURN_NULL(); + } } catch(const IceUtil::Exception& ex) { - throwException(ex TSRMLS_CC); - RETURN_NULL(); + throwException(ex TSRMLS_CC); + RETURN_NULL(); } } @@ -1659,7 +1659,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getCachedConnection) { if(ZEND_NUM_ARGS() != 0) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -1668,7 +1668,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getCachedConnection) try { - Ice::ConnectionPtr con = _this->getProxy()->ice_getCachedConnection(); + Ice::ConnectionPtr con = _this->getProxy()->ice_getCachedConnection(); if(!con || !createConnection(return_value, con TSRMLS_CC)) { RETURN_NULL(); @@ -1676,8 +1676,8 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getCachedConnection) } catch(const IceUtil::Exception& ex) { - throwException(ex TSRMLS_CC); - RETURN_NULL(); + throwException(ex TSRMLS_CC); + RETURN_NULL(); } } @@ -1764,7 +1764,7 @@ do_cast(INTERNAL_FUNCTION_PARAMETERS, bool check) if(findClassScoped(scoped TSRMLS_CC) == 0) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "the Slice definition for type %s has not been compiled", - scoped.c_str()); + scoped.c_str()); RETURN_NULL(); } @@ -1826,8 +1826,8 @@ ZEND_FUNCTION(Ice_Endpoint___tostring) try { - string str = (*_this)->toString(); - RETURN_STRINGL(const_cast<char*>(str.c_str()), str.length(), 1); + string str = (*_this)->toString(); + RETURN_STRINGL(const_cast<char*>(str.c_str()), str.length(), 1); } catch(const IceUtil::Exception& ex) { @@ -1859,8 +1859,8 @@ ZEND_FUNCTION(Ice_Connection___tostring) try { - string str = (*_this)->toString(); - RETURN_STRINGL(const_cast<char*>(str.c_str()), str.length(), 1); + string str = (*_this)->toString(); + RETURN_STRINGL(const_cast<char*>(str.c_str()), str.length(), 1); } catch(const IceUtil::Exception& ex) { @@ -1873,7 +1873,7 @@ ZEND_FUNCTION(Ice_Connection_close) { if(ZEND_NUM_ARGS() != 1) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -1883,12 +1883,12 @@ ZEND_FUNCTION(Ice_Connection_close) zend_bool b; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &b TSRMLS_CC) != SUCCESS) { - RETURN_NULL(); + RETURN_NULL(); } try { - (*_this)->close(b ? true : false); + (*_this)->close(b ? true : false); } catch(const IceUtil::Exception& ex) { @@ -1901,7 +1901,7 @@ ZEND_FUNCTION(Ice_Connection_flushBatchRequests) { if(ZEND_NUM_ARGS() > 0) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -1910,7 +1910,7 @@ ZEND_FUNCTION(Ice_Connection_flushBatchRequests) try { - (*_this)->flushBatchRequests(); + (*_this)->flushBatchRequests(); } catch(const IceUtil::Exception& ex) { @@ -1923,7 +1923,7 @@ ZEND_FUNCTION(Ice_Connection_type) { if(ZEND_NUM_ARGS() > 0) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -1932,8 +1932,8 @@ ZEND_FUNCTION(Ice_Connection_type) try { - string str = (*_this)->type(); - RETURN_STRINGL(const_cast<char*>(str.c_str()), str.length(), 1); + string str = (*_this)->type(); + RETURN_STRINGL(const_cast<char*>(str.c_str()), str.length(), 1); } catch(const IceUtil::Exception& ex) { @@ -1946,7 +1946,7 @@ ZEND_FUNCTION(Ice_Connection_timeout) { if(ZEND_NUM_ARGS() != 0) { - WRONG_PARAM_COUNT; + WRONG_PARAM_COUNT; } ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); @@ -1955,13 +1955,13 @@ ZEND_FUNCTION(Ice_Connection_timeout) try { - Ice::Int timeout = (*_this)->timeout(); - ZVAL_LONG(return_value, static_cast<long>(timeout)); + Ice::Int timeout = (*_this)->timeout(); + ZVAL_LONG(return_value, static_cast<long>(timeout)); } catch(const IceUtil::Exception& ex) { - throwException(ex TSRMLS_CC); - RETURN_NULL(); + throwException(ex TSRMLS_CC); + RETURN_NULL(); } } @@ -2001,7 +2001,7 @@ IcePHP::Operation::Operation(const Ice::ObjectPrx& proxy, const string& name, co Slice::ParamDeclList::const_iterator p; for(p = params.begin(), i = 0; p != params.end(); ++p, ++i) { - Slice::TypePtr paramType = (*p)->type(); + Slice::TypePtr paramType = (*p)->type(); MarshalerPtr m = Marshaler::createMarshaler(paramType TSRMLS_CC); if(!m) { @@ -2011,16 +2011,16 @@ IcePHP::Operation::Operation(const Ice::ObjectPrx& proxy, const string& name, co argInfo[i].name = NULL; argInfo[i].class_name = NULL; argInfo[i].allow_null = 1; - Slice::ContainedPtr cont = Slice::ContainedPtr::dynamicCast(paramType); - if(cont) - { - argInfo[i].array_type_hint = ((cont->containedType() == Slice::Contained::ContainedTypeSequence || - cont->containedType() == Slice::Contained::ContainedTypeDictionary) ? 1 : 0); - } - else - { - argInfo[i].array_type_hint = 0; - } + Slice::ContainedPtr cont = Slice::ContainedPtr::dynamicCast(paramType); + if(cont) + { + argInfo[i].array_type_hint = ((cont->containedType() == Slice::Contained::ContainedTypeSequence || + cont->containedType() == Slice::Contained::ContainedTypeDictionary) ? 1 : 0); + } + else + { + argInfo[i].array_type_hint = 0; + } argInfo[i].return_reference = 0; argInfo[i].required_num_args = static_cast<zend_uint>(params.size()); if((*p)->isOutParam()) @@ -2100,7 +2100,7 @@ IcePHP::Operation::invoke(INTERNAL_FUNCTION_PARAMETERS) if(!PZVAL_IS_REF(*args[i])) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "argument for out parameter %s must be passed by reference", - _paramNames[i].c_str()); + _paramNames[i].c_str()); return; } } @@ -2368,7 +2368,7 @@ handleProxyAlloc(zend_class_entry* ce TSRMLS_DC) assert(obj); result.handle = zend_objects_store_put(obj, NULL, (zend_objects_free_object_storage_t)handleProxyFreeStorage, - NULL TSRMLS_CC); + NULL TSRMLS_CC); result.handlers = &_proxyHandlers; return result; @@ -2450,7 +2450,7 @@ handleProxyGetMethod(zval** zv, char* method, int len TSRMLS_DC) assert(obj->ptr); Proxy* _this = static_cast<Proxy*>(obj->ptr); - Slice::ClassDefPtr def = _this->getClass(); + Slice::ClassDefPtr def = _this->getClass(); if(!def) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "unknown method %s invoked on untyped proxy", method); @@ -2460,9 +2460,9 @@ handleProxyGetMethod(zval** zv, char* method, int len TSRMLS_DC) OperationPtr op = _this->getOperation(method); if(!op) { - string scoped = def->scoped(); + string scoped = def->scoped(); php_error_docref(NULL TSRMLS_CC, E_ERROR, "unknown operation %s invoked on proxy of type %s", method, - scoped.c_str()); + scoped.c_str()); return NULL; } @@ -2530,7 +2530,7 @@ handleEndpointAlloc(zend_class_entry* ce TSRMLS_DC) assert(obj); result.handle = zend_objects_store_put(obj, NULL, (zend_objects_free_object_storage_t)handleEndpointFreeStorage, - NULL TSRMLS_CC); + NULL TSRMLS_CC); result.handlers = &_endpointHandlers; return result; @@ -2562,7 +2562,7 @@ handleConnectionAlloc(zend_class_entry* ce TSRMLS_DC) assert(obj); result.handle = zend_objects_store_put(obj, NULL, (zend_objects_free_object_storage_t)handleConnectionFreeStorage, - NULL TSRMLS_CC); + NULL TSRMLS_CC); result.handlers = &_connectionHandlers; return result; @@ -2604,14 +2604,14 @@ handleConnectionCompare(zval* zobj1, zval* zobj2 TSRMLS_DC) if(con1 == con2) { - return 0; + return 0; } else if(con1 < con2) { - return -1; + return -1; } else { - return 1; + return 1; } } diff --git a/php/src/IcePHP/Proxy.h b/php/src/IcePHP/Proxy.h index 17a41c6c7aa..298a9de912b 100644 --- a/php/src/IcePHP/Proxy.h +++ b/php/src/IcePHP/Proxy.h @@ -80,49 +80,49 @@ ZEND_FUNCTION(Ice_Connection_toString); } #define ICE_PHP_PROXY_FUNCTIONS \ - ZEND_FE(Ice_ObjectPrx___construct, NULL) \ - ZEND_FE(Ice_ObjectPrx___tostring, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_getCommunicator, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_toString, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_isA, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_ping, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_id, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_ids, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_getIdentity, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_identity, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_getContext, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_context, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_defaultContext, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_getFacet, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_facet, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_getAdapterId, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_adapterId, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_getEndpoints, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_endpoints, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_getLocatorCacheTimeout, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_locatorCacheTimeout, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_isConnectionCached, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_connectionCached, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_getEndpointSelection, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_endpointSelection, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_isSecure, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_secure, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_twoway, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_isTwoway, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_oneway, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_isOneway, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_batchOneway, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_isBatchOneway, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_datagram, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_isDatagram, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_batchDatagram, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_isBatchDatagram, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_compress, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_timeout, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_connectionId, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_getConnection, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_uncheckedCast, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_checkedCast, NULL) + ZEND_FE(Ice_ObjectPrx___construct, NULL) \ + ZEND_FE(Ice_ObjectPrx___tostring, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_getCommunicator, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_toString, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_isA, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_ping, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_id, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_ids, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_getIdentity, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_identity, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_getContext, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_context, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_defaultContext, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_getFacet, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_facet, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_getAdapterId, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_adapterId, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_getEndpoints, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_endpoints, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_getLocatorCacheTimeout, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_locatorCacheTimeout, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_isConnectionCached, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_connectionCached, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_getEndpointSelection, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_endpointSelection, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_isSecure, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_secure, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_twoway, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_isTwoway, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_oneway, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_isOneway, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_batchOneway, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_isBatchOneway, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_datagram, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_isDatagram, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_batchDatagram, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_isBatchDatagram, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_compress, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_timeout, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_connectionId, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_getConnection, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_uncheckedCast, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_checkedCast, NULL) #define ICE_PHP_ENDPOINT_FUNCTIONS \ ZEND_FE(Ice_Endpoint___construct, NULL) \ diff --git a/php/src/IcePHP/Util.cpp b/php/src/IcePHP/Util.cpp index 4cfcfeb3987..51424c740df 100644 --- a/php/src/IcePHP/Util.cpp +++ b/php/src/IcePHP/Util.cpp @@ -178,7 +178,7 @@ IcePHP::extractIdentity(zval* zv, Ice::Identity& id TSRMLS_DC) { string s = zendTypeToString(Z_TYPE_PP(nameVal)); php_error_docref(NULL TSRMLS_CC, E_ERROR, "expected a string value for identity member `name' but received %s", - s.c_str()); + s.c_str()); return false; } @@ -186,7 +186,7 @@ IcePHP::extractIdentity(zval* zv, Ice::Identity& id TSRMLS_DC) { string s = zendTypeToString(Z_TYPE_PP(categoryVal)); php_error_docref(NULL TSRMLS_CC, E_ERROR, - "expected a string value for identity member `category' but received %s", s.c_str()); + "expected a string value for identity member `category' but received %s", s.c_str()); return false; } @@ -225,7 +225,7 @@ IcePHP::extractContext(zval* zv, Ice::Context& ctx TSRMLS_DC) { string s = zendTypeToString(Z_TYPE_P(zv)); php_error_docref(NULL TSRMLS_CC, E_ERROR, "expected an array for the context argument but received %s", - s.c_str()); + s.c_str()); return false; } @@ -301,7 +301,7 @@ IcePHP::getObject(zval* zv TSRMLS_DC) if(!zv) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "method %s() must be invoked on an object", - get_active_function_name(TSRMLS_C)); + get_active_function_name(TSRMLS_C)); return 0; } @@ -324,32 +324,32 @@ IcePHP::throwException(const IceUtil::Exception& ex TSRMLS_DC) } catch(const Ice::TwowayOnlyException& e) { - string name = e.ice_name(); - zend_class_entry* cls = findClassScoped(name TSRMLS_CC); - if(!cls) - { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "unable to find class %s", name.c_str()); - return; - } - - zval* zex; - MAKE_STD_ZVAL(zex); - if(object_init_ex(zex, cls) != SUCCESS) - { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "unable to create exception %s", cls->name); - return; - } - - // - // Set the unknown member. - // - zend_update_property_string(cls, zex, "operation", sizeof("operation") - 1, - const_cast<char*>(e.operation.c_str()) TSRMLS_CC); - - // - // Throw the exception. - // - zend_throw_exception_object(zex TSRMLS_CC); + string name = e.ice_name(); + zend_class_entry* cls = findClassScoped(name TSRMLS_CC); + if(!cls) + { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "unable to find class %s", name.c_str()); + return; + } + + zval* zex; + MAKE_STD_ZVAL(zex); + if(object_init_ex(zex, cls) != SUCCESS) + { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "unable to create exception %s", cls->name); + return; + } + + // + // Set the unknown member. + // + zend_update_property_string(cls, zex, "operation", sizeof("operation") - 1, + const_cast<char*>(e.operation.c_str()) TSRMLS_CC); + + // + // Throw the exception. + // + zend_throw_exception_object(zex TSRMLS_CC); } catch(const Ice::UnknownException& e) { @@ -491,7 +491,7 @@ IcePHP::throwException(const IceUtil::Exception& ex TSRMLS_DC) // zend_update_property_string(cls, zex, "type", sizeof("type") - 1, const_cast<char*>(e.type.c_str()) TSRMLS_CC); zend_update_property_string(cls, zex, "expectedType", sizeof("expectedType") - 1, - const_cast<char*>(e.expectedType.c_str()) TSRMLS_CC); + const_cast<char*>(e.expectedType.c_str()) TSRMLS_CC); // // Throw the exception. |