summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-07-24 16:39:16 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-07-24 16:40:14 +0200
commit1f8a93abaafcdef776f342634af167c466cae34c (patch)
treed1253c84b2ac9d296d8fc3da2f4c1a5d184eb492
parente96e4ac7264a1d1bca9e340109a8115968e1ddff (diff)
downloadphp-git-1f8a93abaafcdef776f342634af167c466cae34c.tar.gz
Support class+mask union for internal argument
-rw-r--r--Zend/zend_API.h2
-rwxr-xr-xbuild/gen_stub.php21
2 files changed, 16 insertions, 7 deletions
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 6cfd903dc8..46b7f26190 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -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 },
diff --git a/build/gen_stub.php b/build/gen_stub.php
index 39f25e53c9..43470497d2 100755
--- a/build/gen_stub.php
+++ b/build/gen_stub.php
@@ -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');
}