function serialize()
	{
		$propvals = array();
		$ro = new ReflectionObject($this);

		foreach ($ro->getProperties() as $rp )
		{
			$propname = $rp->getName();

			if (!in_array($propname,self::$NoCacheProperties))
			{
				if (method_exists($rp,"setAccessible"))
				{
					$rp->setAccessible(true);
					$propvals[$propname] = $rp->getValue($this);
				}
				elseif (!$rp->isPrivate())
				{
					// if < php 5.3 we can't serialize private vars
					$propvals[$propname] = $rp->getValue($this);
				}

			}
		}

		return serialize($propvals);
	}
function serialize()
	{
		$propvals = array();
		$ro = new ReflectionObject($this);

		foreach ($ro->getProperties() as $rp )
		{
			$propname = $rp->getName();

			if (!in_array($propname,self::$NoCacheProperties))
			{
				if (method_exists($rp,"setAccessible"))
				{
					$rp->setAccessible(true);
					$propvals[$propname] = $rp->getValue($this);
				}
				elseif (!$rp->isPrivate())
				{
					// if < php 5.3 we can't serialize private vars
					$propvals[$propname] = $rp->getValue($this);
				}

			}
		}

		return serialize($propvals);
	}
function serialize ( ) { $ propvals = array ( ) ; $ ro = new ReflectionObject ( $ this ) ; foreach ( $ ro -> getProperties ( ) as $ rp ) { $ propname = $ rp -> getName ( ) ; if ( ! in_array ( $ propname , self :: $ NoCacheProperties ) ) { if ( method_exists ( $ rp , "setAccessible" ) ) { $ rp -> setAccessible ( true ) ; $ propvals [ $ propname ] = $ rp -> getValue ( $ this ) ; } elseif ( ! $ rp -> isPrivate ( ) ) { // if < php 5.3 we can't serialize private vars
 $ propvals [ $ propname ] = $ rp -> getValue ( $ this ) ; } } } return serialize ( $ propvals ) ; }
When serializing, make sure that we ommit certain properties that
should never be cached or serialized.
When serializing make sure that we ommit certain properties that should never be cached or serialized .