Closed ddarbyson closed 4 years ago
More information on the change of count()
function in PHP 7.2 which breaks SRDB.
More digging around... The error occurs on this line:
https://github.com/interconnectit/Search-Replace-DB/blob/master/srdb.class.php#L1156
$parts = mb_split( preg_quote( $search ), $subject );
Where "mb_split now return false with ISO strings". When $parts is passed to count() and implode() functions in lines https://github.com/interconnectit/Search-Replace-DB/blob/master/srdb.class.php#L1157-L1158 we get failures. This breaks search and replace and ends up corrupting data.
See PHP issue https://bugs.php.net/bug.php?id=78190
Looking at the collation for table it appears to be latin1_swedish_ci
After sometime I came to the conclusion that updating the collation would resolve this issue. However, what is critical to note, is SRDB does not exit or produce an exit status when a error or critical warning occurs. In my case, latin1_swedish_ci
collation with PHP 7.2 caused complete data corruption without any notice. Since I use SRDB in a wrapper script to process hundreds of websites at a time, not reporting exit status would produce false-positives. There would be no way of knowing data had been corrupted unless exitstaus != 0 was produced.
I improved the error_hander callback to account for this in the following pull request.
https://github.com/interconnectit/Search-Replace-DB/pull/272
The code in https://github.com/interconnectit/Search-Replace-DB/pull/274/files worked well for my sites
@markdelf Yeah ! ✔
thanks, we are merging that code into the new version
@gianluigi-icit - The issue still persists. Could you merge #274 before closing?
This absolutely breaks databases data:
https://www.php.net/manual/en/migration72.incompatible.php
After these errors, data is missing from the database.
I've been a long time user of interconnectit/Search-Replace-DB. So much so, that it's become a dependency for hundreds of websites which need to move between servers.
I really hope developers are watching this thread and will actively pursue PHP 7.2 compatibility.