-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Banners application crashes #42841
Comments
I experience the same issue. When I publish a banner module or even access this page : administrator/index.php?option=com_banners&view=banners with Joomla installed on PHP 8.2.4, it crashes the website. Not only with Joomla 5, but I also experience the issue with Joomla 4.4.0. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42841. |
Sorry, forgot to mention that the file referred to that contains the error is .../administrator/components/com_banners/src/Helper/BannersHelper.php This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42841. |
unable to replicate with php 8.2.16 |
I cannot reproduce either. Please enable debug mode and set error reporting to maximum to get a stack trace. |
from my old memories could help |
I have set the error reporting to maximum and enabled the debug mode, but no stack trace shows up. The issue disappeared when I commented out this line in mod_banners.php: BannersComponentHelper::updateReset(); This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42841. |
I cannot reproduce the issue, too. However, I can see that the code is wrong. @webchun @counterpoint Could you please modify this line of code https://github.com/joomla/joomla-cms/blob/4.4-dev/administrator/components/com_banners/src/Helper/BannersHelper.php#L42 to: $date = Factory::getDate()->toSql(); Then check it again to see if the error is gon? |
The results of (string) and ->toSql() are exactly the same (so either works):
var_dump(get_class($date), (string) $date, $date->toSql());
string(20) "Joomla\CMS\Date\Date" string(19) "2024-02-23 11:32:48" string(19) "2024-02-23 11:32:48"
On 23/02/2024 01:49, Tuan Pham Ngoc wrote:
I cannot reproduce the issue, too. However, I can see that the code is wrong. @webchun <https://github.com/webchun> @counterpoint <https://github.com/counterpoint> Could you please modify this line of code https://github.com/joomla/joomla-cms/blob/4.4-dev/administrator/components/com_banners/src/Helper/BannersHelper.php#L42 to:
$date =Factory::getDate()->toSql();
Then check it again to see if the error is gon?
—
Reply to this email directly, view it on GitHub <#42841 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAJG5RKXQT6OILSDGMKT6A3YU7YQ5AVCNFSM6AAAAABDRHM4LOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRQGYZDOMJXG4>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
-- Black Sheep Research icon
MartinBrampton
Director
Black Sheep Research
Phone icon
+44 1653 487048 <tel:+44 1653 487048> | +44 7771 787010 <tel:+44 7771 787010>
Email icon
***@***.*** ***@***.***>
Website link icon
https://black-sheep-research.com <https://black-sheep-research.com>
Address icon
4 York Road, Malton, YO17 6AX, UK
|
Debug and error reporting maximum were already enabled. But since the problem causes PHP to crash, diagnostics of that kind are not feasible. That made the problem difficult to track, since the only initial information was that there was a problem somewhere - probably in PHP code. PHP crashes may well be specific to a precise environnment. But Debian 12 is pretty mainstream. This link provides similar information to the link provided by @alikon but is not specific to Wordpress and indicates that a PHP error is the most common of the possible causes - https://bobcares.com/blog/apache-error-failed-to-read-fastcgi-header/ This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42841. |
@counterpoint You are right. I just checked the code more and see that (string) $date and $date->toSql() result in same value. However, I would use $date->toSql() to make it consistent with other places in Joomla. For example https://github.com/joomla/joomla-cms/blob/4.4-dev/components/com_content/src/Model/ArticleModel.php#L184 and https://github.com/joomla/joomla-cms/blob/4.4-dev/components/com_content/src/Model/ArticleModel.php#L202 (Who knows if we use a DB driver using a date format different with Y-m-d H:i:s) Do you want to make PR with the suggested change? |
That makes sense @joomdonation, although (string) is a lot more efficient. What is PR? This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42841. |
@counterpoint In short, you make code change to to fix the issue. Please try to follow instructions here https://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests to make the PR The file you need to make change is https://github.com/joomla/joomla-cms/blob/4.4-dev/administrator/components/com_banners/src/Helper/BannersHelper.php (for 4.4-dev branch and later it will be up-merge to 5.1) |
Thanks @joomdonation. Sorry, but I'm not familiar with making git pull requests and do not have time to find out. I've precisely identified the fault, that should be enough. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42841. |
No worry @counterpoint . For the time being, you can make the propose change to your site to have the issue fixed. I will make the pull request on tomorrow to fix this issue so that it won't happen again when you update to future releases of Joomla |
Thanks @joomdonation that's great. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42841. |
PR #42869 should address this issue. Please test it if you can. Thanks ! |
Steps to reproduce the issue
Create a Joomla 5.0.2 site. Go to admin interface. Select component Banners. Exact result may vary. On Debian 12 with PHP 8.2 the site crashes and records an error "AH01067: Failed to read FastCGI header".
Expected result
Displays banners information
Actual result
Site crashes
System information (as much as possible)
Debian 12 PHP-FPM 8.2 Joomla 5.0.2
Additional comments
This can also affect third party software that calls the relevant method.
Line 42 sets $date:
$date = Factory::getDate();
This is then used in a bind to a SQL statement. But it is an object. It works if changed to:
$date = (string) Factory::getDate();
The text was updated successfully, but these errors were encountered: