LibreBooking / app

Repository for the last open source version of Booked Scheduler. The "develop" branch contains the most current working code of the project and should be considered beta. The "master" branch is the most current stable release of BookedScheduler. Please read doc/README.md for further details.
GNU General Public License v3.0
401 stars 240 forks source link

Failure when sending invitation to multiple email addresses #80

Open gcskoenig opened 3 years ago

gcskoenig commented 3 years ago

When inviting someone to an event (edit event, more, email) a menu pops up where you can enter one or multiple emails. By hitting enter they are formatted in a list. (See screenshots).

Screen Shot 2021-11-01 at 22 08 10 Screen Shot 2021-11-01 at 22 08 33

Then the email does not arrive and an error is thrown. If formatted as comma-separated list everything works. The code seems to expect a string but gets an array.

2021/11/01 22:05:12 [error] 3503#3503: *260031 FastCGI sent in stderr: "PHP message: PHP Warning: preg_split() expects parameter 2 to be string, array given in /booked/Pages/Ajax/ReservationEmailPage.php on line 53 PHP message: PHP Warning: Invalid argument supplied for foreach() in /booked/Presenters/Reservation/ReservationEmailPresenter.php on line 64" while reading response header from upstream, client: someip, server: url.de, request: "POST /booked/Web/ajax/reservation_email.php?rn=6180033972605532815057 HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "url.de", referrer: "url/booked/Web/reservation.php?rn=bla"

effgarces commented 3 years ago

Thanks for the report and the error log,marked as a bug and will check this later.

effgarces commented 3 years ago

Took a look to the file Pages/Ajax/ReservationEmailPage.php. The error seems to come from the function: public function GetEmailAddresses() { $email = $this->GetForm('email'); return preg_split('/, ?/', $email); }

As a quick fix (I did not test it) you could try changing $email = $this->GetForm('email'); to $email = implode($this->GetForm('email'));

aliciarf2611 commented 2 years ago

Hello, I have the same problem. I tested your solution and works fine with a little change: $email = implode(',',$this->GetForm('email')); Thanks a lot!