ZF-8145: Broken test case, Zend_Translate_Adapter_IniTest:testCreate() causes fatal error

Description

Running Zend_Tranlsate_Adapter AllTests or the full test suite for release-1.9 branch and 1.9.x tagged releases fails with a fatal error

PHP Fatal error: Unsupported operand types in /data/php5/ZendFramework/library/Zend/Translate/Adapter.php on line 482

The Zend_Tranlsate_Adapter tests do not appear to be broken in trunk, but having spoken to Thomas on IRC there may be a BC issue with the changes in Zend/Translate/Adapter.php currently in trunk. If there are issues with merging the code from trunk would it be possible to mark the test skipped or incomplete? Broken test suite is the same as no test suite imo.

Comments

Not reproducable, please give additional infos:

OS, php release, ZF release (I don't expect that you've really tested with 5 different releases the same time), the complete error/exception which is thrown/returned

And no, trunk has no BC issue, but new features are not allowed to be integrated into branch. Only bugs are allowed to be branched. The changeset you pointed to is no bug fix but a feature enhancement and this could lead to a BC breaking behaviour as features must not change between mini releases.

And no, unit test problems are not intentionally fatal problems. Especially when there is one error within 400 tests of one component.

Actually I did test with all of the 1.9 releases including the release-1.9 branch, although I was mistaken about the issue existing in 1.9.0 (I don't expect that you've really tried to reproduce this against different versions).

{quote}(I don't expect that you've really tested with 5 different releases the same time){quote}

Thomas, please comment on the issue rather than on whether or not you think the reporter is being dishonest. Issue reporters will mostly not bother posting again if you have an attitude problem.

Here is your further info:


 Zend_Translate_Adapter_IniTest::testCreate()

PHP Fatal error:  Unsupported operand types in /data/php5/ZendFramework/library/Zend/Translate/Adapter.php on line 482
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpunit:0
PHP   2. require() /usr/bin/phpunit:44
PHP   3. PHPUnit_TextUI_Command::main() /usr/share/php5/PEAR/PHPUnit/TextUI/Command.php:718
PHP   4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php5/PEAR/PHPUnit/TextUI/Command.php:131
PHP   5. PHPUnit_Framework_TestSuite->run() /usr/share/php5/PEAR/PHPUnit/TextUI/TestRunner.php:324
PHP   6. PHPUnit_Framework_TestSuite->run() /usr/share/php5/PEAR/PHPUnit/Framework/TestSuite.php:636
PHP   7. PHPUnit_Framework_TestSuite->runTest() /usr/share/php5/PEAR/PHPUnit/Framework/TestSuite.php:673
PHP   8. PHPUnit_Framework_TestCase->run() /usr/share/php5/PEAR/PHPUnit/Framework/TestSuite.php:692
PHP   9. PHPUnit_Framework_TestResult->run() /usr/share/php5/PEAR/PHPUnit/Framework/TestCase.php:375
PHP  10. PHPUnit_Framework_TestCase->runBare() /usr/share/php5/PEAR/PHPUnit/Framework/TestResult.php:609
PHP  11. PHPUnit_Framework_TestCase->runTest() /usr/share/php5/PEAR/PHPUnit/Framework/TestCase.php:401
PHP  12. ReflectionMethod->invoke() /usr/share/php5/PEAR/PHPUnit/Framework/TestCase.php:486
PHP  13. Zend_Translate_Adapter_IniTest->testCreate() /data/php5/ZendFramework/tests/Zend/Translate/Adapter/IniTest.php:0
PHP  14. Zend_Translate_Adapter_Ini->__construct() /data/php5/ZendFramework/tests/Zend/Translate/Adapter/IniTest.php:67
PHP  15. Zend_Translate_Adapter->__construct() /data/php5/ZendFramework/library/Zend/Translate/Adapter/Ini.php:48
PHP  16. Zend_Translate_Adapter->addTranslation() /data/php5/ZendFramework/library/Zend/Translate/Adapter.php:117
PHP  17. Zend_Translate_Adapter->_addTranslationData() /data/php5/ZendFramework/library/Zend/Translate/Adapter.php:212

OS        | PHP Release | ZF Release  | Issue occurs
----------+-------------+-------------+-------------
GNU/Linux | 5.2.11      | 1.9.1-1.9.4 | No
GNU/Linux | 5.3.0       | 1.9.1-1.9.4 | Yes
GNU/Linux | 5.3.0       | Trunk       | No

The problem lies in the structure of the two arrays being merged, here is the statement where the issue occurs.


$this->_translate[$key] = $temp[$key] + $this->_translate[$key];

In PHP 5.3.0 the value of $temp[$key] is null whereas in PHP 5.2.x it is an empty array. This is a result of the differing return value of parse_ini_file() between PHP versions.

{quote} And no, trunk has no BC issue, but new features are not allowed to be integrated into branch. Only bugs are allowed to be branched. The changeset you pointed to is no bug fix but a feature enhancement and this could lead to a BC breaking behaviour as features must not change between mini releases. {quote}

I'm confused, there is no BC issue but the changeset can't be merged because there is a BC issue?

The changeset is http://framework.zend.com/code/browse/…

The conditional check made against the array operation in the _addTranslationData() method in this changeset addresses the broken test case when using PHP 5.3. I don't understand why this code change was added in the same commit as the other changes which address #ZF-7508, the changes are entirely unrelated.

When it's your opinion that my request for further information is nonsense then please think before you write in such a manner.

I could also have closed the issue as not-reproducable as I was not able to reproduce it which I definetly wrote. And as you wrote in your second reply the issue is related to a special php version which was not available at the time 1.9 was released.

This would have been a very important information in my opinion as reading your reply it seems to me that you had it already before you wrote the issue.

The other discussion points are useless in my eyes as you are picking out one commit of multiple commits which adressed new features. Just because you don't understand the commits, it does not mean that they are allowed to be branched. As already stated, only bug fixes are allowed to be merged. No features and no improvements.

{quote} When it's your opinion that my request for further information is nonsense then please think before you write in such a manner. {quote}

Your request for further information is valid and I have not stated otherwise. Your suggestion that i was being dishonest by apparently pulling out of thin air the versions that I found to be affected is what I have a problem with.

{quote} The other discussion points are useless in my eyes as you are picking out one commit of multiple commits which adressed new features. Just because you don't understand the commits, it does not mean that they are allowed to be branched. As already stated, only bug fixes are allowed to be merged. No features and no improvements. {quote}

Sigh. I'm picking commit r17784 because, gasp, this commit is the one that stops the issue from happening when running the tests against trunk. I'm not asking for a feature to be merged but again; I will say that some of the code changes in that commit are unrelated to the issue it is resolving. Specifically the following changes.


<>  482     -               $this->_translate[$key] = $temp[$key] + $this->_translate[$key];
        482 +               if (array_key_exists($key, $temp) && is_array($temp[$key])) {
        483 +                   $this->_translate[$key] = $temp[$key] + $this->_translate[$key];
        484 +               }

The obvious solution would be to separate those changes from the other ones affecting the return values that were for #ZF-7508.

If you don't wish to deal with this issue please say so and I'll re-assign it to someone else.

{quote} If you don't wish to deal with this issue please say so and I'll re-assign it to someone else. {quote}

You are not allowed to reassign and I am the component maintainer, so I must know how to deal with this issue.

You may not read it within the mailing list, but we have a code freeze for branch already before you reported this issue. So actually no one is allowed to commit to branch, not even me.