ZF-9802: Unable to use shorthand names for Zend_Mail_Transport type in Zend_Application configs

Description

When implementing the Zend_Application_Resouce_Mail for use of sendmail via configs as outlined at http://framework.zend.com/manual/en/…, using shorthand in resources.mail.transport.type (eg: 'smtp') does not work, giving the following error:

Warning: include(smtp.php) [function.include]: failed to open stream: No such file or directory in /path/to/app/public/index.php(38) : runtime-created function on line 1

Warning: include() [function.include]: Failed opening 'smtp.php' for inclusion (include_path='/path/to/ZendFramework') in /path/to/app/public/index.php(38) : runtime-created function on line 1

Warning: include(smtp.php) [function.include]: failed to open stream: No such file or directory in /path/to/app/public/index.php(38) : runtime-created function on line 1

Warning: include() [function.include]: Failed opening 'smtp.php' for inclusion (include_path='/path/to/ZendFramework') in /path/to/app/public/index.php(38) : runtime-created function on line 1

Fatal error: Class 'smtp' not found in /path/to/ZendFramework/library/Zend/Application/Resource/Mail.php on line 140

Using the longhand like so works:

````

But this differs from the docs, so either the docs need to be updated to reflect the need to use the full name for transport type, or the _setupTransport() method needs to be updated in Zend_Application_Resource_Mail to allow shorthanded transport types. I personally think it's cleaner to allow shorthanded transport names, and based on a quick look at the _setupTransport() method, it looks like that is the intent. I'm going to give a shot at a patch and will post here if I am successful.

Comments

Could it be there is a file called smtp.php or Smtp.php in your include path? The unittests thoroughly test the behavior you describe and as such I'm not able to reproduce this issue.

Awaiting more info on how to reproduce this issue.

Nope, the only smtp.php in my include path is the one in Zend/Mail/Transport.

To reproduce, put the following in your application.ini:

resources.mail.transport.type       = smtp
resources.mail.transport.host       = "smtp.server.com"
resources.mail.transport.auth       = login
resources.mail.transport.username   = "myLogin"
resources.mail.transport.password   = "myPasswd"

The above does not work. The config below works fine:

resources.mail.transport.type       = Zend_Mail_Transport_Smtp
resources.mail.transport.host       = "smtp.server.com"
resources.mail.transport.auth       = login
resources.mail.transport.username   = "myLogin"
resources.mail.transport.password   = "myPasswd"

I've whipped up a quick patch that works for both cases, will attach. It's my first time submitting a patch, so please forgive me if I've done it wrong.

The problem with your patch is that it doesn't allow for transport names like someOtherLib_Mail_Transport_SmtpFoobar. I'm closing this issue as cannot reproduce until you're able to provide a unittest, or more information on how to reproduce.

ACK; please fix doc or code to use "smtp". You can reproduce it with a default application created. This bug is also reported here: http://www.zfforum.de/showthread.php?t=6332