Exporting the IP addressing report (from an addressing network's form) fails with HTTP 500 and the generic "An unexpected error occurred" message. The plugin itself works fine otherwise.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
Direzione di ricerca
Leggi src/Report.php, in particolare displayExport() nella sezione delle definizioni delle colonne, e segui la chiamata segnalata fino a Spreadsheet::formatValue() di GLPI. Riproduci l’esportazione in GLPI 12.0.2 usando il modulo della rete di indirizzamento e controlla i valori delle celle passati all’output del foglio di calcolo. Il lavoro è completato quando l’esportazione nei formati elencati non genera più l’errore di binding dell’array.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Code of Conduct
- I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues
GLPI Version
12.0.2
Plugin version
3.3.1
Bug description
Steps to reproduce
- Go to Tools > IP Addressing and open a network (e.g.
addressing.form.php?id=2) - Choose any export format (e.g. PDF landscape) and start the export
- → HTTP 500, "An unexpected error occurred"
Request:
GET /front/report.dynamic.php?item_type=GlpiPlugin%5CAddressing%5CReport&id=2&ping_on=1&ping_off=1&filter=0&seeallotedip=1&seedoubleip=1&seereservedip=1&seefreeip=1&start=0&display_type=2&export=
Expected behavior
The report is exported in the selected format.
Actual behavior
glpi.CRITICAL: *** Uncaught PHP Exception PhpOffice\PhpSpreadsheet\Exception: "Unable to bind unstringable array" at DefaultValueBinder.php line 43
Backtrace :
...c/PhpSpreadsheet/Cell/DefaultValueBinder.php:43
...preadsheet/src/PhpSpreadsheet/Cell/Cell.php:252 PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder->bindValue()
...src/PhpSpreadsheet/Worksheet/Worksheet.php:1219 PhpOffice\PhpSpreadsheet\Cell\Cell->setValue()
./src/Glpi/Search/Output/Spreadsheet.php:596 PhpOffice\PhpSpreadsheet\Worksheet\Worksheet->setCellValue()
./src/Glpi/Search/Output/Spreadsheet.php:151 Glpi\Search\Output\Spreadsheet->formatValue()
.../glpi/marketplace/addressing/src/Report.php:451 Glpi\Search\Output\Spreadsheet->displayData()
.../glpi/marketplace/addressing/src/Report.php:113 GlpiPlugin\Addressing\Report::displayExport()
/var/glpi/marketplace/addressing/hook.php:444 GlpiPlugin\Addressing\Report->displayReport()
./src/Plugin.php:1913 plugin_addressing_dynamicReport()
./front/report.dynamic.php:116 Plugin::doOneHook()
...Glpi/Controller/LegacyFileLoadController.php:64 require()
...
./public/index.php:78 Glpi\Kernel\Kernel->handle()
Root cause
In GLPI 12, Glpi\Search\Output\Spreadsheet::formatValue() only unwraps a cell array (['displayname' => ...]) when the column options contain a searchopt key:
if (is_array($value) && isset($options['searchopt'])) {
...
$value = DataExport::normalizeValueForTextExport($value['displayname'] ?? '');
}
$worksheet->setCellValue([$x_coordinate, $y_coordinate], $value);
Report::displayExport() builds its column definitions without searchopt, so the whole cell array is passed to setCellValue(), which throws Unable to bind unstringable array. As GLPI 12 handles all non-HTML outputs via Spreadsheet, this affects every export format (PDF, CSV, ODS, XLSX).
Proposed fix
In src/Report.php, displayExport():
$colid = 0;
foreach ($headers as $header) {
$addressing_data['data']['cols'][] = [
- 'name' => $header,
- 'itemtype' => $itemtype,
- 'id' => ++$colid,
+ 'name' => $header,
+ 'itemtype' => $itemtype,
+ 'id' => ++$colid,
+ // Spreadsheet::formatValue() only unwraps the cell array
+ // (['displayname' => ...]) when a search option is given.
+ 'searchopt' => ['datatype' => 'string'],
];
}
Using datatype => 'string' avoids the date formatting branch and lets normalizeValueForTextExport() decode the escaped displayname, as displayExport() already expects.
Tested on GLPI 12.0.2: export works again with this change.
Relevant log output
Page URL
No response
Steps To reproduce
No response
Your GLPI setup information
No response
Anything else?
No response
- Lingua principale
- PHP
- Stelle
- 43
- Fork
- 24
- Merge medio
- 6h 30m
- PR unite (30g)
- 1
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di pluginsGLPI/addressing
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 45/100
pluginsGLPI/addressing#131 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
pluginsGLPI/addressing#129 ·
-
Enhancement: Wake on LANAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
pluginsGLPI/addressing#125 ·
-
ImprovementsAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
pluginsGLPI/addressing#105 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
pluginsGLPI/addressing#82 · 1 commento ·
Tutte le issue di pluginsGLPI/addressing
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
matomo-org/plugin-CustomAlerts#310 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug Status: Needs Triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
php/web-php#2102 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
domain/checkout Platform(Default) priority/low testing/acceptance
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
5.14.0 PIE packages still declare PHP >=8.3, so PIE installs them on PHP 8.3 and the build failsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
bug component:user_profiles
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
knowii-oss/knowii#1689 ·
I maintainer di solito rispondono entro 1 giorno