deliciousbrains / wp-migrate-db

WordPress plugin that exports your database, does a find and replace on URLs and file paths, then allows you to save it to your computer.
https://wordpress.org/plugins/wp-migrate-db/
341 stars 515 forks source link

Invalid path for compatiblity directory in Compatibility->wpmdbc_disable_theme function. #128

Open yanmorinokamca opened 2 years ago

yanmorinokamca commented 2 years ago

Seen in master branch and in wp-migrate-db-pro 2.2.0: https://github.com/deliciousbrains/wp-migrate-db/blob/master/class/Common/Compatibility/Compatibility.php#L68

The invalid path for compatiblity directory cause realpath function to return false, and $theme_root become an absolute path from the /temp-theme/ folder. This absolute path is outside of allowed path in my open_basedir configuration and cause a fatal error preventing normal migration.

Note that this error is raised by wordpress class-wp-theme-json-resolver.php that try to open File(/temp-theme/theme.json)

A solution could be to use three back path: /../../../ instead of only one /../. or to use the variable $GLOBALS['wpmdb_meta']['wp-migrate-db-pro']['abspath']