? Pending

User tests: Successful: Unsuccessful:

avatar jajodiaraghav
jajodiaraghav
11 Jan 2017

Pull Request for Issue #12072 .

Summary of Changes

Replaced the line

if ($required)
        {
            // If the field is required and the value is empty return an error message.
            if (($value === '') || ($value === null))

with if ($required && !$value)
prevents waring "Field required" even when the field is filled.

Documentation Changes Required

No

avatar jajodiaraghav jajodiaraghav - open - 11 Jan 2017
avatar jajodiaraghav jajodiaraghav - change - 11 Jan 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 11 Jan 2017
Category Libraries
avatar jajodiaraghav jajodiaraghav - change - 11 Jan 2017
The description was changed
avatar jajodiaraghav jajodiaraghav - edited - 11 Jan 2017
avatar Bakual
Bakual - comment - 11 Jan 2017

($value === '') || ($value === null) would be correct. !$value would return true also for 0 and false which could be perfectly valid values. We only need to check for empty strings or null when a field is required.

avatar jajodiaraghav
jajodiaraghav - comment - 11 Jan 2017

Then what could be the correct way to resolve issue #12072?

avatar Bakual
Bakual - comment - 11 Jan 2017

I'd say there is something wrong in your component since it works fine for core apparently. I also can't explain why it works with your code.
What is the value you see in your extension at that point?

avatar tonypartridge
tonypartridge - comment - 4 Feb 2017

So for some reason your code is matching the $value === '' do a var_dump on the $value var at this point to see what it is containing and type or pause it here in the debugger all you are doing is removing a testing constraint which should be perfectly valid.

avatar Bakual
Bakual - comment - 4 Feb 2017

I'm closing this PR as it is a wrong fix.
If you cna show that it doesn't work with core extension or can provide the code that fails we can have a look at it again.

avatar Bakual Bakual - change - 4 Feb 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-02-04 19:48:46
Closed_By Bakual
Labels Added: ?
avatar Bakual Bakual - close - 4 Feb 2017

Add a Comment

Login with GitHub to post a comment