Contact form isn´t working when user is not logged in (General)

by Auge ⌂, Sunday, August 13, 2023, 20:26 (311 days ago) @ Tommy Nilsson


After replying in your new report about another case of HTTP-status 500 and re-reading this thread, I want to come back to your error message.

Fatal error: Uncaught Error:

Call to a member function getResponse() on null in /customers/3/d/5/svenska-lok.se/httpd.www/forum/modules/akismet/akismet.class.php:250

Stack trace: #0 /customers/3/d/5/svenska-lok.se/httpd.www/forum/includes/contact.inc.php(176):

Akismet->isSpam() #1 /customers/3/d/5/svenska-lok.se/httpd.www/forum/index.php(149):

include('/customers/3/d/...') #2 {main} thrown in /customers/3/d/5/svenska-lok.se/httpd.www/forum/modules/akismet/akismet.class.php on line 250

This ($response = $this->…) is line #250 of the namely file.

  * Query the Akismet and determine if the comment is spam or not
  * @return boolean
 function isSpam() {
  $response = $this->http->getResponse($this->_getQueryString(), 'comment-check'); //<== line #250
  return ($response == "true");

I am not familar with the code of the Akismet class, but does "Call to a member function getResponse() on null" mean, that there is perhaps an unhandled NULL value? In the line #250 the code calls the method getResponse() which is calling the method $this->_getQueryString() for its first parameter $request (See lines #136 ff. for the method getResponse() itself and lines #366 ff. for the method _getQueryString()). The second parameter cannot be NULL because it's the string "comment-check". So it can only be the first parameter (_getQueryString()), that could be a NULL-value.

That's the code of _getQueryString().

  * Build a query string for use with HTTP requests
  * @access Protected
  * @return String
 function _getQueryString() {
  foreach($_SERVER as $key => $value) {
   if(!in_array($key, $this->ignore)) {
    if($key == 'REMOTE_ADDR') {
     $this->comment[$key] = $this->comment['user_ip'];
    } else {
     $this->comment[$key] = $value;
  $query_string = '';
  foreach($this->comment as $key => $data) {
   $query_string .= $key . '=' . urlencode(stripslashes($data)) . '&';
  return $query_string;

Could it be possible, that the code returns NULL? I mean, $_SERVER is one of PHP's own, native superglobal arrays. I would expect this array never ever to be empty.

I hope this helps. :-)

I also hope so. :-)

Tschö, Auge

Trenne niemals Müll, denn er hat nur eine Silbe!

Complete thread:

 RSS Feed of thread