I have submitted one module in Magento Marketplace. They gave me 2 errors in my code.
Use of echo language construct is discouraged.
Use of exit language construct is discouraged.
For echo, I have added /* @noEscape */ before echo.
But for exit, I don't know, how to solve error.
Code piece from Observer.php
if ($maintenancePageBody != '') {
if ($redirectPage == 0) {
/* @noEscape */ echo $blankpageMsg;
} else if ($redirectPage == 1) {
/* @noEscape */ echo $maintenancePage;
} else if ($redirectPage == 2 && $customUrl != '') {
header('Location:' . $customUrl);
exit;
} else {
/* @noEscape */ echo $maintenancePage;
}
}
// exit; /* my code */
$this->getResponse()->setBody(); // I used this line instead of `exit`
Magento Marketplace error is,
Use of exit language construct is discouraged.
File: Model/Observer.php Line: 717 Column: 17 Source: MEQP1.Security.LanguageConstruct.ExitUsage
EDIT
I submitted extension again.
echo
error still occurs. $maintenancePage
variable has HTML content.
Would anyone please help me, what should I do for echo
and exit
?
exit
? You can remove it and usereturn
instead. – Jaimin Sutariya Mar 2 '17 at 5:48return
, but my code stop to work. – Prince Mar 2 '17 at 6:04