Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strlen(): Passing null to parameter #1 ($string) of type string is deprecated #24

Open
imadepurnamayasa opened this issue Aug 8, 2022 · 1 comment

Comments

@imadepurnamayasa
Copy link

imadepurnamayasa commented Aug 8, 2022

PHP Version: 8.1

APPPATH\Libraries\GroceryCrud.php at line 336

329 * @param string
330 * @param integer
331 * @param string the end character. Usually an ellipsis
332 * @return string
333 */
334 function character_limiter($str, $n = 500, $end_char = '…')
335 {
336 if (strlen($str) < $n)
337 {
338 return $str;
339 }
340
341 // a bit complicated, but faster than preg_replace with \s+
342 $str = preg_replace('/ {2,}/', ' ', str_replace(array("\r", "\n", "\t", "\x0B", "\x0C"), ' ', $str));

@imadepurnamayasa
Copy link
Author

function character_limiter($str, $n = 500, $end_char = '…')
{
===> i add this code in my local grocerycrud
if (is_null($str)) {
return NULL;
}

    if (strlen($str) < $n)
    {
        return $str;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant