Source for file PHP.php
Documentation is available at PHP.php
* @author Arpad Ray <arpad@php.net>
* @copyright 2005 Arpad Ray
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.4
* @link http://pear.php.net/package/HTML_AJAX
* Unserializes the given string
* Triggers an error if a class is found which is not
* in the provided array of allowed class names.
* the serialized string to process
* @param array $allowedClasses
* an array of class names to check objects against
* the unserialized variable on success, or false on
* failure. If this method fails it will also trigger
trigger_error('Unsafe version of PHP for native unserialization');
$classes = $this->_getSerializedClassNames ($input);
if ($classes === false ) {
* Extract class names from serialized string
* Adapted from code by Harry Fuecks
* the serialized string to process
* an array of class names found, or false if the input
function _getSerializedClassNames ($string) {
// Strip any string representations (which might contain object syntax)
while (($pos = strpos($string, 's:')) !== false ) {
$pos2 = strpos($string, ':', $pos + 2 );
// invalidly serialized string
$end = $pos + 2 + substr($string, $pos + 2 , $pos2) + 1;
// Pull out the class names
// Make sure names are unique (same object serialized twice)
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
Documentation generated on Fri, 04 Apr 2008 18:30:22 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.
|