Skosmos icon indicating copy to clipboard operation
Skosmos copied to clipboard

Calling removeDuplicatePropertyValues() on some elementary datatypes crashes Skosmos

Open joelit opened this issue 1 year ago • 0 comments

URL address of the page where you encountered the problem

On Skosmos 2.18, but this needs to be tested on Skosmos 3.0

On a KOKO concept page with owl:deprecated true. In this case it was at https://dev.finto.fi/koko/fi/page/p1330 but the data has changed since.

Description of the problem

Uncertain of the exact conditions for reproduction. In general, when calling Concept->removeDuplicatePropertyValues() on a Concept which has booleans as a property value, this causes a PHP Fatal error since PHP8. This behaviour has been reported before: https://bugs.php.net/bug.php?id=79623

Skosmos concepts can have strings, uriresources, booleans or numbers as their value. Skosmos code calls method_exists() function which only accepts strings or objects, and it's possible that elementary datatypes ere neither.

Additional information (e.g. screenshots) about the problem

Got error 'PHP message: PHP Fatal error:  Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, bool given in /var/www/dev.finto.fi/model/Concept.php:663
Stack trace:
#0 /var/www/dev.finto.fi/model/Concept.php(663): method_exists()
#1 /var/www/dev.finto.fi/model/Concept.php(645): Concept->removeDuplicatePropertyValues()
#2 /var/www/dev.finto.fi/vendor/twig/twig/src/Extension/CoreExtension.php(1570): Concept->getProperties()
#3 /tmp/dev.finto.fi-template-cache/14/14195eb90970f3d82291e8b5206fbde97857f3ec07a811c6d30bb2e78e0c8bcd.php(400): twig_get_attribute()
#4 /var/www/dev.finto.fi/vendor/twig/twig/src/Template.php(405): __TwigTemplate_6cfe4edcf45ed4eafa80c27675c92860c18b44e7cea82694d18c63deca2a6327->doDisplay()
#5 /var/www/dev.finto.fi/vendor/twig/twig/src/Template.php(378): Twig\\Template->displayWithErrorHandling()
...

joelit avatar Jun 28 '24 08:06 joelit