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

fix: add a fix to cover infinity recursive call #1139

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions core/kernel/classes/class.Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -763,13 +763,7 @@ public function equals(core_kernel_classes_Resource $resource): bool
*/
public function isInstanceOf(core_kernel_classes_Class $class): bool
{
foreach ($this->getTypes() as $type) {
if ($class->equals($type) || $type->isSubClassOf($class)) {
return true;
}
}

return false;
return in_array($class->getUri(), $this->getParentClassesIds(), true);
}

public function getRootId(): string
Expand Down
8 changes: 5 additions & 3 deletions core/kernel/persistence/smoothsql/class.Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT);
*/

use oat\generis\model\GenerisRdf;
use oat\generis\model\OntologyRdf;
use oat\generis\model\OntologyRdfs;
use oat\oatbox\session\SessionService;
Expand Down Expand Up @@ -120,7 +121,7 @@ public function getParentClassesIds(string $resourceUri): array
JOIN statements_tree st
ON s.subject = st.object
AND s.predicate IN (?, ?)
AND s.object NOT IN (?, ?, ?, ?)
AND s.object NOT IN (?, ?, ?, ?, ?)
)
SELECT object FROM statements_tree;
SQL;
Expand All @@ -136,8 +137,9 @@ public function getParentClassesIds(string $resourceUri): array
OntologyRdf::RDF_TYPE,
'http://www.tao.lu/Ontologies/TAO.rdf#AssessmentContentObject',
'http://www.tao.lu/Ontologies/TAO.rdf#TAOObject',
'http://www.tao.lu/Ontologies/generis.rdf#generis_Ressource',
'http://www.w3.org/2000/01/rdf-schema#Resource',
GenerisRdf::CLASS_GENERIS_RESOURCE,
OntologyRdfs::RDFS_RESOURCE,
OntologyRdfs::RDFS_CLASS,
]
);

Expand Down
Loading