CodeIgniter Forums
PHP8.1 CI3 deprecated errors - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: PHP8.1 CI3 deprecated errors (/showthread.php?tid=88791)



PHP8.1 CI3 deprecated errors - akeni - 11-07-2023

I'm looking to migrate from PHP7.4 to PHP 8.1 and I get errors like:
PHP Error was encountered
Severity: 8192
Message: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated
Filename: libraries/Javascript.php
Line Number: 658

Line Number Trace:
            $str = $this->_open_script($external_file);
        }
        elseif (strpos($this->_javascript_location, 'http://') !== FALSE)
        {
            $str = $this->_open_script($this->_javascript_location.$external_file);

I thought CI3 can support PHP 8? Has anyone ran into these same issues?



        }


RE: PHP8.1 CI3 deprecated errors - JustJohnQ - 11-08-2023

Are you running CodeIgniter 3.1.13?


RE: PHP8.1 CI3 deprecated errors - pugelarouge - 11-08-2023

akeni : I run CI 3.1.13 with PHP8.1 and is all running fine (I had to do some fixes in my app code - but framework code is fine)


RE: PHP8.1 CI3 deprecated errors - SwellFellar - 09-12-2024

(11-07-2023, 02:26 PM)akeni Wrote: I'm looking to migrate from PHP7.4 to PHP 8.1 and I get errors like:
PHP Error was encountered
Severity: 8192
Message: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated
Filename: libraries/Javascript.php
Line Number: 658

Line Number Trace:
            $str = $this->_open_script($external_file);
        }
        elseif (strpos($this->_javascript_location, 'http://') !== FALSE)
        {
            $str = $this->_open_script($this->_javascript_location.$external_file);

I thought CI3 can support PHP 8? Has anyone ran into these same issues?


You have to update that section to this:

Code:
elseif (!empty($this->_javascript_location) && strpos($this->_javascript_location, 'http://') !== FALSE)
{
$str = $this->_open_script($this->_javascript_location.$external_file);
}

        }