Skip to content

Fix missing use statements for global REDAXO classes in namespaced context#454

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/fix-rex-content-service-error
Closed

Fix missing use statements for global REDAXO classes in namespaced context#454
Copilot wants to merge 1 commit intomainfrom
copilot/fix-rex-content-service-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 7, 2026

In 7.0.0, lib/search_it.php was missing use declarations for four global REDAXO classes. PHP resolved them within the FriendsOfRedaxo\SearchIt namespace instead of the global namespace, causing fatal errors and silently swallowed exceptions.

Changes

  • lib/search_it.php — Added missing use statements:
    • use rex_content_service; — static call at rex_content_service::generateArticleContent() threw Class "FriendsOfRedaxo\SearchIt\rex_content_service" not found
    • use rex_dir; — used for rex_dir::create() before tempnam()
    • use rex_socket_exception;catch (rex_socket_exception $e) blocks were silently not matching
    • use rex_sql_exception; — same issue in SQL error handling

Example

// 7.0.0 — missing use, PHP looks for FriendsOfRedaxo\SearchIt\rex_content_service
$generated = rex_content_service::generateArticleContent($_id, $langID); // Fatal Error

// 7.0.1 — use statement added at top of file
use rex_content_service;
$generated = rex_content_service::generateArticleContent($_id, $langID); // OK
Original prompt

This section details on the original issue you should resolve

<issue_title>Class "FriendsOfRedaxo\SearchIt\rex_content_service" not found"</issue_title>
<issue_description>Error thrown with message "Class "FriendsOfRedaxo\SearchIt\rex_content_service" not found"

Stacktrace:
#13 Error in /var/www/vhosts/redd.unfccc.int/httpdocs/redaxo/src/addons/search_it/lib/search_it.php:460
#12 FriendsOfRedaxo\SearchIt\SearchIt:indexArticle in /var/www/vhosts/redd.unfccc.int/httpdocs/redaxo/src/addons/search_it/lib/EventHandler.php:130
#11 FriendsOfRedaxo\SearchIt\EventHandler:handleExtensionPoint in /var/www/vhosts/redd.unfccc.int/httpdocs/redaxo/src/core/lib/extension.php:52
#10 rex_extension:{closure} in /var/www/vhosts/redd.unfccc.int/httpdocs/redaxo/src/core/lib/util/timer.php:56
#9 rex_timer:measure in /var/www/vhosts/redd.unfccc.int/httpdocs/redaxo/src/core/lib/extension.php:42
#8 rex_extension:registerPoint in /var/www/vhosts/redd.unfccc.int/httpdocs/redaxo/src/addons/structure/plugins/content/pages/content.php:267
#7 require in /var/www/vhosts/redd.unfccc.int/httpdocs/redaxo/src/core/lib/packages/package.php:233
#6 rex_package:includeFile in /var/www/vhosts/redd.unfccc.int/httpdocs/redaxo/src/core/lib/be/controller.php:516
#5 rex_be_controller:{closure} in /var/www/vhosts/redd.unfccc.int/httpdocs/redaxo/src/core/lib/util/timer.php:56
#4 rex_timer:measure in /var/www/vhosts/redd.unfccc.int/httpdocs/redaxo/src/core/lib/be/controller.php:498
#3 rex_be_controller:includePath in /var/www/vhosts/redd.unfccc.int/httpdocs/redaxo/src/core/lib/be/controller.php:438
#2 rex_be_controller:includeCurrentPage in /var/www/vhosts/redd.unfccc.int/httpdocs/redaxo/src/core/backend.php:279
#1 require in /var/www/vhosts/redd.unfccc.int/httpdocs/redaxo/src/core/boot.php:136
FriendsOfREDAXO/search_it#0 require in /var/www/vhosts/redd.unfccc.int/httpdocs/redaxo/index.php:9
</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Fix class 'FriendsOfRedaxo\SearchIt\rex_content_service' not found error Fix missing use statements for global REDAXO classes in namespaced context Mar 7, 2026
@tyrant88
Copy link
Copy Markdown
Member

tyrant88 commented Mar 7, 2026

ich bearbeite die issues weiterhin selbst, wenn auch eventuell mit KI

@tyrant88 tyrant88 closed this Mar 7, 2026
@tyrant88 tyrant88 deleted the copilot/fix-rex-content-service-error branch March 9, 2026 21:30
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.

Class "FriendsOfRedaxo\SearchIt\rex_content_service" not found"

3 participants