Skip to content
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

PHP 8: Preventing Fatal error for ezobjectrelationlist datatype #457

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thiagocamposviana
Copy link

@thiagocamposviana thiagocamposviana commented Nov 21, 2024

Preventing Fatal error in PHP 8 for ezobjectrelationlist datatype when data_text is an empty string or null

We want to standardize the data_text default value to an empty string because in PHP 8 most of operations with string will throw a Fatal error when passing null. The data_text value is initialized with a null value when adding a new attribute to an existing content class.

Example, execute this in PHP 8.3:

$dom = new DOMDocument('1.0', 'utf-8');
$dom->loadXML('');

PHP Fatal error: Uncaught ValueError: DOMDocument::loadXML(): Argument #1 ($source) must not be empty...

$dom = new DOMDocument('1.0', 'utf-8');
$dom->loadXML(null);

PHP Fatal error: Uncaught ValueError: DOMDocument::loadXML(): Argument #1 ($source) must not be empty in...

…n data_text is an empty string or null

We want to standardize the data_text default value to an empty string because in PHP 8 most of operations with string will throw a Fatal error when passing null.
The data_text value is initialized with a null value when adding a new attribute to an existing content class.
Copy link

sonarcloud bot commented Nov 21, 2024

Copy link
Member

@alongosz alongosz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. You haven't added any test coverage. It would be useful to asses the bugfix and ensure any further refactoring doesn't break this.

Side note: if you target your PR to main, it will be fixed in upcoming 5.0 only. I'm not sure if this is what you inteded.

@thiagocamposviana
Copy link
Author

thiagocamposviana commented Nov 22, 2024

@alongosz yeah I am not sure about all the bureaucratic steps to submit a pull request. I think I will create a ticket describing the issue and I will point this as a possible solution hoping in the future there is an official patch for this issue.

Update: Created this issue https://issues.ibexa.co/browse/IBX-9259

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

Successfully merging this pull request may close these issues.

2 participants