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

PHP 8 Support #58

Closed
christiaangoossens opened this issue Jun 20, 2021 · 26 comments · Fixed by #160
Closed

PHP 8 Support #58

christiaangoossens opened this issue Jun 20, 2021 · 26 comments · Fixed by #160
Labels
bug Something isn't working

Comments

@christiaangoossens
Copy link

It seems that the latest version does not support PHP 8, as it does not use namespaces in PHP, redeclaring system classnames instead (e.g. Attribute).

If anyone could solve this that would be great, otherwise, if I have time, I might look at it, but I'm not familiar with the codebase..

@christiaangoossens
Copy link
Author

@effgarces
Copy link
Collaborator

Thanks for the heads-up, I'm not able to solve this right now due to a heavy workload, but I will definitely address it as soon as my schedule eases up (in one or two months).

@guilegatan
Copy link

Bump. Sorry, but any progress in regard of PHP 8.0 support?
Thank you.

@effgarces
Copy link
Collaborator

Yes, I already did some work on that direction, there were a couple of commits sometime ago that tried to address some of the issues, but as my current production server are still on 7.x land I haven't advanced much more. Also due to health related issues I had to slow down alot, so most of the progress here will only occur when my day job slows down.

@guilegatan
Copy link

Thank you. I already tried to incorporate the various commits but there is definitely something still missing.
I totally understand you. This is your part-time project anyway.
I will be patient, and all the best with your health issues!

@guilegatan
Copy link

guilegatan commented Sep 8, 2022

Sorry to bring it up again.
Any progress on PHP 8 support? Anything I/we can contribute to the solution?

EDIT: just found this #132
I will test asap

@effgarces
Copy link
Collaborator

I took sometime off to recover and slowly getting back to work, but as you already seen, one of the most recent pull request was exactly about PHP8 compatibility, and it will also be one of my main objectives in the coming weeks/months.

@guilegatan
Copy link

Thank you very much!

@chriskpalmer
Copy link

Hello @effgarces, I am interested in PHP 8 support as IT people will not let me have PHP 7 after November. I am trying to get librebooking installed on a UBuntu linux box with a fresh install of xampp. So far I have got it working except for this error from librebooking-app.log:

2022-10-06T07:50:50+02:00 [589902] ERROR default - [User= ()] Error executing MySQL query Table 'librebooking.announcement_groups' doesn't exist [File=/opt/lampp/htdocs/librebooking/lib/Database/MySQL/MySqlConnection.php,Line=112]
2022-10-06T07:50:50+02:00 [589902] ERROR default - [User= ()] Uncaught exception: Exception: There was an error executing your query\nTable 'librebooking.announcement_groups' doesn't exist in /opt/lampp/htdocs/librebooking/lib/Database/MySQL/MySqlConnection.php:114
Stack trace:
#0 /opt/lampp/htdocs/librebooking/lib/Database/MySQL/MySqlConnection.php(76): MySqlConnection->_handleError(false)
#1 /opt/lampp/htdocs/librebooking/lib/Database/Database.php(27): MySqlConnection->Query(Object(GetDashboardAnnouncementsCommand))
#2 /opt/lampp/htdocs/librebooking/Domain/Access/AnnouncementRepository.php(11): Database->Query(Object(GetDashboardAnnouncementsCommand))
#3 /opt/lampp/htdocs/librebooking/Presenters/LoginPresenter.php(123): AnnouncementRepository->GetFuture(5)
#4 /opt/lampp/htdocs/librebooking/Pages/LoginPage.php(124): LoginPresenter->PageLoad()
#5 /opt/lampp/htdocs/librebooking/Web/index.php(22): LoginPage->PageLoad()
#6 {main} [File=/opt/lampp/htdocs/librebooking/lib/Common/Logging/ExceptionHandler.php,Line=19]

I searched for "announcement_groups" and found it in upgrades/2.6/schema.sql and nowhere else. The table is not in the schema I successfully manually installed from the develop database_schema/create-schema.sql. I would appreciate help figuring out why it is being asked for and producing this error. Thank you for your efforts to keep this alive and working with PHP 8.

@effgarces
Copy link
Collaborator

effgarces commented Oct 6, 2022

I took a quick look at our installs and all of them contain the "announcement_groups" table, but they were all installed initially using the web wizard, and while I'm not able, at the moment, to take in depth look at this I can tell you that this table is required and it should be in your database, but as you say it's not on the create-schema.sql, so I'm putting this tentatively as a bug. As soon as I get back to the office, next week, I will dive on this. In the mean time, just grab the sql from upgrades/2.6/schema.sql, just the part that creates this table and apply it to your install, it should fix this error.

@effgarces effgarces added the bug Something isn't working label Oct 6, 2022
@chriskpalmer
Copy link

chriskpalmer commented Oct 6, 2022

Hi @effgarces thanks for having a quick look at this. When you get a chance can you look at one of your installs and tell me how many tables you have? From the develop create_schema.sql I ran there are 25 tables.

I am asking because I see other tables in 2.6 that are not in the 25 tables I see in phpmyadmin and the create_schema.sql. (peak_times, custom_attribute_entities, resource_type_assignment, reservation_color_rules, reservation_guests, announcement_resources, reservation_waitlist_requests)

I hesitate to add announcement_groups then to go right to another error and so on if there are many missing.

@chriskpalmer
Copy link

As I suspected the next error was missing announcement_resources

@chriskpalmer
Copy link

chriskpalmer commented Oct 6, 2022

Okay wow, I managed to run the Web/install successfully and it seems to be working. There are 57 tables. I'll report back later how it goes with php 8 setting it up and using it.

@chriskpalmer
Copy link

chriskpalmer commented Oct 6, 2022

I'm in just getting started. So far this is the only error that makes the Dashboard return Unknown Error:
2022-10-06T23:50:43+02:00 [589668] ERROR default - [User=Chris Palmer ([email protected])] Uncaught exception: --> Smarty Compiler: Syntax error in template "file:/opt/lampp/htdocs/librebooking/tpl/Dashboard/resource_availability.tpl" on line 59 "<a href="{if isset($path) $Path}{Pages::RESERVATION}?{QueryStringKeys::RESOURCE_ID}={$i->ResourceId()}"" too many shorthand attributes <-- [File=/opt/lampp/htdocs/librebooking/lib/Common/Logging/ExceptionHandler.php,Line=19]

@chriskpalmer
Copy link

chriskpalmer commented Oct 7, 2022

So far, the smarty syntax error above persists ||FIXED||and only one other:
After a reservation is made when the "Close" button is clicked on the reservation confirmation the app goes to the url http://schedule.php/ which has nothing. Also the "Cancel" button on a new reservation does the same thing. |||FIXED||| Needed to add https:// to script url

Everything else (Making Resources, Schedules, etc) has worked as expected.

@effgarces
Copy link
Collaborator

Thank you documenting your findings, it's always helpfull to have this kind of info out on the web. The basic functionality should be working with PHP 8, at the moment I'm going around fixing warnings (you never know what the next PHP version will cause) and also trying to figure out why the reports are not working properly on my test install.

@chriskpalmer
Copy link

Hi @effgarces, yes there are lots of warnings but it seems to work well. I wish I could figure that smarty syntax thing out but it is just past my comfort zone, tcl is not so readable code!

One thing I would love to get working but that has not yet is the email function. I have tried many combinations of settings and been on forums and found this: https://forums.bookedscheduler.com/viewtopic.php?f=3&t=1529&p=2047&hilit=sendmail#p2047
"I will note that Booked uses the package "PhpMailer", which has been upgraded from the version in Booked (5.0) to a more recent version (6.5.1). The new version is not compatible with with the 5.0 version. I don't know what the effort would be to update Booked to the newer version, but I suspect that although it would be "non trivial", it wouldn't be difficult."

I wonder if that is why I have been having trouble. I will continue to work on this but if you could test it on your environment and let me know if it works it would be helpful.

@chriskpalmer
Copy link

@effgarces Does your dashboard work?

@chriskpalmer
Copy link

~$ echo "Subject" | sendmail [email protected] on my linux xampp box works but I can't get the librebooking email to work with either "mail" or "sendmail" and the correct path to usr/sbin/sendmail

@chriskpalmer
Copy link

The sendmail problem was |||FIXED||| by my IT support. It had to do with fixing this:
usr/sbin/sendmail: /opt/lampp/lib/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /lib/x86_64-linux-gnu/libicuuc.so.70)
So probably not a librebooking problem :)

@effgarces
Copy link
Collaborator

effgarces commented Oct 11, 2022

Hi @effgarces, yes there are lots of warnings but it seems to work well. I wish I could figure that smarty syntax thing out but it is just past my comfort zone, tcl is not so readable code!

One thing I would love to get working but that has not yet is the email function. I have tried many combinations of settings and been on forums and found this: https://forums.bookedscheduler.com/viewtopic.php?f=3&t=1529&p=2047&hilit=sendmail#p2047 "I will note that Booked uses the package "PhpMailer", which has been upgraded from the version in Booked (5.0) to a more recent version (6.5.1). The new version is not compatible with with the 5.0 version. I don't know what the effort would be to update Booked to the newer version, but I suspect that although it would be "non trivial", it wouldn't be difficult."

I wonder if that is why I have been having trouble. I will continue to work on this but if you could test it on your environment and let me know if it works it would be helpful.

This is one off the big issues with Librebooking, besides phpmailer, there are a bunch of libraries that are stuck in old versions, all of those need to be updated and that means one needs to familiar with how they were integrated and as of consequence more time is required and I'm in short supply of it.

@effgarces Does your dashboard work?

Yes, seems to working ok.

@chriskpalmer
Copy link

Dashboard Unknown Error bug |||FIXED||| --- this error:
Uncaught exception: --> Smarty Compiler: Syntax error in template "file:/opt/lampp/htdocs/librebooking/tpl/Dashboard/resource_availability.tpl" on line 59 "<a href="{if isset($path) $Path}{Pages::RESERVATION}?{QueryStringKeys::RESOURCE_ID}={$i->ResourceId()}"" too many shorthand attributes
Fixed by changing the first part {if isset($path) $Path} to {$Path}:
<a href="{$Path}{Pages::RESERVATION}?{QueryStringKeys::RESOURCE_ID}={$i->ResourceId()}

@chriskpalmer
Copy link

chriskpalmer commented Oct 11, 2022

Thanks @effgarces for all your work dealing with all the depreciated and warning bugs.
Small bug just observed:
When as admin (did not see this as regular user) making a new reservation there is a link "View Availability" that goes to a blank page.
Also, thanks for working on "Reports" they are not working on my install either. No rush but it will be nice when they are there again.

@guilegatan
Copy link

Is the current development version already working with PHP8? Does it need a database upgrade?

I still get an "unknown error" on my PHP8 testserver with imported database from my production environment.
apache2 log says: PHP Warning: Attempt to read property "value" on null in /var/www/html/app_develop/tpl_c/02c57c49d3225e4b7754ac327c8994c6afa5f642_0.file.globalheader.tpl.php on line 32, referer: https://my.testserver.url/app_develop/Web/?

PHP 8,1,9
MySQL 8.0.31

@effgarces
Copy link
Collaborator

The current version is working with PHP8, no database upgrade required ( do bear in mind that recently added functionality does require an upgrade to the DB, but this is not related to PHP8 support). The only part of librebooking that needs a bit of help in terms of PHP8 support is the reports functionality, that is not working properly.

@guilegatan
Copy link

Thank you for the update. In this case I will dig deeper into my problem. If the current development version is PHP 8 capable, I should somehow get it running on my testserver with PHP 8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants