Catchable fatal error: Argument 1 passed to Swift_Transport_EsmtpTransport::__construct() must implement interface Swift_Transport_IoBuffer, none given in /home/benjamin/public_html/ldnr/lib/vendor/swift/classes/Swift/Transport/EsmtpTransport.php on line 74
Warning: Missing argument 1 for Swift_Transport_EsmtpTransport::__construct() in /home/benjamin/public_html/ldnr/lib/vendor/swift/classes/Swift/Transport/EsmtpTransport.php on line 74
Catchable fatal error: Argument 2 passed to Swift_Transport_EsmtpTransport::__construct() must be an array, none given in /home/benjamin/public_html/ldnr/lib/vendor/swift/classes/Swift/Transport/EsmtpTransport.php on line 75
Warning: Missing argument 2 for Swift_Transport_EsmtpTransport::__construct() in /home/benjamin/public_html/ldnr/lib/vendor/swift/classes/Swift/Transport/EsmtpTransport.php on line 75
Catchable fatal error: Argument 3 passed to Swift_Transport_EsmtpTransport::__construct() must be an instance of Swift_Events_EventDispatcher, none given in /home/benjamin/public_html/ldnr/lib/vendor/swift/classes/Swift/Transport/EsmtpTransport.php on line 75
Warning: Missing argument 3 for Swift_Transport_EsmtpTransport::__construct() in /home/benjamin/public_html/ldnr/lib/vendor/swift/classes/Swift/Transport/EsmtpTransport.php on line 75
Well I figured that maybe I needed to include the swift_required.php class, because perhaps the symfony autoloader wasn't loading the library correctly automatically.
I added the following line to ProjectConfiguration.class.php, which is the file for global application configuration:
# include the swift mailer library
require_once('../lib/vendor/swift/swift_required.php');
And that gives me this error:
LogicException: Passed array specifies a non static method but no object in /home/benjamin/public_html/ldnr/lib/vendor/swift/swift_required.php on line 65
And the code in swift_required.php for that line is:
Yes, I copied the entire lib folder to projectName/lib/vendor/swift/. That line you gave me, gives me this:
stack trace
at ()
in SF_ROOT_DIR/lib/vendor/swift/classes/Swift/DependencyContainer.php line 103 ...
{
if (!$this->has($itemName))
{
throw new Swift_DependencyException(
'Cannot lookup dependency "' . $itemName . '" since it is not registered.'
);
}
at Swift_DependencyContainer->lookup('transport.smtp')
in SF_ROOT_DIR/apps/frontend/modules/content/actions/actions.class.php line 44 ...
at contentActions->executeCreate(object('sfWebRequest'))
in SF_SYMFONY_LIB_DIR/action/sfActions.class.php line 53 ...
at sfActions->execute(object('sfWebRequest'))
in SF_SYMFONY_LIB_DIR/filter/sfExecutionFilter.class.php line 90 ...
at sfExecutionFilter->executeAction(object('contentActions'))
in SF_SYMFONY_LIB_DIR/filter/sfExecutionFilter.class.php line 76 ...
at sfExecutionFilter->handleAction(object('sfFilterChain'), object('contentActions'))
in SF_SYMFONY_LIB_DIR/filter/sfExecutionFilter.class.php line 42 ...
at sfExecutionFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_SYMFONY_LIB_DIR/filter/sfCommonFilter.class.php line 29 ...
at sfCommonFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_SYMFONY_LIB_DIR/filter/sfCacheFilter.class.php line 65 ...
at sfCacheFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_SYMFONY_LIB_DIR/filter/sfRenderingFilter.class.php line 33 ...
at sfRenderingFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_SYMFONY_LIB_DIR/controller/sfController.class.php line 245 ...
at sfController->forward('content', 'create')
in SF_SYMFONY_LIB_DIR/controller/sfFrontWebController.class.php line 48 ...
at sfFrontWebController->dispatch()
in SF_SYMFONY_LIB_DIR/util/sfContext.class.php line 159 ...
at sfContext->dispatch()
in SF_ROOT_DIR/web/frontend_dev.php line 12 ...
Last edited by Benjamin on Thu Mar 12, 2009 4:21 pm, edited 1 time in total.
Yes, Swift Mailer absolutely requires that you include the swift_required file since it doesn't only set up autoloading, it actually prepares dependency injection.
I think I'm going to refactor this so that people can use their own autoloader. Swift Mailer is doing this, which mean one of the already registered loaders is not valid:
1. Get the current list of autoloaders (callbacks)
2. Unregister all of those autoloaders
3. Register itself first on the autoloader stack
4. Re-register all of the current autoloaders
If I move my autoloader into it's own file, people will be able to set up their own autoloader to use swift without having to use mine (I'd prefer this too).
Ok. When I add print_r above line 65 I get the following output before the logic exception. What would you recommend that I do? Just comment out your autoloader?
Array
(
[0] => sfCoreAutoload
[1] => autoload
)
EDIT: Commenting out your autoloader code and just leaving in the spl_autoload_register('swift_autoload'); line appears to fix it.
Comment out the call to swift_autoload_register() in my swift_required.php file, but make sure you include that file.
In the next release I'll structure it this way:
You pick one of:
a) swift_autoloaded.php
b) swift_nonautoloaded.php
swift_required.php will be deprecated and will simply include the swift_autoloaded version. I'll probably think of better file names.
Basically, you use the nonautoloaded version Swift Mailer will assume you've configured your own autoloader to find classes in the "lib/classes" directory using Zend's naming conventions.
saiaman wrote:Hi i've got the same problem but the fact is that i only have copied swift/ and swift.php inside my include path while i'm using Zend framework.
Do you have any idea ? or do i really need to add dependency_maps and other files in my include_path and require swift_init ???
Thank you
You need the whole "lib/classes" path on your include_path. All the other files from the lib directory are needed too yes. Swift Mailer won't work without them. And swift_init.php must be included in all cases since it sets swift mailer up (it starts dependency injection).