I installed csv-export together with views_data_export (Drupal 8.5.3) . Blocked the export for all users that have not the right to administer users in views (not logged in and also logged in with no appropriate rights).

Then I tried to access the export with no appropriate rights (https://www.mydomain.org/user-data-export?_format=csv). The results: "The 'administer users' permission is required." I am not sure whether I find that good or if it tells the user too much. Most probably a Views thing.

From this I go back to the main domain (https://www.mydomain.org) and get a lot of error messages starting with:

Notice: Undefined offset: 0 in Drupal\csv_serialization\Encoder\CsvEncoder->extractHeaders() (line 176 of modules/contrib/csv_serialization/src/Encoder/CsvEncoder.php).
Drupal\csv_serialization\Encoder\CsvEncoder->extractHeaders(Array, Array) (Line: 143)
Drupal\csv_serialization\Encoder\CsvEncoder->encode(Array, 'csv', Array) (Line: 40)
Symfony\Component\Serializer\Encoder\ChainEncoder->encode(Array, 'csv', Array) (Line: 272)

No idea whether this is a views, csv_serialization or views_data_export . But the error messages are all from csv_serialization. After reload all error messages disappear.

CommentFileSizeAuthor
#2 fixes-php-warning-2975802-2.patch485 bytess.messaris
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

julius95 created an issue. See original summary.

s.messaris’s picture

Here is a patch for the errors. The checking of the array being empty was not enough, since it can be

$data = ["message" => "The 'XXX' permission is required."]
s.messaris’s picture

Status: Active » Needs review
s.messaris’s picture

Hey, I have being using this the last month without issues, and it is a pretty simple fix. Can someone else RTBC this so that maybe we can have this commited?

  • grasmash committed b088783 on 8.x-1.x authored by s.messaris
    Issue #2975802 by s.messaris: Undefined offset: 0 in Drupal\...

  • grasmash committed 9fda252 on 8.x-2.x authored by s.messaris
    Issue #2975802 by s.messaris: Undefined offset: 0 in Drupal\...
grasmash’s picture

Status: Needs review » Fixed

What if we just cast it to an array instead?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

tjtj’s picture

Yet again, as a user I have to run down a patch. Why isn't this installed automatically in the distribution? This makes using Drupal unnecessarily difficult.