Skip to content

gen_stub.php does not correctly handle @not-serializable + final for legacy-arginfo #18506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
TimWolla opened this issue May 6, 2025 · 0 comments

Comments

@TimWolla
Copy link
Member

TimWolla commented May 6, 2025

Description

The following code:

<?php
    /**
 * @generate-class-entries static
 * @generate-legacy-arginfo 80000
 * @undocumentable
 */
    /**
     * @not-serializable
     */
    final class Test {

    }

Resulted in this output:

static zend_class_entry *register_class_Test(void)
{
	zend_class_entry ce, *class_entry;

	INIT_CLASS_ENTRY(ce, "Test", NULL);
#if (PHP_VERSION_ID >= 80400)
	class_entry = zend_register_internal_class_with_flags(&ce, NULL, #if (PHP_VERSION_ID >= 80100)
ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE#elif (PHP_VERSION_ID >= 80000)
ZEND_ACC_FINAL#endif
);
#else
	class_entry = zend_register_internal_class_ex(&ce, NULL);
	class_entry->ce_flags |= #if (PHP_VERSION_ID >= 80100)
ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE#elif (PHP_VERSION_ID >= 80000)
ZEND_ACC_FINAL#endif
;
#endif

	return class_entry;
}

But I expected this output instead: Valid C code.

PHP Version

n/a

Operating System

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant