The error occurs when get_post_meta() returns NULL and StringData::fromString() doesn't handle null values gracefully.
A link to a Sandbox site where the bug has been reproduced
(Als je tijd hebt, maak een Sandbox op https://oxygenbuilder.com/try en reproduceer het. Anders gebruik de stappen hieronder)
Steps required to reproduce the bug:
Create a custom post type called "Project" with a custom field _project_client using this code in a plugin or functions.php:
phpadd_action('init', function() {
register_post_type('project', array(
'public' => true,
'supports' => array('title', 'editor')
));
});
2. Go to WordPress Dashboard → Pages → Add New
3. Edit the page with Oxygen Builder
4. Add a **Text** element to the page (NOT inside a Post Loop or Repeater)
5. In the Text element, click the dynamic data icon and select **Meta Field**
6. Enter the custom field key: `project_client`
7. Save and view the page on the frontend
8. Site crashes with fatal error:
Fatal error: Uncaught TypeError: Breakdance\DynamicData\StringData::fromString():
Argument #1 ($string) must be of type string, null given, called in
/wp-content/plugins/oxygen/plugin/dynamic-data/fields/utility/php-function.php on line 80
Expected behavior:
The dynamic data should display nothing or a fallback message when the custom field doesn't exist in the current context, not crash the site.
Additional context:
The root cause is in /plugin/dynamic-data/field-types/StringData.php line 44 where fromString() expects a string but receives NULL when the custom field doesn't exist. A null check would prevent this crash.
The error occurs when get_post_meta() returns NULL and StringData::fromString() doesn't handle null values gracefully.
A link to a Sandbox site where the bug has been reproduced
(Als je tijd hebt, maak een Sandbox op https://oxygenbuilder.com/try en reproduceer het. Anders gebruik de stappen hieronder)
Steps required to reproduce the bug:
Create a custom post type called "Project" with a custom field _project_client using this code in a plugin or functions.php:
phpadd_action('init', function() {
register_post_type('project', array(
'public' => true,
'supports' => array('title', 'editor')
));
});
Fatal error: Uncaught TypeError: Breakdance\DynamicData\StringData::fromString():
Argument #1 ($string) must be of type string, null given, called in
/wp-content/plugins/oxygen/plugin/dynamic-data/fields/utility/php-function.php on line 80
Expected behavior:
The dynamic data should display nothing or a fallback message when the custom field doesn't exist in the current context, not crash the site.
Additional context:
The root cause is in /plugin/dynamic-data/field-types/StringData.php line 44 where fromString() expects a string but receives NULL when the custom field doesn't exist. A null check would prevent this crash.