PHP8.1 Deprecated function: fseek():
Overview
On php8.1 the below error will appear:
Deprecated function: fseek(): Passing null to parameter #2 ($offset) of type int is deprecated in FileReader->seekto() (line 125 of /opt/bitnami/apps/civicrm/htdocs/sites/all/modules/civicrm/packages/PHPgettext/streams.php)
The code in this file that causes the error is:
function seekto($pos) {
fseek($this->_fd, $pos);
$this->_pos = ftell($this->_fd);
return $this->_pos;
}
After changing this to
function seekto($pos) {
fseek($this->_fd, $this->_pos);
$this->_pos = ftell($this->_fd);
return $this->_pos;
}
It seems to make the error go away.
If you have already posted on:
Environment information
- Browser: Firefox
- CiviCRM: 5.71.0
- PHP: 8.1
- CMS: Drupal 7.100
- Database: MariaDB 10.6.16
- Web Server: Apache/2.4.52