ternary operator does not follow correct statement and not working properly in php

  conditional-operator, php, symfony

I am trying to use ternary operator to add classname to an input-box in php with a condition.
I can see on debug that ..condition results are right i.e. it returns true or false as expected but the resultant statement (“” : “”) is not followed properly..seems that it is stuck to “true” always whereas i can clearly see the debug statement is correctly resulting the condition.

//This section works completely fine please do no bother commenting this section…just provided for idea only Thanks 🙂

  if (!isset($row['number']) || StringHelper::blank($row['number']))
        { $this->getRequest()->setError('rows{number}','Number field is required');       

template :

<?php echo input_tag('rows[][number]', $row['number'], array('class' =>'test '.(($sf_request->hasError('rows{number}')) ?  "form-error" : ""))); ?>

Source: Symfony Questions