Page MenuHomePhabricator

When using $wgSMTP, all send attempts return a code of 1, which MediaWiki sees as an error, but is not
Closed, ResolvedPublic

Description

Author: me

Description:
When using $wgSMTP on 1.11.1, and therefore using the Pear Mail::factory class, I noticed that all pages on MediaWiki say sending the email failed, reporting:
Mailer returned: 1

But, the email goes through.

I think (but am not sure not being a PHP expert) that this is as simple as the fact that Mail->send() in the Pear object returns "true" with success, and the corresponding MediaWiki function (line 155 of UserMailer.php, in the userMailer function) returns this value, and I am guessing the code above this expects a 0 as a no-error state.

This was on CentOS, uname -a:
Linux swrepos 2.6.18-8.el5 #1 SMP Thu Mar 15 19:57:35 EDT 2007 i686 i686 i386 GNU/Linux

Pear versions:

Installed packages, channel pear.php.net:

Package Version State
Archive_Tar 1.3.2 stable
Console_Getopt 1.2.3 stable
Mail 1.1.14 stable
Net_SMTP 1.2.11 stable
Net_Socket 1.0.8 stable
PEAR 1.7.1 stable
Structures_Graph 1.0.2 stable

using a smtp server that requires no authentication.


Version: 1.11.x
Severity: minor
OS: Linux
Platform: PC

Details

Reference
bz13276

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:03 PM
bzimport added a project: MediaWiki-Email.
bzimport set Reference to bz13276.
bzimport added a subscriber: Unknown Object (MLST).

robert wrote:

All strings and positive integers (and some other variables) are equivilant to true (under normal circumstances) in PHP, therefore the value 1 is equal to true so this cannot be the problem.

(In reply to comment #1)

All strings and positive integers ... are equivalent to true

IIRC, negative integers are also true. Only the integer 0 is cast to false. It is possible, of course, that a === test is used somewhere, which would fail: 1 !== true

  • This bug has been marked as a duplicate of bug 11567 ***