welaika / wordmove

Multi-stage command line deploy/mirroring and task runner for Wordpress
https://wptools.it/wordmove
MIT License
1.87k stars 165 forks source link

invalid byte sequence in UTF-8 (ArgumentError) #530

Closed ahmedmusawir closed 4 years ago

ahmedmusawir commented 5 years ago

Yes, I've read all the docs and tried everything. Everything is up to date on my Mac OSX Sierra 10.12.6 Ruby: 2.6.0 wordmove: 4.01

But no matter what I do, I keep getting the following:

Ahmeds-Capitan-2:GARAGE-CYFI-2019 shourav$ wordmove push -d

▬▬ Using Movefile: ./movefile.yml ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

▬▬ Pushing Database ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
   remote | mysqldump --host=localhost --user=devhtmlf_wpadmin --password=KXXXX --result-file="/home2/devhtmlf/public_html/garage-dev/wp-content/dump.sql" --hex-blob devhtmlf_garage-dev_db
   remote | gzip -9 -f "/home2/devhtmlf/public_html/garage-dev/wp-content/dump.sql"
   remote | get: /home2/devhtmlf/public_html/garage-dev/wp-content/dump.sql.gz /Users/shourav/Documents/2019/6.June/GARAGE-CYFI-2019/wp-content/production-backup-1560829075.sql.gz
   remote | delete: /home2/devhtmlf/public_html/garage-dev/wp-content/dump.sql.gz
    local | mysqldump --host=localhost --user=root --password=XXX --result-file="/Users/shourav/Documents/2019/6.June/GARAGE-CYFI-2019/wp-content/dump.sql" garage-cyfi_db
mysqldump: [Warning] Using a password on the command line interface can be insecure.
    local | Adapt dump
Traceback (most recent call last):
    19: from /usr/local/bin/wordmove:23:in `<main>'
    18: from /usr/local/bin/wordmove:23:in `load'
    17: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/exe/wordmove:6:in `<top (required)>'
    16: from /usr/local/lib/ruby/gems/2.6.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
    15: from /usr/local/lib/ruby/gems/2.6.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
    14: from /usr/local/lib/ruby/gems/2.6.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
    13: from /usr/local/lib/ruby/gems/2.6.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
    12: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:102:in `push'
    11: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:41:in `handle_options'
    10: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:41:in `each'
     9: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:42:in `block in handle_options'
     8: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:103:in `block in push'
     7: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/deployer/ssh.rb:38:in `push_db'
     6: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/deployer/ssh/default_sql_adapter.rb:13:in `adapt_local_db!'
     5: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/deployer/ssh/default_sql_adapter.rb:42:in `adapt_sql'
     4: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/sql_adapter/default.rb:18:in `adapt!'
     3: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/sql_adapter/default.rb:26:in `replace_vhost!'
     2: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/sql_adapter/default.rb:38:in `replace_field!'
     1: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/sql_adapter/default.rb:45:in `serialized_replace!'
/usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/sql_adapter/default.rb:45:in `gsub!': invalid byte sequence in UTF-8 (ArgumentError)

Please help ... at least steer me to the right direction ... already tried:

  1. --hex-blob
  2. SqlAdapter::Wpcli
  3. Tried the following with .profile
    
    export LC_ALL=en_US.UTF-8
    export LANG=en_US.UTF-8 
4. This is no longer valid (I think), tried adding to `default.rb` ... didn't work.
Folder: `/usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/sql_adapter`

sql_content.encode!('UTF-16', 'UTF-8', :invalid => :replace, :replace => '') sql_content.encode!('UTF-8', 'UTF-16') sql_content.force_encoding("UTF-8")


5. Then upgraded Ruby, Wordmove and everything else ...

No Luck ... Please help ... thanx.
alessandro-fazzi commented 5 years ago

What error does wpcli adapter throws?

Unfortunately this happens when you have non-UTF-8 chars in the DB; that could be somewhat legit, but Wordmove can't afford to solve this problem. Moreover I thought the problem disappeared with the advent of wp-cli, which is an official tool and is expected to work in all supported scenarios...

So the facts are:

ahmedmusawir commented 5 years ago

This is what wpcli is throwing:

    local | adapt dump for vhost
    local | wp search-replace http://ias.local http://ias-dev.devhtmlfive.com --quiet --skip-columns=guid --all-tables --allow-root
Warning: preg_match(): JIT compilation failed: no more memory in /Users/shourav/Documents/2019/7.July/IAS MARKETING/wp-content/plugins/gallery-images-ape/modules/fields/include/apeGalleryFieldsConfig.php on line 26
Warning: preg_match(): JIT compilation failed: no more memory in /Users/shourav/Documents/2019/7.July/IAS MARKETING/wp-content/plugins/gravityforms/gravityforms.php on line 5411
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /Users/shourav/Documents/2019/7.July/IAS MARKETING/wp-content/plugins/gravityformszapier/zapier.php on line 851
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /Users/shourav/Documents/2019/7.July/IAS MARKETING/wp-content/plugins/gravityformszapier/zapier.php on line 901
Warning: preg_replace(): JIT compilation failed: no more memory in /Users/shourav/Documents/2019/7.July/IAS MARKETING/wp-content/plugins/thrive-leads/inc/helpers.php on line 1229
Warning: preg_match(): JIT compilation failed: no more memory in /Users/shourav/Documents/2019/7.July/IAS MARKETING/wp-content/plugins/wp-google-maps/legacy-core.php on line 93
Fatal error: Uncaught InvalidArgumentException: RegexIterator::__construct(): JIT compilation failed: no more memory in /Users/shourav/Documents/2019/7.July/IAS MARKETING/wp-content/plugins/wp-google-maps/includes/class.auto-loader.php:121
Stack trace:
#0 /Users/shourav/Documents/2019/7.July/IAS MARKETING/wp-content/plugins/wp-google-maps/includes/class.auto-loader.php(121): RegexIterator->__construct(Object(RecursiveIteratorIterator), '/^.+(\\.php)$/i', 1)
#1 /Users/shourav/Documents/2019/7.July/IAS MARKETING/wp-content/plugins/wp-google-maps/includes/class.auto-loader.php(144): WPGMZA\AutoLoader->getClassesInPathByFilename('/Users/shourav/...')
#2 /Users/shourav/Documents/2019/7.July/IAS MARKETING/wp-content/plugins/wp-google-maps/includes/class.auto-loader.php(209): WPGMZA\AutoLoader->registerClassesInPath('/Users/shourav/...')
#3 /Users/shourav/Documents/2019/7.July/IAS MARKETING/wp-content/plugins/wp-google-maps/legacy-core.php(10): require_once('/Users/shourav/...')
#4 /Users/shourav/Documents/2019/7.July/IAS MARKET in /Users/shourav/Documents/2019/7.July/IAS MARKETING/wp-content/plugins/wp-google-maps/includes/class.auto-loader.php on line 121
Warning: preg_match(): JIT compilation failed: no more memory in phar:///usr/local/bin/wp/php/utils-wp.php on line 58
Warning: preg_match(): JIT compilation failed: no more memory in phar:///usr/local/bin/wp/php/utils-wp.php on line 61
Error: The site is experiencing technical difficulties.
Traceback (most recent call last):
    14: from /usr/local/bin/wordmove:23:in `<main>'
    13: from /usr/local/bin/wordmove:23:in `load'
    12: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/exe/wordmove:6:in `<top (required)>'
    11: from /usr/local/lib/ruby/gems/2.6.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
    10: from /usr/local/lib/ruby/gems/2.6.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
     9: from /usr/local/lib/ruby/gems/2.6.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
     8: from /usr/local/lib/ruby/gems/2.6.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
     7: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:102:in `push'
     6: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:41:in `handle_options'
     5: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:41:in `each'
     4: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:42:in `block in handle_options'
     3: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:103:in `block in push'
     2: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/deployer/ssh.rb:38:in `push_db'
     1: from /usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/deployer/ssh/wpcli_sql_adapter.rb:11:in `adapt_local_db!'
/usr/local/lib/ruby/gems/2.6.0/gems/wordmove-4.0.1/lib/wordmove/deployer/base.rb:93:in `run': Return code reports an error (Wordmove::ShellCommandError)
alessandro-fazzi commented 5 years ago

Hm; but that problem seems to be more related to your PHP (https://php.net/manual/en/pcre.configuration.php#ini.pcre.jit) than to Wordmove. What do you think? Wanna try turning off JIT compilation on PCRE?

ahmedmusawir commented 5 years ago

I'm using MAMP Pro ... recently upgraded to 5.0 ... any specific suggestion on what I have to do?

alessandro-fazzi commented 5 years ago

Oh well...unfortunately I have no idea at all. But a php.ini should be there along with any php installation :) For sure it will be mentioned in MAMP docs ;)

alessandro-fazzi commented 4 years ago

Stalled 🤷‍♂ thus closing