[pLog-svn] r2214 - plog/trunk/class/dao
ork at devel.plogworld.net
ork at devel.plogworld.net
Sun Jun 12 11:09:48 GMT 2005
Author: ork
Date: 2005-06-12 11:09:47 +0000 (Sun, 12 Jun 2005)
New Revision: 2214
Modified:
plog/trunk/class/dao/article.class.php
Log:
PLEASE NOTE:
$var = array();
if ( $var == null )
echo 'this is true';
if ( $var === null )
echo 'this is not true';
if ( is_null($var) )
echo 'this is not true, either';
when checking if some var == null, php sees null as empty, thus an empty string, an empty array, false and null equals null. if you really want to check against null, use is_null() or use === instead of ==.
see:
http://www.php.net/manual/en/language.operators.comparison.php
http://www.php.net/manual/en/function.is-null.php
Modified: plog/trunk/class/dao/article.class.php
===================================================================
--- plog/trunk/class/dao/article.class.php 2005-06-12 10:33:00 UTC (rev 2213)
+++ plog/trunk/class/dao/article.class.php 2005-06-12 11:09:47 UTC (rev 2214)
@@ -266,7 +266,7 @@
function getComments( $onlyActive = true )
{
// load the comments if they haven't been loaded yet
- if( $this->_comments == null ) {
+ if( is_null($this->_comments) ) {
include_once( PLOG_CLASS_PATH.'class/dao/articlecomments.class.php' );
$userComments = new ArticleComments();
$blogSettings = $this->_blogInfo->getSettings();
@@ -299,7 +299,7 @@
function getTrackbacks( $onlyActive = true )
{
// load the comments if they haven't been loaded yet
- if( $this->_trackbacks == null ) {
+ if( is_null($this->_trackbacks) ) {
include_once( PLOG_CLASS_PATH.'class/dao/trackbacks.class.php' );
$trackbacks = new Trackbacks();
$blogSettings = $this->_blogInfo->getSettings();
@@ -331,7 +331,7 @@
function getUserInfo()
{
// load the user if it hasn't been loaded yet
- if( $this->_userInfo == null ) {
+ if( is_null($this->_userInfo) ) {
$users = new Users();
$this->setUserInfo( $users->getUserInfoFromId( $this->getUser()));
}
@@ -739,7 +739,7 @@
*/
function getFields()
{
- if( $this->_fields == null ) {
+ if( is_null($this->_fields) ) {
include_once( PLOG_CLASS_PATH.'class/dao/customfields/customfieldsvalues.class.php' );
// get the custom fields
$customFields = new CustomFieldsValues();
@@ -759,7 +759,7 @@
function getFieldObject( $fieldName )
{
// if fields haven't been loaded yet, do so now
- if( $this->_fields == null )
+ if( is_null($this->_fields) )
$this->getFields();
return $this->_fields["$fieldName"];
@@ -774,7 +774,7 @@
function setFieldObject( $fieldValue )
{
// if fields haven't been loaded yet, do so now
- if( $this->_fields == null )
+ if( is_null($this->_fields) )
$this->getFields();
$fieldName = $fieldValue->getName();
More information about the pLog-svn
mailing list