summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--php/CHANGES14
-rw-r--r--php/INSTALL69
-rw-r--r--php/src/ice/communicator.cpp26
-rw-r--r--php/src/ice/ice_communicator.h4
-rw-r--r--php/src/ice/ice_proxy.h2
-rw-r--r--php/src/ice/marshal.cpp52
-rw-r--r--php/src/ice/profile.cpp75
-rw-r--r--php/src/ice/proxy.cpp42
-rw-r--r--php/src/ice/util.cpp64
-rw-r--r--php/test/Ice/exceptions/Client.php14
-rw-r--r--php/test/Ice/facets/Client.php14
-rw-r--r--php/test/Ice/inheritance/Client.php14
-rw-r--r--php/test/Ice/objects/Client.php14
-rw-r--r--php/test/Ice/operations/Client.php28
-rw-r--r--php/test/Ice/slicing/exceptions/Client.php14
-rw-r--r--php/test/Ice/slicing/objects/Client.php14
16 files changed, 225 insertions, 235 deletions
diff --git a/php/CHANGES b/php/CHANGES
new file mode 100644
index 00000000000..6351ec1ea80
--- /dev/null
+++ b/php/CHANGES
@@ -0,0 +1,14 @@
+Changes since version 1.0.0
+---------------------------
+
+- Minor fixes for compatibility with PHP 5.0.0b2.
+
+- Fixes for Ice 1.2.0 API changes. The ice_flush operation has been
+ removed from proxies, and the operation flushBatchRequests has been
+ added to the communicator.
+
+- The base Ice exception class (Ice_Exception) now derives from the PHP
+ base exception class (Exception). Also, the mapping for exceptions now
+ supports an optional string argument to constructors. This argument
+ represents the exception "message" and is passed to the base Exception
+ constructor unmodified.
diff --git a/php/INSTALL b/php/INSTALL
index ba96c6ed131..ea1fd0bfeb0 100644
--- a/php/INSTALL
+++ b/php/INSTALL
@@ -2,8 +2,8 @@
Requirements
=========================================================================
-- PHP5 (http://www.php.net/downloads.php)
-- Ice 1.1.1
+- PHP5.0.0b2 (http://www.php.net/downloads.php)
+- Ice 1.2.0
@@ -68,13 +68,6 @@ $ ./configure --with-ice=shared,$ICE_HOME ...
Note that additional configuration options are generally necessary.
Please refer to the PHP documentation for more information.
-If you are building PHP version 5.0.0b1, you will need to manually
-edit one of the PHP source files to avoid a compiler error. Open the
-file php-5.0.0b1/Zend/zend_operators.h and modify line 206 to add a
-cast, as shown below:
-
- return zend_str_tolower_copy((char*)emalloc(length+1), source, length);
-
If you are using Solaris with Sun CC, please refer to the section
titled "Additional Requirements for Solaris with Sun CC" before
proceeding any further.
@@ -134,7 +127,7 @@ to do the following:
2) Have a suitable Ice development environment.
3) Configure the include and library paths in Visual C++ for PHP and
- Ice. Assuming that you've extracted the PHP5 sources into C:\PHP5,
+ Ice. Assuming that you've extracted the PHP5 sources into C:\PHP5,
and installed Ice into C:\Ice, then the following paths must be
configured:
@@ -152,14 +145,7 @@ to do the following:
If you are using Visual C++ 6.0, then you must also be sure to
include the appropriate paths for STLport.
-4) If you are using PHP version 5.0.0b1, you will need to manually
- edit one of the PHP header files to avoid a compiler error. Open the
- file C:\PHP5\Zend\zend_operators.h and modify line 206 to add a
- cast, as shown below:
-
- return zend_str_tolower_copy((char*)emalloc(length+1), source, length);
-
-5) Open the workspace icephp.dsw, select the Debug or Release
+4) Open the workspace icephp.dsw, select the Debug or Release
configuration, and build php_ice.dll. Note that the Ice extension
must be compiled using the same Debug/Release configuration as PHP
itself. If you are linking against the dynamic libraries included
@@ -172,21 +158,21 @@ to do the following:
Installing a Dynamic Extension
=========================================================================
-If you are using the dynamic Ice extension, then the shared library
-must be moved into a directory where PHP can find it. This directory
-is determined by the PHP configuration directive "extension_dir". You
-can determine the default value for this directive by running the
-command- line version of PHP with the -i option.
+If you are using the dynamic Ice extension, you must move the
+extension's shared library into PHP's extension directory. This
+directory is determined by the PHP configuration directive
+"extension_dir". You can determine the default value for this directive
+by running the command-line version of PHP with the -i option.
After compiling the dynamic extension on Linux and Solaris, the shared
library can be found in the "modules" subdirectory of the PHP source
-tree. If you've compiled the dynamic Ice extension on Windows, the DLL
-is located in bin/Debug/php_ice.dll or bin/Release/php_ice.dll,
+tree. If you've compiled the dynamic Ice extension on Windows, the
+DLL is located in bin/Debug/php_ice.dll or bin/Release/php_ice.dll,
depending on the build configuration you selected.
Once you've copied the dynamic extension to PHP's extension directory,
-you will need to enable the extension in PHP configuration. In
-php.ini, use the following directive on Linux and Solaris:
+you will need to enable the extension in PHP configuration. In php.ini,
+use the following directive on Linux and Solaris:
extension = ice.so
@@ -200,13 +186,13 @@ extension = php_ice.dll
Dependencies
=========================================================================
-Whether you build a dynamic or static Ice extension, PHP will need to
-be able to locate the Ice run-time libraries "Ice", "Slice" and
-"IceUtil"). In general, these libraries must reside in a directory of
+Whether you build a dynamic or static Ice extension, PHP will need
+to be able to locate the Ice run-time libraries "Ice", "Slice" and
+"IceUtil". In general, these libraries must reside in a directory of
the user's PATH.
For Web servers, the libraries may need to reside in a system
-directory. For example, on Linux you can add the directory containing
+directory. For example, on Linux you can add the directory containing
the Ice run-time libraries to /etc/ld.so.conf and run ldconfig. On
Windows, you can copy the DLLs to the C:\WINDOWS\system32 directory.
@@ -218,8 +204,7 @@ Note that if you want to use IceSSL from the Ice extension, then PHP
will also need access to the shared libraries for IceSSL and Xerces.
Finally, the Ice extension will need to execute the Ice preprocessor
-(icecpp), therefore this binary must reside in an accessible
-directory.
+(icecpp), therefore this binary must reside in an accessible directory.
@@ -228,13 +213,13 @@ Running the Tests
=========================================================================
The test subdirectory contains PHP implementations of the core Ice
-test suite. In order to run these tests, you must have Python 2.2 or
-later, and the Ice for C++ tests must be built in the directory
+test suite. In order to run these tests, you must have Python 2.2
+or later, and the Ice for C++ tests must be built in the directory
specified by the ICE_HOME environment variable.
The test scripts require that the CLI version of the PHP interpreter
-be available in your PATH, and assume that the Ice extension was built
-in a static configuration.
+be available in your PATH, and assume that the Ice extension was
+built in a static configuration.
To run all of the tests, do the following:
@@ -245,9 +230,9 @@ and running this command:
$ python run.py
-In order to run the tests using a dynamic Ice extension, you will need
-to edit the php.ini files in each test directory and add the following
-configuration directives:
+In order to run the tests using a dynamic Ice extension, you will
+need to edit the php.ini files in each test directory and add the
+following configuration directives:
extension_dir=<phpdir>/modules
extension=ice.so
@@ -266,8 +251,8 @@ If you are using the Ice extension in a PHP-CGI executable, or in a
PHP Apache module, then you must ensure that the environment variable
LD_ASSUME_KERNEL has the value "2.4.1".
-For the CGI case, you can set this variable in the Apache
-configuration with the following directive:
+For the CGI case, you can set this variable in the Apache configuration
+with the following directive:
SetEnv LD_ASSUME_KERNEL 2.4.1
diff --git a/php/src/ice/communicator.cpp b/php/src/ice/communicator.cpp
index c01265364d4..df9f1346ba9 100644
--- a/php/src/ice/communicator.cpp
+++ b/php/src/ice/communicator.cpp
@@ -57,6 +57,7 @@ static function_entry _methods[] =
{"addObjectFactory", PHP_FN(Ice_Communicator_addObjectFactory), NULL},
{"removeObjectFactory", PHP_FN(Ice_Communicator_removeObjectFactory), NULL},
{"findObjectFactory", PHP_FN(Ice_Communicator_findObjectFactory), NULL},
+ {"flushBatchRequests", PHP_FN(Ice_Communicator_flushBatchRequests), NULL},
{NULL, NULL, NULL}
};
@@ -348,6 +349,31 @@ ZEND_FUNCTION(Ice_Communicator_findObjectFactory)
phpFactory->findObjectFactory(id, return_value TSRMLS_CC);
}
+ZEND_FUNCTION(Ice_Communicator_flushBatchRequests)
+{
+ if(ZEND_NUM_ARGS() != 0)
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ ice_object* obj = getObject(getThis() TSRMLS_CC);
+ if(!obj)
+ {
+ RETURN_NULL();
+ }
+ assert(obj->ptr);
+ Ice::CommunicatorPtr* _this = static_cast<Ice::CommunicatorPtr*>(obj->ptr);
+
+ try
+ {
+ (*_this)->flushBatchRequests();;
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ throwException(ex TSRMLS_CC);
+ }
+}
+
#ifdef WIN32
extern "C"
#endif
diff --git a/php/src/ice/ice_communicator.h b/php/src/ice/ice_communicator.h
index dfdd4fdf14d..131d2839ece 100644
--- a/php/src/ice/ice_communicator.h
+++ b/php/src/ice/ice_communicator.h
@@ -28,6 +28,7 @@ ZEND_FUNCTION(Ice_Communicator_proxyToString);
ZEND_FUNCTION(Ice_Communicator_addObjectFactory);
ZEND_FUNCTION(Ice_Communicator_removeObjectFactory);
ZEND_FUNCTION(Ice_Communicator_findObjectFactory);
+ZEND_FUNCTION(Ice_Communicator_flushBatchRequests);
}
#define ICE_PHP_COMMUNICATOR_FUNCTIONS \
@@ -36,7 +37,8 @@ ZEND_FUNCTION(Ice_Communicator_findObjectFactory);
ZEND_FE(Ice_Communicator_proxyToString, NULL) \
ZEND_FE(Ice_Communicator_addObjectFactory, NULL) \
ZEND_FE(Ice_Communicator_removeObjectFactory, NULL) \
- ZEND_FE(Ice_Communicator_findObjectFactory, NULL)
+ ZEND_FE(Ice_Communicator_findObjectFactory, NULL) \
+ ZEND_FE(Ice_Communicator_flushBatchRequests, NULL)
namespace IcePHP
{
diff --git a/php/src/ice/ice_proxy.h b/php/src/ice/ice_proxy.h
index 9a4cdc56dbf..2df1efe8f81 100644
--- a/php/src/ice/ice_proxy.h
+++ b/php/src/ice/ice_proxy.h
@@ -48,7 +48,6 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_secure);
ZEND_FUNCTION(Ice_ObjectPrx_ice_compress);
ZEND_FUNCTION(Ice_ObjectPrx_ice_timeout);
ZEND_FUNCTION(Ice_ObjectPrx_ice_default);
-ZEND_FUNCTION(Ice_ObjectPrx_ice_flush);
ZEND_FUNCTION(Ice_ObjectPrx_ice_uncheckedCast);
ZEND_FUNCTION(Ice_ObjectPrx_ice_checkedCast);
}
@@ -79,7 +78,6 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_checkedCast);
ZEND_FE(Ice_ObjectPrx_ice_compress, NULL) \
ZEND_FE(Ice_ObjectPrx_ice_timeout, NULL) \
ZEND_FE(Ice_ObjectPrx_ice_default, NULL) \
- ZEND_FE(Ice_ObjectPrx_ice_flush, NULL) \
ZEND_FE(Ice_ObjectPrx_ice_uncheckedCast, NULL) \
ZEND_FE(Ice_ObjectPrx_ice_checkedCast, NULL)
diff --git a/php/src/ice/marshal.cpp b/php/src/ice/marshal.cpp
index d34dfd73910..f3fbfd5fb96 100644
--- a/php/src/ice/marshal.cpp
+++ b/php/src/ice/marshal.cpp
@@ -236,7 +236,7 @@ public:
ObjectWriter(zval*, const Slice::SyntaxTreeBasePtr& TSRMLS_DC);
~ObjectWriter();
- virtual void __write(::IceInternal::BasicStream*) const;
+ virtual void __write(::IceInternal::BasicStream*, bool) const;
virtual void __read(::IceInternal::BasicStream*, bool = true);
private:
@@ -253,7 +253,7 @@ public:
ObjectReader(zval*, const Slice::ClassDefPtr& TSRMLS_DC);
~ObjectReader();
- virtual void __write(::IceInternal::BasicStream*) const;
+ virtual void __write(::IceInternal::BasicStream*, bool) const;
virtual void __read(::IceInternal::BasicStream*, bool = true);
void setValue(zend_class_entry*, zval*);
@@ -1462,7 +1462,7 @@ IcePHP::ObjectWriter::~ObjectWriter()
}
void
-IcePHP::ObjectWriter::__write(IceInternal::BasicStream* os) const
+IcePHP::ObjectWriter::__write(IceInternal::BasicStream* os, bool) const
{
MarshalerMap* marshalerMap = static_cast<MarshalerMap*>(ICE_G(marshalerMap));
@@ -1546,7 +1546,7 @@ IcePHP::ObjectReader::~ObjectReader()
}
void
-IcePHP::ObjectReader::__write(IceInternal::BasicStream* os) const
+IcePHP::ObjectReader::__write(IceInternal::BasicStream* os, bool) const
{
zend_error(E_ERROR, "ObjectReader::__write should never be called");
}
@@ -1846,16 +1846,25 @@ IcePHP::PHPObjectFactory::create(const string& scoped)
zval* id;
MAKE_STD_ZVAL(id);
ZVAL_STRINGL(id, const_cast<char*>(scoped.c_str()), scoped.length(), 1);
-
- zval* create;
- MAKE_STD_ZVAL(create);
- ZVAL_STRINGL(create, "create", sizeof("create") - 1, 1);
-
args[0] = &id;
+
zval* zresult = NULL;
- int status = call_user_function_ex(NULL, &p->second, create, &zresult, 1, args, 0, NULL TSRMLS_CC);
- zval_ptr_dtor(&create);
+ zend_fcall_info fci;
+ fci.size = sizeof(fci);
+ fci.function_table = NULL;
+ MAKE_STD_ZVAL(fci.function_name);
+ ZVAL_STRINGL(fci.function_name, "create", sizeof("create") - 1, 1);
+ fci.symbol_table = NULL;
+ fci.retval_ptr_ptr = &zresult;
+ fci.param_count = 1;
+ fci.params = args;
+ fci.object_pp = &p->second;
+ fci.no_separation = 0;
+
+ int status = zend_call_function(&fci, NULL TSRMLS_CC);
+
+ zval_ptr_dtor(&fci.function_name);
zval_ptr_dtor(&id);
AutoDestroy destroyResult(zresult);
@@ -1951,14 +1960,23 @@ IcePHP::PHPObjectFactory::destroy()
//
for(map<string, zval*>::iterator p = _factories.begin(); p != _factories.end(); ++p)
{
- zval* funcName;
- MAKE_STD_ZVAL(funcName);
- ZVAL_STRINGL(funcName, "destroy", sizeof("destroy") - 1, 1);
-
zval* result = NULL;
- int status = call_user_function_ex(NULL, &p->second, funcName, &result, 0, NULL, 0, NULL TSRMLS_CC);
- zval_ptr_dtor(&funcName);
+ zend_fcall_info fci;
+ fci.size = sizeof(fci);
+ fci.function_table = NULL;
+ MAKE_STD_ZVAL(fci.function_name);
+ ZVAL_STRINGL(fci.function_name, "destroy", sizeof("destroy") - 1, 1);
+ fci.symbol_table = NULL;
+ fci.retval_ptr_ptr = &result;
+ fci.param_count = 0;
+ fci.params = NULL;
+ fci.object_pp = &p->second;
+ fci.no_separation = 0;
+
+ int status = zend_call_function(&fci, NULL TSRMLS_CC);
+
+ zval_ptr_dtor(&fci.function_name);
if(result)
{
zval_ptr_dtor(&result);
diff --git a/php/src/ice/profile.cpp b/php/src/ice/profile.cpp
index 6d3e18183f8..d59dd258426 100644
--- a/php/src/ice/profile.cpp
+++ b/php/src/ice/profile.cpp
@@ -80,32 +80,58 @@ private:
// necessary to IcePHP::throwException.
//
static const char* _coreTypes =
- "define(\"ICE_STRING_VERSION\", \"1.1.0\");\n"
- "define(\"ICE_INT_VERSION\", 10100);\n"
+ "define(\"ICE_STRING_VERSION\", \"1.2.0\");\n"
+ "define(\"ICE_INT_VERSION\", 10200);\n"
"\n"
- "abstract class Ice_Exception\n"
+ "abstract class Ice_Exception extends Exception\n"
"{\n"
+ " function __construct($message = '')\n"
+ " {\n"
+ " Exception::__construct($message);\n"
+ " }\n"
"}\n"
"\n"
"abstract class Ice_LocalException extends Ice_Exception\n"
"{\n"
+ " function __construct($message = '')\n"
+ " {\n"
+ " Ice_Exception::__construct($message);\n"
+ " }\n"
"}\n"
"\n"
"class Ice_UnknownException extends Ice_LocalException\n"
"{\n"
+ " function __construct($message = '')\n"
+ " {\n"
+ " Ice_LocalException::__construct($message);\n"
+ " }\n"
+ "\n"
" var $unknown;\n"
"}\n"
"\n"
"class Ice_UnknownLocalException extends Ice_UnknownException\n"
"{\n"
+ " function __construct($message = '')\n"
+ " {\n"
+ " Ice_UnknownException::__construct($message);\n"
+ " }\n"
"}\n"
"\n"
"class Ice_UnknownUserException extends Ice_UnknownException\n"
"{\n"
+ " function __construct($message = '')\n"
+ " {\n"
+ " Ice_UnknownException::__construct($message);\n"
+ " }\n"
"}\n"
"\n"
"class Ice_RequestFailedException extends Ice_LocalException\n"
"{\n"
+ " function __construct($message = '')\n"
+ " {\n"
+ " Ice_LocalException::__construct($message);\n"
+ " }\n"
+ "\n"
" var $id;\n"
" var $facet;\n"
" var $operation;\n"
@@ -113,31 +139,60 @@ static const char* _coreTypes =
"\n"
"class Ice_ObjectNotExistException extends Ice_RequestFailedException\n"
"{\n"
+ " function __construct($message = '')\n"
+ " {\n"
+ " Ice_RequestFailedException::__construct($message);\n"
+ " }\n"
"}\n"
"\n"
"class Ice_FacetNotExistException extends Ice_RequestFailedException\n"
"{\n"
+ " function __construct($message = '')\n"
+ " {\n"
+ " Ice_RequestFailedException::__construct($message);\n"
+ " }\n"
"}\n"
"\n"
"class Ice_OperationNotExistException extends Ice_RequestFailedException\n"
"{\n"
+ " function __construct($message = '')\n"
+ " {\n"
+ " Ice_RequestFailedException::__construct($message);\n"
+ " }\n"
"}\n"
"\n"
"class Ice_ProtocolException extends Ice_LocalException\n"
"{\n"
+ " function __construct($message = '')\n"
+ " {\n"
+ " Ice_LocalException::__construct($message);\n"
+ " }\n"
"}\n"
"\n"
"class Ice_MarshalException extends Ice_ProtocolException\n"
"{\n"
+ " function __construct($message = '')\n"
+ " {\n"
+ " Ice_ProtocolException::__construct($message);\n"
+ " }\n"
"}\n"
"\n"
"class Ice_NoObjectFactoryException extends Ice_MarshalException\n"
"{\n"
+ " function __construct($message = '')\n"
+ " {\n"
+ " Ice_MarshalException::__construct($message);\n"
+ " }\n"
+ "\n"
" var $type;\n"
"}\n"
"\n"
"abstract class Ice_UserException extends Ice_Exception\n"
"{\n"
+ " function __construct($message = '')\n"
+ " {\n"
+ " Ice_Exception::__construct($message);\n"
+ " }\n"
"}\n"
"\n"
"interface Ice_LocalObject\n"
@@ -775,23 +830,29 @@ IcePHP::CodeVisitor::visitExceptionStart(const Slice::ExceptionPtr& p)
Slice::ExceptionPtr base = p->base();
_out << "class " << flat << " extends ";
+ string baseName;
if(!base)
{
if(p->isLocal())
{
- _out << "Ice_LocalException";
+ baseName = "Ice_LocalException";
}
else
{
- _out << "Ice_UserException";
+ baseName = "Ice_UserException";
}
}
else
{
- _out << flatten(base->scoped());
+ baseName = flatten(base->scoped());
}
- _out << endl << '{' << endl;
+ _out << baseName << endl << '{' << endl;
+
+ _out << "function __construct($message = '')" << endl;
+ _out << "{" << endl;
+ _out << " " << baseName << "::__construct($message);" << endl;
+ _out << "}" << endl;
return true;
}
diff --git a/php/src/ice/proxy.cpp b/php/src/ice/proxy.cpp
index 89d567b75b6..96f6914681d 100644
--- a/php/src/ice/proxy.cpp
+++ b/php/src/ice/proxy.cpp
@@ -166,7 +166,6 @@ static function_entry _methods[] =
{"ice_compress", PHP_FN(Ice_ObjectPrx_ice_compress), NULL},
{"ice_timeout", PHP_FN(Ice_ObjectPrx_ice_timeout), NULL},
{"ice_default", PHP_FN(Ice_ObjectPrx_ice_default), NULL},
- {"ice_flush", PHP_FN(Ice_ObjectPrx_ice_flush), NULL},
{"ice_uncheckedCast", PHP_FN(Ice_ObjectPrx_ice_uncheckedCast), NULL},
{"ice_checkedCast", PHP_FN(Ice_ObjectPrx_ice_checkedCast), NULL},
{NULL, NULL, NULL}
@@ -988,27 +987,6 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_default)
}
}
-ZEND_FUNCTION(Ice_ObjectPrx_ice_flush)
-{
- if(ZEND_NUM_ARGS() != 0)
- {
- WRONG_PARAM_COUNT;
- }
-
- ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC));
- assert(obj->ptr);
- Proxy* _this = static_cast<Proxy*>(obj->ptr);
-
- try
- {
- _this->getProxy()->ice_flush();
- }
- catch(const IceUtil::Exception& ex)
- {
- throwException(ex TSRMLS_CC);
- }
-}
-
static void
do_cast(INTERNAL_FUNCTION_PARAMETERS, bool check)
{
@@ -1162,14 +1140,12 @@ IcePHP::Operation::Operation(const Ice::ObjectPrx& proxy, const string& name, co
//
// Create an array that indicates how arguments are passed to the operation.
- // The first element in the array determines how many follow it.
//
- zend_uchar* argTypes = new zend_uchar[params.size() + 1];
- argTypes[0] = static_cast<zend_uchar>(params.size());
+ zend_arg_info* argInfo = new zend_arg_info[params.size()];
int i;
Slice::ParamDeclList::const_iterator p;
- for(p = params.begin(), i = 1; p != params.end(); ++p, ++i)
+ for(p = params.begin(), i = 0; p != params.end(); ++p, ++i)
{
MarshalerPtr m = Marshaler::createMarshaler((*p)->type() TSRMLS_CC);
if(!m)
@@ -1177,24 +1153,30 @@ IcePHP::Operation::Operation(const Ice::ObjectPrx& proxy, const string& name, co
break;
}
_paramNames.push_back((*p)->name());
+ argInfo[i].name = NULL;
+ argInfo[i].class_name = NULL;
+ argInfo[i].allow_null = 1;
if((*p)->isOutParam())
{
- argTypes[i] = BYREF_FORCE;
+ argInfo[i].pass_by_reference = 1;
_outParams.push_back(m);
}
else
{
- argTypes[i] = BYREF_NONE;
+ argInfo[i].pass_by_reference = 0;
_inParams.push_back(m);
}
}
_zendFunction = static_cast<zend_internal_function*>(emalloc(sizeof(zend_internal_function)));
_zendFunction->type = ZEND_INTERNAL_FUNCTION;
- _zendFunction->arg_types = argTypes;
_zendFunction->function_name = estrndup(const_cast<char*>(name.c_str()), name.length());
_zendFunction->scope = proxyClassEntry;
_zendFunction->fn_flags = ZEND_ACC_PUBLIC;
+ _zendFunction->prototype = 0;
+ _zendFunction->num_args = static_cast<zend_uint>(params.size());
+ _zendFunction->arg_info = argInfo;
+ _zendFunction->pass_rest_by_reference = 0;
_zendFunction->handler = ZEND_FN(Ice_ObjectPrx_call);
}
@@ -1202,7 +1184,7 @@ IcePHP::Operation::~Operation()
{
if(_zendFunction)
{
- delete []_zendFunction->arg_types;
+ delete []_zendFunction->arg_info;
efree(_zendFunction->function_name);
efree(_zendFunction);
}
diff --git a/php/src/ice/util.cpp b/php/src/ice/util.cpp
index 83002e49fde..e61c2e73049 100644
--- a/php/src/ice/util.cpp
+++ b/php/src/ice/util.cpp
@@ -143,10 +143,9 @@ IcePHP::createIdentity(zval* zv, const Ice::Identity& id TSRMLS_DC)
return false;
}
- add_property_stringl_ex(zv, "name", sizeof("name"), const_cast<char*>(id.name.c_str()),
- id.name.length(), 1 TSRMLS_CC);
- add_property_stringl_ex(zv, "category", sizeof("category"), const_cast<char*>(id.category.c_str()),
- id.category.length(), 1 TSRMLS_CC);
+ zend_update_property_string(cls, zv, "name", sizeof("name") - 1, const_cast<char*>(id.name.c_str()) TSRMLS_CC);
+ zend_update_property_string(cls, zv, "category", sizeof("category") - 1,
+ const_cast<char*>(id.category.c_str()) TSRMLS_CC);
return true;
}
@@ -287,15 +286,8 @@ IcePHP::throwException(const IceUtil::Exception& ex TSRMLS_DC)
//
// Set the unknown member.
//
- zval* unknown;
- MAKE_STD_ZVAL(unknown);
- ZVAL_STRINGL(unknown, const_cast<char*>(e.unknown.c_str()), e.unknown.length(), 1);
- if(add_property_zval(zex, "unknown", unknown) == FAILURE)
- {
- zend_error(E_ERROR, "unable to set unknown member of %s", cls->name);
- return;
- }
- zval_ptr_dtor(&unknown); // add_property_zval increments the refcount
+ zend_update_property_string(cls, zex, "unknown", sizeof("unknown") - 1,
+ const_cast<char*>(e.unknown.c_str()) TSRMLS_CC);
//
// Throw the exception.
@@ -329,12 +321,7 @@ IcePHP::throwException(const IceUtil::Exception& ex TSRMLS_DC)
{
return;
}
- if(add_property_zval(zex, "id", id) == FAILURE)
- {
- zend_error(E_ERROR, "unable to set id member of %s", cls->name);
- return;
- }
- zval_ptr_dtor(&id); // add_property_zval increments the refcount
+ zend_update_property(cls, zex, "id", sizeof("id") - 1, id TSRMLS_CC);
//
// Set the facet member.
@@ -351,25 +338,13 @@ IcePHP::throwException(const IceUtil::Exception& ex TSRMLS_DC)
ZVAL_STRINGL(val, const_cast<char*>(f.c_str()), f.length(), 1);
add_index_zval(facet, i, val);
}
- if(add_property_zval(zex, "facet", facet) == FAILURE)
- {
- zend_error(E_ERROR, "unable to set facet member of %s", cls->name);
- return;
- }
- zval_ptr_dtor(&facet); // add_property_zval increments the refcount
+ zend_update_property(cls, zex, "facet", sizeof("facet") - 1, facet TSRMLS_CC);
//
// Set the operation member.
//
- zval* op;
- MAKE_STD_ZVAL(op);
- ZVAL_STRINGL(op, const_cast<char*>(e.operation.c_str()), e.operation.length(), 1);
- if(add_property_zval(zex, "operation", op) == FAILURE)
- {
- zend_error(E_ERROR, "unable to set operation member of %s", cls->name);
- return;
- }
- zval_ptr_dtor(&op); // add_property_zval increments the refcount
+ zend_update_property_string(cls, zex, "operation", sizeof("operation") - 1,
+ const_cast<char*>(e.operation.c_str()) TSRMLS_CC);
//
// Throw the exception.
@@ -397,15 +372,7 @@ IcePHP::throwException(const IceUtil::Exception& ex TSRMLS_DC)
//
// Set the type member.
//
- zval* type;
- MAKE_STD_ZVAL(type);
- ZVAL_STRINGL(type, const_cast<char*>(e.type.c_str()), e.type.length(), 1);
- if(add_property_zval(zex, "type", type) == FAILURE)
- {
- zend_error(E_ERROR, "unable to set type member of %s", cls->name);
- return;
- }
- zval_ptr_dtor(&type); // add_property_zval increments the refcount
+ zend_update_property_string(cls, zex, "type", sizeof("type") - 1, const_cast<char*>(e.type.c_str()) TSRMLS_CC);
//
// Throw the exception.
@@ -448,18 +415,11 @@ IcePHP::throwException(const IceUtil::Exception& ex TSRMLS_DC)
//
// Set the unknown member.
//
- zval* unknown;
- MAKE_STD_ZVAL(unknown);
ostringstream ostr;
e.ice_print(ostr);
string str = ostr.str();
- ZVAL_STRINGL(unknown, const_cast<char*>(str.c_str()), str.length(), 1);
- if(add_property_zval(zex, "unknown", unknown) == FAILURE)
- {
- zend_error(E_ERROR, "unable to set unknown member of %s", cls->name);
- return;
- }
- zval_ptr_dtor(&unknown); // add_property_zval increments the refcount
+ zend_update_property_string(cls, zex, "unknown", sizeof("unknown") - 1,
+ const_cast<char*>(str.c_str()) TSRMLS_CC);
}
//
diff --git a/php/test/Ice/exceptions/Client.php b/php/test/Ice/exceptions/Client.php
index bd99a0962e4..ebbead10f89 100644
--- a/php/test/Ice/exceptions/Client.php
+++ b/php/test/Ice/exceptions/Client.php
@@ -283,15 +283,7 @@ function allTests()
return $thrower;
}
-try
-{
- $thrower = allTests();
- $thrower->shutdown();
- exit();
-}
-catch(Ice_LocalException $ex)
-{
- echo "Caught exception:\n";
- print_r($ex);
-}
+$thrower = allTests();
+$thrower->shutdown();
+exit();
?>
diff --git a/php/test/Ice/facets/Client.php b/php/test/Ice/facets/Client.php
index d3c4d67b541..e473f4fe0ad 100644
--- a/php/test/Ice/facets/Client.php
+++ b/php/test/Ice/facets/Client.php
@@ -72,15 +72,7 @@ function allTests()
return $gf;
}
-try
-{
- $g = allTests();
- $g->shutdown();
- exit();
-}
-catch(Ice_LocalException $ex)
-{
- echo "Caught exception:\n";
- print_r($ex);
-}
+$g = allTests();
+$g->shutdown();
+exit();
?>
diff --git a/php/test/Ice/inheritance/Client.php b/php/test/Ice/inheritance/Client.php
index 66703a2e2a2..ba536d34923 100644
--- a/php/test/Ice/inheritance/Client.php
+++ b/php/test/Ice/inheritance/Client.php
@@ -219,15 +219,7 @@ function allTests()
return $initial;
}
-try
-{
- $initial = allTests();
- $initial->shutdown();
- exit();
-}
-catch(Ice_LocalException $ex)
-{
- echo "Caught exception:\n";
- print_r($ex);
-}
+$initial = allTests();
+$initial->shutdown();
+exit();
?>
diff --git a/php/test/Ice/objects/Client.php b/php/test/Ice/objects/Client.php
index 6c9f2d35464..c4e3b5544a7 100644
--- a/php/test/Ice/objects/Client.php
+++ b/php/test/Ice/objects/Client.php
@@ -271,15 +271,7 @@ function allTests()
return $initial;
}
-try
-{
- $initial = allTests();
- $initial->shutdown();
- exit();
-}
-catch(Ice_LocalException $ex)
-{
- echo "Caught exception:\n";
- print_r($ex);
-}
+$initial = allTests();
+$initial->shutdown();
+exit();
?>
diff --git a/php/test/Ice/operations/Client.php b/php/test/Ice/operations/Client.php
index 8b824d15204..6c7dabd2d1f 100644
--- a/php/test/Ice/operations/Client.php
+++ b/php/test/Ice/operations/Client.php
@@ -404,28 +404,20 @@ function allTests()
return $cl;
}
+$myClass = allTests();
+
+echo "testing server shutdown... ";
+flush();
+$myClass->shutdown();
try
{
- $myClass = allTests();
-
- echo "testing server shutdown... ";
- flush();
- $myClass->shutdown();
- try
- {
- $myClass->opVoid();
- test(false);
- }
- catch(Ice_LocalException $ex)
- {
- echo "ok\n";
- }
-
- exit();
+ $myClass->opVoid();
+ test(false);
}
catch(Ice_LocalException $ex)
{
- echo "Caught exception:\n";
- print_r($ex);
+ echo "ok\n";
}
+
+exit();
?>
diff --git a/php/test/Ice/slicing/exceptions/Client.php b/php/test/Ice/slicing/exceptions/Client.php
index f059b51d141..73f3c6c80ec 100644
--- a/php/test/Ice/slicing/exceptions/Client.php
+++ b/php/test/Ice/slicing/exceptions/Client.php
@@ -266,15 +266,7 @@ function allTests()
return $test;
}
-try
-{
- $test = allTests();
- $test->shutdown();
- exit();
-}
-catch(Ice_LocalException $ex)
-{
- echo "Caught exception:\n";
- print_r($eX);
-}
+$test = allTests();
+$test->shutdown();
+exit();
?>
diff --git a/php/test/Ice/slicing/objects/Client.php b/php/test/Ice/slicing/objects/Client.php
index d4cf42631ab..f443c8c63d6 100644
--- a/php/test/Ice/slicing/objects/Client.php
+++ b/php/test/Ice/slicing/objects/Client.php
@@ -785,15 +785,7 @@ function allTests()
return $test;
}
-try
-{
- $test = allTests();
- $test->shutdown();
- exit();
-}
-catch(Ice_LocalException $ex)
-{
- echo "Caught exception:\n";
- print_r($ex);
-}
+$test = allTests();
+$test->shutdown();
+exit();
?>