fb-instant-articles
fb-instant-articles copied to clipboard
PHP Fatal error: Uncaught exception 'InvalidArgumentException'
Steps required to reproduce the problem
- go to an old post
Expected Result
- show the post
Actual Result
- Error 500 Internal Server Error
Version Info
- Plugin version: 4.0.5
- WordPress version: 4.7.5
- PHP version: indifferent, i've triet 5.6 and also 7
PHP message: PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Method expects this value \n----[\nbool(false)\n]----\n to be one of the types \n====[\narray(2) {\n [0]=>\n string(6) "STRING"\n [1]=>\n string(36) "Facebook\InstantArticles\Elements\H2"\n}\n]====' in /var/www/www.xxxxxxx.com/wp-content/plugins/fb-instant-articles/vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php:182\nStack trace:\n#0 /var/www/www.xxxxxxx.com/wp-content/plugins/fb-instant-articles/vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php(62): Facebook\InstantArticles\Validators\Type::throwException(false, Array)\n#1 /var/www/www.xxxxxxx.com/wp-content/plugins/fb-instant-articles/vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php(39): Facebook\InstantArticles\Validators\Type::is(false, Array, true)\n#2 /var/www/www.xxxxxxx.com/wp-content/plugins/fb-instant-articles/ve...\n', referer: http://www.xxxxxxx.com/yyyyy/kkkkkk
I have the Same error. I get the 500 error on any 404 page or if no results are found.
Version Info:
-
Plugin Version: 4.0.5
-
WordPress version: 4.8.1
-
PHP Version: 5.6
-
Theme: Salient
PHP Error
/nas/content/live/XXXXXXXX/wp-content/plugins/fb-instant-articles/vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php 263 PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Method expects this value \n----[\nbool(false)\n]----\n to be one of the types \n====[\nstring(6) "STRING"\n]====' in /nas/content/live/XXXXXXXX/wp-content/plugins/fb-instant-articles/vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php:182\nStack trace:\n#0 /nas/content/live/XXXXXXXX/wp-content/plugins/fb-instant-articles/vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php(69): Facebook\\InstantArticles\\Validators\\Type::throwException(false, 'STRING')\n#1 /nas/content/live/XXXXXXXX/wp-content/plugins/fb-instant-articles/vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php(39): Facebook\\InstantArticles\\Validators\\Type::is(false, 'STRING', true)\n#2 /nas/content/live/XXXXXXXX/wp-content/plugins/fb-instant-articles/vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Instan in /nas/content/live/XXXXXXXX/wp-content/plugins/fb-instant-articles/vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php on line 182
I can't reproduce this problem. Could you please give some more context. Old post on the blog itself or in the admin interface? Could this be a conflict with another plugin?
Closing due to inactivity, please reopen if you still need help and can provide the required information for us to be able to help.
If you search for this error in search engines, you get multiple results.
I have this issue on some articles, this is because of an empty _post in class-instant-articles-post.php
$this->instant_article =
InstantArticle::create()
->withCanonicalUrl( $this->get_canonical_url() )
->withHeader( $header )
->addMetaProperty( 'op:generator:application', 'facebook-instant-articles-wp' )
->addMetaProperty( 'op:generator:application:version', IA_PLUGIN_VERSION );
array(7) {
["file"]=>
string(118) "XXX/wp-content/plugins/fb-instant-articles/class-instant-articles-post.php"
["line"]=>
int(677)
["function"]=>
string(16) "withCanonicalURL"
["class"]=>
string(48) "Facebook\InstantArticles\Elements\InstantArticle"
["object"]=>
object(Facebook\InstantArticles\Elements\InstantArticle)#12400 (14) {
["metaProperties":"Facebook\InstantArticles\Elements\InstantArticle":private]=>
array(2) {
["op:generator"]=>
string(33) "facebook-instant-articles-sdk-php"
["op:generator:version"]=>
string(6) "1.10.0"
}
["canonicalURL":"Facebook\InstantArticles\Elements\InstantArticle":private]=>
NULL
["markupVersion":"Facebook\InstantArticles\Elements\InstantArticle":private]=>
string(4) "v1.0"
["isAutomaticAdPlaced":"Facebook\InstantArticles\Elements\InstantArticle":private]=>
bool(true)
["adDensity":"Facebook\InstantArticles\Elements\InstantArticle":private]=>
string(7) "default"
["isRecirculationAdPlaced":"Facebook\InstantArticles\Elements\InstantArticle":private]=>
bool(false)
["adRecirculationPlacement":"Facebook\InstantArticles\Elements\InstantArticle":private]=>
NULL
["charset":"Facebook\InstantArticles\Elements\InstantArticle":private]=>
string(5) "utf-8"
["style":"Facebook\InstantArticles\Elements\InstantArticle":private]=>
NULL
["header":"Facebook\InstantArticles\Elements\InstantArticle":private]=>
object(Facebook\InstantArticles\Elements\Header)#12401 (10) {
["cover":"Facebook\InstantArticles\Elements\Header":private]=>
NULL
["title":"Facebook\InstantArticles\Elements\Header":private]=>
NULL
["subtitle":"Facebook\InstantArticles\Elements\Header":private]=>
NULL
["authors":"Facebook\InstantArticles\Elements\Header":private]=>
array(0) {
}
["published":"Facebook\InstantArticles\Elements\Header":private]=>
NULL
["modified":"Facebook\InstantArticles\Elements\Header":private]=>
NULL
["kicker":"Facebook\InstantArticles\Elements\Header":private]=>
NULL
["ads":"Facebook\InstantArticles\Elements\Header":private]=>
array(0) {
}
["sponsor":"Facebook\InstantArticles\Elements\Header":private]=>
NULL
["empty_validation":"Facebook\InstantArticles\Elements\Element":private]=>
bool(true)
}
["footer":"Facebook\InstantArticles\Elements\InstantArticle":private]=>
NULL
["children":"Facebook\InstantArticles\Elements\InstantArticle":private]=>
array(0) {
}
["isRTLEnabled":"Facebook\InstantArticles\Elements\InstantArticle":private]=>
bool(false)
["empty_validation":"Facebook\InstantArticles\Elements\Element":private]=>
bool(true)
}
["type"]=>
string(2) "->"
["args"]=>
array(1) {
[0]=>
&bool(false)
}
}```
This happens on article where amp_markup=1 is set in the URL and the URL of the article has been changed (following a title change), somehow it's not redirecting to the new URL and it tries to render a non existent post (which has moved to a new URL).
I can trigger this with a fresh WP 5.2 and this plugin.
- Create a post
- Change the URL
- Add ?amp_markup=1 to the old URL Expected result: redirect Actual result: error 500
A WordPress VIP enterprise client is seeing the same error being reported...
InvalidArgumentException: Uncaught exception 'InvalidArgumentException' with message 'Method expects this value ----[bool(false)]---- to be one of the types ====[string(6) "STRING"]====' in /var/www/wp-content/plugins/facebook-instant-articles/vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php:182
Running on latest version of WordPress. Let me know if you need to know anything more.
any update on this error?
A WordPress VIP enterprise client is seeing the same error being reported...
InvalidArgumentException: Uncaught exception 'InvalidArgumentException' with message 'Method expects this value ----[bool(false)]---- to be one of the types ====[string(6) "STRING"]====' in /var/www/wp-content/plugins/facebook-instant-articles/vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php:182
Running on latest version of WordPress. Let me know if you need to know anything more.
Any Update on this?
I'm not able to recreate this with the develop
branch of this plugin, and the AMP 2.3.0 plugin. We would need more reproduction steps of plugin settings to confirm if the issue is still an issue.
I'll close this ticket out, but feedback using the latest versions of the plugins can be added.