prinsich / php-excel-reader

Automatically exported from code.google.com/p/php-excel-reader
0 stars 0 forks source link

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in [...]\xlsReader\excel_reader2.php on line 347 #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Trying to access a certain xls file (other files are working)
2.
3.

What is the expected output? What do you see instead?
It should just list everything on the first sheet.

Please provide any additional information below.
The code is pretty simple and works with another xls-file, so the problem
somehow lies within the xls itself, but I can't figure out what it might be:
require_once 'pricelist/xlsReader/excel_reader2.php';
$file = $_REQUEST['sheet'];
$xls = new Spreadsheet_Excel_Reader('pricelist/files/'.$file.'');
$numcol = $xls->colcount();
$numrow = $xls->rowcount();

for ($row = 0; $row <= $numrow; $row++) {
 for ($col = 0; $col <= $numcol; $col++) {
  echo $xls->val($row, $col);
  echo ' : ';
 }
 echo '<br>';

}

Original issue reported on code.google.com by MIX.Dra...@gmail.com on 2 Apr 2009 at 10:31

GoogleCodeExporter commented 9 years ago
Just tried version 2.2 (I still had 2.11) and the error is still there, it just 
isn't
in the same line anymore. Now it is 339 (it's in the val Function: getCol() ).

Original comment by MIX.Dra...@gmail.com on 2 Apr 2009 at 11:57

GoogleCodeExporter commented 9 years ago
If you could attach an XLS file that causes the problem, that would be helpful

Original comment by matthew....@gmail.com on 2 Apr 2009 at 4:22

GoogleCodeExporter commented 9 years ago
Unfortunately I am not allowed to post this publically. Can I send it to you 
somehow?
Thank you!

Original comment by MIX.Dra...@gmail.com on 3 Apr 2009 at 7:10

GoogleCodeExporter commented 9 years ago
sure, you can email it to me at matt@mattkruse.com

Original comment by matthew....@gmail.com on 3 Apr 2009 at 2:51

GoogleCodeExporter commented 9 years ago
Hi Matthew,

are there any news concerning this?
It would be great hearing from you.

Thank you very much.
Best regards

Original comment by MIX.Dra...@gmail.com on 12 Jun 2009 at 9:27

GoogleCodeExporter commented 9 years ago
I noticed the same problem with one of my Excel files which I frequently have 
to 
edit. Every now and then, after saving the document, the problem occurs. The I 
edit 
back and forth again - and suddenly the problem is gone again, but may re-occur 
after some more editing later again. I would appreciate very much, if I could 
find a 
workaround for that.
Apart from this problem I find this piece of software great - thank you very 
much 
for this very useful piece of code!
Best regards from Munich, Bavaria
Christian

Original comment by cdg.fore...@gmail.com on 21 Oct 2009 at 2:48

GoogleCodeExporter commented 9 years ago
I'm having this problem as well.

Original comment by slimands...@gmail.com on 30 Oct 2009 at 4:43

GoogleCodeExporter commented 9 years ago
Same problem here, but when i checked the code the function array_key_exists() 
is getting an array as second 
argument, havent found a fix for it, would be nice if someone did

Original comment by ricardo....@gmail.com on 17 Nov 2009 at 7:21

GoogleCodeExporter commented 9 years ago
I'm still waiting for the solution. At least, can someone point me to a 
workaround
please?
It always works but just for only one file has a problem. Wondering if it will 
happen
again in the future!

Original comment by peerawut...@gmail.com on 17 Jan 2010 at 5:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I think it maybe about the format as I create the new blank worksheet and paste 
only
"value" from the old one. And it works.

Original comment by peerawut...@gmail.com on 17 Jan 2010 at 6:41

GoogleCodeExporter commented 9 years ago
Yes, I also remove every bit of formatting from my Excel files before processing
them. This way I no longer have this issue.

Original comment by MIX.Dra...@gmail.com on 17 Jan 2010 at 11:40

GoogleCodeExporter commented 9 years ago
Repost it in the new trung of the development:
http://code.google.com/p/php-excel-reader2/

Attach the Excell that you had problem and I will check it out.

Alex

Original comment by sirsh...@gmail.com on 19 Jan 2010 at 12:56

GoogleCodeExporter commented 9 years ago
well, i made a quick fix,

[code]
    function val($row, $col, $sheet = 0) {
        $col = $this->getCol ( $col );
        $test=$test2=false;
        $test=@array_key_exists ( $row, $this->sheets [$sheet] ['cells'] );
        $test2=@array_key_exists ( $col, $this->sheets [$sheet] ['cells'] [$row] );
        if ($test && $test2) {
            return $this->sheets [$sheet] ['cells'] [$row] [$col];
        }
        return "";
    }
[/code]

Original comment by silverha...@gmail.com on 11 Aug 2010 at 2:43