Giter Site home page Giter Site logo

silverstripe-excel-import-export's People

Contributors

aljosab avatar dpezer avatar fernando-larios avatar lekoala avatar rvxd avatar t3hn0 avatar thebnl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

silverstripe-excel-import-export's Issues

ExcelBulkLoader Boolean value comparison on PHP < 8

There's an issue in PHP < 8 when integer zero (0) is compared to a string (in this case: "yes").

It always results true, which is incorrect. This causes importing all values with int 0 from XLS file and sets them TRUE.

https://www.php.net/manual/en/language.operators.comparison.php - look at the "Warning" section.

Problem is on:

I think best way is to compare string with string so instead of
if ($val == 'yes') {
use:
if ((string) $val == 'yes') {
this fixes issue, and imports 0/false values properly.

Sanitization problem in v3

Version: 3.0.0
SS version: 5.1.0

The new v3 version currently doesn't work for me. I'm getting this error

E_WARNING: Trying to access array offset on value of type int {"code":2,"message":"Trying to access array offset on value of type int","file":".../vendor/lekoala/silverstripe-excel-import-export/src/ExcelGridFieldExportButton.php","line":337} []

It seems like it's doing some sanitization there and expects $value to be array but it isn't

// @link https://owasp.org/www-community/attacks/CSV_Injection
// [SS-2017-007] Sanitise XLS executable column values with a leading tab
if ($sanitize) {
    // If we have only one char we can make it simpler
    if ($sanitize_xls_chars_len === 1) {
        if ($value && $value[0] === $sanitize_xls_chars) {
            $value = "\t" . $value;
        }
    } else {
        if (preg_match('/^[' . $sanitize_xls_chars . '].*/', $value ?? '')) {
            $value = "\t" . $value;
        }
    }
}

The $value is being set in line 314 $value = $gridField->getDataFieldValue($item, $columnSource); where $columnSource is ID (it's safe to assume it'll be present in any type of object) and it's returning 1, which is probably the ID of the first record, but not array.

Update release

Version 2.0.4 currently contains bug which prevents XLS(X) documents to contain header because $row is set to 1 after header is added to spreadsheet.

You already fixed issue with commit d40923b: d40923b

Could you create new release with this fix?

SpreadCompat::ensureExtension causes tmp files to be missed

When calling the SpreadCompat read method while uploading an spreadsheet (in the ModelAdmin) the method ensureExtension causes the fileextension to be forced to an tmp file. This results in the file to be unfindable as the tmp file doesn't have an extension.

Is the forced extension required or could it be omitted?

public static function read(
    string $filename,
    ...$opts
): Generator {
    $ext = $opts['extension'] ?? null;
    if ($ext) {
        // Errors on tmp files without an extension.
        // $filename = self::ensureExtension($filename, $ext);
    }
        
    return static::getAdapterForFile($filename, $ext)->readFile($filename, ...$opts);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.