5

In app/code/core there is a folder Zend that contains several classes that are slightly different from the ones in Zend.
I understand the fact that based on how the Magento autoloader works, these classes will be used instead of the zend ones.
My question is to why are these needed.
I tried to compare the contents but it's too abstract for me.

Zend_Mime has been there since the beginning. It suffered a few modifications but it's there today.
Zend_Date was added in and it has an explanation:

This class replaces default Zend_Date because of problem described in Jira ticket MAGE-4872
The only difference between current class and original one is overwritten implementation of mktime method

Well...there are other differences beside mktime. Any chance someone knows what the MAGE-4872 jira ticket contains?

Zend_XmlRpc_Request and Zend_XmlRpc_Response were added in . I assume they were added because of this security issue, but that should be fixed by now.

Zend_Db_Statement was added in . For this one there are only 2 crazy regex-es in the _stripQuoted method that I don't understand.

In older versions up to 1.3 there was some backend cache classes but I don't care about them anymore.

  • your question itself holds the answer ! – Rajeev K Tomy Oct 8 '14 at 6:25
  • @programmer_rkt Yes and no. I understand that there is something wrong with the classes from ZF that does not fit the Magento needs, but what are the problems? I'm really hoping for examples of what will happen if the ZF classes are used and what will happen if the cloned classes are used. Maybe for the XmlRpc is a bit clear, but what about the rest? – Marius Oct 8 '14 at 6:27
  • when talking about the Zend_Date, on top of mktime method, it clearly says Added limitation: $year value must be between -10 000 and 10 000.Parent method implementation causes 504 error if it gets too big(small) year value. So I assume, in every case, in order to fix such small small patches, they placed modified zend files in core directory. – Rajeev K Tomy Oct 8 '14 at 6:46
  • @programmer_rkt Oh. I missed that. Please write it as an answer. It's not complete, but it's something useful. :) – Marius Oct 8 '14 at 6:51
  • magento uses subversion and jira officially as its version controlling system. This is the first time I came to know about it. My assumption is, they may be using this version control system internally, while developing the application. Mage-4872 may be a ticket that is raised through jira. Since its internal versioning system, I dont think we will get more details about it. This is my weird guess. sumoheavy.com/magento-and-version-control – Rajeev K Tomy Oct 8 '14 at 6:51
2

MAGE-4872 is below, interesting bug:

Description Default value of attribute parsed as date cause 504 error.

STEPS TO REPRODUCE:

  1. Login to admin panel.
  2. Go to Catalog -> Attributes -> Manage Attributes -> Add New Attribute.
  3. Fill the following data: "Attribute Code" -> "test" "Default Value" -> "67260687/3/6123439430"
  4. Click "Save And Continue Edit"

ACTUAL RESULT: Error 504 or page loading very long (I was waiting for 5 minutes)

EXPECTED RESULT: Page should be loaded normally

Attribute edit form contains 'default_value_date' field for all attribute types. So, when form is loading Zend_Date is instantiated with date "67260687/3/6123439430". Method Zend_Date_DateObject::mktime() receiving year=6123439430 and starts cycle from 1970 to 6123439430 (line: 204).

It cause huge time delay for page loading.

2

The following is my personal opinion. I am not 100% sure about its prosperity. So these are my guesses

While developing an application on a platform (here it is zend), there are lot of situations occurs where basic platform lacks with some important aspects that we really required for our application. There are lot of ways to implement it. Quiet common method is extend the basic platform with our own classes

In case of Magento, we don't want to do that. Because it uses beautiful callback functionality in it. So placing a basic file in the core directory simply gives us to modify the zend platform according to our need.

For an example, in case of Zend_Date, above mktime method, it clearly states what it tries to overcome. It looks like this.

/**
 * Get unix timestamp.
 * Added limitation: $year value must be between -10 000 and 10 000
 * Parent method implementation causes 504 error if it gets too big(small) year value
 *

I have made a check in Zend_Db_Statement. _stripQuoted method do an additional functionality there when comapare with original one. It says

    // get a version of the SQL statement with all quoted
    // values and delimited identifiers stripped out
    // remove quoted identifiers

Where original method do last two functioanlities.

As in the case of Zend_Date, if core team provided what real difference updated class holds, then it would be more helpful to us. Unfortunately other classes do not hold such information.

Side Note : This is the first time I came to know that, Magento team uses Jira and subversion officially to do versioning. So my assumption is, they may be using this version control system internally, while developing the application. Mage-4872 may be a ticket that is raised through jira. Since its internal versioning system, I dont think we will get more details about it. Again this is my wild guess :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.