]> granicus.if.org Git - php/commitdiff
Fix the signature of FFI::sizeof() and FFI::alignof()
authorMáté Kocsis <kocsismate@woohoolabs.com>
Wed, 23 Dec 2020 22:27:12 +0000 (23:27 +0100)
committerMáté Kocsis <kocsismate@woohoolabs.com>
Thu, 24 Dec 2020 10:39:09 +0000 (11:39 +0100)
ext/ffi/ffi.c
ext/ffi/ffi.stub.php
ext/ffi/ffi_arginfo.h

index 1b5784102d4e876f9d767c9b875074779e8db9e3..620e4c6431f8e28372e67d806dfe6f3f2879588b 100644 (file)
@@ -4165,7 +4165,7 @@ ZEND_METHOD(FFI, sizeof) /* {{{ */
                type = ZEND_FFI_TYPE(ctype->type);
        } else {
                zend_wrong_parameter_class_error(1, "FFI\\CData or FFI\\CType", zv);
-               return;
+               RETURN_THROWS();
        }
 
        RETURN_LONG(type->size);
@@ -4191,7 +4191,7 @@ ZEND_METHOD(FFI, alignof) /* {{{ */
                type = ZEND_FFI_TYPE(ctype->type);
        } else {
                zend_wrong_parameter_class_error(1, "FFI\\CData or FFI\\CType", zv);
-               return;
+               RETURN_THROWS();
        }
 
        RETURN_LONG(type->align);
index 0a347b2aa123b0b7dadab82739d2dabbbb966f72..ab0342e43ef640c9cd7d1ac9182b3ea69abe2ab6 100644 (file)
@@ -33,11 +33,17 @@ final class FFI
     /** @prefer-ref $ptr */
     public static function addr(FFI\CData $ptr): FFI\CData {}
 
-    /** @prefer-ref $ptr */
-    public static function sizeof(object $ptr): ?int {}
+    /**
+     * @param FFI\CData|FFI\CType $ptr
+     * @prefer-ref $ptr
+     */
+    public static function sizeof($ptr): int {}
 
-    /** @prefer-ref $ptr */
-    public static function alignof(object $ptr): ?int {}
+    /**
+     * @param FFI\CData|FFI\CType $ptr
+     * @prefer-ref $ptr
+     */
+    public static function alignof($ptr): int {}
 
     /**
      * @param FFI\CData|string $from
index 19e0adb25d7a6b92be8f6a9c17a937d7a89a1d63..01e9e1f912976b6446d8c10326827694f4ef38ef 100644 (file)
@@ -1,5 +1,5 @@
 /* This is a generated file, edit the .stub.php file instead.
- * Stub hash: abd3bc186ae3f71f2b7eb1d47f3b6bab84fb2bda */
+ * Stub hash: f106049da816d8fef7bbfb40c5335245b57044e0 */
 
 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cdef, 0, 0, FFI, 0)
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, code, IS_STRING, 0, "\"\"")
@@ -46,8 +46,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_addr, 0, 1, FFI\\CData,
        ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, ptr, FFI\\CData, 0)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_sizeof, 0, 1, IS_LONG, 1)
-       ZEND_ARG_TYPE_INFO(ZEND_SEND_PREFER_REF, ptr, IS_OBJECT, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_sizeof, 0, 1, IS_LONG, 0)
+       ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
 ZEND_END_ARG_INFO()
 
 #define arginfo_class_FFI_alignof arginfo_class_FFI_sizeof