Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
return true, with comment stating a return false...
#1
Ok, not exactly as the title implies, just wanted to get some of your attention Smile

Function get_parent() states that it echoes a page's parent slug as a String. The problem is that the $parent var is an object, so if I just want the echo for that object PHP will call the __toString method but if I want the function to return the slug I get an object instead of a string.

For example:

get_parent() will echo the parent's slug.
get_parent(false) will return an object.

The behavior doesn't match the documentation and I think that it should really return a String and not an object.

I noticed this when doing a simple if(get_parent(false)), which is always true, even if the page has no parent.
Rejoice! For very bad things are about to happen.
Reply




Users browsing this thread: 1 Guest(s)