Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Zend.php #268

Closed
wants to merge 1 commit into from
Closed

Update Zend.php #268

wants to merge 1 commit into from

Conversation

mrploddy
Copy link

I came across a bug with Payment methods and I'm guessing it might also come up elsewhere.

I'm writing a test payment gateway for Sagepay form and in the declaration in the config.xml there was a spelling mistake in the payment code so that it didn't match up with the payment code declared in the Model eg

Config.xml

sagepayform
0
JuicyMedia_Sagepayform_Model_Sagepayform
<title>Sagepayform</title>
0

And in the Model -
class JuicyMedia_Sagepayform_Model_Sagepayform extends Mage_Payment_Model_Method_Abstract
{
protected $_code = 'sagepayform';

Because there was this spelling mistake it was creating an exception in /lib/Magento/Di/Zend.php

This pull request therefore is a way of making sure that Magento error's out properly with an exception instead of a PHP fatal error message.

This is only one specific use case but Im guessing there are other examples where this might occur.

I came across a bug with Payment methods and I'm guessing it might also come up elsewhere. 

I'm writing a test payment gateway for Sagepay form and in the <payment> declaration in the config.xml there was a spelling mistake in the payment code so that it didn't match up with the payment code declared in the Model eg

Config.xml
<sagepayformd>
                <group>sagepayform</group>
                <active>0</active>
                <model>JuicyMedia_Sagepayform_Model_Sagepayform</model>
                <title>Sagepayform</title>
                <allowspecific>0</allowspecific>
            </sagepayformd>

And in the Model - 
class JuicyMedia_Sagepayform_Model_Sagepayform extends Mage_Payment_Model_Method_Abstract
{
    protected $_code  = 'sagepayform';

Because there was this spelling mistake it was creating an exception in /lib/Magento/Di/Zend.php

This pull request therefore is a way of making sure that Magento error's out properly with an exception instead of a PHP fatal error message. 

This is only one specific use case but Im guessing there are other examples where this might occur.
@mrploddy
Copy link
Author

Just come across another mistyped class name with exactly the same thing and I had missed out the Model in the class name so it was giving me a class not defined error. Should thefore add a class_exists too on to the check on $name to again make sure that Magento exceptions out gracefully.

@mrploddy
Copy link
Author

eg if ($name == "" || $name == false || class_exists($name) == false) {
throw new Exception\RuntimeException("Invalid Class Name");
}

@mrploddy
Copy link
Author

Just to clarify in the config.xml the payment code was sagepayformd and the model was sagepayform so it wasn't returning the model creating the PHP fatal error. There would be occasion when developers make mistakes in class namings and would cause Magento to error ungracefully in those instances.

@verklov
Copy link
Contributor

verklov commented Nov 7, 2013

Hello mrploddy,
Sorry for the delay with response.
Thank you for your contribution! Our team will review your pull request and respond as soon as our analysis is complete.

@verklov
Copy link
Contributor

verklov commented Dec 1, 2013

Hello mrploddy,
We cannot accept your pull request. Due to the changes we are making to the product, the code that is modified in the pull request does not exist in Magento any more.
Nevertheless, thank you for your contribution and participation in the Magento product development!

@verklov verklov closed this Dec 1, 2013
vpelipenko added a commit that referenced this pull request May 8, 2015
[Troll] Kpi build & bugfixes
magento-team pushed a commit that referenced this pull request Dec 23, 2015
mmansoor-magento pushed a commit that referenced this pull request Aug 21, 2016
magento-devops-reposync-svc pushed a commit that referenced this pull request Jul 17, 2024
#268)

* LYNX-460: Bundle products does not show original price and the final price has no currency

* LYNX-460: updated tests

* LYNX-460: updated review point
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants