ZF-8767: Zend_Validate_NotEmpty reports self::INVALID for every type of validation error


self::INVALID is set to "Invalid type given, value should be float, string, array, boolean or integer", but it is reported for "" string, 0 integer, 0.0 float, array().

"" is an empty string, but it is a string. 0 is an integer etc. so the message is plainly wrong. It should be self::IS_EMPTY => "Value is required and can't be empty".


Here's a patch that fixes this.

Fixed in trunk

User named 'thomas' already merged my patch in r20180 not mentioning this bug in the commit.

Was that you? If so, why don't you just admit that you merged my patch to SVN, instead of pretending, that the bug was "already fixed"?

$ svn log -c20180 library/Zend/

r20180 | thomas | 2010-01-10 21:43:25 +0100 (nie) | 3 linie

[GENERIC] Zend_Validate:

  • fixed wrong messages

$ svn diff -c20180 library/Zend/ | head -n 20

Index: library/Zend/Validate/NotEmpty.php


--- library/Zend/Validate/NotEmpty.php (wersja 20179)

+++ library/Zend/Validate/NotEmpty.php (wersja 20180)

@@ -164,7 +164,7 @@

     if ($type >= self::SPACE) {

         $type -= self::SPACE;

         if (is_string($value) && (preg_match('/^\s+$/s', $value))) {
  •          $this->_error(self::INVALID);
  •          $this->_error(self::IS_EMPTY);
             return false;

@@ -173,7 +173,7 @@

     if ($type >= self::NULL) {

         $type -= self::NULL;

         if (is_null($value)) {
  •          $this->_error(self::INVALID);
  •          $this->_error(self::IS_EMPTY);
             return false;


I'm in several online forums.

Sometimes I fix things when they are mentioned within a forum without raising an issue myself. And sometimes it collidates with another user reporting the same issue.

As there is only one solution for this problem, by using the correct constant, I would not be too strict in the wording "my patch". Other people come to the same conclusion without looking into your patch.

You may also have noted that email delivery for issues is delayed. The time this issue was sent to me, the fix was already committed.

I'm sorry when such a situation is problematic for you. When you want I could wait some weeks in future before fixing things which are mentioned to me in a public discussion. :-)

Do you really expect me to believe that accidentally both two of my issues reported within an hour was "already fixed" with no other commits within a week, just these two just after the bug reports? And you are so busy, that you do not remember what exactly happened few hours ago and need to be speculative with "sometimes".

I do not really care about giving credit for a few-liner patch. What struck me is the bizarre attitude of not admitting "yes, there was a bug" and pretending that the reports were invalid in a first place.

You just lost more than one user - I will discourage every person asking my advice and reading my blog from using ZF, because your development methods are doubtful and not transparent. EOT

There were 40 commits within the last week by me, not only 2. And yes I am busy in my sparetime on sunday at home.

No one said that this report is invalid. I just said "probably fixed in trunk". The issue itself is marked as "fixed" and not as "not an issue" or "incomplete". In my eyes "fixed" is the proper status.

And there is also a changeset connected to this issue which tests this behaviour.