[wp-trac] [WordPress Trac] #35781: Incorrect use of PHP method compact
WordPress Trac
noreply at wordpress.org
Wed Feb 24 17:51:54 UTC 2016
#35781: Incorrect use of PHP method compact
-----------------------------------+-----------------------------
Reporter: maweder | Owner: SergeyBiryukov
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 4.4.3
Component: Mail | Version: 4.4
Severity: normal | Resolution:
Keywords: has-patch fixed-major | Focuses:
-----------------------------------+-----------------------------
Comment (by maweder):
Replying to [comment:7 SergeyBiryukov]:
> In [changeset:"36688"]:
> {{{
> #!CommitTicketReference repository="" revision="36688"
> Mail: Correct `compact()` usage in `wp_mail()`.
>
> Props Ankit K Gupta, maweder.
> Fixes #35781 for trunk.
> }}}
Hi Sergey, the change in [changeset:"36688"] is again incorrect.
From http://php.net/manual/en/function.compact.php: ''Each parameter can
be either a string containing the name of the variable, '''or an array of
variable names. The array can contain other arrays of variable names
inside it; compact() handles it recursively'''.''
$headers and $attachments, these are arrays and not names of variables.
The correct code:
{{{#!php
$mail_error_data = compact( 'to', 'subject', 'message', $headers,
$attachments );
}}}
Thanks & Greets
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35781#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list