On posting a new node I'm getting this message:-
Notice: Undefined index: validate_url in link_field() (line 229 of /srv/bindings/ab331aab8e404f6d89add5010badaee5/code/sites/all/modules/link/link.module).
I tried to make this change to guard against nonexistent array indices, but the message still exists.
- if ($field['validate_url'] !== 0 || is_null($field['validate_url']) || !isset($field['validate_url'])) {
+ if (array_key_exists('validate_url', $field) || $field['validate_url'] !== 0 || is_null($field['validate_url']) || !isset($field['validate_url'])) {
Comments
Comment #1
reikiman commentedAh.. I had the test wrong. This makes the message go away:-
if (!array_key_exists('validate_url', $field) || ...Comment #2
reikiman commentedI found another instance where the fix is:-
Comment #3
damienmckennaThis will fix the error in the D6 -dev version for both lines 85 and 101.
Comment #4
damienmckennaThis fixes the problem in 6.x-2.9.
Comment #5
brad.bulger commentedreroll against current 2.x-dev code, including a few additional changes (eg is_null() and !isset() are equivalent)
could this get applied? it's been almost a year. thanks.
Comment #6
yhager commentedthis looks backwards to me - if validate_url is not set we should not validate the url.
Comment #7
brad.bulger commentedcompare it to the original code:
i guess the idea was that if it doesn't explicitly have a value of zero, then the validation should happen?
Comment #8
yhager commentedYeah, I know it is like the original code, but it still does not make sense to me :) (or at least looks very hacky)
Comment #9
brad.bulger commentedwell can i suggest that that's a separate issue? the point here is to fix the undefined index notice, not to rewrite the module logic. that may also be a thing worth doing, but for its own sake. meanwhile, this is a solution to a problem that has existed for over a year.
Comment #10
jcfiala commentedI'll pour this in the next time I'm working on 6.x.
Comment #11
jcfiala commentedOkay, this has been committed - should show up in 6.x-2.x-dev by tomorrow, I expect. If folks could give it a quick look sometime soon and comment if there's a problem, that would be a help.
Comment #13
yhager commentedLooks like this was not committed yet.
Comment #14
yhager commentedSorry, my bad, it's in commit 6d9890b5
Comment #16
jenlamptonlooks like this never got into an official release for 6.x. Patch in #5 applies to latest stable with some offset.