Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#15293 closed defect (bug) (invalid)

Variable problem for debug between class-phpmailer and class-smtp

Reported by: phasetransitions's profile phasetransitions Owned by:
Milestone: Priority: normal
Severity: minor Version: 3.0.1
Component: General Keywords: SMTP_Debug do_debug class-phpmailer class-smtp
Focuses: Cc:

Description

In "class-phpmailer” and on line 227 there is a boolean for debugging: $SMTPDebug whose default value is boolean 'false.' This looks like it is passed to the variable $do_debug inside "class-smtp" on line 584.

Inside class-smtp variable $do_debug is defined on line 55. The comments indicate do_debug as boolean. do_debug is initialized on line 80 of "class-smtp" to value 0, not a boolean.

do_debug appears to have four values (0, 1, 2, 4) inside "class-smtp," even though it is commented as boolean, and SMTP_Debug in "class-phpmailer" is boolean.

"class-smtp" echoes different degrees of debug detail at do_debug 1, 2, and 4. Value 4 is for internal debug of "class-smtp"

I’m not a php programmer, so perhaps “false” gets cast as “0″ into
"class-smtp"? If this is not the case, then it appears to me that "class-phpmailer" needs to pass a value of (0, 1, 2, 4) to do_debug depending on the state of the boolean SMTP_Debug.

This came out of my trying to diagnose problems at fsockopen in "class-smtp" when configuring smtp over SSL with Google on my shared hosting.

-Phil G

Change History (5)

#1 follow-up: @nacin
14 years ago

0 == false, yes.

#2 in reply to: ↑ 1 @phasetransitions
14 years ago

Replying to nacin:

0 == false, yes.

Again, not a PHP programmer, but I assumed that 0 == false and 1 == true, but that doesn't allow you to access 2 or 4. I probably should have clarified that.

#3 follow-up: @nacin
14 years ago

Anything that doesn't evaluate to false, evaluates to true.

0 == array() == '' == '0' == null == false

Anything else == true

#4 in reply to: ↑ 3 @phasetransitions
14 years ago

Replying to nacin:

Anything that doesn't evaluate to false, evaluates to true.

0 == array() == '' == '0' == null == false

Anything else == true

Gotcha, that's clear.

I decided to read the PHP documentation:

http://www.php.net/manual/en/language.types.integer.php#language.types.integer.casting

"Converting to integer

To explicitly convert a value to integer, use either the (int) or (integer) casts. However, in most cases the cast is not needed, since a value will be automatically converted if an operator, function or control structure requires an integer argument. A value can also be converted to integer with the intval() function.

See also: type-juggling.
From booleans

FALSE will yield 0 (zero), and TRUE will yield 1 (one)."

#5 @mdawaffe
14 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Closing as not-a-bug.

Note: See TracTickets for help on using tickets.