MyBB Community Forums

Full Version: Search not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Using the search-function of our mybb-installation the results look fine but the links doesn't work. The linkes look like this:

https://www.forum.com/thread-ex?highlight=seachterm

It throws an error 500.

But the url works if deleting the variable at the end of the link like this:

https://www.forum.com/thread-ex

The url even doesn't work if letting the question mark at the end like this:

https://www.forum.com/thread-ex?

Does anybody know what I have to change to make it work or which analysis I have to do to finde the problem?
(2024-01-24, 08:14 PM)RobRo Wrote: [ -> ]It throws an error 500.

take a look in the server error logs
(2024-01-24, 09:02 PM)bv64 Wrote: [ -> ]take a look in the server error logs
This is the error-message:

PHP Fatal error:  Uncaught Error: Call to undefined function get_magic_quotes_gpc() in .../inc/plugins/google_seo/redirect.php:291
Stack trace:
#0 .../inc/class_plugins.php(142): google_seo_redirect_hook('')
#1 ...global.php(100): pluginSystem->run_hooks(Array)
#2 ...showthread.php(28): require_once('...')
#3 {main} thrown in ...inc/plugins/google_seo/redirect.php on line 291
Do you think these errors are a part of the problem?
https://stackoverflow.com/questions/6105...e#61260285 Wrote:PHP 7.4 deprecated get_magic_quotes_gpc function alternative
http://stackoverflow.com/questions/61054...g#61260285

You need to remove every mention of this function from your code and do not replace it with anything else.

get_magic_quotes_gpc() has been useless ever since PHP 5.4.0. It would tell you whether you have magic quotes switched on in the configuration or not. Magic quotes were a terrible idea and this feature was removed for security reasons (PHP developers believed in magic & superstitions and wrote unsecure code).

Most likely even you yourself do not know why you had this line of code in your project. I know I was fooled by it when I was learning PHP. The reality is you do not need it at all. This function has nothing to do with security and the concept of input sanitization is preposterous.

Instead, rely on good security guidelines.

Use parameterized prepared statements for interactions with the database. PHP has a very good library called PDO, which can be used with many DB drivers including MySQL.
If you produce output, then escape the output taking into consideration the rules of that medium. For example when outputting to HTML use htmlspecialchars() to prevent XSS.
Never sanitize input. There is no magical solution that would protect you against everything. Instead, you as a developer must be aware of dangers and you need to know how to protect your code.

--Dharman
(2024-01-24, 11:43 PM)HLFadmin Wrote: [ -> ]
https://stackoverflow.com/questions/6105...e#61260285 Wrote:PHP 7.4 deprecated get_magic_quotes_gpc function alternative
http://stackoverflow.com/questions/61054...g#61260285

You need to remove every mention of this function from your code and do not replace it with anything else.

Thanks Dharman,
and do you think this is also the reason for the error 500 in our case?
I'm not familiar with google seo plugin, so I can't answer that.
500 error is a catchall in lieu of a more specific error.

The question mark separator without an argument following is not valid syntax.
(2024-01-25, 12:50 PM)HLFadmin Wrote: [ -> ]I'm not familiar with google seo plugin, so I can't answer that.
500 error is a catchall in lieu of a more specific error.

The question mark separator without an argument following is not valid syntax.

I tried the question mark separator with a variable and value behind like ?a=1 and many others.

But they all throw the error.

Anybody an idea why this could be a problem?
(2024-01-25, 04:48 PM)RobRo Wrote: [ -> ]Anybody an idea why this could be a problem?

The official version of the Google SEO plugin is not compatible with PHP 8. My guess is that you're using both. Omar is maintaining a fork which is compatible with PHP 8. I'm not sure whether he's announced it yet, but it might be worth trying out:

https://github.com/Sama34/MyBB-Google-SEO