This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

php 8 compatibility - new comment not ajax refreshed
#1

Hello,

I am using Commentics 3.4 with PHP 7.4. No problem at all with it, in spite of you officially write that only Commentics 4.1 is PHP 7.4 compatible.
 
So I tried the new PHP 8. Also, evertyhing works, apart from one thing: Ajax send comment. Comment is sent, it is stored in the database, and after refresh it will be shown on the page. It is just not refreshed live, the comment doesn't show with Ajax live, and no "comment succesful" message is displayed in the green box.
 
Do you maybe have a workaround for this? 

Or do you think it would work with Commentics 4.1? 

Or do you maybe plan a new version with PHP 8 compatibility? 

I am just asking these, because I have modified Commentics some parts. So update maybe wouldn't be too easy for me, and it would be a little time-consuming. So I want to upgrade to the "right" version, or not upgrade yet, if there is a workaround. Thank you very much for your help if you can have some info on it!
Reply
#2

After turning on error reporting, this is the error log I got after testing again twice (but I think it is not related at all, but for any case, I paste it):

Code:
[27-Feb-2021 01:21:27 Europe/Budapest] PHP Fatal error:  Uncaught Error: Call to undefined function escapeshellcmd() in /web/****/****.info/commentics2/****/3rdparty/swift_mailer/lib/classes/Swift/Transport/MailTransport.php:259
Stack trace:
#0 /web/****/****.info/commentics2/****/3rdparty/swift_mailer/lib/classes/Swift/Transport/MailTransport.php(288): Swift_Transport_MailTransport->_isShellSafe('comments@utazas...')
#1 /web/****/****.info/commentics2/****/3rdparty/swift_mailer/lib/classes/Swift/Transport/MailTransport.php(176): Swift_Transport_MailTransport->_formatExtraParams('-f%s', 'comments@utazas...')
#2 /web/****/****.info/commentics2/****/3rdparty/swift_mailer/lib/classes/Swift/Mailer.php(85): Swift_Transport_MailTransport->send(Object(Swift_Message), Array)
#3 /web/****/****.info/commentics2/****/system/library/email.php(137): Swift_Mailer->send(Object(Swift_Message))
#4 /web/****/****.info/commentics2/****/system/library/notify.php(64): Commentics\Email->send('****gmail....', NULL, 'Comment Success', '<table style="b...', 'html', 'comments@utazas...', 'Test', 'no-reply@utazas...')
#5 /web/****/****.info/commentics2/****/frontend/controller/main/form.php(1641): Commentics\Notify->adminNotifyCommentSuccess(4528)
#6 /web/****/****.info/commentics2/****/frontend/index.php(133): Commentics\MainFormController->submit()
#7 {main}
  thrown in /web/****/****.info/commentics2/****/3rdparty/swift_mailer/lib/classes/Swift/Transport/MailTransport.php on line 259
[27-Feb-2021 01:21:34 Europe/Budapest] PHP Fatal error:  Uncaught Error: Call to undefined function escapeshellcmd() in /web/****/****.info/commentics2/****/3rdparty/swift_mailer/lib/classes/Swift/Transport/MailTransport.php:259
Stack trace:
#0 /web/****/****.info/commentics2/****/3rdparty/swift_mailer/lib/classes/Swift/Transport/MailTransport.php(288): Swift_Transport_MailTransport->_isShellSafe('comments@utazas...')
#1 /web/****/****.info/commentics2/****/3rdparty/swift_mailer/lib/classes/Swift/Transport/MailTransport.php(176): Swift_Transport_MailTransport->_formatExtraParams('-f%s', 'comments@utazas...')
#2 /web/****/****.info/commentics2/****/3rdparty/swift_mailer/lib/classes/Swift/Mailer.php(85): Swift_Transport_MailTransport->send(Object(Swift_Message), Array)
#3 /web/****/****.info/commentics2/****/system/library/email.php(137): Swift_Mailer->send(Object(Swift_Message))
#4 /web/****/****.info/commentics2/****/system/library/notify.php(64): Commentics\Email->send('****gmail....', NULL, 'Comment Success', '<table style="b...', 'html', 'comments@utazas...', 'Test', 'no-reply@utazas...')
#5 /web/****/****.info/commentics2/****/frontend/controller/main/form.php(1641): Commentics\Notify->adminNotifyCommentSuccess(4529)
#6 /web/****/****.info/commentics2/****/frontend/index.php(133): Commentics\MainFormController->submit()
#7 {main}
  thrown in /web/****/****.info/commentics2/****/3rdparty/swift_mailer/lib/classes/Swift/Transport/MailTransport.php on line 259
Reply
#3

Hi tibor,

When a user posts a comment, it tries to send an email to the admin and it's this action which is causing an error for you and consequently disrupting the ajax from completing properly. It uses a third party script called Swift Mailer to send emails. Swift Mailer is complaining that the function escapeshellcmd() isn't available in your PHP 8 installation, which is strange because escapeshellcmd() is a core function in PHP 4, PHP 5, PHP 7 and PHP 8. So I believe that your PHP 8 installation has disabled the escapeshellcmd() function using the 'disable_functions' directive in your php.ini file. Normally if a function is disabled, you'd see an error like "Warning: escapeshellcmd() has been disabled" but in PHP 8 there's a quirk whereby it instead acts as if the function is undefined. More info about that is here. So I recommend editing your php.ini file and removing that function from the 'disable_functions' directive.

Have you completed the interview?
Reply
#4

Hi,

Thank you very much! Smile I didn't know they are related. 
Yes, I found now escapeshellcmd at webshost disabled_function field.
I could enable this, but for security (maybe there is a reason for disabling it), I rather changed at Commentics - Settings - Email - Setup from PHP (Swift) to PHP (Basic).
With PHP (Basic) it works. 
Now I can say, that evertyhing works: even with PHP 8.0.2, Commentics 3.4 still works (However,I don't use fancy features like ratings, etc.)
PHP error reporting - error log is also empty now.
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by goppss
08-May-2014, 10:15 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)