Support » Plugin: Activity Log » CSV Export and comma separated values

  • Resolved Dealer Solutions

    (@dealersolutions)


    Hello all,

    If I log a value with commas in it the CSV export breaks due to a lack of field escaping.

    aal_insert_log( array(
      'action' => 'Test Log',
      'object_type' => 'Options',
      'object_name' => 'thing,with,comma', // This is the problem
      'object_subtype' => 'Test Log'
    ));

    https://i.imgur.com/04TlXIi.png

    using version 2.7.0

    I’d like to report this as a bug with the following code thank you

    $output = join( ',', array_values( $columns ) ) . "\n";
    foreach ( $data as $row ) {
        $output .= join( ',', $row ) . "\n";
    }

    This export could be refactored into perhaps?

    $fp = fopen('php://output', 'wb');
    fputcsv($fp, $columns );
    foreach ( $data as $row ) {
        fputcsv($fp, $row );
    }
    fclose($fp);
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.