Bug #55715 [Opn->Dup]: Iterating Excel worksheet cell values may crash PHP
| From: | thekid@php.net | Date: | Thu, 24 Nov 2011 13:33:09 +0000 |
| Subject: | Bug #55715 [Opn->Dup]: Iterating Excel worksheet cell values may crash PHP | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165472@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55715&edit=1
ID: 55715
Updated by: thekid@php.net
Reported by: ystsoi at yahoo dot com dot hk
Summary: Iterating Excel worksheet cell values may crash PHP
-Status: Open
+Status: Duplicate
Type: Bug
Package: COM related
Operating System: Windows XP SP3, Windows 7
PHP Version: 5.4.0beta1
Block user comment: N
Private report: N
New Comment:
The patch in bug #60167 fixes this, also. Pending review for commit, this should be in 5.4.0RC2.
Previous Comments:
------------------------------------------------------------------------
[2011-11-12 09:40:15] bugzilla33 at gmail dot com
Expected result:
----------------
PHP 5.3.9RC1 prints: Microsoft Windows
Actual result:
--------------
PHP 5.4.0RC1 crash
<?php
$z=50;while($z--){
$o=new COM('WinMgmts:',null,CP_UTF8);
foreach($o->ExecQuery('SELECT * FROM Win32_OperatingSystem') as $x){
$s=$x->Caption;
}
}
print($s);
?>
------------------------------------------------------------------------
[2011-11-11 00:07:39] lunter at interia dot pl
Confirmed on PHP 5.4.0 RC1, Apache 2.2.21 VC9
Windows 7 32bit
Bug introduced in PHP 5.4
PHP 5.3.8 works fine.
------------------------------------------------------------------------
[2011-09-17 15:20:52] ystsoi at yahoo dot com dot hk
Description:
------------
When run the following test script, PHP will crash when it tries to get the value of the second
cell.
The problem will not occur if Cells() is not used within the for-loop.
Test script:
---------------
<?php
$excel = new COM("Excel.Application");
$excel->Workbooks->Open(realpath('test.xls'));
$worksheet = $excel->ActiveSheet;
for ($j = 1; $j <= 2; $j++) {
echo $worksheet->Cells(1, $j)->Value, "\n";
}
$excel->Quit();
?>
Expected result:
----------------
The values of A1 and B1 in test.xls will be echoed.
Actual result:
--------------
Only the value of A1 in test.xls is echoed, then crash.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55715&edit=1