Slew of errors triggered from empty $_POST data

Status
Not open for further replies.

Bauer

Well-Known Member
I know this is probably a trivial complaint - but I get close to 100 lines of error messages each time a form is submitted because of the code in function copyToFromRaw() in components/com_fabrik/models/form.php. This then triggers another error in components/com_fabrik/helpers/parent.php (line 1323).

I have attached the segment from my php_error.log file (including the backtrace paths) as evidence.

This occurs for any element that has been set as hidden, or any element that is empty - such as a database join, radio button group or checkbox for which a value has not been set.

There is no $_POST data for such conditions ("raw" or otherwise), so these errors occur.

But at any rate, it seems to me there should be a way of checking for those conditions - and not even run this function on such elements - because, as you see from the timestamps in the error_log attached, it's a few seconds of wasted time.

I've tried looking at the code to fix it, but am not all that familiar with just what exactly is being done here, and why. So maybe someone who is more familiar with this function could put that check into the code rather than just prefacing the undefined variables with a @ - and allowing these errors to be triggered?
 

Attachments

  • hidden_or_empty_fields.txt
    122.9 KB · Views: 106
[forgot to hit Post on this one from yesterday]

Should be fixed as of ...

https://github.com/Fabrik/fabrik/commit/1a0321a20f5acb1dbfbbb777aca7c907a7a98aca

It's interesting that the existing code pitched a warning, as we were prepending the offending array reference with the @ operator, specifically to suppress any warnings, and it should simply used "undefined".

http://php.net/manual/en/language.operators.errorcontrol.php

... but it's entirely possible the way @ works in that context has changed in PHP since we wrote that code.

I don't *think* replacing it with the array helper using an empty string as a default will have any adverse effect, but do be on the lookout for any inadvertent side effects. For instance, if we test for is_null() on any of those $post items being created, the behaviour might change. I might be better off setting it to null, but we'll see.

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top