@@ -852,15 +852,16 @@ public function setInterfaceGetsImplementedHandler(Closure $handler): void
852
852
* This method is useful within create_object handler
853
853
*
854
854
* @param CData $classType zend_class_entry type to create
855
+ * @param bool $persistent Whether object should be allocated persistent or not. Low-level feature!
855
856
*
856
857
* @return CData Instance of zend_object *
857
858
* @see zend_objects.c:zend_objects_new
858
859
*/
859
- public static function newInstanceRaw (CData $ classType ): CData
860
+ public static function newInstanceRaw (CData $ classType, bool $ persistent = false ): CData
860
861
{
861
862
$ objectSize = Core::sizeof (Core::type ('zend_object ' ));
862
863
$ totalSize = $ objectSize + self ::getObjectPropertiesSize ($ classType );
863
- $ memory = Core::new ("char[ {$ totalSize }] " , false );
864
+ $ memory = Core::new ("char[ {$ totalSize }] " , false , $ persistent );
864
865
$ object = Core::cast ('zend_object * ' , $ memory );
865
866
866
867
Core::call ('zend_object_std_init ' , $ object , $ classType );
@@ -939,10 +940,7 @@ private static function getObjectHandlers(CData $classType): CData
939
940
{
940
941
$ className = (StringEntry::fromCData ($ classType ->name )->getStringValue ());
941
942
if (!isset (self ::$ objectHandlers [$ className ])) {
942
- throw new \RuntimeException (
943
- 'Object handlers for class ' . $ className . ' are not configured. ' . PHP_EOL .
944
- 'Have you installed the create_object handler first? '
945
- );
943
+ self ::allocateClassObjectHandlers ($ className );
946
944
}
947
945
948
946
return self ::$ objectHandlers [$ className ];
0 commit comments