WordPress / wordpress-importer

The WordPress Importer
https://wordpress.org/plugins/wordpress-importer/
GNU General Public License v2.0
80 stars 81 forks source link

Fix conditional logic for setting base_blog_url #105

Closed jjpmann closed 2 years ago

jjpmann commented 3 years ago

don't override base_blog_url if already set

dd32 commented 3 years ago

Hi @jjpmann, Thanks for the PR!

Looking at the change here, it seems reasonable, but can you expand upon the need for it / if there's a ticket explaining the bug somewhere?

Thanks!

jjpmann commented 3 years ago

Hi @dd32 ,

Sorry for missing the details. I created a ticket here but didn't exactly know the full process. https://core.trac.wordpress.org/ticket/53956

Basically, if the regex parse was used the blog_url would always get overridden unless it was the last parsed line in the loop.

dd32 commented 2 years ago

Reviewing this closer..

SimpleXML has similar logic, but runs once prior to the parse, rather than each loop. https://github.com/WordPress/wordpress-importer/blob/master/src/parsers/class-wxr-parser-simplexml.php#L55-L63

XML Parser has similar logic, only setting once thanks to isset(): https://github.com/WordPress/wordpress-importer/blob/master/src/parsers/class-wxr-parser-xml.php#L240-L244

Change seems appropriate.