Description
The following code:
<?php/** * @generate-class-entries */class Test {
protectedstring$x = '[{"label":"Option 1","value":"1"},{"label":"Option 2","value":"2"},{"label":"Option 3","value":"3"},{"label":"Option 4","value":"4"}]';
protectedfunctionbar(): void {
}
}Resulted in this output:
php build/gen_stub.php t.stub.php
staticzend_class_entry*register_class_Test(void)
{
zend_class_entryce, *class_entry;
INIT_CLASS_ENTRY(ce, "Test", class_Test_methods);
class_entry=zend_register_internal_class_with_flags(&ce, NULL, 0);
zvalproperty_x_default_value;
zend_string*property_x_default_value_str=zend_string_init("[{"label":"Option1","value":"1"},{"label":"Option2","value":"2"},{"label":"Option3","value":"3"},{"label":"Option4","value":"4"}]", strlen("[{"label":"Option1","value":"1"},{"label":"Option2","value":"2"},{"label":"Option3","value":"3"},{"label":"Option4","value":"4"}]"), 1);
ZVAL_STR(&property_x_default_value, property_x_default_value_str);
zend_string*property_x_name=zend_string_init("x", sizeof("x") -1, 1);
zend_declare_typed_property(class_entry, property_x_name, &property_x_default_value, ZEND_ACC_PROTECTED, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
zend_string_release(property_x_name);
returnclass_entry;
} But I expected this output instead:
Double quotes need to be escaped
PHP Version
PHP 8.4.14 (cli) (built: Dec 1 2025 12:04:28) (ZTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.4.14, Copyright (c) Zend Technologies
Operating System
No response
Description
The following code:
Resulted in this output:
But I expected this output instead:
Double quotes need to be escaped
PHP Version
Operating System
No response