*

Alealto1

  • **
  • 14 posts
Deprecated error in rawurlencode() - utils.php on line 1481
« on: January 27, 2026, 12:24:36 PM »
Hi everyone,

I'm encountering a deprecation error on my Osclass site and I would like to ask for your help to fix it properly. This error is being triggered specifically when the Cron job runs.

The Error: Deprecated: rawurlencode(): Passing null to parameter #1 ($string) of type string is deprecated in /home/mysite/public_html/oc-includes/osclass/utils.php on line 1481

Context: This error started appearing after upgrading to 8.3.1 version.

It seems that the rawurlencode() function is receiving a null value instead of a string, which is no longer allowed in recent PHP versions.

The code at line 1481 in oc-includes/osclass/utils.php

return rawurlencode($string);

Question: What is the best practice to fix this in the Osclass core? Should I simply cast the variable to a string or add a null check?

For example, would the following change be the recommended approach? return rawurlencode($string ?? '');

Thank you in advance for your help!
« Last Edit: January 27, 2026, 12:30:57 PM by Alealto1 »

Marked as best answer by frosticek on January 28, 2026, 07:34:09 PM
*

MB Themes

Re: Deprecated error in rawurlencode() - utils.php on line 1481
« Reply #1 on: January 27, 2026, 01:55:49 PM »
Usually fix it as:
Code: [Select]
rawurlencode((string)$text)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Alealto1

  • **
  • 14 posts
Re: Deprecated error in rawurlencode() - utils.php on line 1481
« Reply #2 on: January 28, 2026, 05:14:52 PM »
Thanks, problem solved  :P