]> granicus.if.org Git - php/commitdiff
Support class+mask union for internal argument
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 24 Jul 2020 14:39:16 +0000 (16:39 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 24 Jul 2020 14:40:14 +0000 (16:40 +0200)
Zend/zend_API.h
build/gen_stub.php

index 6cfd903dc81e8de1019466ffa08c5b66842f7e01..46b7f26190c89c45139d06705a22ce0282deb2f1 100644 (file)
@@ -122,6 +122,8 @@ typedef struct _zend_fcall_info_cache {
 /* Arginfo structures with complex type information */
 #define ZEND_ARG_TYPE_MASK(pass_by_ref, name, type_mask, default_value) \
        { #name, ZEND_TYPE_INIT_MASK(type_mask | _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), default_value },
+#define ZEND_ARG_OBJ_TYPE_MASK(pass_by_ref, name, class_name, type_mask, default_value) \
+       { #name, ZEND_TYPE_INIT_CLASS_CONST_MASK(#class_name, type_mask | _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), default_value },
 /* Arginfo structures with object type information */
 #define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) \
        { #name, ZEND_TYPE_INIT_CLASS_CONST(#classname, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), NULL },
index 39f25e53c9024c2c3d10fc3ffac07e9e57b7a4c6..43470497d27af3ee041b182d2bbd4b906d0d7dad 100755 (executable)
@@ -905,14 +905,21 @@ function funcInfoToCode(FuncInfo $funcInfo): string {
                 }
             } else if (null !== $representableType = $argType->tryToRepresentableType()) {
                 if ($representableType->classType !== null) {
-                    throw new Exception('Unimplemented');
+                    $code .= sprintf(
+                        "\tZEND_%s_OBJ_TYPE_MASK(%s, %s, %s, %s, %s)\n",
+                        $argKind, $argInfo->getSendByString(), $argInfo->name,
+                        $representableType->classType->toEscapedName(),
+                        $representableType->toTypeMask(),
+                        $argInfo->getDefaultValueString()
+                    );
+                } else {
+                    $code .= sprintf(
+                        "\tZEND_%s_TYPE_MASK(%s, %s, %s, %s)\n",
+                        $argKind, $argInfo->getSendByString(), $argInfo->name,
+                        $representableType->toTypeMask(),
+                        $argInfo->getDefaultValueString()
+                    );
                 }
-                $code .= sprintf(
-                    "\tZEND_%s_TYPE_MASK(%s, %s, %s, %s)\n",
-                    $argKind, $argInfo->getSendByString(), $argInfo->name,
-                    $representableType->toTypeMask(),
-                    $argInfo->getDefaultValueString()
-                );
             } else {
                 throw new Exception('Unimplemented');
             }