Forum
PHP Error on Blog comment submission when "Notify author" is turned on
I'm using the Perch blog, and in the Settings I have "Notify author of new comments" checked. When comments are submitted I get a 500 error as follows:
[04-Dec-2016 18:54:52 UTC] PHP Fatal error: Uncaught Error: Call to a member function authorEmail() on boolean in /home/[redacted]/public_html/perch/addons/apps/perch_blog/PerchBlog_Comments.class.php:586
Stack trace:
#0 /home/moneypla/public_html/perch/addons/apps/perch_blog/PerchBlog_Comments.class.php(529): PerchBlog_Comments->_notify_author_of_comment(Object(PerchBlog_Post), Object(PerchBlog_Comment))
#1 /home/moneypla/public_html/perch/addons/apps/perch_blog/runtime.php(27): PerchBlog_Comments->receive_new_comment(Object(PerchAPI_SubmittedForm))
#2 /home/moneypla/public_html/perch/core/lib/Perch.class.php(127): perch_blog_form_handler(Object(PerchAPI_SubmittedForm))
#3 /home/moneypla/public_html/perch/core/inc/forms.php(9): Perch->dispatch_form('comment:perch_b...', Array, Array)
#4 /home/moneypla/public_html/perch/core/inc/forms.php(26): perch_find_posted_forms()
#5 /home/moneypla/public_html/perch/core/runtime/runtime.php(16): include('/home/[redacted]...')
#6 /home/moneypla/public_html/perch/runtime.php(2): include('/home/[redacted]/...')
#7 /home/m in /home/moneypla/public_html/perch/addons/apps/perch_blog/PerchBlog_Comments.class.php on line 586
The comment still gets posted to the blog. When I uncheck the "notify author" option, everything works fine. Diagnostics below:
SUMMARY INFORMATION
Perch: 2.8.32, PHP: 7.0.13, MySQL: 10.0.28-MariaDB, with PDO
Server OS: Linux, litespeed
Installed apps: content (2.8.32), assets (2.8.32), categories (2.8.32), perch_blog (5.0)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog' );
PERCH_LOGINPATH: /perch
PERCH_PATH: /home/[redacted]/public_html/perch
PERCH_CORE: /home/[redacted]/public_html/perch/core
PERCH_RESFILEPATH: /home/[redacted]/public_html/perch/resources
Image manipulation: GD Imagick
PHP limits: Max upload 2M, Max POST 8M, Memory: 128M, Total max file upload: 2M
F1: cf7b09dff1a51c394299a87c489bee69
Resource folder writeable: Yes
HTTP_HOST: www.[redacted].com
DOCUMENT_ROOT: /home/[redacted]/public_html
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
No huge rush for a solution, I just thought I'd report this as I think its a bug.
Yes, the author of the post exists (Can't seem to reply with another comment, just returns [update] in my browser, lol)
Does the author for the post exist?
Yes the author of the post exists
IN the post meta information, is the author correctly selected?
Yes, there's only me as an author so I was selected by default, and am the only option
That's really odd. I can't get that to fail here. Can you turn on debug and try it again?
I can't get it to fail now either. One thing I can't really figure out is how to set when comments require approval before they're posted, and when comments are posted instantly. They seem be posted instantly now, but a couple days ago when I was setting this up, some comments I posted required approval before they would show up.
How does that work, and would that have something do with it?
If you're logged into Perch, the comments don't need approval. So if you're testing, make sure you're tested when logged out otherwise the results will seem strange.
In real use, it's much more convenient that needing to moderate your own comments.