本文整理汇总了PHP中trigger_error函数的典型用法代码示例。如果您正苦于以下问题:PHP trigger_error函数的具体用法?PHP trigger_error怎么用?PHP trigger_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了trigger_error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _str_pad
/**
* utf8::str_pad
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
function _str_pad($str, $final_str_length, $pad_str = ' ', $pad_type = STR_PAD_RIGHT)
{
if (utf8::is_ascii($str) and utf8::is_ascii($pad_str)) {
return str_pad($str, $final_str_length, $pad_str, $pad_type);
}
$str_length = utf8::strlen($str);
if ($final_str_length <= 0 or $final_str_length <= $str_length) {
return $str;
}
$pad_str_length = utf8::strlen($pad_str);
$pad_length = $final_str_length - $str_length;
if ($pad_type == STR_PAD_RIGHT) {
$repeat = ceil($pad_length / $pad_str_length);
return utf8::substr($str . str_repeat($pad_str, $repeat), 0, $final_str_length);
}
if ($pad_type == STR_PAD_LEFT) {
$repeat = ceil($pad_length / $pad_str_length);
return utf8::substr(str_repeat($pad_str, $repeat), 0, floor($pad_length)) . $str;
}
if ($pad_type == STR_PAD_BOTH) {
$pad_length /= 2;
$pad_length_left = floor($pad_length);
$pad_length_right = ceil($pad_length);
$repeat_left = ceil($pad_length_left / $pad_str_length);
$repeat_right = ceil($pad_length_right / $pad_str_length);
$pad_left = utf8::substr(str_repeat($pad_str, $repeat_left), 0, $pad_length_left);
$pad_right = utf8::substr(str_repeat($pad_str, $repeat_right), 0, $pad_length_left);
return $pad_left . $str . $pad_right;
}
trigger_error('utf8::str_pad: Unknown padding type (' . $type . ')', E_USER_ERROR);
}
开发者ID:Toushi,项目名称:flow,代码行数:40,代码来源:str_pad.php
示例2: create
/**
* Factory method that creates a cache object based on configuration
* @param $name Name of definitions handled by cache
* @param $config Instance of HTMLPurifier_Config
*/
public function create($type, $config)
{
$method = $config->get('Cache', 'DefinitionImpl');
if ($method === null) {
return new HTMLPurifier_DefinitionCache_Null($type);
}
if (!empty($this->caches[$method][$type])) {
return $this->caches[$method][$type];
}
if (isset($this->implementations[$method]) && class_exists($class = $this->implementations[$method], false)) {
$cache = new $class($type);
} else {
if ($method != 'Serializer') {
trigger_error("Unrecognized DefinitionCache {$method}, using Serializer instead", E_USER_WARNING);
}
$cache = new HTMLPurifier_DefinitionCache_Serializer($type);
}
foreach ($this->decorators as $decorator) {
$new_cache = $decorator->decorate($cache);
// prevent infinite recursion in PHP 4
unset($cache);
$cache = $new_cache;
}
$this->caches[$method][$type] = $cache;
return $this->caches[$method][$type];
}
开发者ID:seclabx,项目名称:xlabas,代码行数:31,代码来源:DefinitionCacheFactory.php
示例3: calculateGFRResult
function calculateGFRResult()
{
$tmpArr = array();
$tmpArr[] = date('Y-m-d H:i:s');
//observation time
$tmpArr[] = 'GFR (CALC)';
//desc
$gender = NSDR::populate($this->_patientId . "::com.clearhealth.person.displayGender");
$crea = NSDR::populate($this->_patientId . "::com.clearhealth.labResults[populate(@description=CREA)]");
$genderFactor = null;
$creaValue = null;
$personAge = null;
$raceFactor = 1;
switch ($gender[key($gender)]) {
case 'M':
$genderFactor = 1;
break;
case 'F':
$genderFactor = 0.742;
break;
}
if ((int) strtotime($crea['observation_time']) >= strtotime('now - 60 days') && strtolower($crea[key($crea)]['units']) == 'mg/dl') {
$creaValue = $crea[key($crea)]['value'];
}
$person = new Person();
$person->personId = $this->_patientId;
$person->populate();
if ($person->age > 0) {
$personAge = $person->age;
}
$personStat = new PatientStatistics();
$personStat->personId = $this->_patientId;
$personStat->populate();
if ($personStat->race == "AFAM") {
$raceFactor = 1.21;
}
$gfrValue = "INC";
if ($personAge > 0 && $creaValue > 0) {
$gfrValue = "" . (int) round(pow($creaValue, -1.154) * pow($personAge, -0.203) * $genderFactor * $raceFactor * 186);
}
trigger_error("gfr:: " . $gfrValue, E_USER_NOTICE);
$tmpArr[] = $gfrValue;
// lab value
$tmpArr[] = 'mL/min/1.73 m2';
//units
$tmpArr[] = '';
//ref range
$tmpArr[] = '';
//abnormal
$tmpArr[] = 'F';
//status
$tmpArr[] = date('Y-m-d H:i:s') . '::' . '0';
// observationTime::(boolean)normal; 0 = abnormal, 1 = normal
$tmpArr[] = '0';
//sign
//$this->_calcLabResults[uniqid()] = $tmpArr;
$this->_calcLabResults[1] = $tmpArr;
// temporarily set index to one(1) to be able to include in selected lab results
return $tmpArr;
}
开发者ID:dragonlet,项目名称:clearhealth,代码行数:60,代码来源:CalcLabs.php
示例4: __construct
/**
* Setup the config based on either the Configure::read() values
* or the PaypalIpnConfig in config/paypal_ipn_config.php
*
* Will attempt to read configuration in the following order:
* Configure::read('PaypalIpn')
* App::import() of config/paypal_ipn_config.php
* App::import() of plugin's config/paypal_ipn_config.php
*/
function __construct()
{
$this->config = Configure::read('PaypalIpn');
if (empty($this->config)) {
$importConfig = array('type' => 'File', 'name' => 'PaypalIpn.PaypalIpnConfig', 'file' => CONFIGS . 'paypal_ipn_config.php');
if (!class_exists('PaypalIpnConfig')) {
App::import($importConfig);
}
if (!class_exists('PaypalIpnConfig')) {
// Import from paypal plugin configuration
$importConfig['file'] = 'config' . DS . 'paypal_ipn_config.php';
App::import($importConfig);
}
if (!class_exists('PaypalIpnConfig')) {
trigger_error(__d('paypal_ipn', 'PaypalIpnConfig: The configuration could not be loaded.', true), E_USER_ERROR);
}
if (!PHP5) {
$config =& new PaypalIpnConfig();
} else {
$config = new PaypalIpnConfig();
}
$vars = get_object_vars($config);
foreach ($vars as $property => $configuration) {
if (strpos($property, 'encryption_') === 0) {
$name = substr($property, 11);
$this->encryption[$name] = $configuration;
} else {
$this->config[$property] = $configuration;
}
}
}
parent::__construct();
}
开发者ID:ranium,项目名称:CakePHP-Paypal-IPN-Plugin,代码行数:42,代码来源:paypal.php
示例5: __construct
function __construct($oTemplate = false)
{
if (isset($GLOBALS['bxDolClasses'][get_class($this)])) {
trigger_error('Multiple instances are not allowed for the class: ' . get_class($this), E_USER_ERROR);
}
parent::__construct($oTemplate ? $oTemplate : BxDolStudioTemplate::getInstance());
}
开发者ID:blas-dmx,项目名称:trident,代码行数:7,代码来源:BxBaseStudioFunctions.php
示例6: PMA_RTN_main
/**
* Main function for the routines functionality
*
* @return nothing
*/
function PMA_RTN_main()
{
global $db;
PMA_RTN_setGlobals();
/**
* Process all requests
*/
PMA_RTN_handleEditor();
PMA_RTN_handleExecute();
PMA_RTN_handleExport();
/**
* Display a list of available routines
*/
$columns = "`SPECIFIC_NAME`, `ROUTINE_NAME`, `ROUTINE_TYPE`, ";
$columns .= "`DTD_IDENTIFIER`, `ROUTINE_DEFINITION`";
$where = "ROUTINE_SCHEMA='" . PMA_Util::sqlAddSlashes($db) . "'";
$items = PMA_DBI_fetch_result("SELECT {$columns} FROM `INFORMATION_SCHEMA`.`ROUTINES` WHERE {$where};");
echo PMA_RTE_getList('routine', $items);
/**
* Display the form for adding a new routine, if the user has the privileges.
*/
echo PMA_RTN_getFooterLinks();
/**
* Display a warning for users with PHP's old "mysql" extension.
*/
if ($GLOBALS['cfg']['Server']['extension'] === 'mysql') {
trigger_error(__('You are using PHP\'s deprecated \'mysql\' extension, ' . 'which is not capable of handling multi queries. ' . '[strong]The execution of some stored routines may fail![/strong] ' . 'Please use the improved \'mysqli\' extension to ' . 'avoid any problems.'), E_USER_WARNING);
}
}
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:34,代码来源:rte_routines.lib.php
示例7: action
/**
* Page のアクション.
*
* @return void
*/
public function action()
{
$objDeliv = new SC_Helper_Delivery_Ex();
$mode = $this->getMode();
if (!empty($_POST)) {
$objFormParam = new SC_FormParam_Ex();
$objFormParam->setParam($_POST);
$this->arrErr = $this->lfCheckError($mode, $objFormParam);
if (!empty($this->arrErr['deliv_id'])) {
trigger_error('', E_USER_ERROR);
return;
}
}
switch ($mode) {
case 'delete':
// ランク付きレコードの削除
$objDeliv->delete($_POST['deliv_id']);
$this->objDisplay->reload();
// PRG pattern
break;
case 'up':
$objDeliv->rankUp($_POST['deliv_id']);
$this->objDisplay->reload();
// PRG pattern
break;
case 'down':
$objDeliv->rankDown($_POST['deliv_id']);
$this->objDisplay->reload();
// PRG pattern
break;
default:
break;
}
$this->arrDelivList = $objDeliv->getList();
}
开发者ID:rateon,项目名称:twhk-ec,代码行数:40,代码来源:LC_Page_Admin_Basis_Delivery.php
示例8: formatMessage
public static function formatMessage(Rule $rule, $withValue = TRUE)
{
$message = $rule->message;
if ($message instanceof Nette\Utils\Html) {
return $message;
} elseif ($message === NULL && is_string($rule->validator) && isset(static::$messages[$rule->validator])) {
$message = static::$messages[$rule->validator];
} elseif ($message == NULL) {
// intentionally ==
trigger_error("Missing validation message for control '{$rule->control->getName()}'.", E_USER_WARNING);
}
if ($translator = $rule->control->getForm()->getTranslator()) {
$message = $translator->translate($message, is_int($rule->arg) ? $rule->arg : NULL);
}
$message = preg_replace_callback('#%(name|label|value|\\d+\\$[ds]|[ds])#', function ($m) use($rule, $withValue) {
static $i = -1;
switch ($m[1]) {
case 'name':
return $rule->control->getName();
case 'label':
return $rule->control->translate($rule->control->caption);
case 'value':
return $withValue ? $rule->control->getValue() : $m[0];
default:
$args = is_array($rule->arg) ? $rule->arg : array($rule->arg);
$i = (int) $m[1] ? $m[1] - 1 : $i + 1;
return isset($args[$i]) ? $args[$i] instanceof IControl ? $withValue ? $args[$i]->getValue() : "%{$i}" : $args[$i] : '';
}
}, $message);
return $message;
}
开发者ID:rostenkowski,项目名称:nette,代码行数:31,代码来源:Validator.php
示例9: output
public function output(Pagemill_Data $data, Pagemill_Stream $stream)
{
//$inner = $data->parseVariables($this->rawOutput(), false);
$tmp = new Pagemill_Stream(true);
foreach ($this->children() as $child) {
$child->process($data, $tmp);
}
$inner = html_entity_decode($tmp->peek(), ENT_COMPAT, 'UTF-8');
$data->set('value', $inner);
$use = $data->parseVariables($this->getAttribute('use'));
if ($use) {
// Use the requested editor if available
if (class_exists($use)) {
if (is_subclass_of($use, __CLASS__)) {
$sub = new $use($this->name(), $this->attributes(), $this, $this->docType());
$sub->output($data, $stream);
return;
} else {
trigger_error("Requested editor class '{$cls}' does not appear to be an editor subclass.");
}
} else {
trigger_error("Requested editor class '{$cls}' does not exist.");
}
}
if (TYPEF_DEFAULT_EDITOR != '') {
// Use the requested editor if available
$use = TYPEF_DEFAULT_EDITOR;
if (class_exists($use)) {
if (is_subclass_of($use, __CLASS__)) {
$sub = new $use($this->name(), $this->attributes(), $this, $this->docType());
$sub->output($data, $stream);
return;
} else {
trigger_error("Configured editor class '{$use}' does not appear to be an editor subclass.");
}
} else {
trigger_error("Configured editor class '{$use}' does not exist.");
}
}
// Use CKEditor if available
if (class_exists('Typeframe_Tag_Editor_CkEditor')) {
$sub = new Typeframe_Tag_Editor_CkEditor($this->name(), $this->attributes(), $this, $this->docType());
$sub->process($data, $stream);
return;
}
// No editor available. Use a plain textarea.
$attribs = '';
foreach ($this->attributes() as $k => $v) {
if ($k != 'use') {
$attribs .= " {$k}=\"" . $data->parseVariables($v) . "\"";
}
}
if (!$this->getAttribute('cols')) {
$attribs .= ' cols="80"';
}
if (!$this->getAttribute('rows')) {
$attribs .= ' rows="25"';
}
$stream->puts("<textarea{$attribs}>" . $inner . "</textarea>");
}
开发者ID:ssrsfs,项目名称:blg,代码行数:60,代码来源:Editor.php
示例10: doExecute
/**
* Main function executed automatically by the controller
*
* @param object $registry Registry object
* @return @e void
*/
public function doExecute(ipsRegistry $registry)
{
/* From App */
$app = trim($this->request['f_app']);
$area = trim($this->request['f_area']);
$relid = intval($this->request['f_relid']);
if (!$app or !$area or empty($relid)) {
trigger_error("Missing data in " . __FILE__ . ' ' . __LINE__);
}
/* Init some data */
require_once IPS_ROOT_PATH . 'sources/classes/like/composite.php';
/*noLibHook*/
$this->_like = classes_like::bootstrap($app, $area);
$this->registry->getClass('class_localization')->loadLanguageFile(array('public_like'), 'core');
/* What to do? */
switch ($this->request['do']) {
case 'setDialogue':
$this->_setDialogue($app, $area, $relid);
break;
case 'save':
$this->_save($relid);
break;
case 'unset':
$this->_unset($relid);
break;
case 'more':
$this->_more($relid);
break;
}
}
开发者ID:mover5,项目名称:imobackup,代码行数:36,代码来源:like.php
示例11: save
/**
* update file contents and meta
* or create new file, if not existing
* @param int $ttl
* @return bool
*/
public function save($ttl = 0)
{
$ttl = $ttl ?: $this->ttl;
if (empty($this->file)) {
trigger_error('Unable to save. No file specified.');
return false;
}
if (is_null($this->content)) {
trigger_error(sprintf('Unable to save. Contents of file `%s´ is NULL.', $this->file));
return false;
}
if ($this->changed) {
$this->fs->write($this->file, (string) $this->content);
if ($this->f3->get('CACHE')) {
$cache = \Cache::instance();
$cacheHash = $this->getCacheHash($this->file);
if ($this->ttl) {
$cache->set($cacheHash, $this->content, $this->ttl);
} elseif ($cache->exists($cacheHash)) {
$cache->clear($cacheHash);
}
}
}
$this->changed = false;
$this->metaHandle->save($this->file, $this->meta, $ttl);
return true;
}
开发者ID:jackycgq,项目名称:bzfshop,代码行数:33,代码来源:fal.php
示例12: __construct
/**
* Constructor method. Will populate other information beyond IP address from the outlet itself.
*
* @param $ip_address
*/
public function __construct($ip_address)
{
$this->ip_address = $ip_address;
if (!$this->refresh()) {
trigger_error("Unable to connect to outlet at " . $ip_address, E_USER_WARNING);
}
}
开发者ID:Antoinebr,项目名称:WeMo-PHP-Toolkit,代码行数:12,代码来源:Outlet.php
示例13: afterroute
/**
* kick start the View, which creates the response
* based on our previously set content data.
* finally echo the response or overwrite this method
* and do something else with it.
* @return string
*/
public function afterroute()
{
if (!$this->response) {
trigger_error('No View has been set.');
}
echo $this->response->render();
}
开发者ID:xfra35,项目名称:fabulog,代码行数:14,代码来源:base.php
示例14: set_user_affiliation
public function set_user_affiliation($user_id, $type, $scope = 'domain', $target_id = null)
{
$allowed_types = array('admin', 'member', 'none', 'outcast', 'owner');
$allowed_scope = array('domain', 'site', 'conv');
if (!in_array($type, $allowed_types)) {
trigger_error('You cannot set a Livefyre user\'s affiliation to a type other than the allowed: ' . implode(', ', $allowed_types), E_USER_ERROR);
return false;
} else {
if (!in_array($scope, $allowed_scope)) {
trigger_error('You cannot set a Livefyre user\'s affiliation within a scope other than the allowed: ' . implode(', ', $allowed_scope), E_USER_ERROR);
return false;
}
$user_jid = $user_id . '@' . $this->get_host();
$systemuser = $this->user('system');
$request_url = 'http://' . $this->get_host() . '/api/v1.1/private/management/user/' . $user_jid . '/role/?lftoken=' . $this->user('system')->token();
$post_data = array('affiliation' => $type);
if ($scope == 'domain') {
$post_data['domain_wide'] = '1';
} elseif ($scope == 'conv') {
$post_data['conv_id'] = $target_id;
} elseif ($scope == 'site') {
$post_data['site_id'] = $target_id;
}
return $this->http->request($request_url, array('method' => 'POST', 'data' => $post_data));
}
return false;
}
开发者ID:dparks-seattletimes,项目名称:openworldstudios,代码行数:27,代码来源:Domain.php
示例15: run
/**
* wird ausgeführt, wenn Cache über "Cache leeren" Button geleert wird
* @param array $data
* @return mixed
*/
public function run($data = null)
{
$functionData = explode('_', $data['name'], 3);
if (!isset($functionData[0]) || !isset($functionData[1]) || !isset($functionData[2])) {
trigger_error('Malformed function name data given: "' . $data['name'] . '"');
return false;
}
$vendorKey = $functionData[0];
$moduleKey = $functionData[1];
$functionName = $functionData[2];
$classFile = \fpcm\classes\baseconfig::$moduleDir . $vendorKey . '/' . $moduleKey . '/events/apiCallFunction.php';
if (!file_exists($classFile)) {
trigger_error('Event class "apiCallFunction" not found in ' . \fpcm\model\files\ops::removeBaseDir($classFile, true));
return false;
}
$classkey = $vendorKey . '/' . $moduleKey;
$eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, 'apiCallFunction');
/**
* @var \fpcm\model\abstracts\event
*/
$module = new $eventClass();
if (!$this->is_a($module)) {
return false;
}
$data['name'] = $functionName;
return $module->run($data);
}
开发者ID:sea75300,项目名称:fanpresscm3,代码行数:32,代码来源:apiCallFunction.php
示例16: chr
/**
* Returns a specific character in UTF-8.
* @param int codepoint
* @return string
*/
public static function chr($code)
{
if (func_num_args() > 1 && strcasecmp(func_get_arg(1), 'UTF-8')) {
trigger_error(__METHOD__ . ' supports only UTF-8 encoding.', E_USER_DEPRECATED);
}
return iconv('UTF-32BE', 'UTF-8//IGNORE', pack('N', $code));
}
开发者ID:rostenkowski,项目名称:nette,代码行数:12,代码来源:Strings.php
示例17: dispatch
/**
* Dispatch the requested action
*
* @param string $action Method name of action
* @return void
*/
public function dispatch($action)
{
$action = str_replace("Action", "", $action);
// Notify helpers of action preDispatch state
$this->_helper->notifyPreDispatch();
$this->preDispatch();
if ($this->getRequest()->isDispatched()) {
if (null === $this->_classMethods) {
$this->_classMethods = get_class_methods($this);
}
// preDispatch() didn't change the action, so we can continue
if ($this->getInvokeArg('useCaseSensitiveActions') || in_array($action, $this->_classMethods)) {
if ($this->getInvokeArg('useCaseSensitiveActions')) {
trigger_error('Using case sensitive actions without word separators is deprecated; please do not rely on this "feature"');
}
$this->{$action}();
$this->view->setVars($this->fields);
} else {
$this->__call($action, array());
$this->view->setVars($this->fields);
}
$this->postDispatch();
}
// whats actually important here is that this action controller is
// shutting down, regardless of dispatching; notify the helpers of this
// state
$this->_helper->notifyPostDispatch();
}
开发者ID:amptools-net,项目名称:midori-php,代码行数:34,代码来源:Controller.php
示例18: getPresenterClass
/**
* Generates and checks presenter class name.
* @param string presenter name
* @return string class name
* @throws InvalidPresenterException
*/
public function getPresenterClass(&$name)
{
if (isset($this->cache[$name])) {
return $this->cache[$name];
}
if (!is_string($name) || !Nette\Utils\Strings::match($name, '#^[a-zA-Z\\x7f-\\xff][a-zA-Z0-9\\x7f-\\xff:]*\\z#')) {
throw new InvalidPresenterException("Presenter name must be alphanumeric string, '{$name}' is invalid.");
}
$class = $this->formatPresenterClass($name);
if (!class_exists($class)) {
throw new InvalidPresenterException("Cannot load presenter '{$name}', class '{$class}' was not found.");
}
$reflection = new \ReflectionClass($class);
$class = $reflection->getName();
if (!$reflection->implementsInterface('Nette\\Application\\IPresenter')) {
throw new InvalidPresenterException("Cannot load presenter '{$name}', class '{$class}' is not Nette\\Application\\IPresenter implementor.");
} elseif ($reflection->isAbstract()) {
throw new InvalidPresenterException("Cannot load presenter '{$name}', class '{$class}' is abstract.");
}
$this->cache[$name] = $class;
if ($name !== ($realName = $this->unformatPresenterClass($class))) {
trigger_error("Case mismatch on presenter name '{$name}', correct name is '{$realName}'.", E_USER_WARNING);
$name = $realName;
}
return $class;
}
开发者ID:jave007,项目名称:test,代码行数:32,代码来源:PresenterFactory.php
示例19: arrayToJsArray
function arrayToJsArray($array, $name, $nl = "\n", $encoding = false)
{
if (is_array($array)) {
$jsArray = $name . ' = new Array();' . $nl;
foreach ($array as $key => $value) {
switch (gettype($value)) {
case 'unknown type':
case 'resource':
case 'object':
break;
case 'array':
$jsArray .= arrayToJsArray($value, $name . '[' . valueToJsValue($key, $encoding) . ']', $nl);
break;
case 'NULL':
$jsArray .= $name . '[' . valueToJsValue($key, $encoding) . '] = null;' . $nl;
break;
case 'boolean':
$jsArray .= $name . '[' . valueToJsValue($key, $encoding) . '] = ' . ($value ? 'true' : 'false') . ';' . $nl;
break;
case 'string':
$jsArray .= $name . '[' . valueToJsValue($key, $encoding) . '] = ' . valueToJsValue($value, $encoding) . ';' . $nl;
break;
case 'double':
case 'integer':
$jsArray .= $name . '[' . valueToJsValue($key, $encoding) . '] = ' . $value . ';' . $nl;
break;
default:
trigger_error('Hoppa, egy j t�us a PHP-ben?' . __CLASS__ . '::' . __FUNCTION__ . '()!', E_USER_WARNING);
}
}
return $jsArray;
} else {
return false;
}
}
开发者ID:BackupTheBerlios,项目名称:comeet-svn,代码行数:35,代码来源:adm_fenvios.php
示例20: hash_equals
function hash_equals($known_str, $user_str)
{
if (!is_string($known_str)) {
trigger_error("Expected known_str to be a string, {$known_str} given", E_USER_WARNING);
return false;
}
if (!is_string($user_str)) {
trigger_error("Expected user_str to be a string, {$user_str} given", E_USER_WARNING);
return false;
}
$known_len = strlen($known_str);
$user_len = strlen($user_str);
if ($known_len != $user_len) {
// if different lengths, do comparison as well, to have time constant
// but return false as expected
$user_str = $known_str;
$result = 1;
} else {
$result = 0;
}
/* This is security sensitive code. Do not optimize this for speed. */
for ($j = 0; $j < $known_len; $j++) {
$result |= ord($known_str[$j] ^ $user_str[$j]);
}
return $result == 0;
}
开发者ID:medali1990,项目名称:medsite,代码行数:26,代码来源:hash_equals.php
注:本文中的trigger_error函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论