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

Fixing a fatal error when installing extensions with Option Values defined in XML #15643

Merged
merged 1 commit into from
Oct 28, 2019
Merged

Fixing a fatal error when installing extensions with Option Values defined in XML #15643

merged 1 commit into from
Oct 28, 2019

Conversation

omarabuhussein
Copy link
Member

If an Extension has an option value defined in an XML file and the
option value belongs to an option group that is already defined in Civi
But in the XML (e.g activity_type option group) then installing the
extension will result in a fatal error with the following message :

"A fatal error was triggered: One of parameters (value: ) is not of the type Integer"

The error happen because CiviCRM fails to find the option group in the
XML file so it look for it in the database, but the code that look for
it pass the option group name as a SimpleXML object (since SimpleXML
does not return scalar values and rather objects of Type SimpleXML) and
because of that the code won't be able to find the value which will
result in executing a query that expect an integer but rather a NULL
pass to it which result in the fatal error.

I fixed it by casting the option group name inside the SimpleXML object
to string.

defined in XML

If an Extension has an option value defined in an XML file and the
option value belongs to an option group that is already defined in Civi
But in the XML (e.g activity_type option group) then installing the
extension will result in a fatal error with the following message :

"A fatal error was triggered: One of parameters (value: ) is not of the type Integer"

The error happen because CiviCRM fails to find the option group in the
XML file so it look for it in the database, but the code that look for
it pass the option group name as a SimpleXML object (since SimpleXML
does not return scalar values and rather objects of Type SimpleXML) and
because of that the code won't be able to find the value which will
result in executing a query that expect an integer but rather a NULL
pass to it which result in the fatal error.

I fixed it by casting the option group name inside the SimpleXML object
to string.
@civibot
Copy link

civibot bot commented Oct 28, 2019

(Standard links)

@eileenmcnaughton
Copy link
Contributor

Casting to a string looks safe & sensible

@eileenmcnaughton eileenmcnaughton merged commit a95c7ad into civicrm:master Oct 28, 2019
@omarabuhussein omarabuhussein deleted the fixing-optionvalues-xml-processing branch November 1, 2019 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants