Error on exporting the error log
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
Research direction
Start with plugins/datainjection/front/clientinjection.form.php line 75 and plugins/datainjection/inc/clientinjection.class.php line 349, then trace readUploadedFile() and the export request at plugins/datainjection/front/export.csv.php. Verify that the uploaded filename remains available after processing and that clicking “Export the log” downloads the rejected rows as a CSV without an HTTP 500.
Written by the indexing model from the issue text.
Description
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
11.0.9
Plugin version
2.15.11
Bug description
Importing a CSV through the client injection wizard loses the "Export the log" feature as soon as the import produces even one failed line.
What happens:
- I upload a valid CSV file to a model and run the injection. Here, PHP output a warning "Undefined array key "filename" at clientinjection.form.php line 75"
- Some rows fail (bad values, duplicates, whatever). The result screen correctly shows them and offers "Export the log" so I can fix the CSV and re-import.
- Clicking "Export the log" downloads nothing — the request just dies with a server error (HTTP 500 on front/export.csv.php). There is no way to recover the list of rejected lines; the only option is to re-run the whole import and read errors on screen, line by line.
Relevant log output
Logs during the upload:
[2026-09-22 12:52:54] glpi.WARNING: *** Warning: Undefined array key "filename" at clientinjection.form.php line 75
Backtrace :
...datainjection/front/clientinjection.form.php:75
...Glpi/Controller/LegacyFileLoadController.php:64 require()
./vendor/symfony/http-kernel/HttpKernel.php:181 Glpi\Controller\LegacyFileLoadController->__invoke()
./vendor/symfony/http-kernel/HttpKernel.php:76 Symfony\Component\HttpKernel\HttpKernel->handleRaw()
./vendor/symfony/http-kernel/Kernel.php:208 Symfony\Component\HttpKernel\HttpKernel->handle()
./src/Glpi/Kernel/Kernel.php:201 Symfony\Component\HttpKernel\Kernel->handle()
./public/index.php:78 Glpi\Kernel\Kernel->handle()
[2026-09-22 12:52:54] glpi.WARNING: *** Warning: Trying to access array offset on null at clientinjection.form.php line 75
Backtrace :
...datainjection/front/clientinjection.form.php:75
...Glpi/Controller/LegacyFileLoadController.php:64 require()
./vendor/symfony/http-kernel/HttpKernel.php:181 Glpi\Controller\LegacyFileLoadController->__invoke()
./vendor/symfony/http-kernel/HttpKernel.php:76 Symfony\Component\HttpKernel\HttpKernel->handleRaw()
./vendor/symfony/http-kernel/Kernel.php:208 Symfony\Component\HttpKernel\HttpKernel->handle()
./src/Glpi/Kernel/Kernel.php:201 Symfony\Component\HttpKernel\Kernel->handle()
./public/index.php:78 Glpi\Kernel\Kernel->handle()
Logs of the error obtained by clicking "Export the log"
[2026-09-22 12:55:46] glpi.WARNING: *** Warning: fopen(/var/glpi/files/_plugins/datainjection/): Failed to open stream: Is a directory at filesystem.php line 399
Backtrace :
...ngmachine/safe/generated/8.2/filesystem.php:399
...datainjection/inc/clientinjection.class.php:349 Safe\fopen()
./plugins/datainjection/front/export.csv.php:33 PluginDatainjectionClientInjection::exportErrorsInCSV()
...Glpi/Controller/LegacyFileLoadController.php:64 require()
./vendor/symfony/http-kernel/HttpKernel.php:181 Glpi\Controller\LegacyFileLoadController->__invoke()
./vendor/symfony/http-kernel/HttpKernel.php:76 Symfony\Component\HttpKernel\HttpKernel->handleRaw()
./vendor/symfony/http-kernel/Kernel.php:208 Symfony\Component\HttpKernel\HttpKernel->handle()
./src/Glpi/Kernel/Kernel.php:201 Symfony\Component\HttpKernel\Kernel->handle()
./public/index.php:78 Glpi\Kernel\Kernel->handle()
[2026-09-22 12:55:46] glpi.CRITICAL: *** Uncaught PHP Exception Safe\Exceptions\FilesystemException: "An error occurred" at FilesystemException.php line 9
Backtrace :
.../generated/Exceptions/FilesystemException.php:9
...ngmachine/safe/generated/8.2/filesystem.php:402 Safe\Exceptions\FilesystemException::createFromPhpError()
...datainjection/inc/clientinjection.class.php:349 Safe\fopen()
./plugins/datainjection/front/export.csv.php:33 PluginDatainjectionClientInjection::exportErrorsInCSV()
...Glpi/Controller/LegacyFileLoadController.php:64 require()
./vendor/symfony/http-kernel/HttpKernel.php:181 Glpi\Controller\LegacyFileLoadController->__invoke()
./vendor/symfony/http-kernel/HttpKernel.php:76 Symfony\Component\HttpKernel\HttpKernel->handleRaw()
./vendor/symfony/http-kernel/Kernel.php:208 Symfony\Component\HttpKernel\HttpKernel->handle()
./src/Glpi/Kernel/Kernel.php:201 Symfony\Component\HttpKernel\Kernel->handle()
./public/index.php:78 Glpi\Kernel\Kernel->handle()
Page URL
error occurs on /plugins/datainjection/front/export.csv.php (/plugins/datainjection/front/clientinjection.form.php on upload step outputs the warning)
Steps To reproduce
- Go to Administration > Data injection (client injection), pick a ready-to-use CSV model.
- Upload a valid CSV matching the model (with at least one row that will fail injection, so error lines exist).
- Check the GLPI PHP error log → "Undefined array key "filename"" at clientinjection.form.php line 75 (file_name stored as null in session).
- Run the injection, then click "Export the log".
- See error: fopen(.../files/plugins/datainjection/): Failed to open stream: Is a directory → uncaught TypeError in fputcsv() → HTTP 500, no CSV download.
Your GLPI setup information
No response
Anything else?
Root cause is the unset($_FILES['filename']); in readUploadedFile() combined with the re-read at clientinjection.form.php:75.
Suggested fix: capture the name before the unset and pass it back, e.g. in clientinjection.form.php do $uploaded_filename = $_FILES['filename']['name']; before processUploadedFile(), then $_SESSION['datainjection']['file_name'] = $uploaded_filename; — or have readUploadedFile() return the original name (it already captures it in $original_filename internally) instead of reaching into $_FILES again.
- Dominant language
- PHP
- Stars
- 76
- Forks
- 62
- Avg merge
- 18h 52m
- Merged PRs (30d)
- 15
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pluginsGLPI/datainjection
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
pluginsGLPI/datainjection#657 · 2 comments ·
All issues in pluginsGLPI/datainjection
Similar issues
-
status/awaiting_triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
WordPress/plugin-check#1486 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
az-digital/az_quickstart#6019 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
grokability/snipe-it#19688 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100