Skip to content

Commit

Permalink
Dynamic properties removal (#1423) - Fix #1422
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone authored Feb 10, 2023
1 parent d455892 commit e2d3940
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 19 deletions.
17 changes: 9 additions & 8 deletions php/lib/Ice_no_ns.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public function ice_name()

abstract class Ice_UserException extends Ice_Exception
{
public $_ice_slicedData;

public function __construct($message = '')
{
parent::__construct($message);
Expand All @@ -57,6 +59,8 @@ public function __construct($message = '')

class Ice_Value
{
public $_ice_slicedData;

public static function ice_staticId()
{
return "::Ice::Object";
Expand All @@ -69,19 +73,14 @@ public function ice_id()

public function ice_getSlicedData()
{
if(property_exists($this, '_ice_slicedData'))
{
return $this->_ice_slicedData;
}
else
{
return null;
}
return $this->_ice_slicedData;
}
}

class Ice_InterfaceByValue extends Ice_Value
{
public $id;

public function __construct($id)
{
$this->id =$id;
Expand Down Expand Up @@ -125,6 +124,8 @@ public static function ice_staticId()

class Ice_UnknownSlicedValue extends Ice_Value
{
public $unknownTypeId;

public function __construct()
{
}
Expand Down
17 changes: 9 additions & 8 deletions php/lib/Ice_ns.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public function ice_name()

abstract class UserException extends Exception
{
public $_ice_slicedData;

public function __construct($message = '')
{
parent::__construct($message);
Expand All @@ -61,6 +63,8 @@ public function __construct($message = '')

class Value
{
public $_ice_slicedData;

public static function ice_staticId()
{
return "::Ice::Object";
Expand All @@ -73,19 +77,14 @@ public function ice_id()

public function ice_getSlicedData()
{
if(property_exists($this, '_ice_slicedData'))
{
return $this->_ice_slicedData;
}
else
{
return null;
}
return $this->_ice_slicedData;
}
}

class InterfaceByValue extends Value
{
public $id;

public function __construct($id)
{
$this->id =$id;
Expand Down Expand Up @@ -129,6 +128,8 @@ public static function ice_staticId()

class UnknownSlicedValue extends Value
{
public $unknownTypeId;

public function __construct()
{
}
Expand Down
6 changes: 6 additions & 0 deletions php/src/php/Connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,8 @@ IcePHP::connectionInit(void)
ZEND_ACC_PUBLIC);
zend_declare_property_string(connectionInfoClassEntry, STRCAST("adapterName"), sizeof("adapterName") - 1,
STRCAST(""), ZEND_ACC_PUBLIC);
zend_declare_property_null(connectionInfoClassEntry, STRCAST("underlying"), sizeof("underlying") - 1,
ZEND_ACC_PUBLIC);

//
// Register the IPConnectionInfo class.
Expand Down Expand Up @@ -621,6 +623,10 @@ IcePHP::connectionInit(void)
#endif
ce.create_object = handleConnectionInfoAlloc;
tcpConnectionInfoClassEntry = zend_register_internal_class_ex(&ce, ipConnectionInfoClassEntry);
zend_declare_property_long(tcpConnectionInfoClassEntry, STRCAST("rcvSize"), sizeof("rcvSize") - 1, 0,
ZEND_ACC_PUBLIC);
zend_declare_property_long(tcpConnectionInfoClassEntry, STRCAST("sndSize"), sizeof("sndSize") - 1, 0,
ZEND_ACC_PUBLIC);

//
// Register the UDPConnectionInfo class.
Expand Down
2 changes: 2 additions & 0 deletions php/src/php/Endpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ IcePHP::endpointInit(void)
ZEND_ACC_PUBLIC);
zend_declare_property_bool(endpointInfoClassEntry, STRCAST("compress"), sizeof("compress") - 1, 0,
ZEND_ACC_PUBLIC);
zend_declare_property_null(endpointInfoClassEntry, STRCAST("underlying"), sizeof("underlying") - 1,
ZEND_ACC_PUBLIC);

//
// Define the IPEndpointInfo class.
Expand Down
2 changes: 1 addition & 1 deletion php/src/php/Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ IcePHP::StreamUtil::getSlicedDataMember(zval* obj, ObjectMap* objectMap)
Ice::SlicedDataPtr slicedData;

string name = "_ice_slicedData";
zval* sd = zend_hash_str_find(Z_OBJPROP_P(obj), STRCAST(name.c_str()), name.size());
zval* sd = zend_hash_str_find_ind(Z_OBJPROP_P(obj), STRCAST(name.c_str()), name.size());
if(sd)
{
if(Z_TYPE_P(sd) != IS_NULL)
Expand Down
2 changes: 0 additions & 2 deletions php/test/Ice/slicing/objects/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,6 @@ function allTests($helper)
$d3->sb = "D3.sb";
$d3->pb = $d3;
$d3->sd3 = "D3.sd3";
$d3->pd1 = null;
$d3->pd3 = $d11;

$d12 = $NS ? eval("return new Test\\D1;") : eval("return new Test_D1;");
Expand Down Expand Up @@ -598,7 +597,6 @@ function allTests($helper)
$ss2d3->sb = "D3.sb";
$ss2d3->sd3 = "D3.sd3";
$ss2d3->pb = $ss2b;
$ss2d3->pd1 = null;

$ss1d1->pd1 = $ss2b;
$ss1d3->pd3 = $ss2d1;
Expand Down

0 comments on commit e2d3940

Please sign in to comment.