No Code Attached Yet Information Required
avatar d0tr0ngnghia
d0tr0ngnghia
30 Apr 2025

Steps to reproduce the issue

if i make ajax call by XMLHttpRequest

echo ('SOME TEXT SOME TEXT SOME TEXT SOME TEXT SOME TEXT SOME TEXT SOME TEXT ')
$app->close(); // exit with code 0

Expected result

but XMLHttpRequest->responseText <----- SOME TEXT SOME TEXT SOME TEXT SOME TEXT SOME TEXT SOME TEXT SOME TEXT

Actual result

but XMLHttpRequest->responseText <----- EMPTY

System information (as much as possible)

EasyPHP on Window11
PHP 8.3.13
project dir: D:\My Documents\my Projects\name_project

Additional comments

\libraries\vendor\joomla\application\src\AbstractApplication.php ->
public function close($code = 0)
{
if (!$code) error_clear_last(); // i suggest add this line -------------------- ***** suggest ***** OPTION 1
exit($code);
}

when call $app->close() exit(0) call;

because in \libraries\bootstrap.php
has code
$errorHandler = \Symfony\Component\ErrorHandler\ErrorHandler::register();
so call to
\libraries\vendor\symfony\error-handler.php -> handleFatalError()

but handleFatalError() has no way to exit with code 0;

Last line in handleFatalError():
if ($exit && $exitCode = self::$exitCode) {
register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
}

----- I suggest: ----- <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< OPTION 2
if ($exit) {
$exitCode = self::$exitCode
register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
}

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar d0tr0ngnghia d0tr0ngnghia - open - 30 Apr 2025
avatar d0tr0ngnghia d0tr0ngnghia - change - 30 Apr 2025
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 30 Apr 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 30 Apr 2025
avatar d0tr0ngnghia d0tr0ngnghia - change - 30 Apr 2025
Title
no way to exit with code 0
no way to exit with code 0 for Ajax
avatar AkameOuO
AkameOuO - comment - 30 Apr 2025

I am unable to replicate this.

Image

Image

avatar QuyTon QuyTon - change - 30 Apr 2025
Labels Added: Information Required
avatar QuyTon QuyTon - labeled - 30 Apr 2025

Add a Comment

Login with GitHub to post a comment