From 6c0e7e6fcabde691e7c38a814b6171f9f4e77d09 Mon Sep 17 00:00:00 2001 From: Joe George Date: Tue, 7 Jul 2020 16:57:51 -0400 Subject: Add class cycle detection during unmarshaling (#946) Add support for detection of class cycles during unmarshaling in languages which do no have garbage collection: C++, Swift, and Objective-C. A `MarshalException` is thrown when a cycle is detected. The property `Ice.AcceptClassCycles` can be set to a value greater than `0` to change this behavior. --- php/src/php5/Communicator.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'php/src/php5/Communicator.cpp') diff --git a/php/src/php5/Communicator.cpp b/php/src/php5/Communicator.cpp index a7d185e9ccc..41b91656238 100644 --- a/php/src/php5/Communicator.cpp +++ b/php/src/php5/Communicator.cpp @@ -1234,6 +1234,14 @@ ZEND_FUNCTION(Ice_initialize) initData.compactIdResolver = new IdResolver(TSRMLS_C); initData.valueFactoryManager = new ValueFactoryManager; + if(!initData.properties) + { + initData.properties = Ice::createProperties(); + } + + // Always accept cycles in PHP + initData.properties->setProperty("Ice.AcceptClassCycles", "1"); + CommunicatorInfoIPtr info = initializeCommunicator(return_value, seq, zvargs != 0, initData TSRMLS_CC); if(!info) { -- cgit v1.2.3