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

Deprecated: Implicit conversion from float xx.xxxx to int loses precision in excel_reader2.php on line 922 #180

Open
rafaelspfonseca opened this issue Jul 5, 2022 · 2 comments

Comments

@rafaelspfonseca
Copy link

rafaelspfonseca commented Jul 5, 2022

OS: Windows 11
PHP Version 8.1.6

Error Mesage:
Deprecated: Implicit conversion from float 65.03846153846153 to int loses precision in C:\xampp\htdocs\sati\import\excel_reader2.php on line 922

public function __construct($file='',$store_extended_info=true,$outputEncoding='') {

  $this->_ole = new OLERead();
  $this->setUTFEncoder('iconv');
  if ($outputEncoding != '') { 
  	$this->setOutputEncoding($outputEncoding);
  }
  for ($i=1; $i<245; $i++) {
  	$name = strtolower(( (($i-1)/26>=1)?chr(($i-1)/26+64):'') . chr(($i-1)%26+65));  //line 922
  	$this->colnames[$name] = $i;
  	$this->colindexes[$i] = $name;
  }
  $this->store_extended_info = $store_extended_info;
  if ($file!="") {
  	$this->read($file);
  }

}

Anyone have ideia to fix the problem?

@rafaelspfonseca
Copy link
Author

rafaelspfonseca commented Jul 11, 2022

Fixed Function

// Constructor
//
//Some basic initialisation
//

//function Spreadsheet_Excel_Reader($file='',$store_extended_info=true,$outputEncoding='') {
public function __construct($file='',$store_extended_info=true,$outputEncoding='') {
$this->_ole = new OLERead();
$this->setUTFEncoder('iconv');
if ($outputEncoding != '') {
$this->setOutputEncoding($outputEncoding);
}
for ($i=1; $i<245; $i++) {
//$name = strtolower(( (($i-1)/26>=1)?chr(($i-1)/26+64):'') . chr(($i-1)%26+65));
$name = strtolower(( (($i-1)/26>=1)? chr((int) (($i-1)/26+64)) :'') . chr((int) (($i-1)%26+65)) );
$this->colnames[$name] = $i;
$this->colindexes[$i] = $name;
}
$this->store_extended_info = $store_extended_info;
if ($file!="") {
$this->read($file);
}
}

@Ezyweb-uk
Copy link

I'm getting the same deprecated warning for the following line in function _GetIEEE754($rknum)
$sign = ($rknum & 0x80000000) >> 31;

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

2 participants