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

Deprecated: Function strftime() is deprecated /libraries/src/Form/Field/CalendarField.php on line 322 #58

Open
heli63 opened this issue Oct 18, 2023 · 26 comments
Labels
bug Something isn't working Joomla 4 Issue occurs while using plugin in Joomla 4 Joomla 5 Issue occurs while using plugin in Joomla 5 Joomla-CMS Issue with root cause in the Joomla CMS platform

Comments

@heli63
Copy link

heli63 commented Oct 18, 2023

Hello, when i want to run your program with php 8.1. I get the error as shown above. With php 8.0. everything is fine.

Best regards!

Helmut

@Jefferson49
Copy link
Owner

Hello Helmut, thank you for reporting the issue.

Which version of sexy_polling do you use? Have you installed the latest version v4.2.0? If not, you should upgrade first.

If you have the latest version, it would help to get a more detailed information, which part of the sexy_polling code causes the issue. Would it be possible for you to switch on debugging with maximum error reporting and post the detailed error messages?

  • Joomla -> Global configuration -> System -> Debug System -> Yes
  • Joomla -> Global configuration -> Server -> Error Reporting -> Maximum

@heli63
Copy link
Author

heli63 commented Oct 18, 2023 via email

@Jefferson49
Copy link
Owner

maybe it would help if you can tell me what you mean with “incompatibility with the database configuration”?

To be honest: I do not know exactly yet. The error message is clearly related to the database, since "country" is a column in the database and the default value is a typical database setting. In the past, the "country cant have default value" seemed to be related to the database version. You are the second user to report that the error occurs with a newer database version. The similarity with issue #49 could be that a PHP version greater than 8.0 is used. Maybe, there was a change in the PHP MySQL libraries between PHP 8.0 and 8.1, which causes this issue.

It would be really helpful to get the full error stack of the PHP error. The error stack shows the order of all the PHP functions, which were called and it would be possible to see, which line of code in the plugin originated the function calls, which finally end up in the error. The provided error message does not contain enough information, since the plugin does not call the strftime() function directly. I have already check that.

@Jefferson49
Copy link
Owner

Another place to look for the PHP error stack trace would be the PHP error log files on the server.

@Jefferson49
Copy link
Owner

We need to differenciate between 2 errors:

  1. "... country cant have a default value" during installation of v4.2.0
  2. "Function strftime() is deprecated" if using v4.1.6

It would be helpful to get more error logs for both of the cases.

@heli63
Copy link
Author

heli63 commented Oct 18, 2023 via email

@heli63
Copy link
Author

heli63 commented Oct 18, 2023 via email

@Jefferson49
Copy link
Owner

As far as I see in the documentation, MySQL from Version 5.7 upwards do not allow to set a default value for those data-types.

The result of my internet search is as follows: It is not allowed to set a default value as a "literal". However, since a certain MySQL version (5.7.24/8.0.13), it seems to be allowed to set the default value by an "expression":

@Jefferson49
Copy link
Owner

After further considerations, I found some alternative SQL expressions to modify the code a little bit. I also found some area in the code, which might have resulted in errors during an installation from scratch.

I created a beta version with some improvements in the code:
com_sexypolling_v4.2.1beta1.zip

Maybe, you can check if this version fixes the (installation) issue.

@Jefferson49
Copy link
Owner

Could reproduce the error message in my installation: "Function strftime() is deprecated /libraries/src/Form/Field/CalendarField.php on line 322":

  • Joomla 4, plugin v4.2.0, PHP 8.1 or 8.2 (i.e. >8.0)
  • Backend -> Sexy Polling -> Pools -> Open Poll
  • Scroll down to button of the page ->created

deprecated_strftime

@Jefferson49
Copy link
Owner

Looks like "Function strftime() is deprecated" is an issue in the Joomla platform: joomla/joomla-cms#41266

Pull requests with changes in the code seem to be scheduled for Joomla 4.4

@heli63
Copy link
Author

heli63 commented Oct 19, 2023 via email

@heli63
Copy link
Author

heli63 commented Oct 19, 2023 via email

@Jefferson49
Copy link
Owner

unfortunately it does not work – I updated Joomla to 4.4. before as it was published just yesterday or so.

Bad luck. Joomla 4.4 should not make a difference. I think there exists a difference how the MySQL implementations handle the default values. On my own servers, everything works fine, but obviously other MySQL implementations do not accept this part of the code.

@Jefferson49
Copy link
Owner

Jefferson49 commented Oct 19, 2023

Nevertheless I get an error when I try to edit the Example Poll: Speichern fehlgeschlagen. Fehler: Incorrect date value: 'NOW' for column 'date_start' at row 1.

I got the same error yesterday and created an issue #59 for it. It is already fixed and will be included in the next release.

As a short term workaround, you can simply change the "Start Date" of the default example poll. Afterwards, you should be able to save the poll.

Hint: There is also an issue #60 about saving a poll with an empty "Start Date". This issue can be simply avoided by setting a proper start date.

@Jefferson49 Jefferson49 added bug Something isn't working Joomla 4 Issue occurs while using plugin in Joomla 4 Joomla-CMS Issue with root cause in the Joomla CMS platform labels Oct 19, 2023
@heli63
Copy link
Author

heli63 commented Oct 19, 2023 via email

@heli63
Copy link
Author

heli63 commented Oct 19, 2023 via email

@heli63
Copy link
Author

heli63 commented Oct 19, 2023 via email

@heli63
Copy link
Author

heli63 commented Oct 19, 2023 via email

@Jefferson49
Copy link
Owner

now I get an additional error when I try to edit the answers in the version 4.6.:
Field 'country' doesn't have a default value.

This is kind of a dilemma: From Joomla 3 to 4 the database strategy changed and Joomla 4 requires to always write some value to all columns. If no value is available, it reports "doesn't have a default value". That's why I tried to change the database definition and define default values in the database. However, some servers do not allow to set the default values :-(

Since there are too many issues, I will have to think about a different solution.

@Jefferson49
Copy link
Owner

That error seems only to occur, when I try to insert votes.

The "insert votes" issue with v4.1.6 is alredy documented in #37. It was fixed with v4.1.7 (which does not help in your case)

@Jefferson49
Copy link
Owner

And hopefully the last error I encountered, this one is in the frontend and can be “solved” when I set the error-reporting to “no”, but nevertheless I wanted to let you know:

About the frontend error: I guess you wanted to described it after the "let you know:", but it is not included here.

@Jefferson49
Copy link
Owner

Since there are too many issues, I will have to think about a different solution.

I restructured the SQL commands and created a new beta version. Maybe, you can try it:

com_sexypolling_v4.2.1beta2.zip

@Jefferson49
Copy link
Owner

com_sexypolling_v4.2.1beta2.zip

Further testing with the new beta version looks very promising. It really seems to be a good alternative to solve the issues with " ... cant have a default value" or "... doesnt have a default value".

If you have some time, it would be very helpful to get feedback if it runs on your server, where the issue was reproducible. If the issues are gone, I would release the new version.

@heli63
Copy link
Author

heli63 commented Oct 31, 2023 via email

Jefferson49 added a commit that referenced this issue Nov 4, 2023
…L commands. Fixes #46, #49, #50, #58. Improves earlier fixes for #19, #27, #37, #38.
@Jefferson49
Copy link
Owner

But now I am back, and I will start testing it and will give you an answer as soon as possible.

Thanx for the update!

Just recently, I published a new release v5.0.0, which is avoiding installation errors of the tpye "column 'country' can't have a default value". Maybe, you can check if the new version also solves the issues you described.

@Jefferson49 Jefferson49 added the Joomla 5 Issue occurs while using plugin in Joomla 5 label Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Joomla 4 Issue occurs while using plugin in Joomla 4 Joomla 5 Issue occurs while using plugin in Joomla 5 Joomla-CMS Issue with root cause in the Joomla CMS platform
Projects
None yet
Development

No branches or pull requests

2 participants