diff options
Diffstat (limited to 'php')
-rwxr-xr-x | php/allTests.py | 48 | ||||
-rw-r--r-- | php/config/TestUtil.py | 108 | ||||
-rwxr-xr-x | php/demo/Ice/hello/hello.php | 38 | ||||
-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 | ||||
-rw-r--r-- | php/test/Ice/binding/Client.php | 756 | ||||
-rw-r--r-- | php/test/Ice/operations/Client.php | 6 | ||||
-rw-r--r-- | php/test/Ice/operations/Test.ice | 42 | ||||
-rw-r--r-- | php/test/Ice/slicing/exceptions/Client.php | 26 | ||||
-rw-r--r-- | php/test/Ice/slicing/objects/Client.php | 12 | ||||
-rw-r--r-- | php/test/Ice/slicing/objects/Test.ice | 4 |
15 files changed, 1209 insertions, 1209 deletions
diff --git a/php/allTests.py b/php/allTests.py index 0ef0e1b4220..62f603e5b97 100755 --- a/php/allTests.py +++ b/php/allTests.py @@ -25,22 +25,22 @@ def runTests(args, tests, num = 0): # for i in tests: - i = os.path.normpath(i) - dir = os.path.join(toplevel, "test", i) + i = os.path.normpath(i) + dir = os.path.join(toplevel, "test", i) - print - if(num > 0): - print "[" + str(num) + "]", - print "*** running tests in " + dir, - print + print + if(num > 0): + print "[" + str(num) + "]", + print "*** running tests in " + dir, + print status = os.system("python " + os.path.join(dir, "run.py " + args)) - if status and not (sys.platform.startswith("aix") and status == 256): - if(num > 0): - print "[" + str(num) + "]", - print "test in " + dir + " failed with exit status", status, - sys.exit(status) + if status and not (sys.platform.startswith("aix") and status == 256): + if(num > 0): + print "[" + str(num) + "]", + print "test in " + dir + " failed with exit status", status, + sys.exit(status) # # List of all basic tests. @@ -62,7 +62,7 @@ def usage(): try: opts, args = getopt.getopt(sys.argv[1:], "lr:R:", \ - ["debug", "protocol=", "compress", "host=", "threadPerConnection"]) + ["debug", "protocol=", "compress", "host=", "threadPerConnection"]) except getopt.GetoptError: usage() @@ -75,23 +75,23 @@ for o, a in opts: if o == "-l": loop = 1 if o == "-r" or o == '-R': - import re - regexp = re.compile(a) - if o == '-r': - def rematch(x): return regexp.search(x) - else: - def rematch(x): return not regexp.search(x) - tests = filter(rematch, tests) + import re + regexp = re.compile(a) + if o == '-r': + def rematch(x): return regexp.search(x) + else: + def rematch(x): return not regexp.search(x) + tests = filter(rematch, tests) if o in ( "--protocol", "--host" ): - args += " " + o + " " + a + args += " " + o + " " + a if o in ( "--debug", "--compress", "--threadPerConnection" ): - args += " " + o + args += " " + o if loop: num = 1 while 1: - runTests(args, tests, num) - num += 1 + runTests(args, tests, num) + num += 1 else: runTests(args, tests) diff --git a/php/config/TestUtil.py b/php/config/TestUtil.py index 8c09d262128..78ad2024237 100644 --- a/php/config/TestUtil.py +++ b/php/config/TestUtil.py @@ -57,15 +57,15 @@ except getopt.GetoptError: for o, a in opts: if o == "--debug": - debug = 1 + debug = 1 if o == "--protocol": - protocol = a + protocol = a if o == "--compress": - compress = 1 + compress = 1 if o == "--threadPerConnection": - threadPerConnection = 1 + threadPerConnection = 1 if o == "--host": - host = a + host = a # # Check for ICE_HOME @@ -101,13 +101,13 @@ def isSolaris(): def closePipe(pipe): try: - status = pipe.close() + status = pipe.close() except IOError, ex: - # TODO: There's a waitpid problem on CentOS, so we have to ignore ECHILD. - if ex.errno == errno.ECHILD: - status = 0 - else: - raise + # TODO: There's a waitpid problem on CentOS, so we have to ignore ECHILD. + if ex.errno == errno.ECHILD: + status = 0 + else: + raise return status @@ -118,22 +118,22 @@ class ReaderThread(Thread): def run(self): - #print "started: " + str(self) + ": " + str(thread.get_ident()) + #print "started: " + str(self) + ": " + str(thread.get_ident()) try: while 1: line = self.pipe.readline() if not line: break - # Suppress "adapter ready" messages. Under windows the eol isn't \n. - if not line.endswith(" ready\n") and not line.endswith(" ready\r\n"): - print "server: " + line, + # Suppress "adapter ready" messages. Under windows the eol isn't \n. + if not line.endswith(" ready\n") and not line.endswith(" ready\r\n"): + print "server: " + line, except IOError: pass - self.status = closePipe(self.pipe) - #print "terminating: " + str(self) + self.status = closePipe(self.pipe) + #print "terminating: " + str(self) def getStatus(self): - return self.status + return self.status serverPids = [] serverThreads = [] @@ -143,18 +143,18 @@ def joinServers(): global serverThreads global allServerThreads for t in serverThreads: - t.join() - allServerThreads.append(t) + t.join() + allServerThreads.append(t) serverThreads = [] def serverStatus(): global allServerThreads joinServers() for t in allServerThreads: - status = t.getStatus() - if status: - print "server " + str(t) + " status: " + str(status) - return status + status = t.getStatus() + if status: + print "server " + str(t) + " status: " + str(status) + return status return 0 def killServers(): @@ -192,32 +192,32 @@ def getServerPid(pipe): global serverThreads while 1: - output = pipe.readline().strip() - if not output: - print "failed!" - killServers() - sys.exit(1) - if output.startswith("warning: "): - continue - break + output = pipe.readline().strip() + if not output: + print "failed!" + killServers() + sys.exit(1) + if output.startswith("warning: "): + continue + break try: - serverPids.append(int(output)) + serverPids.append(int(output)) except ValueError: - print "Output is not a PID: " + output - raise + print "Output is not a PID: " + output + raise def ignorePid(pipe): while 1: - output = pipe.readline().strip() - if not output: - print "failed!" - killServers() - sys.exit(1) - if output.startswith("warning: "): - continue - break + output = pipe.readline().strip() + if not output: + print "failed!" + killServers() + sys.exit(1) + if output.startswith("warning: "): + continue + break def getAdapterReady(pipe, createThread = True): global serverThreads @@ -231,9 +231,9 @@ def getAdapterReady(pipe, createThread = True): # Start a thread for this server. if createThread: - serverThread = ReaderThread(pipe) - serverThread.start() - serverThreads.append(serverThread) + serverThread = ReaderThread(pipe) + serverThread.start() + serverThreads.append(serverThread) def waitServiceReady(pipe, token, createThread = True): global serverThreads @@ -248,9 +248,9 @@ def waitServiceReady(pipe, token, createThread = True): # Start a thread for this server. if createThread: - serverThread = ReaderThread(pipe) - serverThread.start() - serverThreads.append(serverThread) + serverThread = ReaderThread(pipe) + serverThread.start() + serverThreads.append(serverThread) def printOutputFromPipe(pipe): @@ -274,7 +274,7 @@ else: os.environ["LD_LIBRARY_PATH_64"] = os.path.join(ice_home, "lib") + ":" + os.getenv("LD_LIBRARY_PATH_64", "") if protocol == "ssl": - plugin = " --Ice.Plugin.IceSSL=IceSSL:createIceSSL" + plugin = " --Ice.Plugin.IceSSL=IceSSL:createIceSSL" clientProtocol = plugin + " --Ice.Default.Protocol=ssl" + \ " --IceSSL.DefaultDir=" + os.path.join(ice_home, "certs") + \ " --IceSSL.CertFile=c_rsa1024_pub.pem" + \ @@ -328,7 +328,7 @@ def clientServerTestWithOptionsAndNames(name, additionalServerOptions, additiona print "starting " + serverName + "...", serverCmd = server + serverOptions + additionalServerOptions if debug: - print "(" + serverCmd + ")", + print "(" + serverCmd + ")", serverPipe = os.popen(serverCmd + " 2>&1") getServerPid(serverPipe) getAdapterReady(serverPipe) @@ -337,7 +337,7 @@ def clientServerTestWithOptionsAndNames(name, additionalServerOptions, additiona print "starting " + clientName + "...", clientCmd = client + " -- " + clientOptions + additionalClientOptions if debug: - print "(" + clientCmd + ")", + print "(" + clientCmd + ")", clientPipe = os.popen(clientCmd + " 2>&1") print "ok" @@ -345,10 +345,10 @@ def clientServerTestWithOptionsAndNames(name, additionalServerOptions, additiona clientStatus = closePipe(clientPipe) if clientStatus: - killServers() + killServers() if clientStatus or serverStatus(): - sys.exit(1) + sys.exit(1) os.chdir(cwd) diff --git a/php/demo/Ice/hello/hello.php b/php/demo/Ice/hello/hello.php index 1bcbefc1b17..f1da7600d59 100755 --- a/php/demo/Ice/hello/hello.php +++ b/php/demo/Ice/hello/hello.php @@ -29,26 +29,26 @@ if(isset($_POST["submitted"])) echo "<P>Status:<BR><B>\n"; try { - if($have_ssl) - { - $p = $ICE->stringToProxy("hello:tcp -p 10000:udp -p 10000:ssl -p 10001"); - } - else - { - $p = $ICE->stringToProxy("hello:tcp -p 10000:udp -p 10000"); - } + if($have_ssl) + { + $p = $ICE->stringToProxy("hello:tcp -p 10000:udp -p 10000:ssl -p 10001"); + } + else + { + $p = $ICE->stringToProxy("hello:tcp -p 10000:udp -p 10000"); + } - if(isset($_POST["mode"])) - { - if($_POST["mode"] == "oneway") - { - $p = $p->ice_oneway(); - } - elseif($_POST["mode"] == "datagram") - { - $p = $p->ice_datagram(); - } - } + if(isset($_POST["mode"])) + { + if($_POST["mode"] == "oneway") + { + $p = $p->ice_oneway(); + } + elseif($_POST["mode"] == "datagram") + { + $p = $p->ice_datagram(); + } + } if(isset($_POST["secure"]) and $_POST["secure"] == "yes") { 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. diff --git a/php/test/Ice/binding/Client.php b/php/test/Ice/binding/Client.php index 06d34f09bec..9e1d85eb423 100644 --- a/php/test/Ice/binding/Client.php +++ b/php/test/Ice/binding/Client.php @@ -27,12 +27,12 @@ function createTestIntfPrx($adapters) $test = null; foreach($adapters as $p) { - $test = $p->getTestIntf(); - $edpts = $test->ice_getEndpoints(); - foreach($edpts as $e) - { - $endpoints[] = $e; - } + $test = $p->getTestIntf(); + $edpts = $test->ice_getEndpoints(); + foreach($edpts as $e) + { + $endpoints[] = $e; + } } $test = $test->ice_endpoints($endpoints); return $test->ice_uncheckedCast("::Test::TestIntf"); @@ -42,7 +42,7 @@ function deactivate($com, $adapters) { foreach($adapters as $p) { - $com->deactivateObjectAdapter($p); + $com->deactivateObjectAdapter($p); } } @@ -56,429 +56,429 @@ function allTests() echo "testing binding with single endpoint... "; flush(); { - $adapter = $com->createObjectAdapter("Adapter", "default"); + $adapter = $com->createObjectAdapter("Adapter", "default"); - $test1 = $adapter->getTestIntf(); - $test2 = $adapter->getTestIntf(); - test($test1->ice_getConnection() == $test2->ice_getConnection()); + $test1 = $adapter->getTestIntf(); + $test2 = $adapter->getTestIntf(); + test($test1->ice_getConnection() == $test2->ice_getConnection()); - $test1->ice_ping(); - $test2->ice_ping(); + $test1->ice_ping(); + $test2->ice_ping(); - $com->deactivateObjectAdapter($adapter); + $com->deactivateObjectAdapter($adapter); - $test3 = $test1->ice_uncheckedCast("::Test::TestIntf"); - test($test3->ice_getConnection() == $test1->ice_getConnection()); - test($test3->ice_getConnection() == $test2->ice_getConnection()); + $test3 = $test1->ice_uncheckedCast("::Test::TestIntf"); + test($test3->ice_getConnection() == $test1->ice_getConnection()); + test($test3->ice_getConnection() == $test2->ice_getConnection()); - try - { - $test3->ice_ping(); - test(false); - } - catch(Ice_LocalException $ex) // Expecting ConnectionRefusedException - { - } + try + { + $test3->ice_ping(); + test(false); + } + catch(Ice_LocalException $ex) // Expecting ConnectionRefusedException + { + } } echo "ok" . "\n"; echo "testing binding with multiple endpoints... "; flush(); { - $adapters = array(); - $adapters[] = $com->createObjectAdapter("Adapter11", "default"); - $adapters[] = $com->createObjectAdapter("Adapter12", "default"); - $adapters[] = $com->createObjectAdapter("Adapter13", "default"); - - // - // Ensure that when a connection is opened it's reused for new - // proxies and that all endpoints are eventually tried. - // - $names = array("Adapter11", "Adapter12", "Adapter13"); - while(count($names) > 0) - { - $adpts = $adapters; - - $test1 = createTestIntfPrx($adpts); - shuffle($adpts); - $test2 = createTestIntfPrx($adpts); - shuffle($adpts); - $test3 = createTestIntfPrx($adpts); - - test($test1->ice_getConnection() == $test2->ice_getConnection()); - test($test2->ice_getConnection() == $test3->ice_getConnection()); - - $key = array_search($test1->getAdapterName(), $names); - if($key !== false) - { - unset($names[$key]); - } - $test1->ice_getConnection()->close(false); - } - - // - // Ensure that the proxy correctly caches the connection (we - // always send the request over the same connection.) - // - { - foreach($adapters as $p) - { - $p->getTestIntf()->ice_ping(); - } - - $test = createTestIntfPrx($adapters); - $name = $test->getAdapterName(); - $nRetry = 10; - for($i = 0; $i < $nRetry && $test->getAdapterName() == $name; $i++); - test($i == $nRetry); - - foreach($adapters as $p) - { - $p->getTestIntf()->ice_getConnection()->close(false); - } - } - - // - // Deactivate an adapter and ensure that we can still - // establish the connection to the remaining adapters. - // - $com->deactivateObjectAdapter($adapters[0]); - $names = array("Adapter12", "Adapter13"); - while(count($names) > 0) - { - $adpts = $adapters; - - $test1 = createTestIntfPrx($adpts); - shuffle($adpts); - $test2 = createTestIntfPrx($adpts); - shuffle($adpts); - $test3 = createTestIntfPrx($adpts); - - test($test1->ice_getConnection() == $test2->ice_getConnection()); - test($test2->ice_getConnection() == $test3->ice_getConnection()); - - $key = array_search($test1->getAdapterName(), $names); - if($key !== false) - { - unset($names[$key]); - } - $test1->ice_getConnection()->close(false); - } - - // - // Deactivate an adapter and ensure that we can still - // establish the connection to the remaining adapter. - // - $com->deactivateObjectAdapter($adapters[2]); - $test = createTestIntfPrx($adapters); - test($test->getAdapterName() == "Adapter12"); - - deactivate($com, $adapters); + $adapters = array(); + $adapters[] = $com->createObjectAdapter("Adapter11", "default"); + $adapters[] = $com->createObjectAdapter("Adapter12", "default"); + $adapters[] = $com->createObjectAdapter("Adapter13", "default"); + + // + // Ensure that when a connection is opened it's reused for new + // proxies and that all endpoints are eventually tried. + // + $names = array("Adapter11", "Adapter12", "Adapter13"); + while(count($names) > 0) + { + $adpts = $adapters; + + $test1 = createTestIntfPrx($adpts); + shuffle($adpts); + $test2 = createTestIntfPrx($adpts); + shuffle($adpts); + $test3 = createTestIntfPrx($adpts); + + test($test1->ice_getConnection() == $test2->ice_getConnection()); + test($test2->ice_getConnection() == $test3->ice_getConnection()); + + $key = array_search($test1->getAdapterName(), $names); + if($key !== false) + { + unset($names[$key]); + } + $test1->ice_getConnection()->close(false); + } + + // + // Ensure that the proxy correctly caches the connection (we + // always send the request over the same connection.) + // + { + foreach($adapters as $p) + { + $p->getTestIntf()->ice_ping(); + } + + $test = createTestIntfPrx($adapters); + $name = $test->getAdapterName(); + $nRetry = 10; + for($i = 0; $i < $nRetry && $test->getAdapterName() == $name; $i++); + test($i == $nRetry); + + foreach($adapters as $p) + { + $p->getTestIntf()->ice_getConnection()->close(false); + } + } + + // + // Deactivate an adapter and ensure that we can still + // establish the connection to the remaining adapters. + // + $com->deactivateObjectAdapter($adapters[0]); + $names = array("Adapter12", "Adapter13"); + while(count($names) > 0) + { + $adpts = $adapters; + + $test1 = createTestIntfPrx($adpts); + shuffle($adpts); + $test2 = createTestIntfPrx($adpts); + shuffle($adpts); + $test3 = createTestIntfPrx($adpts); + + test($test1->ice_getConnection() == $test2->ice_getConnection()); + test($test2->ice_getConnection() == $test3->ice_getConnection()); + + $key = array_search($test1->getAdapterName(), $names); + if($key !== false) + { + unset($names[$key]); + } + $test1->ice_getConnection()->close(false); + } + + // + // Deactivate an adapter and ensure that we can still + // establish the connection to the remaining adapter. + // + $com->deactivateObjectAdapter($adapters[2]); + $test = createTestIntfPrx($adapters); + test($test->getAdapterName() == "Adapter12"); + + deactivate($com, $adapters); } echo "ok" . "\n"; echo "testing random endpoint selection... "; flush(); { - $adapters = array(); - $adapters[] = $com->createObjectAdapter("Adapter21", "default"); - $adapters[] = $com->createObjectAdapter("Adapter22", "default"); - $adapters[] = $com->createObjectAdapter("Adapter23", "default"); - - $test = createTestIntfPrx($adapters); - test($test->ice_getEndpointSelection() == Ice_EndpointSelectionType::Random); - - $names = array("Adapter21", "Adapter22", "Adapter23"); - while(count($names) > 0) - { - $key = array_search($test->getAdapterName(), $names); - if($key !== false) - { - unset($names[$key]); - } - $test->ice_getConnection()->close(false); - } - - $test = $test->ice_endpointSelection(Ice_EndpointSelectionType::Random)->ice_uncheckedCast("::Test::TestIntf"); - test($test->ice_getEndpointSelection() == Ice_EndpointSelectionType::Random); - - $names = array("Adapter21", "Adapter22", "Adapter23"); - while(count($names) > 0) - { - $key = array_search($test->getAdapterName(), $names); - if($key !== false) - { - unset($names[$key]); - } - $test->ice_getConnection()->close(false); - } - - deactivate($com, $adapters); + $adapters = array(); + $adapters[] = $com->createObjectAdapter("Adapter21", "default"); + $adapters[] = $com->createObjectAdapter("Adapter22", "default"); + $adapters[] = $com->createObjectAdapter("Adapter23", "default"); + + $test = createTestIntfPrx($adapters); + test($test->ice_getEndpointSelection() == Ice_EndpointSelectionType::Random); + + $names = array("Adapter21", "Adapter22", "Adapter23"); + while(count($names) > 0) + { + $key = array_search($test->getAdapterName(), $names); + if($key !== false) + { + unset($names[$key]); + } + $test->ice_getConnection()->close(false); + } + + $test = $test->ice_endpointSelection(Ice_EndpointSelectionType::Random)->ice_uncheckedCast("::Test::TestIntf"); + test($test->ice_getEndpointSelection() == Ice_EndpointSelectionType::Random); + + $names = array("Adapter21", "Adapter22", "Adapter23"); + while(count($names) > 0) + { + $key = array_search($test->getAdapterName(), $names); + if($key !== false) + { + unset($names[$key]); + } + $test->ice_getConnection()->close(false); + } + + deactivate($com, $adapters); } echo "ok" . "\n"; echo "testing ordered endpoint selection... "; flush(); { - $adapters = array(); - $adapters[] = $com->createObjectAdapter("Adapter31", "default"); - $adapters[] = $com->createObjectAdapter("Adapter32", "default"); - $adapters[] = $com->createObjectAdapter("Adapter33", "default"); - - $test = createTestIntfPrx($adapters); - $test = $test->ice_endpointSelection(Ice_EndpointSelectionType::Ordered)->ice_uncheckedCast("::Test::TestIntf"); - test($test->ice_getEndpointSelection() == Ice_EndpointSelectionType::Ordered); - $nRetry = 5; - - // - // Ensure that endpoints are tried in order by deactiving the adapters - // one after the other. - // - for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter31"; $i++); - test($i == $nRetry); - $com->deactivateObjectAdapter($adapters[0]); - for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter32"; $i++); - test($i == $nRetry); - $com->deactivateObjectAdapter($adapters[1]); - for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter33"; $i++); - test($i == $nRetry); - $com->deactivateObjectAdapter($adapters[2]); - - try - { - $test->getAdapterName(); - } - catch(Ice_LocalException $ex) // Expecting ConnectionRefusedException - { - } - - $endpoints = $test->ice_getEndpoints(); - - $adapters = array(); - - // - // Now, re-activate the adapters with the same endpoints in the opposite - // order. - // - $adapters[] = $com->createObjectAdapter("Adapter36", $endpoints[2]->toString()); - for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter36"; $i++); - test($i == $nRetry); - $test->ice_getConnection()->close(false); - $adapters[] = $com->createObjectAdapter("Adapter35", $endpoints[1]->toString()); - for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter35"; $i++); - test($i == $nRetry); - $test->ice_getConnection()->close(false); - $adapters[] = $com->createObjectAdapter("Adapter34", $endpoints[0]->toString()); - for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter34"; $i++); - test($i == $nRetry); - - deactivate($com, $adapters); + $adapters = array(); + $adapters[] = $com->createObjectAdapter("Adapter31", "default"); + $adapters[] = $com->createObjectAdapter("Adapter32", "default"); + $adapters[] = $com->createObjectAdapter("Adapter33", "default"); + + $test = createTestIntfPrx($adapters); + $test = $test->ice_endpointSelection(Ice_EndpointSelectionType::Ordered)->ice_uncheckedCast("::Test::TestIntf"); + test($test->ice_getEndpointSelection() == Ice_EndpointSelectionType::Ordered); + $nRetry = 5; + + // + // Ensure that endpoints are tried in order by deactiving the adapters + // one after the other. + // + for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter31"; $i++); + test($i == $nRetry); + $com->deactivateObjectAdapter($adapters[0]); + for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter32"; $i++); + test($i == $nRetry); + $com->deactivateObjectAdapter($adapters[1]); + for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter33"; $i++); + test($i == $nRetry); + $com->deactivateObjectAdapter($adapters[2]); + + try + { + $test->getAdapterName(); + } + catch(Ice_LocalException $ex) // Expecting ConnectionRefusedException + { + } + + $endpoints = $test->ice_getEndpoints(); + + $adapters = array(); + + // + // Now, re-activate the adapters with the same endpoints in the opposite + // order. + // + $adapters[] = $com->createObjectAdapter("Adapter36", $endpoints[2]->toString()); + for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter36"; $i++); + test($i == $nRetry); + $test->ice_getConnection()->close(false); + $adapters[] = $com->createObjectAdapter("Adapter35", $endpoints[1]->toString()); + for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter35"; $i++); + test($i == $nRetry); + $test->ice_getConnection()->close(false); + $adapters[] = $com->createObjectAdapter("Adapter34", $endpoints[0]->toString()); + for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter34"; $i++); + test($i == $nRetry); + + deactivate($com, $adapters); } echo "ok" . "\n"; echo "testing per request binding with single endpoint... "; flush(); { - $adapter = $com->createObjectAdapter("Adapter41", "default"); - - $test1 = $adapter->getTestIntf()->ice_connectionCached(false)->ice_uncheckedCast("::Test::TestIntf"); - $test2 = $adapter->getTestIntf()->ice_connectionCached(false)->ice_uncheckedCast("::Test::TestIntf"); - test(!$test1->ice_isConnectionCached()); - test(!$test2->ice_isConnectionCached()); - test($test1->ice_getConnection() == $test2->ice_getConnection()); - - $test1->ice_ping(); - - $com->deactivateObjectAdapter($adapter); - - $test3 = $test1->ice_uncheckedCast("::Test::TestIntf"); - try - { - test($test3->ice_getConnection() == $test1->ice_getConnection()); - test(false); - } - catch(Ice_LocalException $ex) // Expecting ConnectionRefusedException - { - } + $adapter = $com->createObjectAdapter("Adapter41", "default"); + + $test1 = $adapter->getTestIntf()->ice_connectionCached(false)->ice_uncheckedCast("::Test::TestIntf"); + $test2 = $adapter->getTestIntf()->ice_connectionCached(false)->ice_uncheckedCast("::Test::TestIntf"); + test(!$test1->ice_isConnectionCached()); + test(!$test2->ice_isConnectionCached()); + test($test1->ice_getConnection() == $test2->ice_getConnection()); + + $test1->ice_ping(); + + $com->deactivateObjectAdapter($adapter); + + $test3 = $test1->ice_uncheckedCast("::Test::TestIntf"); + try + { + test($test3->ice_getConnection() == $test1->ice_getConnection()); + test(false); + } + catch(Ice_LocalException $ex) // Expecting ConnectionRefusedException + { + } } echo "ok" . "\n"; echo "testing per request binding with multiple endpoints... "; flush(); { - $adapters = array(); - $adapters[] = $com->createObjectAdapter("Adapter51", "default"); - $adapters[] = $com->createObjectAdapter("Adapter52", "default"); - $adapters[] = $com->createObjectAdapter("Adapter53", "default"); - - $test = createTestIntfPrx($adapters)->ice_connectionCached(false)->ice_uncheckedCast("::Test::TestIntf"); - test(!$test->ice_isConnectionCached()); - - $names = array("Adapter51", "Adapter52", "Adapter53"); - while(count($names) > 0) - { - $key = array_search($test->getAdapterName(), $names); - if($key !== false) - { - unset($names[$key]); - } - } - - $com->deactivateObjectAdapter($adapters[0]); - - $names = array("Adapter52", "Adapter53"); - while(count($names) > 0) - { - $key = array_search($test->getAdapterName(), $names); - if($key !== false) - { - unset($names[$key]); - } - } - - $com->deactivateObjectAdapter($adapters[2]); - - test($test->getAdapterName() == "Adapter52"); - - deactivate($com, $adapters); + $adapters = array(); + $adapters[] = $com->createObjectAdapter("Adapter51", "default"); + $adapters[] = $com->createObjectAdapter("Adapter52", "default"); + $adapters[] = $com->createObjectAdapter("Adapter53", "default"); + + $test = createTestIntfPrx($adapters)->ice_connectionCached(false)->ice_uncheckedCast("::Test::TestIntf"); + test(!$test->ice_isConnectionCached()); + + $names = array("Adapter51", "Adapter52", "Adapter53"); + while(count($names) > 0) + { + $key = array_search($test->getAdapterName(), $names); + if($key !== false) + { + unset($names[$key]); + } + } + + $com->deactivateObjectAdapter($adapters[0]); + + $names = array("Adapter52", "Adapter53"); + while(count($names) > 0) + { + $key = array_search($test->getAdapterName(), $names); + if($key !== false) + { + unset($names[$key]); + } + } + + $com->deactivateObjectAdapter($adapters[2]); + + test($test->getAdapterName() == "Adapter52"); + + deactivate($com, $adapters); } echo "ok" . "\n"; echo "testing per request binding and ordered endpoint selection... "; flush(); { - $adapters = array(); - $adapters[] = $com->createObjectAdapter("Adapter61", "default"); - $adapters[] = $com->createObjectAdapter("Adapter62", "default"); - $adapters[] = $com->createObjectAdapter("Adapter63", "default"); - - $test = createTestIntfPrx($adapters); - $test = $test->ice_endpointSelection(Ice_EndpointSelectionType::Ordered)->ice_uncheckedCast("::Test::TestIntf"); - test($test->ice_getEndpointSelection() == Ice_EndpointSelectionType::Ordered); - $test = $test->ice_connectionCached(false)->ice_uncheckedCast("::Test::TestIntf"); - test(!$test->ice_isConnectionCached()); - $nRetry = 5; - - // - // Ensure that endpoints are tried in order by deactiving the adapters - // one after the other. - // - for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter61"; $i++); - test($i == $nRetry); - $com->deactivateObjectAdapter($adapters[0]); - for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter62"; $i++); - test($i == $nRetry); - $com->deactivateObjectAdapter($adapters[1]); - for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter63"; $i++); - test($i == $nRetry); - $com->deactivateObjectAdapter($adapters[2]); - - try - { - $test->getAdapterName(); - } - catch(Ice_LocalException $ex) // Expecting ConnectionRefusedException - { - } - - $endpoints = $test->ice_getEndpoints(); - - $adapters = array(); - - // - // Now, re-activate the adapters with the same endpoints in the opposite - // order. - // - $adapters[] = $com->createObjectAdapter("Adapter66", $endpoints[2]->toString()); - for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter66"; $i++); - test($i == $nRetry); - $adapters[] = $com->createObjectAdapter("Adapter65", $endpoints[1]->toString()); - for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter65"; $i++); - test($i == $nRetry); - $adapters[] = $com->createObjectAdapter("Adapter64", $endpoints[0]->toString()); - for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter64"; $i++); - test($i == $nRetry); - - deactivate($com, $adapters); + $adapters = array(); + $adapters[] = $com->createObjectAdapter("Adapter61", "default"); + $adapters[] = $com->createObjectAdapter("Adapter62", "default"); + $adapters[] = $com->createObjectAdapter("Adapter63", "default"); + + $test = createTestIntfPrx($adapters); + $test = $test->ice_endpointSelection(Ice_EndpointSelectionType::Ordered)->ice_uncheckedCast("::Test::TestIntf"); + test($test->ice_getEndpointSelection() == Ice_EndpointSelectionType::Ordered); + $test = $test->ice_connectionCached(false)->ice_uncheckedCast("::Test::TestIntf"); + test(!$test->ice_isConnectionCached()); + $nRetry = 5; + + // + // Ensure that endpoints are tried in order by deactiving the adapters + // one after the other. + // + for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter61"; $i++); + test($i == $nRetry); + $com->deactivateObjectAdapter($adapters[0]); + for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter62"; $i++); + test($i == $nRetry); + $com->deactivateObjectAdapter($adapters[1]); + for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter63"; $i++); + test($i == $nRetry); + $com->deactivateObjectAdapter($adapters[2]); + + try + { + $test->getAdapterName(); + } + catch(Ice_LocalException $ex) // Expecting ConnectionRefusedException + { + } + + $endpoints = $test->ice_getEndpoints(); + + $adapters = array(); + + // + // Now, re-activate the adapters with the same endpoints in the opposite + // order. + // + $adapters[] = $com->createObjectAdapter("Adapter66", $endpoints[2]->toString()); + for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter66"; $i++); + test($i == $nRetry); + $adapters[] = $com->createObjectAdapter("Adapter65", $endpoints[1]->toString()); + for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter65"; $i++); + test($i == $nRetry); + $adapters[] = $com->createObjectAdapter("Adapter64", $endpoints[0]->toString()); + for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter64"; $i++); + test($i == $nRetry); + + deactivate($com, $adapters); } echo "ok" . "\n"; echo "testing endpoint mode filtering... "; flush(); { - $adapters = array(); - $adapters[] = $com->createObjectAdapter("Adapter71", "default"); - $adapters[] = $com->createObjectAdapter("Adapter72", "udp"); - - $test = createTestIntfPrx($adapters); - test($test->getAdapterName() == "Adapter71"); - - $testUDP = $test->ice_datagram()->ice_uncheckedCast("::Test::TestIntf"); - test($test->ice_getConnection() != $testUDP->ice_getConnection()); - try - { - $testUDP->getAdapterName(); - } - catch(Ice_TwowayOnlyException $ex) - { - } + $adapters = array(); + $adapters[] = $com->createObjectAdapter("Adapter71", "default"); + $adapters[] = $com->createObjectAdapter("Adapter72", "udp"); + + $test = createTestIntfPrx($adapters); + test($test->getAdapterName() == "Adapter71"); + + $testUDP = $test->ice_datagram()->ice_uncheckedCast("::Test::TestIntf"); + test($test->ice_getConnection() != $testUDP->ice_getConnection()); + try + { + $testUDP->getAdapterName(); + } + catch(Ice_TwowayOnlyException $ex) + { + } } echo "ok" . "\n"; if(strlen($ICE->getProperty("Ice.Plugin.IceSSL")) > 0) { - echo "testing unsecure vs. secure endpoints... "; - flush(); - { - $adapters = array(); - $adapters[] = $com->createObjectAdapter("Adapter81", "ssl"); - $adapters[] = $com->createObjectAdapter("Adapter82", "tcp"); - - $test = createTestIntfPrx($adapters); - for($i = 0; $i < 5; $i++) - { - test($test->getAdapterName() == "Adapter82"); - $test->ice_getConnection()->close(false); - } - - $testSecure = $test->ice_secure(true)->ice_uncheckedCast("::Test::TestIntf"); - test($testSecure->ice_isSecure()); - $testSecure = $test->ice_secure(false)->ice_uncheckedCast("::Test::TestIntf"); - test(!$testSecure->ice_isSecure()); - $testSecure = $test->ice_secure(true)->ice_uncheckedCast("::Test::TestIntf"); - test($testSecure->ice_isSecure()); - test($test->ice_getConnection() != $testSecure->ice_getConnection()); - - $com->deactivateObjectAdapter($adapters[1]); - - for($i = 0; $i < 5; $i++) - { - test($test->getAdapterName() == "Adapter81"); - $test->ice_getConnection()->close(false); - } - - $endpts = $test->ice_getEndpoints(); - $com->createObjectAdapter("Adapter83", $endpts[1]->toString()); // Reactive tcp OA. - - for($i = 0; $i < 5; $i++) - { - test($test->getAdapterName() == "Adapter83"); - $test->ice_getConnection()->close(false); - } - - $com->deactivateObjectAdapter($adapters[0]); - try - { - $testSecure->ice_ping(); - test(false); - } - catch(Ice_LocalException $ex) // Expecting ConnectionRefusedException - { - } - - deactivate($com, $adapters); - } - echo "ok" . "\n"; + echo "testing unsecure vs. secure endpoints... "; + flush(); + { + $adapters = array(); + $adapters[] = $com->createObjectAdapter("Adapter81", "ssl"); + $adapters[] = $com->createObjectAdapter("Adapter82", "tcp"); + + $test = createTestIntfPrx($adapters); + for($i = 0; $i < 5; $i++) + { + test($test->getAdapterName() == "Adapter82"); + $test->ice_getConnection()->close(false); + } + + $testSecure = $test->ice_secure(true)->ice_uncheckedCast("::Test::TestIntf"); + test($testSecure->ice_isSecure()); + $testSecure = $test->ice_secure(false)->ice_uncheckedCast("::Test::TestIntf"); + test(!$testSecure->ice_isSecure()); + $testSecure = $test->ice_secure(true)->ice_uncheckedCast("::Test::TestIntf"); + test($testSecure->ice_isSecure()); + test($test->ice_getConnection() != $testSecure->ice_getConnection()); + + $com->deactivateObjectAdapter($adapters[1]); + + for($i = 0; $i < 5; $i++) + { + test($test->getAdapterName() == "Adapter81"); + $test->ice_getConnection()->close(false); + } + + $endpts = $test->ice_getEndpoints(); + $com->createObjectAdapter("Adapter83", $endpts[1]->toString()); // Reactive tcp OA. + + for($i = 0; $i < 5; $i++) + { + test($test->getAdapterName() == "Adapter83"); + $test->ice_getConnection()->close(false); + } + + $com->deactivateObjectAdapter($adapters[0]); + try + { + $testSecure->ice_ping(); + test(false); + } + catch(Ice_LocalException $ex) // Expecting ConnectionRefusedException + { + } + + deactivate($com, $adapters); + } + echo "ok" . "\n"; } $com->shutdown(); diff --git a/php/test/Ice/operations/Client.php b/php/test/Ice/operations/Client.php index 3729568e608..a800072af76 100644 --- a/php/test/Ice/operations/Client.php +++ b/php/test/Ice/operations/Client.php @@ -89,9 +89,9 @@ function twoways($communicator, $p) { $r = $p->opMyClass($p, $c1, $c2); // TODO: Identity tests - test($c1->ice_getIdentity() == $ICE->stringToIdentity("test")); - test($c2->ice_getIdentity() == $ICE->stringToIdentity("noSuchIdentity")); - test($r->ice_getIdentity() == $ICE->stringToIdentity("test")); + test($c1->ice_getIdentity() == $ICE->stringToIdentity("test")); + test($c2->ice_getIdentity() == $ICE->stringToIdentity("noSuchIdentity")); + test($r->ice_getIdentity() == $ICE->stringToIdentity("test")); $r->opVoid(); $c1->opVoid(); try diff --git a/php/test/Ice/operations/Test.ice b/php/test/Ice/operations/Test.ice index 9f001bdc119..d47b365e1be 100644 --- a/php/test/Ice/operations/Test.ice +++ b/php/test/Ice/operations/Test.ice @@ -69,72 +69,72 @@ dictionary<string, MyEnum> StringMyEnumD; void opVoid(); byte opByte(byte p1, byte p2, - out byte p3); + out byte p3); bool opBool(bool p1, bool p2, - out bool p3); + out bool p3); long opShortIntLong(short p1, int p2, long p3, - out short p4, out int p5, out long p6); + out short p4, out int p5, out long p6); double opFloatDouble(float p1, double p2, - out float p3, out double p4); + out float p3, out double p4); string opString(string p1, string p2, - out string p3); + out string p3); MyEnum opMyEnum(MyEnum p1, out MyEnum p2); MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3); Structure opStruct(Structure p1, Structure p2, - out Structure p3); + out Structure p3); ByteS opByteS(ByteS p1, ByteS p2, - out ByteS p3); + out ByteS p3); BoolS opBoolS(BoolS p1, BoolS p2, - out BoolS p3); + out BoolS p3); LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3, - out ::Test::ShortS p4, out IntS p5, out LongS p6); + out ::Test::ShortS p4, out IntS p5, out LongS p6); DoubleS opFloatDoubleS(FloatS p1, DoubleS p2, - out FloatS p3, out DoubleS p4); + out FloatS p3, out DoubleS p4); StringS opStringS(StringS p1, StringS p2, - out StringS p3); + out StringS p3); ByteSS opByteSS(ByteSS p1, ByteSS p2, - out ByteSS p3); + out ByteSS p3); BoolSS opBoolSS(BoolSS p1, BoolSS p2, - out BoolSS p3); + out BoolSS p3); LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3, - out ShortSS p4, out IntSS p5, out LongSS p6); + out ShortSS p4, out IntSS p5, out LongSS p6); DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2, - out FloatSS p3, out DoubleSS p4); + out FloatSS p3, out DoubleSS p4); StringSS opStringSS(StringSS p1, StringSS p2, - out StringSS p3); + out StringSS p3); ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2, - out ByteBoolD p3); + out ByteBoolD p3); ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2, - out ShortIntD p3); + out ShortIntD p3); LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2, - out LongFloatD p3); + out LongFloatD p3); StringStringD opStringStringD(StringStringD p1, StringStringD p2, - out StringStringD p3); + out StringStringD p3); StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2, - out StringMyEnumD p3); + out StringMyEnumD p3); IntS opIntS(IntS s); diff --git a/php/test/Ice/slicing/exceptions/Client.php b/php/test/Ice/slicing/exceptions/Client.php index 2863baa5cbb..8721d0a0cce 100644 --- a/php/test/Ice/slicing/exceptions/Client.php +++ b/php/test/Ice/slicing/exceptions/Client.php @@ -25,7 +25,7 @@ function allTests() try { $test->baseAsBase(); - test(false); + test(false); } catch(Test_Base $b) { @@ -41,7 +41,7 @@ function allTests() try { $test->unknownDerivedAsBase(); - test(false); + test(false); } catch(Test_Base $b) { @@ -57,7 +57,7 @@ function allTests() try { $test->knownDerivedAsBase(); - test(false); + test(false); } catch(Test_KnownDerived $k) { @@ -74,7 +74,7 @@ function allTests() try { $test->knownDerivedAsKnownDerived(); - test(false); + test(false); } catch(Test_KnownDerived $k) { @@ -91,7 +91,7 @@ function allTests() try { $test->unknownIntermediateAsBase(); - test(false); + test(false); } catch(Test_Base $b) { @@ -107,7 +107,7 @@ function allTests() try { $test->knownIntermediateAsBase(); - test(false); + test(false); } catch(Test_KnownIntermediate $ki) { @@ -124,7 +124,7 @@ function allTests() try { $test->knownMostDerivedAsBase(); - test(false); + test(false); } catch(Test_KnownMostDerived $kmd) { @@ -142,7 +142,7 @@ function allTests() try { $test->knownIntermediateAsKnownIntermediate(); - test(false); + test(false); } catch(Test_KnownIntermediate $ki) { @@ -159,7 +159,7 @@ function allTests() try { $test->knownMostDerivedAsKnownIntermediate(); - test(false); + test(false); } catch(Test_KnownMostDerived $kmd) { @@ -177,7 +177,7 @@ function allTests() try { $test->knownMostDerivedAsKnownMostDerived(); - test(false); + test(false); } catch(Test_KnownMostDerived $kmd) { @@ -195,7 +195,7 @@ function allTests() try { $test->unknownMostDerived1AsBase(); - test(false); + test(false); } catch(Test_KnownIntermediate $ki) { @@ -212,7 +212,7 @@ function allTests() try { $test->unknownMostDerived1AsKnownIntermediate(); - test(false); + test(false); } catch(Test_KnownIntermediate $ki) { @@ -229,7 +229,7 @@ function allTests() try { $test->unknownMostDerived2AsBase(); - test(false); + test(false); } catch(Test_Base $b) { diff --git a/php/test/Ice/slicing/objects/Client.php b/php/test/Ice/slicing/objects/Client.php index e82968b8f3b..3987942ef0c 100644 --- a/php/test/Ice/slicing/objects/Client.php +++ b/php/test/Ice/slicing/objects/Client.php @@ -66,15 +66,15 @@ function allTests() echo "testing unknown with Object as Object... "; flush(); { - try - { - $o = $test->SUnknownAsObject(); - test(false); - } + try + { + $o = $test->SUnknownAsObject(); + test(false); + } catch(Ice_NoObjectFactoryException $e) { test(get_class($e) == "Ice_NoObjectFactoryException"); - } + } } echo "ok\n"; diff --git a/php/test/Ice/slicing/objects/Test.ice b/php/test/Ice/slicing/objects/Test.ice index 9d31ce660b5..01e91579311 100644 --- a/php/test/Ice/slicing/objects/Test.ice +++ b/php/test/Ice/slicing/objects/Test.ice @@ -67,7 +67,7 @@ exception DerivedException extends BaseException D1 pd1; }; -class Forward; // Forward-declared class defined in another compilation unit +class Forward; // Forward-declared class defined in another compilation unit ["ami"] interface TestIntf { @@ -104,7 +104,7 @@ class Forward; // Forward-declared class defined in another compilation unit void throwDerivedAsDerived() throws DerivedException; void throwUnknownDerivedAsBase() throws BaseException; - void useForward(out Forward f); // Use of forward-declared class to verify that code is generated correctly. + void useForward(out Forward f); // Use of forward-declared class to verify that code is generated correctly. void shutdown(); }; |