Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.9k views
in Q2A Core by
PHP Notice:  Trying to access array offset on value of type null in /home/ruyadaruya.com/public_html/qa-include/pages/question-view.php on line 1131
Q2A version: 1.8.4
by
+1
Which PHP version? And you see the notice when viewing a question?
by
edited by
php 7.4, just php error logs pages in server. but fixed now ,
by
New notice
 [STDERR] PHP Notice:  Trying to access array offset on value of type null in /home/ruyadaruya.com/public_html/qa-include/pages/tag.php on line 85
by
and this
[STDERR] PHP Notice:  Undefined index: url in /home/ruyadaruya.com/public_html/qa-theme/SnowFlat/qa-theme.php on line 370
by
+1
Please replace this line:

$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $tagword['tagcount'], qa_opt('pages_prev_next'));

with this one:

$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, @$tagword['tagcount'], qa_opt('pages_prev_next'));

in line 85, here:
https://github.com/q2a/question2answer/blob/v1.8.4/qa-include/pages/tag.php#L85

for fixing the PHP notice in tag.php
by
+1
As for the other notice, I was able to get it after inserting questions with no title manually (because the UI doesn't allow that). How did you get it?
by
tag.php is ok... Thank you again,
by
I had manually turned some questions into answers. I think this error comes up in the related questions
by
one more
[STDERR] PHP Notice:  Trying to access array offset on value of type null in /home/ruyadaruya.com/public_html/qa-include/pages/question.php on line 73
by
+1
Replace this:

if ($question['basetype'] != 'Q')

with this:

if (isset($question) && $question['basetype'] != 'Q')

in line 73, here
https://github.com/q2a/question2answer/blob/v1.8.4/qa-include/pages/question.php#L73
by
I forgot to make the title null while turning the questions into answers.  an error when they appeared in the related questions section.
by
I think you need to re-index content after turning questions into answers; for that go to 'Admin' > 'Stats' and then click on the 'Reindex content' button.
by
yes, i did. Thank you jair. its ok now.
by
I'm glad it worked.
by
What theme are you using? Do the errors still appear with one of the default themes like SnowFlat? I don't see where those errors would come from.
by
i m using snowflat, I manually (phpmyadmin) turned the questions into answers. I forgot to make the title parts null and it gave the error in the related links.
its not problem now. fixed.
by
New notice
[STDERR] PHP Notice:  Trying to access array offset on value of type null in /home/ruyadaruya.com/public_html/qa-include/qa-base.php(720) : eval()'d code on line 54
by
and this
[STDERR] PHP Notice:  session_start(): ps_files_cleanup_dir: opendir(/var/lib/php/session) failed: Permission denied (13) in /home/ruyadaruya.com/public_html/qa-include/app/users.php on line 162
by
The first notice is about a similar issue, but this time in a plugin; you need to find out which one is raising this notice.

As for the second one, how often does it happen?
by
second is almost every 15 minutes
by
+1
Please contact your hosting provider, they might be able to fix it for you, or at least they can give your information about it.
by
The session folder is too full. so it made a mistake. the problem was solved when cleaning.

3 Answers

+3 votes
by
selected by
 
Best answer

Hello sonsuz,

For fixing this notice please replace this line:

isset($in['notify']) ? $in['notify'] : qa_opt('notify_users_default'), $in['email'], @$errors['email'], $prefix);

with this one:

isset($in['notify']) ? $in['notify'] : qa_opt('notify_users_default'), @$in['email'], @$errors['email'], $prefix);

in qa-include/pages/question-view.php:1131

Have a nice day!

by
+1
Thank you so much
by
+1
You're welcome!
+3 votes
by

At first I couldn't see what would be causing those notices, but it turns out there were some changes to variable handling in PHP 7.4 that are not mentioned in the normal PHP changelog page.

I set up a PHP 7.4 install and managed to replicate the notices, so I've fixed them. The changes have been posted above already, but here is the diff on GitHub.

Will release Q2A 1.8.5 with these changes in the next few days.

0 votes
by

There is also this.

I cannot send SSL secure email through the site.

but I can throw it with other settings.

sample

	//Server settings
		$mail->isSMTP();                                            // Send using SMTP
		$mail->Host = 'mail.ruyadaruya.com';                    // Set the SMTP server to send through
		$mail->SMTPAuth = true;                                   // Enable SMTP authentication
		$mail->Username = 'bilgi@ruyadaruya.com';                     // SMTP username
		$mail->Password = '**********';                               // SMTP password
		$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;         // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
		$mail->Port = 587;                                    // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above

		$mail->SMTPOptions = [
			'ssl' => [
				'verify_peer'       => false,
				'verify_peer_name'  => false,
				'allow_self_signed' => true
			]
		];

how to fix?

...