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

"Segmentation fault" occurs when 'setCellVale' is called #2270

Open
mumubusu opened this issue Aug 13, 2021 · 1 comment
Open

"Segmentation fault" occurs when 'setCellVale' is called #2270

mumubusu opened this issue Aug 13, 2021 · 1 comment

Comments

@mumubusu
Copy link

mumubusu commented Aug 13, 2021

This is:

- [*] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

What is the current behavior?

What are the steps to reproduce?

Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:

<?php

require __DIR__ . '/vendor/autoload.php';

// Create new Spreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', '平台');
$sheet->setCellValue('B1', '门店');
$sheet->setCellValue('C1', '商品名称');
$sheet->setCellValue('D1', '条形码');
$sheet->setCellValue('E1', '商品分类');
$sheet->setCellValue('F1', 'ERP商品编码');
$sheet->setCellValue('G1', '是否对码');
$sheet->setCellValue('H1', '门店库存');
$sheet->setCellValue('I1', '门店价格');
$sheet->setCellValue('J1', '锁定状态');
$sheet->setCellValue('K1', '同步时间');
$sheet->setCellValue('L1', '上架状态');

foreach($datas as $index => $row) {

$sheet->setCellValue('A' . $index, $row[0]);
$sheet->setCellValue('B' . $index, $row[1]);
$sheet->setCellValue('C' . $index, $row[2]);
$sheet->setCellValue('D' . $index, $row[3]);
$sheet->setCellValue('E' . $index, $row[4]);
$sheet->setCellValue('F' . $index, $row[5]);
$sheet->setCellValue('G' . $index, $row[6]);

$sheet->setCellValue('H' . $index, $row[7]);
$sheet->setCellValue('I' . $index, $row[8]);
$sheet->setCellValue('J' . $index, $row[9]);
$sheet->setCellValue('K' . $index, $row[10]);
$sheet->setCellValue('L' . $index, $row[11]);

}

Which versions of PhpSpreadsheet and PHP are affected?

@MarkBaker
Copy link
Member

Given that you don't tell us what is in $datas, this is impossible to diagnose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants