getgrav / grav-premium-issues

Official Grav Premium Issues repository to report problems or ask questions regarding the Premium products offered.
https://getgrav.org/premium
7 stars 2 forks source link

[seo-magic] After upgrade, error on SEOGenerator.php #173

Closed hdwebpros closed 3 years ago

hdwebpros commented 3 years ago

Grav: 1.7.23 SEO Magic: 3.0.3 Admin: 1.10.23

When trying to view the SEOMagic plugin, I see

Server Error
Sorry, something went terribly wrong!

0 - Argument 2 passed to Symfony\Component\HttpClient\HttpClient::create() must be of the type int, null given, called in /home/hoist/public_html/user/plugins/seo-magic/classes/SEOGenerator.php on line 211
For further details please review your logs/ folder, or enable displaying of errors in your system configuration.
rhukster commented 3 years ago

This looks like a similar issue to this: https://github.com/getgrav/grav-premium-issues/issues/170

Basically was a new option added in 3.0.3, it should totally fallback to the one in the seo-magic configuration though. This guy had other issues, but a quick fix is to add that client_connections: 10 to your config.

hdwebpros commented 3 years ago

I tried adding that to the config, the error persists.

rhukster commented 3 years ago

cleared cache?

rhukster commented 3 years ago

and how did you install? manually or via admin or CLI gpm command? seems like your seo-magic.yaml is cached, and not picking up the new value.

hdwebpros commented 3 years ago

I forget how we installed, we've had it for a while now. Early adopters :)

I cleared cache, no progress

hdwebpros commented 3 years ago

Full config file:

enabled: true
enable_admin_page_events: true
enable_quicktray: true
enable_seo_report: true
log_results: true
user_agent: 'Grav SEOMagic Plugin'
robots: all
body_selectors:
  - .magic-content
  - 'article .rich-text'
ignore_routes: null
custom_stopwords:
  - content
  - '&'
opengraph:
  enabled: true
twitter:
  enabled: true
  username: null
  card: summary_large_image
  reading_time: true
facebook:
  enabled: true
  appid: '414509766633604'
keep_utf8_chars: true
global_keywords: null
autogenerate_desc: true
autogenerate_keywords: true
desc_summarization_method: textrank
images:
  type: auto
  webshot_url: 'https://webshot.getgrav.org'
  image_name: null
  image_attribute: hero_image
  default_image: null
  size:
    x: '1200'
    'y': '630'
sitemap_url: /sitemap.xml
keywords_default_fallback: true
desc_default_fallback: true
client_connections: 10
rhukster commented 3 years ago

No clue why this is not working for you :(

However, a quick fix is edit: /home/hoist/public_html/user/plugins/seo-magic/classes/SEOGenerator.php on line 211

and put a ,10 at the end of that call so:

return Client::getClient($options, $config->get('plugins.seo-magic.client_connections', 10));
hdwebpros commented 3 years ago

Tried that, now I get this error:

Server Error Sorry, something went terribly wrong!

0 - Class 'Grav\Plugin\SEOMagic\Client' not found

hdwebpros commented 3 years ago

Further update...

I fully deleted the plugin. I cleared my cache. I deleted the saved config.

Then I reinstalled it. Same error as originally posted.

rhukster commented 3 years ago

Oh sorry, that example I gave you was with the new Grav 1.7.24 version. Please just change your version to pass the extra 10 default parameter for /home/hoist/public_html/user/plugins/seo-magic/classes/SEOGenerator.php on line 211

return HttpClient::create($options, $config->get('plugins.seo-magic.client_connections', 10));
hdwebpros commented 3 years ago

Okay, patched in the hack and the admin page now loads