php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55715 Iterating Excel worksheet cell values may crash PHP
Submitted: 2011-09-17 15:20 UTC Modified: 2011-11-24 13:33 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: ystsoi at yahoo dot com dot hk Assigned:
Status: Duplicate Package: COM related
PHP Version: 5.4.0beta1 OS: Windows XP SP3, Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ystsoi at yahoo dot com dot hk
New email:
PHP Version: OS:

 

 [2011-09-17 15:20 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-11 00:07 UTC] 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-11-12 09:40 UTC] 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-24 13:33 UTC] thekid@php.net
-Status: Open +Status: Duplicate
 [2011-11-24 13:33 UTC] thekid@php.net
The patch in bug #60167 fixes this, also. Pending review for commit, this should be in 5.4.0RC2.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 15:01:30 2024 UTC