Osclass Support Forums

General osclass questions => Report bug => Topic started by: dsf on May 21, 2023, 12:37:50 AM

Title: PHP 8.0.x - 404 doesn't work?
Post by: dsf on May 21, 2023, 12:37:50 AM
Hi.

Today i switched one site from php 7.4 to 8.0.x. And i see that now the 404 doesn't work at all.

Verified it also here:

https://demo.osclasspoint.com/a1a2

check this and see it returns 301 and 200 status !! and goes to

https://demo.osclasspoint.com/index.php?page=search&sCategory=a1a2

Do i miss something? At php 7.4 Osclass returns a not found page 404.

Thanks
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: MB Themes on May 21, 2023, 09:00:27 AM
That does not sound right until you have category with that name.
There could be impact from integrating language code in URLs that hit whole application, especially rewrite rules.
Is this more PHP related or Osclass version related?
Can you test?
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: dsf on May 21, 2023, 10:54:07 AM
That does not sound right until you have category with that name.
There could be impact from integrating language code in URLs that hit whole application, especially rewrite rules.
Is this more PHP related or Osclass version related?
Can you test?

I can test of cource, if you tell me what to test. Still since the issue happens in your demo also ....
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: MB Themes on May 21, 2023, 04:43:12 PM
I tested on latest version running on PHP 8 and got redirected to 404
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: dsf on May 22, 2023, 01:02:53 PM
I tested on latest version running on PHP 8 and got redirected to 404

How can this happen if your own demo has that issue. Sorry i don't get it.

https://demo.osclasspoint.com/index.php?page=search&sCategory=a1a2

and in any case, what that issue is? PHP related or not?
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: dsf on May 22, 2023, 01:38:36 PM
Check

https://prodaja.org/a1a2

https://adslab.pk/a1a2

https://tobaratos.com/a2a3

MOST of what i could found are experiencing the same issue. And do you realize how serious this bug is? It will impact all google indexing of a site.
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: dsf on May 22, 2023, 01:44:10 PM
Osclasspoint 8.0.2 works right. After that, 8.1.0 and the latest suffer from the same issue.

And again, in PHP 8.0.x (and probably greater). PHP 7.4 works right.
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: MB Themes on May 23, 2023, 05:58:46 PM
Ok I was able to reproduce a bit.
Code: [Select]
Matched rule: "^(.+)/?$" ... Request URI: "index.php?page=search&sCategory=a1a2"

Matching this rule.

It's particular issue with this category name only, because Params::getParam('sCategory') > 0 ... yes really :)

Solution is to update line 122 in oc-includes/osclass/controller/search.php:
Code: [Select]
if((int)Params::getParam('sCategory') > 0) {
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: dsf on May 23, 2023, 06:24:35 PM
Not sure what "It's particular issue with this category name only," means.

Whatever non existent url i try, produces same issue. I mean not only "a1a2", if this is what you mean.

/testz
/whatever
/haha

same issue.

thanks, i will try your suggestion and update here. May i ask why this becomes an issue with php 8 and not with previous?
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: dsf on May 23, 2023, 06:31:49 PM
Checking your own demo

https://demo.osclasspoint.com/testz

i get a redirect to

https://demo.osclasspoint.com/en/index.php?page=search&sCategory=testz

and then a 404. Not sure if this is correct. Didn't work this way before.

Check it yourself

https://httpstatus.io/


&

https://demo.osclasspoint.com/testz

as a url to check.
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: MB Themes on May 23, 2023, 06:37:24 PM
There is no reason to do more testing before applying fix.
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: dsf on May 23, 2023, 06:49:32 PM
Why most of the replies of yours are so, how to describe this, maybe "cryptic"?

I have provided all the links, all the facts, everything, but for some reason you only write what you want.

For example why this is a PHP 8 issue? And why "categories" are used for search and then a 404.

This is not a solution. Please check it when you have more time and let us know. I do not want to pressure or anything.

Thank you
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: MB Themes on May 23, 2023, 10:23:06 PM
Ok I was able to reproduce a bit.
Code: [Select]
Matched rule: "^(.+)/?$" ... Request URI: "index.php?page=search&sCategory=a1a2"

Matching this rule.

It's particular issue with this category name only, because Params::getParam('sCategory') > 0 ... yes really :)

Solution is to update line 122 in oc-includes/osclass/controller/search.php:
Code: [Select]
if((int)Params::getParam('sCategory') > 0) {

You can test on https://epsilon.mb-themes.com/a1a2
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: dsf on May 23, 2023, 10:42:45 PM
I will. I have to borrow an account first :) since i can't test live any more. Dangerous.
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: dsf on May 23, 2023, 11:19:11 PM
It seems to work fine for me. I also understood what happened with php ....

Will that be included at some future update?

Thank you
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: MB Themes on May 24, 2023, 11:45:00 AM
@dsf
Yes it will be included in 8.2.0
Title: Re: PHP 8.0.x - 404 doesn't work?
Post by: dsf on June 07, 2023, 10:13:09 PM
Hi,

Works fine UNLESS you use a number instead of characters or a mix of characters AND numbers

www. website . com / 827364

www. website . com / 827364test

www. website . com / test827364

I think this must be examined more carefully.