Edit report at https://bugs.php.net/bug.php?id=55715&edit=1

 ID:                 55715
 Updated by:         the...@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

Reply via email to