xperseguers / t3ext-extractor

TYPO3 Extension extractor
https://extensions.typo3.org/extension/extractor
GNU General Public License v2.0
15 stars 24 forks source link

Two INSERT crashes #18

Closed SicorDev closed 4 years ago

SicorDev commented 5 years ago

Hello there, I experienced 2 crashes when using impexp two transfer 15.000 files from one typo3 to another.

First Problem: The "publisher" String of a PDF was longer than 45 chars, which is the database limit. My solution: Truncating the string. In SimpleString I added:

/**
* Truncates String to 45 letters max.
* @param string $str
* @return string
*/
public static function maxLength45($str)
{
    $str = SimpleString::trim($str);
    return substr($str, 0, 45);
}

And in the PDF Jason:

"FAL": "publisher",
"DATA": "Producer->Causal\\Extractor\\Utility\\SimpleString::maxLength45"

Second problem: One timestamp was signed negative (Really no clue why...) My solution: returning 'null':

I changed the end of utility function DateTime::timestamp to:

$timestamp = strtotime($str);
if($timestamp === false || $timestamp < 0)
    return null;

return $timestamp;

Maybe it helps, maybe you find better solutions.