示例#1
0
/**
 * error handler.
 * This method is invoked by PHP when an error happens.
 * It displays the error if the application state is in debug;
 * otherwise, it saves the error in log.
 */
function pradoErrorHandler($errno, $errstr, $errfile, $errline)
{
    $errRpt = error_reporting();
    if (($errno & $errRpt) != $errno) {
        return;
    }
    $msg = "[{$errno}] {$errstr} (@line {$errline} in file {$errfile}).";
    pradoFatalError($msg);
}
 /**
  * Sets value of a component property.
  *
  * The property must be defined in the component specification.
  * Otherwise an exception will be raised.
  * @param string the property name
  * @param mixed the property value
  * @throw TPropertyReadOnlyException
  * @throw TPropertyNotDefinedException
  */
 public function __set($name, $value)
 {
     $definition = $this->getDefinition(get_class($this));
     if ($definition->hasProperty($name)) {
         $setter = $definition->getPropertySetter($name);
         if (empty($setter)) {
             pradoFatalError('Property is read-only: ' . get_class($this) . '.' . $name);
             // throw new TPropertyReadOnlyException(get_class($this),$name);
         } else {
             $this->{$setter}($value);
         }
     } else {
         pradoFatalError('Property is not defined: ' . get_class($this) . '.' . $name);
         //throw new TPropertyNotDefinedException(get_class($this),$name);
     }
 }
示例#3
0
 /**
  * Required by interface.
  * Do not call this method.
  */
 public function offsetUnset($offset)
 {
     if (isset($this->data[$offset])) {
         $this->removeAt($offset);
     } else {
         pradoFatalError(get_class($this) . ": invalid offset '{$offset}'");
     }
 }