Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metadata convenience access fails for "0" (Trac #979) #979

Closed
elgg-gitbot opened this issue Feb 16, 2013 · 3 comments
Closed

metadata convenience access fails for "0" (Trac #979) #979

elgg-gitbot opened this issue Feb 16, 2013 · 3 comments

Comments

@elgg-gitbot
Copy link

Original ticket http://trac.elgg.org/ticket/979 on 39286481-02-03 by trac user kevinjardine, assigned to unknown.

Elgg version: 1.5

If a metadata string value happens to be set to "0", then the convenience access incorrectly returns "".

Eg.

$m = get_metadata_byname($field->getGUID(),'default_access');
print "data: ".$m->value.','.$field->default_value;

returns

0,

That is, the full function invocation returns the correct value, but the simpler $field->default_value convenience access incorrectly returns an empty string instead.

I am setting this to "minor" because there is a work around, but this bug took me several hours to track down in a plugin and may cause subtle and hard to solve bugs for plugin developers.

@elgg-gitbot
Copy link
Author

trac user kevinjardine wrote on 39286486-08-22

Sorry, the example code above should have been:

$m = get_metadata_byname($field->getGUID(),'default_access');
print "data: ".$m->value.','.$field->default_access;

This corrected code also returns

0,

@elgg-gitbot
Copy link
Author

cash wrote on 39954941-06-10

I'm not able to reproduce this on the latest from svn:

$entity->test = "0";

var_dump($entity->test);

produces the expected result.

@elgg-gitbot
Copy link
Author

cash wrote on 39974171-08-05

Closing this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant