The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Check if datastore entry exists?
I thought I saw the answer to this yesterday while searching the forums, but now I can't find the post. Now I can't fine the post.
What is the best way to test if a datastore entry exists before trying to use the data that is supposed to be there? Thanks, James --------------- Added [DATE]1432064018[/DATE] at [TIME]1432064018[/TIME] --------------- I think I found it. Does this look right? Code:
if ($vbulletin->datastore_item !== null) |
#2
|
|||
|
|||
Man, I just read that whole section on NULL vs isset() vs empty() a few weeks ago and I already can't remember. I think what you have is right because IIRC I don't think there's any practical difference between a variable set to NULL and an unset variable.
|
#3
|
|||
|
|||
I got that code bit from the first post in this thread:
https://vborg.vbsupport.ru/showthread.php?t=98047 |
#4
|
|||
|
|||
Hmm...I guess at some point it used to be separate from $vbulletin (or $vbulletin didn't exist yet), but I wonder why they changed from isset() to !== NULL? Anyway, I guess that'll work.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|