wpsharks / comment-mail

A WordPress plugin enabling email subscriptions for comments.
http://comment-mail.com
GNU General Public License v3.0
8 stars 3 forks source link

PHP 7: Notice: Array to string conversion #272

Closed raamdev closed 7 years ago

raamdev commented 8 years ago

When leaving a reply on a comment and choosing to subscribe to replies to my comment, I'm getting the following notice (tested with the latest Comment Mail Pro on the 000000-dev branch; also had this happen with the latest public release of Comment Mail Lite v160213).

Despite this notice, the subscription does appear to get created in Comment Mail, however the status says unconfirmed, despite Auto-Confirm Everyone enabled in Comment Mail → Config. Options → Auto-Confirm Settings (is that perhaps a separate bug?).

Errors when testing the dev branch on 2016-06-08:

PHP Notice:  Array to string conversion in /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php on line 1026
PHP Stack trace:
PHP   1. {main}() /srv/www/wordpress-default/wp-comments-post.php:0
PHP   2. wp_handle_comment_submission($comment_data = array ('comment' => 'test!!', 'author' => 'test2', 'email' => 'test@test2.com', 'url' => '', 'comment_mail_sub_type' => 'comment', 'comment_mail_sub_deliver' => 'asap', 'submit' => 'Submit Comment', 'comment_post_ID' => '1740', 'comment_parent' => '0')) /srv/www/wordpress-default/wp-comments-post.php:20
PHP   3. wp_new_comment($commentdata = array ('comment_post_ID' => 1740, 'comment_author' => 'test2', 'comment_author_email' => 'test@test2.com', 'comment_author_url' => '', 'comment_content' => 'test!!', 'comment_type' => '', 'comment_parent' => 0, 'comment_author_IP' => '192.168.50.1', 'comment_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36', 'comment_date' => '2016-06-08 11:55:21', 'comment_date_gmt' => '2016-06-08 15:55:21', 'filtered' => TRUE, 'comment_approved' => 1)) /srv/www/wordpress-default/wp-includes/comment.php:2918
PHP   4. do_action($tag = 'comment_post', $arg = 45, 1, array ('comment_post_ID' => 1740, 'comment_author' => 'test2', 'comment_author_email' => 'test@test2.com', 'comment_author_url' => '', 'comment_content' => 'test!!', 'comment_type' => '', 'comment_parent' => 0, 'comment_author_IP' => '192.168.50.1', 'comment_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36', 'comment_date' => '2016-06-08 11:55:21', 'comment_date_gmt' => '2016-06-08 15:55:21', 'filtered' => TRUE, 'comment_approved' => 1)) /srv/www/wordpress-default/wp-includes/comment.php:1821
PHP   5. WebSharks\CommentMail\Plugin->commentPost($comment_id = 45, $comment_status = 1) /srv/www/wordpress-default/wp-includes/plugin.php:525
PHP   6. WebSharks\CommentMail\CommentPost->__construct($comment_id = 45, $comment_status = 1) /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/Plugin.php:2403
PHP   7. WebSharks\CommentMail\CommentPost->maybeInjectSub() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/CommentPost.php:54
PHP   8. WebSharks\CommentMail\SubInjector->__construct($user = class WP_User { public $data = class stdClass {  }; public $ID = 0; public $caps = array (); public $cap_key = NULL; public $roles = array (); public $allcaps = array (); public $filter = NULL }, $comment_id = 45, $args = array ('type' => 'comment', 'deliver' => 'asap', 'auto_confirm' => NULL, 'process_events' => TRUE, 'process_list_server' => FALSE, 'user_initiated' => TRUE, 'keep_existing' => TRUE)) /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/CommentPost.php:95
PHP   9. WebSharks\CommentMail\SubInjector->maybeInject() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInjector.php:142
PHP  10. WebSharks\CommentMail\SubInserter->__construct($request_args = array ('ID' => NULL, 'key' => NULL, 'user_id' => 0, 'post_id' => '1740', 'comment_id' => '45', 'deliver' => 'asap', 'fname' => 'test2', 'lname' => '', 'email' => 'test@test2.com', 'insertion_ip' => NULL, 'insertion_region' => NULL, 'insertion_country' => NULL, 'last_ip' => NULL, 'last_region' => NULL, 'last_country' => NULL, 'status' => NULL, 'insertion_time' => NULL, 'last_update_time' => NULL), $args = array ('auto_confirm' => NULL, 'process_events' => TRUE, 'process_confirmation' => TRUE, 'process_list_server' => FALSE, 'user_initiated' => TRUE, 'ui_protected_data_keys_enable' => FALSE, 'ui_protected_data_user' => NULL, 'user_allow_0' => NULL, 'keep_existing' => TRUE, 'check_blacklist' => TRUE)) /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInjector.php:199
PHP  11. WebSharks\CommentMail\SubInserter->maybeInsertUpdate() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php:479
PHP  12. WebSharks\CommentMail\SubInserter->insert() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php:695
PHP  13. WebSharks\CommentMail\SubInserter->overwriteAnyOthersAfterInsertUpdate() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php:766
PHP Notice:  Array to string conversion in /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php on line 1029
PHP Stack trace:
PHP   1. {main}() /srv/www/wordpress-default/wp-comments-post.php:0
PHP   2. wp_handle_comment_submission($comment_data = array ('comment' => 'test!!', 'author' => 'test2', 'email' => 'test@test2.com', 'url' => '', 'comment_mail_sub_type' => 'comment', 'comment_mail_sub_deliver' => 'asap', 'submit' => 'Submit Comment', 'comment_post_ID' => '1740', 'comment_parent' => '0')) /srv/www/wordpress-default/wp-comments-post.php:20
PHP   3. wp_new_comment($commentdata = array ('comment_post_ID' => 1740, 'comment_author' => 'test2', 'comment_author_email' => 'test@test2.com', 'comment_author_url' => '', 'comment_content' => 'test!!', 'comment_type' => '', 'comment_parent' => 0, 'comment_author_IP' => '192.168.50.1', 'comment_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36', 'comment_date' => '2016-06-08 11:55:21', 'comment_date_gmt' => '2016-06-08 15:55:21', 'filtered' => TRUE, 'comment_approved' => 1)) /srv/www/wordpress-default/wp-includes/comment.php:2918
PHP   4. do_action($tag = 'comment_post', $arg = 45, 1, array ('comment_post_ID' => 1740, 'comment_author' => 'test2', 'comment_author_email' => 'test@test2.com', 'comment_author_url' => '', 'comment_content' => 'test!!', 'comment_type' => '', 'comment_parent' => 0, 'comment_author_IP' => '192.168.50.1', 'comment_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36', 'comment_date' => '2016-06-08 11:55:21', 'comment_date_gmt' => '2016-06-08 15:55:21', 'filtered' => TRUE, 'comment_approved' => 1)) /srv/www/wordpress-default/wp-includes/comment.php:1821
PHP   5. WebSharks\CommentMail\Plugin->commentPost($comment_id = 45, $comment_status = 1) /srv/www/wordpress-default/wp-includes/plugin.php:525
PHP   6. WebSharks\CommentMail\CommentPost->__construct($comment_id = 45, $comment_status = 1) /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/Plugin.php:2403
PHP   7. WebSharks\CommentMail\CommentPost->maybeInjectSub() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/CommentPost.php:54
PHP   8. WebSharks\CommentMail\SubInjector->__construct($user = class WP_User { public $data = class stdClass {  }; public $ID = 0; public $caps = array (); public $cap_key = NULL; public $roles = array (); public $allcaps = array (); public $filter = NULL }, $comment_id = 45, $args = array ('type' => 'comment', 'deliver' => 'asap', 'auto_confirm' => NULL, 'process_events' => TRUE, 'process_list_server' => FALSE, 'user_initiated' => TRUE, 'keep_existing' => TRUE)) /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/CommentPost.php:95
PHP   9. WebSharks\CommentMail\SubInjector->maybeInject() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInjector.php:142
PHP  10. WebSharks\CommentMail\SubInserter->__construct($request_args = array ('ID' => NULL, 'key' => NULL, 'user_id' => 0, 'post_id' => '1740', 'comment_id' => '45', 'deliver' => 'asap', 'fname' => 'test2', 'lname' => '', 'email' => 'test@test2.com', 'insertion_ip' => NULL, 'insertion_region' => NULL, 'insertion_country' => NULL, 'last_ip' => NULL, 'last_region' => NULL, 'last_country' => NULL, 'status' => NULL, 'insertion_time' => NULL, 'last_update_time' => NULL), $args = array ('auto_confirm' => NULL, 'process_events' => TRUE, 'process_confirmation' => TRUE, 'process_list_server' => FALSE, 'user_initiated' => TRUE, 'ui_protected_data_keys_enable' => FALSE, 'ui_protected_data_user' => NULL, 'user_allow_0' => NULL, 'keep_existing' => TRUE, 'check_blacklist' => TRUE)) /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInjector.php:199
PHP  11. WebSharks\CommentMail\SubInserter->maybeInsertUpdate() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php:479
PHP  12. WebSharks\CommentMail\SubInserter->insert() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php:695
PHP  13. WebSharks\CommentMail\SubInserter->overwriteAnyOthersAfterInsertUpdate() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php:766
PHP Notice:  Array to string conversion in /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php on line 1032
PHP Stack trace:
PHP   1. {main}() /srv/www/wordpress-default/wp-comments-post.php:0
PHP   2. wp_handle_comment_submission($comment_data = array ('comment' => 'test!!', 'author' => 'test2', 'email' => 'test@test2.com', 'url' => '', 'comment_mail_sub_type' => 'comment', 'comment_mail_sub_deliver' => 'asap', 'submit' => 'Submit Comment', 'comment_post_ID' => '1740', 'comment_parent' => '0')) /srv/www/wordpress-default/wp-comments-post.php:20
PHP   3. wp_new_comment($commentdata = array ('comment_post_ID' => 1740, 'comment_author' => 'test2', 'comment_author_email' => 'test@test2.com', 'comment_author_url' => '', 'comment_content' => 'test!!', 'comment_type' => '', 'comment_parent' => 0, 'comment_author_IP' => '192.168.50.1', 'comment_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36', 'comment_date' => '2016-06-08 11:55:21', 'comment_date_gmt' => '2016-06-08 15:55:21', 'filtered' => TRUE, 'comment_approved' => 1)) /srv/www/wordpress-default/wp-includes/comment.php:2918
PHP   4. do_action($tag = 'comment_post', $arg = 45, 1, array ('comment_post_ID' => 1740, 'comment_author' => 'test2', 'comment_author_email' => 'test@test2.com', 'comment_author_url' => '', 'comment_content' => 'test!!', 'comment_type' => '', 'comment_parent' => 0, 'comment_author_IP' => '192.168.50.1', 'comment_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36', 'comment_date' => '2016-06-08 11:55:21', 'comment_date_gmt' => '2016-06-08 15:55:21', 'filtered' => TRUE, 'comment_approved' => 1)) /srv/www/wordpress-default/wp-includes/comment.php:1821
PHP   5. WebSharks\CommentMail\Plugin->commentPost($comment_id = 45, $comment_status = 1) /srv/www/wordpress-default/wp-includes/plugin.php:525
PHP   6. WebSharks\CommentMail\CommentPost->__construct($comment_id = 45, $comment_status = 1) /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/Plugin.php:2403
PHP   7. WebSharks\CommentMail\CommentPost->maybeInjectSub() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/CommentPost.php:54
PHP   8. WebSharks\CommentMail\SubInjector->__construct($user = class WP_User { public $data = class stdClass {  }; public $ID = 0; public $caps = array (); public $cap_key = NULL; public $roles = array (); public $allcaps = array (); public $filter = NULL }, $comment_id = 45, $args = array ('type' => 'comment', 'deliver' => 'asap', 'auto_confirm' => NULL, 'process_events' => TRUE, 'process_list_server' => FALSE, 'user_initiated' => TRUE, 'keep_existing' => TRUE)) /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/CommentPost.php:95
PHP   9. WebSharks\CommentMail\SubInjector->maybeInject() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInjector.php:142
PHP  10. WebSharks\CommentMail\SubInserter->__construct($request_args = array ('ID' => NULL, 'key' => NULL, 'user_id' => 0, 'post_id' => '1740', 'comment_id' => '45', 'deliver' => 'asap', 'fname' => 'test2', 'lname' => '', 'email' => 'test@test2.com', 'insertion_ip' => NULL, 'insertion_region' => NULL, 'insertion_country' => NULL, 'last_ip' => NULL, 'last_region' => NULL, 'last_country' => NULL, 'status' => NULL, 'insertion_time' => NULL, 'last_update_time' => NULL), $args = array ('auto_confirm' => NULL, 'process_events' => TRUE, 'process_confirmation' => TRUE, 'process_list_server' => FALSE, 'user_initiated' => TRUE, 'ui_protected_data_keys_enable' => FALSE, 'ui_protected_data_user' => NULL, 'user_allow_0' => NULL, 'keep_existing' => TRUE, 'check_blacklist' => TRUE)) /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInjector.php:199
PHP  11. WebSharks\CommentMail\SubInserter->maybeInsertUpdate() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php:479
PHP  12. WebSharks\CommentMail\SubInserter->insert() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php:695
PHP  13. WebSharks\CommentMail\SubInserter->overwriteAnyOthersAfterInsertUpdate() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php:766
PHP Notice:  Array to string conversion in /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php on line 1033
PHP Stack trace:
PHP   1. {main}() /srv/www/wordpress-default/wp-comments-post.php:0
PHP   2. wp_handle_comment_submission($comment_data = array ('comment' => 'test!!', 'author' => 'test2', 'email' => 'test@test2.com', 'url' => '', 'comment_mail_sub_type' => 'comment', 'comment_mail_sub_deliver' => 'asap', 'submit' => 'Submit Comment', 'comment_post_ID' => '1740', 'comment_parent' => '0')) /srv/www/wordpress-default/wp-comments-post.php:20
PHP   3. wp_new_comment($commentdata = array ('comment_post_ID' => 1740, 'comment_author' => 'test2', 'comment_author_email' => 'test@test2.com', 'comment_author_url' => '', 'comment_content' => 'test!!', 'comment_type' => '', 'comment_parent' => 0, 'comment_author_IP' => '192.168.50.1', 'comment_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36', 'comment_date' => '2016-06-08 11:55:21', 'comment_date_gmt' => '2016-06-08 15:55:21', 'filtered' => TRUE, 'comment_approved' => 1)) /srv/www/wordpress-default/wp-includes/comment.php:2918
PHP   4. do_action($tag = 'comment_post', $arg = 45, 1, array ('comment_post_ID' => 1740, 'comment_author' => 'test2', 'comment_author_email' => 'test@test2.com', 'comment_author_url' => '', 'comment_content' => 'test!!', 'comment_type' => '', 'comment_parent' => 0, 'comment_author_IP' => '192.168.50.1', 'comment_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36', 'comment_date' => '2016-06-08 11:55:21', 'comment_date_gmt' => '2016-06-08 15:55:21', 'filtered' => TRUE, 'comment_approved' => 1)) /srv/www/wordpress-default/wp-includes/comment.php:1821
PHP   5. WebSharks\CommentMail\Plugin->commentPost($comment_id = 45, $comment_status = 1) /srv/www/wordpress-default/wp-includes/plugin.php:525
PHP   6. WebSharks\CommentMail\CommentPost->__construct($comment_id = 45, $comment_status = 1) /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/Plugin.php:2403
PHP   7. WebSharks\CommentMail\CommentPost->maybeInjectSub() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/CommentPost.php:54
PHP   8. WebSharks\CommentMail\SubInjector->__construct($user = class WP_User { public $data = class stdClass {  }; public $ID = 0; public $caps = array (); public $cap_key = NULL; public $roles = array (); public $allcaps = array (); public $filter = NULL }, $comment_id = 45, $args = array ('type' => 'comment', 'deliver' => 'asap', 'auto_confirm' => NULL, 'process_events' => TRUE, 'process_list_server' => FALSE, 'user_initiated' => TRUE, 'keep_existing' => TRUE)) /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/CommentPost.php:95
PHP   9. WebSharks\CommentMail\SubInjector->maybeInject() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInjector.php:142
PHP  10. WebSharks\CommentMail\SubInserter->__construct($request_args = array ('ID' => NULL, 'key' => NULL, 'user_id' => 0, 'post_id' => '1740', 'comment_id' => '45', 'deliver' => 'asap', 'fname' => 'test2', 'lname' => '', 'email' => 'test@test2.com', 'insertion_ip' => NULL, 'insertion_region' => NULL, 'insertion_country' => NULL, 'last_ip' => NULL, 'last_region' => NULL, 'last_country' => NULL, 'status' => NULL, 'insertion_time' => NULL, 'last_update_time' => NULL), $args = array ('auto_confirm' => NULL, 'process_events' => TRUE, 'process_confirmation' => TRUE, 'process_list_server' => FALSE, 'user_initiated' => TRUE, 'ui_protected_data_keys_enable' => FALSE, 'ui_protected_data_user' => NULL, 'user_allow_0' => NULL, 'keep_existing' => TRUE, 'check_blacklist' => TRUE)) /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInjector.php:199
PHP  11. WebSharks\CommentMail\SubInserter->maybeInsertUpdate() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php:479
PHP  12. WebSharks\CommentMail\SubInserter->insert() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php:695
PHP  13. WebSharks\CommentMail\SubInserter->overwriteAnyOthersAfterInsertUpdate() /srv/www/wordpress-default/wp-content/plugins/comment-mail/src/includes/classes/SubInserter.php:766

Errors testing latest public release (v160215):

Notice: Array to string conversion in /srv/www/wordpress-default/wp-content/plugins/comment-mail-pro/src/includes/classes/SubInserter.php on line 1026
Call Stack
#   Time    Memory  Function    Location
1   0.2021  363976  {main}( )   .../wp-comments-post.php:0
2   0.3216  2765200 wp_handle_comment_submission( array(9) )    .../wp-comments-post.php:20
3   0.3230  2468400 wp_new_comment( array(13) ) .../comment.php:2918
4   0.3294  2483192 do_action( string(12), long, long, array(13) )  .../comment.php:1821
5   1.0258  2619664 WebSharks\CommentMail\Pro\Plugin->commentPost( long, long ) .../plugin.php:525
6   1.0286  2621536 WebSharks\CommentMail\Pro\CommentPost->__construct( long, long )    .../Plugin.php:2536
7   1.0315  2624280 WebSharks\CommentMail\Pro\CommentPost->maybeInjectSub( )    .../CommentPost.php:54
8   1.0345  2630776 WebSharks\CommentMail\Pro\SubInjector->__construct( object(WP_User)[352], long, array(7) )  .../CommentPost.php:95
9   1.0365  2634408 WebSharks\CommentMail\Pro\SubInjector->maybeInject( )   .../SubInjector.php:142
10  1.0387  2640200 WebSharks\CommentMail\Pro\SubInserter->__construct( array(18), array(10) )  .../SubInjector.php:199
11  1.0392  2641120 WebSharks\CommentMail\Pro\SubInserter->maybeInsertUpdate( ) .../SubInserter.php:479
12  1.0432  2649296 WebSharks\CommentMail\Pro\SubInserter->insert( )    .../SubInserter.php:695
13  1.0525  2800536 WebSharks\CommentMail\Pro\SubInserter->overwriteAnyOthersAfterInsertUpdate( )   .../SubInserter.php:766

( ! ) Notice: Array to string conversion in /srv/www/wordpress-default/wp-content/plugins/comment-mail-pro/src/includes/classes/SubInserter.php on line 1029
Call Stack
#   Time    Memory  Function    Location
1   0.2021  363976  {main}( )   .../wp-comments-post.php:0
2   0.3216  2765200 wp_handle_comment_submission( array(9) )    .../wp-comments-post.php:20
3   0.3230  2468400 wp_new_comment( array(13) ) .../comment.php:2918
4   0.3294  2483192 do_action( string(12), long, long, array(13) )  .../comment.php:1821
5   1.0258  2619664 WebSharks\CommentMail\Pro\Plugin->commentPost( long, long ) .../plugin.php:525
6   1.0286  2621536 WebSharks\CommentMail\Pro\CommentPost->__construct( long, long )    .../Plugin.php:2536
7   1.0315  2624280 WebSharks\CommentMail\Pro\CommentPost->maybeInjectSub( )    .../CommentPost.php:54
8   1.0345  2630776 WebSharks\CommentMail\Pro\SubInjector->__construct( object(WP_User)[352], long, array(7) )  .../CommentPost.php:95
9   1.0365  2634408 WebSharks\CommentMail\Pro\SubInjector->maybeInject( )   .../SubInjector.php:142
10  1.0387  2640200 WebSharks\CommentMail\Pro\SubInserter->__construct( array(18), array(10) )  .../SubInjector.php:199
11  1.0392  2641120 WebSharks\CommentMail\Pro\SubInserter->maybeInsertUpdate( ) .../SubInserter.php:479
12  1.0432  2649296 WebSharks\CommentMail\Pro\SubInserter->insert( )    .../SubInserter.php:695
13  1.0525  2800536 WebSharks\CommentMail\Pro\SubInserter->overwriteAnyOthersAfterInsertUpdate( )   .../SubInserter.php:766

( ! ) Notice: Array to string conversion in /srv/www/wordpress-default/wp-content/plugins/comment-mail-pro/src/includes/classes/SubInserter.php on line 1032
Call Stack
#   Time    Memory  Function    Location
1   0.2021  363976  {main}( )   .../wp-comments-post.php:0
2   0.3216  2765200 wp_handle_comment_submission( array(9) )    .../wp-comments-post.php:20
3   0.3230  2468400 wp_new_comment( array(13) ) .../comment.php:2918
4   0.3294  2483192 do_action( string(12), long, long, array(13) )  .../comment.php:1821
5   1.0258  2619664 WebSharks\CommentMail\Pro\Plugin->commentPost( long, long ) .../plugin.php:525
6   1.0286  2621536 WebSharks\CommentMail\Pro\CommentPost->__construct( long, long )    .../Plugin.php:2536
7   1.0315  2624280 WebSharks\CommentMail\Pro\CommentPost->maybeInjectSub( )    .../CommentPost.php:54
8   1.0345  2630776 WebSharks\CommentMail\Pro\SubInjector->__construct( object(WP_User)[352], long, array(7) )  .../CommentPost.php:95
9   1.0365  2634408 WebSharks\CommentMail\Pro\SubInjector->maybeInject( )   .../SubInjector.php:142
10  1.0387  2640200 WebSharks\CommentMail\Pro\SubInserter->__construct( array(18), array(10) )  .../SubInjector.php:199
11  1.0392  2641120 WebSharks\CommentMail\Pro\SubInserter->maybeInsertUpdate( ) .../SubInserter.php:479
12  1.0432  2649296 WebSharks\CommentMail\Pro\SubInserter->insert( )    .../SubInserter.php:695
13  1.0525  2800536 WebSharks\CommentMail\Pro\SubInserter->overwriteAnyOthersAfterInsertUpdate( )   .../SubInserter.php:766

( ! ) Notice: Array to string conversion in /srv/www/wordpress-default/wp-content/plugins/comment-mail-pro/src/includes/classes/SubInserter.php on line 1033
Call Stack
#   Time    Memory  Function    Location
1   0.2021  363976  {main}( )   .../wp-comments-post.php:0
2   0.3216  2765200 wp_handle_comment_submission( array(9) )    .../wp-comments-post.php:20
3   0.3230  2468400 wp_new_comment( array(13) ) .../comment.php:2918
4   0.3294  2483192 do_action( string(12), long, long, array(13) )  .../comment.php:1821
5   1.0258  2619664 WebSharks\CommentMail\Pro\Plugin->commentPost( long, long ) .../plugin.php:525
6   1.0286  2621536 WebSharks\CommentMail\Pro\CommentPost->__construct( long, long )    .../Plugin.php:2536
7   1.0315  2624280 WebSharks\CommentMail\Pro\CommentPost->maybeInjectSub( )    .../CommentPost.php:54
8   1.0345  2630776 WebSharks\CommentMail\Pro\SubInjector->__construct( object(WP_User)[352], long, array(7) )  .../CommentPost.php:95
9   1.0365  2634408 WebSharks\CommentMail\Pro\SubInjector->maybeInject( )   .../SubInjector.php:142
10  1.0387  2640200 WebSharks\CommentMail\Pro\SubInserter->__construct( array(18), array(10) )  .../SubInjector.php:199
11  1.0392  2641120 WebSharks\CommentMail\Pro\SubInserter->maybeInsertUpdate( ) .../SubInserter.php:479
12  1.0432  2649296 WebSharks\CommentMail\Pro\SubInserter->insert( )    .../SubInserter.php:695
13  1.0525  2800536 WebSharks\CommentMail\Pro\SubInserter->overwriteAnyOthersAfterInsertUpdate( )   .../SubInserter.php:766

Related: https://github.com/websharks/comment-mail/issues/298

raamdev commented 8 years ago

Here's L1026 on the dev branch that's throwing the Array to string conversion notice: https://github.com/websharks/comment-mail-pro/blob/000000-dev/src/includes/classes/SubInserter.php#L1026

It looks like $this->sub->post_id is an Array for some reason, but probably shouldn't be.

raamdev commented 8 years ago

Confirmed via XDebug that $this->sub->post_id is an Array:

2016-06-08_12-16-51

raamdev commented 8 years ago

It looks like this line that calls SubEventLogInserter is modifying $this->sub->post_id and turning it into an array.

raamdev commented 8 years ago

The SubEventLogInserter is calling the following:

$this->plugin->utils_db->wp->insert($this->plugin->utils_db->prefix().'sub_event_log', $this->entry)

That eventually calls the WordPress process_fields() function with the data (i.e., $this->entry aka $this->sub), which is resulting in the data in $this->sub being modified unexpectedly.

So it sounds like this line should be passing a copy of $this->sub to the SubEventLogInserter, so that we don't end up with unexpected data.

@jaswsinc do you agree?

jaswrks commented 8 years ago

Yes. I agree. You found a PHP 🐛 it looks like! :-)

raamdev commented 8 years ago

Confirmed that this issue does not occur with PHP 5.5. I'm marking this a php bug and moving this issue to the Future Release milestone. PHP7 support is not a top priority at the moment (getting the next release out is a top priority, as its been 4 months since the last release).

raamdev commented 8 years ago

Noting that this issue also affects the StCR importer.

2016-06-14_10-23-07

raamdev commented 8 years ago

Marking this as a high-priority issue to solve one the current release cycle finishes. As it stands, Comment Mail is unusable on PHP 7, so we either need to detect sites running PHP 7 and provide a Dashboard notice, or fix the underlying issue so that it's not an issue.

jaswrks commented 7 years ago

Objective: Confirm via XDebug that this does not impact prior versions of PHP and also test against the latest release of PHP v7.0.x and 7.1 to see if the problem has been solved; assuming it is in fact a PHP v7. x bug. ~ Estimate at 1 day.

jaswrks commented 7 years ago

Referencing the origin of the unexpected array of data noted above. https://github.com/WordPress/WordPress/blob/4.6.1/wp-includes/wp-db.php#L2161-L2215

jaswrks commented 7 years ago

Confirmed this is in fact a PHP 7 bug.

This bug appears to have been corrected in PHP 7.0.9. https://bugs.php.net/bug.php?id=72508

And then another related bug was corrected in PHP 7.0.10. https://bugs.php.net/bug.php?id=72622

Also referencing: http://php.net/ChangeLog-7.php


Conclusion: Comment Mail requires PHP 5.4.x+, or when upgrading to PHP 7, requires PHP 7.0.9+ with PHP 7.0.10 being suggested as it includes some additional bug fixes that are indirectly related to a problem with PHP internals creating references inadvertently.

jaswrks commented 7 years ago

Next Release Changelog:

2016-11-02_07-26-31

jaswrks commented 7 years ago

This issue can be closed by @raamdev once a review is complete.

raamdev commented 7 years ago

@jaswsinc Awesome! Glad we got to the bottom of that issue. In your screenshot, that notice is dismissable, but IMO that notice should be persistent, since a site owner could inadvertently dismiss it and might then wonder why Comment Mail isn't working as expected. Comment Mail is truly broken (notifications don't get sent) when running PHP 7 < 7.0.9, so I think a persistent notice is applicable here.

jaswrks commented 7 years ago

Agree. I'm opening a fork in https://github.com/websharks/comment-mail/issues/308

jaswrks commented 7 years ago

No longer dismissable. Fixed in https://github.com/websharks/comment-mail/issues/308

raamdev commented 7 years ago

Comment Mail v161118 has been released and includes changes from this GitHub Issue. See the v161118 announcement for further details.


This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#272).