summaryrefslogtreecommitdiff
path: root/php/src/php5/Communicator.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2016-03-01 15:12:26 +0100
committerJose <jose@zeroc.com>2016-03-01 15:12:26 +0100
commit1419f188bf7d06ba0131cfd94a82f5d43ec0c7dd (patch)
tree38929143a6575d23e4438e590a20f525a829e194 /php/src/php5/Communicator.cpp
parentFix LMDB nuget package version (diff)
parentIce::identityToString/Ice::stringToIdentity php/ruby/python implementations (diff)
downloadice-1419f188bf7d06ba0131cfd94a82f5d43ec0c7dd.tar.bz2
ice-1419f188bf7d06ba0131cfd94a82f5d43ec0c7dd.tar.xz
ice-1419f188bf7d06ba0131cfd94a82f5d43ec0c7dd.zip
Merge remote-tracking branch 'origin/3.6'
Diffstat (limited to 'php/src/php5/Communicator.cpp')
-rw-r--r--php/src/php5/Communicator.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/php/src/php5/Communicator.cpp b/php/src/php5/Communicator.cpp
index 494b75f9ad2..e0ad62bc654 100644
--- a/php/src/php5/Communicator.cpp
+++ b/php/src/php5/Communicator.cpp
@@ -1359,6 +1359,59 @@ ZEND_FUNCTION(Ice_getProperties)
}
}
+ZEND_FUNCTION(Ice_identityToString)
+{
+ zend_class_entry* identityClass = idToClass("::Ice::Identity" TSRMLS_CC);
+ assert(identityClass);
+
+ zval* zv;
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, const_cast<char*>("O"), &zv, identityClass) != SUCCESS)
+ {
+ RETURN_NULL();
+ }
+ Ice::Identity id;
+ if(!extractIdentity(zv, id TSRMLS_CC))
+ {
+ RETURN_NULL();
+ }
+
+ try
+ {
+ string str = Ice::identityToString(id);
+ RETURN_STRINGL(STRCAST(str.c_str()), static_cast<int>(str.length()), 1);
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ throwException(ex TSRMLS_CC);
+ RETURN_NULL();
+ }
+}
+
+ZEND_FUNCTION(Ice_stringToIdentity)
+{
+ char* str;
+ int strLen;
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, const_cast<char*>("s"), &str, &strLen) != SUCCESS)
+ {
+ RETURN_NULL();
+ }
+ string s(str, strLen);
+
+ try
+ {
+ Ice::Identity id = Ice::stringToIdentity(s);
+ if(!createIdentity(return_value, id TSRMLS_CC))
+ {
+ RETURN_NULL();
+ }
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ throwException(ex TSRMLS_CC);
+ RETURN_NULL();
+ }
+}
+
//
// Necessary to suppress warnings from zend_function_entry in php-5.2
// and INI_STR macro.