Page 1 of 1

Undefined index: _SWIFT_LOG

Posted: Wed Oct 24, 2007 11:00 am
by georgeoc
Hi all,

Chris - thanks for your work on Swift. I've just started experimenting with it for my application and I'm loving it so far!

One small error when I send an email with SMTP:

Code: Select all

Undefined index: _SWIFT_LOG [includes/swift/Swift/LogContainer.php, line 42]
Looking at the code, I can't understand why $GLOBALS["_SWIFT_LOG"] is not defined, as you give it a value of null at the top of the page. I have a feeling it might be something to do with php.ini configuration, as I only get the error on my test server, and not my development server. All errors are enabled on both.

Posted: Thu Oct 25, 2007 3:41 am
by Chris Corbyn
Very odd. Unless you have some whacky code somewhere before Swift gets used which empties the $GLOBALS array I can't see why you'd get that. I doubt you can turn the $GLOBALS array off neither :?

Not sure what else to suggest other than changing the code to use the "global" keyword rather than the $GLOBALS array.

Re: Undefined index: _SWIFT_LOG

Posted: Sat Apr 05, 2008 8:03 am
by bronwen
I had the same error message and found it occurred because I was running the php4 version of Swift Mail under php5.

The Swift_Connection_SMTP class has a __destruct() method (which wouldn't normally be called under php 4). The destructor calls stop() which logs the closure, and we then have an error message about an undefined global in logContainer because by now all the globals have been destroyed.

Just in case anyone else has the same problem.

Re: Undefined index: _SWIFT_LOG

Posted: Sat Apr 05, 2008 8:15 am
by Chris Corbyn
bronwen wrote:I had the same error message and found it occurred because I was running the php4 version of Swift Mail under php5.

The Swift_Connection_SMTP class has a __destruct() method (which wouldn't normally be called under php 4). The destructor calls stop() which logs the closure, and we then have an error message about an undefined global in logContainer because by now all the globals have been destroyed.

Just in case anyone else has the same problem.
Well spotted, and thanks for sharing :) This will indeed be the problem due to the timing at which __destruct() runs.

/me waves goodbye to PHP4 support

Re: Undefined index: _SWIFT_LOG

Posted: Sat Apr 05, 2008 8:16 am
by georgeoc
Chris Corbyn wrote:/me waves goodbye to PHP4 support
Me too, thankfully!