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

Bug: Array to String Conversion #211

Closed jaswrks closed 8 years ago

jaswrks commented 8 years ago

Step to Reproduce

No warnings/notices.

Observed Behavior

Notice: Array to string conversion in /wp-business/plugins/comment-mail-pro/comment-mail-pro/includes/classes/sub-inserter.php on line 979

Notice: Array to string conversion in /wp-business/plugins/comment-mail-pro/comment-mail-pro/includes/classes/sub-inserter.php on line 982

Notice: Array to string conversion in /wp-business/plugins/comment-mail-pro/comment-mail-pro/includes/classes/sub-inserter.php on line 985

Notice: Array to string conversion in /wp-business/plugins/comment-mail-pro/comment-mail-pro/includes/classes/sub-inserter.php on line 986

Possible Cause

Some magic happens around this block of code, and it may contain a nasty bug.

raamdev commented 8 years ago

@jaswsinc writes...

may contain a nasty bug.

Is this high priority? You mention subscribing once via a comment, and then subscribing again without commenting to the same post--that seems like somewhat of an edge case, so I'm wondering how big a deal this bug is (i.e., should it hold up an RC?). Are there other issues you think this bug might be causing?

I reviewed the code you linked to but I admit I'm not as familiar as you with regards to how it all fits together, so I'll need to spend some time researching this one.

jaswrks commented 8 years ago

@raamdev I'll say it's not, for now. However, that's only because I can't seem to locate the bug after another review just now. The fact that I've only seen this once, and that nobody else has reported it, suggests that it may have a been caused by some other factor.

The bug itself indicates a serious issue, but a review of the codebase turns up nothing so far.

~ It remains a mystery for the moment.

jaswrks commented 8 years ago

Referencing the following debug output when taking a closer look at this on PHP v7.

The following output is a dump of the sub property in the SubInserter class, right after event logging takes place. This output appears to come from the WPDB class, and it would seem (at first glance) that this is an object that is being modified by reference by the WPDB class once another insert takes place. If that's the case (still needs further research), this could be a WP core bug.

Regardless, this explains the array to string conversion bug. Now to find out how this occurs. Notice that instead of string/int keys, we have arrays; i.e., value, format, charset, length.

stdClass Object
(
    [ID] => 10
    [key] => Array
        (
            [value] => xxxxxxxxxxxxxxx
            [format] => %s
            [charset] => utf8
            [length] => Array
                (
                    [type] => char
                    [length] => 20
                )

        )

    [user_id] => Array
        (
            [value] => 0
            [format] => %d
            [charset] =>
            [length] =>
        )

    [post_id] => Array
        (
            [value] => 1
            [format] => %d
            [charset] =>
            [length] =>
        )

    [comment_id] => Array
        (
            [value] => 1
            [format] => %s
            [charset] =>
            [length] =>
        )

    [deliver] => Array
        (
            [value] => asap
            [format] => %s
            [charset] => utf8
            [length] =>
        )

    [fname] => Array
        (
            [value] => Jason
            [format] => %s
            [charset] => utf8
            [length] => Array
                (
                    [type] => char
                    [length] => 50
                )

        )

    [lname] => Array
        (
            [value] => Caldwell
            [format] => %s
            [charset] => utf8
            [length] => Array
                (
                    [type] => char
                    [length] => 100
                )

        )

    [email] => Array
        (
            [value] => xxxx@xxxxx.com
            [format] => %s
            [charset] => utf8
            [length] => Array
                (
                    [type] => char
                    [length] => 100
                )

        )

    [insertion_ip] =>
    [insertion_region] =>
    [insertion_country] =>
    [last_ip] =>
    [last_region] =>
    [last_country] =>
    [status] => Array
        (
            [value] => unconfirmed
            [format] => %s
            [charset] => utf8
            [length] =>
        )

    [insertion_time] => 1455521501
    [last_update_time] => 1455521501
)
jaswrks commented 8 years ago

Closing. This is attributed to bugs in early versions of PHP v7. False alarm.