• I am the developer of plugin wp-photo-album-plus
    One of the (admin) features is to import/export media item metadata in the form of .csv files.
    I use the php functions str_getcsv() and fputcsv().
    To use fputcsv() a file must be opend by fopen(), and afterwards closed by fclose(). I also use fwrite() for the header line of the .csv file.

    However, plugin check reports the following errors:

    ERROR WordPress.WP.AlternativeFunctions.file_system_operations_fopen File operations should use WP_Filesystem methods instead of direct PHP filesystem calls. Found: fopen().
    ERROR WordPress.WP.AlternativeFunctions.file_system_operations_fclose File operations should use WP_Filesystem methods instead of direct PHP filesystem calls. Found: fclose().
    ERROR WordPress.WP.AlternativeFunctions.file_system_operations_fwrite File operations should use WP_Filesystem methods instead of direct PHP filesystem calls. Found: fwrite().

    And these functions do not exist in WP_Filesystem_Direct.

    So, any idea how to fix this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator threadi

    (@threadi)

    Which plugin check are you using exactly? The PCP plugin or the GitHub Action? With PCP, I don’t see any errors in the information displayed in my plugins, even when generating CSV files. Regardless, I would still just use this method to generate CSV files and document it accordingly in the code comments. If the plugin team sees this, they’ll be able to understand it.

    Thread Starter Jacob N. Breetvelt

    (@opajaap)

    Moderator threadi

    (@threadi)

    Yep, that’s what I meant by PCP. The plugin also detects this PHP function in some of my plugins and flags it as an error. As I said, I’d recommend ignoring it and clearly documenting in the code itself why you’re using it the way it’s written there. Anyone who looks at the code will understand.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.