Peach icon indicating copy to clipboard operation
Peach copied to clipboard

Widget link serialized array remains unchanged

Open cfxd opened this issue 10 years ago • 10 comments

Hi @petesaia,

Thank you for the amazing tool and for making it freely available.

I recently encountered an issue where widgets with internal site links do not get corrected character counts in their serialized arrays and they end up breaking after a migration. See here for a more detailed description.

Thanks again for Peach and for looking into this!

cfxd avatar Feb 25 '15 04:02 cfxd

@CFXd, Based on the snippet you sent me (thank you, btw):

a:2:{i:2;a:3:{s:5:"title";s:7:"HIRE US";s:4:"text";s:34:"<a href="http://1234.dev">test</a>";s:6:"filter";b:0;}s:12:"_multiwidget";i:1;}

I believe the issue is the way you're exporting the dump. Specifically, the problem is the nested quotations - "<a href="http://1234.dev">test</a>". Ideally, it should export to '<a href="http://1234.dev">test</a>'. This may actually be an issue with MySQL. Could you provde the version you are using? This issue isn't occurring for me using mysqldump Ver 10.13 Distrib 5.6.10, for osx10.8 (x86_64).

Run mysqldump --version to display the version.

Related:

  • http://dba.stackexchange.com/questions/29575/mysqldump-not-escaping-single-quotes-properly
  • http://stackoverflow.com/questions/9523628/specifying-the-escape-character-inserted-by-mysqldump-in-sql-files

psaia avatar Feb 26 '15 05:02 psaia

mysqldump Ver 10.13 Distrib 5.5.29, for osx10.6 (i386)

Will investigate further and let you know what I find.

cfxd avatar Feb 26 '15 05:02 cfxd

Just upgraded to mysqldump Ver 10.13 Distrib 5.6.23, for osx10.8 (x86_64) and I get the same result when migrating the db, even though the entry now appears completely escaped:

a:2:{i:2;a:3:{s:5:\"title\";s:7:\"HIRE US\";s:4:\"text\";s:34:\"<a href=\"http://ushs.dev\">test</a>\";s:6:\"filter\";b:0;}s:12:\"_multiwidget\";i:1;}

cfxd avatar Feb 26 '15 06:02 cfxd

I think it's odd that 100% of them are escaped. I'm going to work on a test for this today.

psaia avatar Feb 26 '15 17:02 psaia

Ok, let me know if you need anything else from me to help.

cfxd avatar Feb 26 '15 17:02 cfxd

I've made an update to the core class. I was unable to re-create the problem exactly but I have a suspicion as to what's causing it. The beginning (s:123:"...) and end (";) was being hard-coded in the previous version assuming all sql dumps were created equal. In this latest commit i'm capturing and using whatever type of quotation (and/or escaping methodology) the dump is using. Hopefully this fixes the issue, but it's quite possible it doesn't. Please feel free to hack your local grunt-peach (tasks/migrate.js) to see if it fixed the issue. This weekend I'm going to fork grunt-peach and do some further testing and finally a pull request.

psaia avatar Feb 27 '15 11:02 psaia

Dude awesome, will do and will let you know what I find!

cfxd avatar Feb 27 '15 16:02 cfxd

@petesaia hey I updated grunt-peach to use your repo as a dependency and require your peach.js file now

davidosomething avatar Feb 27 '15 17:02 davidosomething

Just tried the new grunt-peach and the widgets still do not make it over :-(

cfxd avatar Feb 27 '15 21:02 cfxd

What's really puzzling is why post content with internal links makes it over but the widgets with internal links do not. Strange that one works but not the other.

cfxd avatar Mar 02 '15 01:03 cfxd