Zend Framework

The condition does not make sense

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Cannot Reproduce
  • Affects Version/s: 1.10.4
  • Fix Version/s: 1.10.7
  • Component/s: Zend_Currency
  • Labels:
    None

Description

/Zend/Currency line 139

if ($value === null) {
if (is_array($value) && isset($options['value'])) {
...

If something is null it can not be an array, it is always false.

and later in line 147 is
if (is_array($value)) {

It's not bug and it's not creating an error but also its not clear to understand, I suggest use:
elseif (is_array($value)) {
because it's continue of pre validation and configuration.

ps

Activity

Hide
Thomas Weidner added a comment -

Closing as not reproduceable.
The given code lines do not exist within trunk or branch.

Show
Thomas Weidner added a comment - Closing as not reproduceable. The given code lines do not exist within trunk or branch.
Hide
Ilya Biryukov added a comment -

@Thomas Weidner
Did you open the file Zend/Currency.php?

Extract:

@version $Id: Currency.php 22368 2010-06-04 14:49:59Z thomas $

if ($value === null) {
if (is_array($options) && isset($options['value'])) { $value = $options['value']; } else { $value = $this->_options['value']; }
}

if (is_array($value)) {
$options += $value;
if (isset($options['value'])) { $value = $options['value']; } }
}

Show
Ilya Biryukov added a comment - @Thomas Weidner Did you open the file Zend/Currency.php? Extract: @version $Id: Currency.php 22368 2010-06-04 14:49:59Z thomas $ if ($value === null) { if (is_array($options) && isset($options['value'])) { $value = $options['value']; } else { $value = $this->_options['value']; } } if (is_array($value)) { $options += $value; if (isset($options['value'])) { $value = $options['value']; } } }
Hide
Dolf Schimmel (Freeaqingme) added a comment -

Ilya; please update the issue with the following details:

  • What are you trying to accomplish
  • What code do you use to accomplish that?
  • What is the outcome
  • What is the outcome you had expected
Show
Dolf Schimmel (Freeaqingme) added a comment - Ilya; please update the issue with the following details:
  • What are you trying to accomplish
  • What code do you use to accomplish that?
  • What is the outcome
  • What is the outcome you had expected
Hide
Thomas Weidner added a comment -

@Ilya:

As I said the issue is not reproduceable.
You are writing it yourself:

The issues code:

if (is_array($value) && isset($options['value'])) {
...

If something is null it can not be an array, it is always false.

Your reply:

if (is_array($options) && isset($options['value'])) {
...

I may be blind but "is_array($options)" is not checked for NULL nor is it always FALSE as noted in the issues description.

In my eyes closing this issue as "not reproduceable for the next minor release 1.10.5" IS correct.

Show
Thomas Weidner added a comment - @Ilya: As I said the issue is not reproduceable. You are writing it yourself: The issues code:
if (is_array($value) && isset($options['value'])) {
...

If something is null it can not be an array, it is always false.
Your reply:
if (is_array($options) && isset($options['value'])) {
...
I may be blind but "is_array($options)" is not checked for NULL nor is it always FALSE as noted in the issues description. In my eyes closing this issue as "not reproduceable for the next minor release 1.10.5" IS correct.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: