Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
i added the post to twitter field to a node type and when i select it when create a new node i get this error:
Recoverable fatal error: Argument 1 passed to Entity::__construct() must be an array, boolean given, called in /home/admin/public_html/calpoly/sites/all/modules/twitter/twitter.module on line 457 and defined in Entity->__construct() (line 40 of /home/admin/public_html/calpoly/sites/all/modules/entity/includes/entity.inc).
Comment | File | Size | Author |
---|---|---|---|
#15 | twitter-error.patch | 1.55 KB | SamLerner |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commented..
Comment #2
DamienMcKennaComment #3
waverate CreditAttribution: waverate commentedUsing 7.x-6.x-dev.
This error still exists. Any updates?
Comment #4
DamienMcKennaCan you please use the Devel module to identify what function called TwitterStatus::__construct()? To do so, enable the Devel module, go to the admin/config/development/devel settings page, change the error handler option to "Krumo backtrace in the message area" and see what is shown when the error is triggered again. Thanks.
Comment #5
DamienMcKennaPS, if you can help me identify the cause of this I'll be happy to fix the bug, but I need a little more detail before I can fix it. Thanks.
Comment #6
DamienMcKennaComment #7
Hamulus CreditAttribution: Hamulus commentedGot the same error
Comment #8
DamienMcKenna@Hamulus: What version of the module are you using? Can you please post the exact error message as the line numbers have moved around since the issue was originally reported. Thanks.
Comment #9
cthshabel CreditAttribution: cthshabel commentedStill getting this error with the latest dev version: 7.x-6.2+1-dev
Exact error message: Recoverable fatal error: Argument 1 passed to Entity::__construct() must be of the type array, boolean given, called in /var/www/html/example/sites/all/modules/contrib/twitter/twitter.module on line 679 and defined in Entity->__construct() (line 41 of /var/www/html/example/sites/all/modules/contrib/entity/includes/entity.inc).
Enabling krumo backtrace just shows that it was successful: Successfully posted to Twitter: https://twitter.com/example/status/654377250083741696
Not sure what is happening, but it does successfully post to twitter. Something on line 679 doesn't play nice?
parent::__construct($values, 'twitter_status');
Comment #10
kjl CreditAttribution: kjl commented$values = $this->call('statuses/update', $params, 'POST');
$values can be empty if the status update sent to twitter is identical to a previous status update.
This causes an exception when the boolean is passed to
return new TwitterStatus($values);
resulting in "recoverable fatal error: Argument 1 passed to Entity::__construct() must be of the type array, boolean given"
Comment #11
DamienMcKenna@kjl: Good catch. And yes, the API was updated at some point to detect duplicate messages. This needs fixing.
Comment #12
Rob T CreditAttribution: Rob T commentedI am running into this issue as error as well...
Comment #13
Rob T CreditAttribution: Rob T commentedThis issue continues to bug my site.
Some Twitter posts process as expected, while others fail with this error. In my case the posts I aim to Tweet via Rules are never duplicates. Yet some go through, and some fail. Hence, I don't think the title of this issue is correct - "... if the message is a duplicate" - at least not for me.
One observation that may be the distinguishing factor in determining whether the content posts to Twitter (or fails) could be the length of the title. However, I am unqualified to make that determination, so it's really just a shot in the dark.
In my dblog report there are 2 errors reported side-by-side: (1) twitter error: "exception 'TwitterException'...", and (2) a php error "Recoverable fatal error". Here they are...
twitter
php
Could this be caused by a title that has too many characters (versus the initial suspicion of attempting to post duplicate messages)?
Comment #14
Rob T CreditAttribution: Rob T commentedAfter observing a handful more Twitter posts fail with this error, I have become more convinced it is the result of a title that has too many characters (of which my Twitter post is set to "[node:title] [node:url:shorten] #SampleHashtag").
Between the messages that get Tweeted without issue, and the messages that fail with this error, the distinguishing factor looks to be the length of the message, or in my case [node:title].
I am changing the title of the issue. I'll still retain "if message is a duplicate" since that was an initial observation or assumption, but in my case there are no attempts to post duplicate messages.
Comment #15
SamLerner CreditAttribution: SamLerner at Acquia commentedThis patch will keep the error from displaying and interrupting the post. However, the tweet will still not be sent, and no response is sent back to the user. So it's not an ideal situation if you want to inform users that they'll need to modify their tweet before submitting.
Comment #16
nickonom CreditAttribution: nickonom commentedHitting the same wall here...
Comment #17
ianm CreditAttribution: ianm commentedI suddenly starting getting the same error yesterday. I had published some tens of nodes each creating a tweet, when I started getting an error and the tweets were no longer posted although the node was published. I wondered whether I had triggered some Twitter limit so waited 24 hours before trying again, but still getting the error.
As people above, there are two errors in the log; one for twitter and one for php. These are:
exception 'TwitterException' with message 'Forbidden' in ../sites/all/modules/twitter/twitter.lib.php:159 Stack trace: #0 ../sites/all/modules/twitter/twitter.lib.php(119): Twitter->request('https://api.twi...', Array, 'POST') #1 ../sites/all/modules/twitter/twitter.lib.php(1273): Twitter->auth_request('https://api.twi...', Array, 'POST') #2 ../sites/all/modules/twitter/twitter.lib.php(407): Twitter->call('statuses/update', Array, 'POST') #3 ../sites/all/modules/twitter/twitter.inc(198): Twitter->statuses_update('New product: AT...') #4 ../sites/all/modules/twitter/twitter_post/twitter_post.module(64): twitter_set_status(Object(TwitterAccount), 'New product: AT...') #5 ../sites/all/modules/twitter/twitter_post/twitter_post.module(82): twitter_post_entity_insert(Object(stdClass), 'node') #6 [internal function]: twitter_post_entity_update(Object(stdClass), 'node') #7 ../includes/module.inc(965): call_user_func_array('twitter_post_en...', Array) #8 ../modules/node/node.module(1181): module_invoke_all('entity_update', Object(stdClass), 'node') #9 ../modules/node/node.pages.inc(459): node_save(Object(stdClass)) #10 ../includes/form.inc(1524): node_form_submit(Array, Array) #11 ../includes/form.inc(906): form_execute_handlers('submit', Array, Array) #12 ../includes/form.inc(386): drupal_process_form('products_node_f...', Array, Array) #13 ../includes/form.inc(131): drupal_build_form('products_node_f...', Array) #14 ../modules/node/node.pages.inc(14): drupal_get_form('products_node_f...', Object(stdClass)) #15 [internal function]: node_page_edit(Object(stdClass)) #16 ../includes/menu.inc(527): call_user_func_array('node_page_edit', Array) #17 ../index.php(21): menu_execute_active_handler() #18 {main}
Recoverable fatal error: Argument 1 passed to Entity::__construct() must be of the type array, boolean given, called in ../sites/all/modules/twitter/twitter.module on line 679 and defined in Entity->__construct() (line 201 of ../sites/all/modules/entity/includes/entity.inc).
This effects at least two different content types.
As I mentioned, this happened in the middle of publishing nodes, I had made no changes to the configuration before the errors started.
Happy to provide further information or test if it helps.