Skip to content

Commit 413cbdf

Browse files
committed
Declare FFI::__BIGGEST_ALIGNMENT__ in stubs as well
1 parent d476da7 commit 413cbdf

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

ext/ffi/ffi.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5280,8 +5280,6 @@ ZEND_MINIT_FUNCTION(ffi)
52805280
zend_ffi_handlers.get_properties = zend_fake_get_properties;
52815281
zend_ffi_handlers.get_gc = zend_fake_get_gc;
52825282

5283-
zend_declare_class_constant_long(zend_ffi_ce, "__BIGGEST_ALIGNMENT__", sizeof("__BIGGEST_ALIGNMENT__")-1, __BIGGEST_ALIGNMENT__);
5284-
52855283
zend_ffi_cdata_ce = register_class_FFI_CData();
52865284
zend_ffi_cdata_ce->create_object = zend_ffi_cdata_new;
52875285
zend_ffi_cdata_ce->get_iterator = zend_ffi_cdata_get_iterator;

ext/ffi/ffi.stub.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
/** @not-serializable */
88
final class FFI
99
{
10+
/**
11+
* @var int
12+
* @cname __BIGGEST_ALIGNMENT__
13+
*/
14+
public const __BIGGEST_ALIGNMENT__ = UNKNOWN;
15+
1016
public static function cdef(string $code = "", ?string $lib = null): FFI {}
1117

1218
public static function load(string $filename): ?FFI {}

ext/ffi/ffi_arginfo.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: ec471e9638aa6b7b46b6e2cf8dd7232daa6d1525 */
2+
* Stub hash: 61da0287284302ae020c50af7d6252f58cd5a9d3 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cdef, 0, 0, FFI, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, code, IS_STRING, 0, "\"\"")
@@ -222,6 +222,12 @@ static zend_class_entry *register_class_FFI(void)
222222
class_entry = zend_register_internal_class_ex(&ce, NULL);
223223
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE;
224224

225+
zval const___BIGGEST_ALIGNMENT___value;
226+
ZVAL_LONG(&const___BIGGEST_ALIGNMENT___value, __BIGGEST_ALIGNMENT__);
227+
zend_string *const___BIGGEST_ALIGNMENT___name = zend_string_init_interned("__BIGGEST_ALIGNMENT__", sizeof("__BIGGEST_ALIGNMENT__") - 1, 1);
228+
zend_declare_class_constant_ex(class_entry, const___BIGGEST_ALIGNMENT___name, &const___BIGGEST_ALIGNMENT___value, ZEND_ACC_PUBLIC, NULL);
229+
zend_string_release(const___BIGGEST_ALIGNMENT___name);
230+
225231
return class_entry;
226232
}
227233

0 commit comments

Comments
 (0)