fixed several smaller bugs in system (json,mysql,autoload)
This commit is contained in:
parent
6d101493ab
commit
ff4e74a0ec
@ -30,10 +30,9 @@ class ConnectionMYS extends ConnectionAbstr {
|
|||||||
$binds = array($prepStmt,null);
|
$binds = array($prepStmt,null);
|
||||||
for($i =0; $i < \count($values);$i++){
|
for($i =0; $i < \count($values);$i++){
|
||||||
$types .= self::getPrepareValueType($values[$i]);
|
$types .= self::getPrepareValueType($values[$i]);
|
||||||
$binds[] = &$values[$i];
|
$binds[] = &$values[$i];}
|
||||||
}
|
|
||||||
$binds[1] = $types;
|
$binds[1] = $types;
|
||||||
\call_user_func_array('mysqli_stmt_bind_param', $binds);
|
\call_user_func_array('mysqli_stmt_bind_param', $binds); //you need 2 append the parameters - thats the right way to do that.
|
||||||
|
|
||||||
if(!mysqli_stmt_execute($prepStmt)){
|
if(!mysqli_stmt_execute($prepStmt)){
|
||||||
throw new \SYSTEM\LOG\ERROR("Could not execute prepare statement: ". \mysqli_stmt_error($prepStmt));}
|
throw new \SYSTEM\LOG\ERROR("Could not execute prepare statement: ". \mysqli_stmt_error($prepStmt));}
|
||||||
|
|||||||
@ -22,11 +22,11 @@ class ResultMysqliPrepare extends \SYSTEM\DB\Result{
|
|||||||
return;}
|
return;}
|
||||||
|
|
||||||
while ($field = $this->meta->fetch_field() ) {
|
while ($field = $this->meta->fetch_field() ) {
|
||||||
$this->binds[$field->name] = &$this->binds[$field->name];}
|
$this->binds[$field->table.'.'.$field->name] = &$this->binds[$field->table.'.'.$field->name];} //fix for ambiguous fieldnames
|
||||||
|
|
||||||
\mysqli_free_result($this->meta);
|
\mysqli_free_result($this->meta);
|
||||||
|
|
||||||
call_user_func_array(array($this->res, 'bind_result'), $this->binds);
|
call_user_func_array(array($this->res, 'bind_result'), $this->binds); //you need 2 append the parameters - thats the right way to do that.
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct() {
|
public function __destruct() {
|
||||||
@ -48,7 +48,7 @@ class ResultMysqliPrepare extends \SYSTEM\DB\Result{
|
|||||||
public function next($object = false, $result_type = MYSQL_BOTH){
|
public function next($object = false, $result_type = MYSQL_BOTH){
|
||||||
if(\mysqli_stmt_fetch($this->res)){
|
if(\mysqli_stmt_fetch($this->res)){
|
||||||
foreach( $this->binds as $key=>$value ){
|
foreach( $this->binds as $key=>$value ){
|
||||||
$row[ $key ] = $value;}
|
$row[substr($key, strpos($key, '.')+1)] = $value;} //fix for ambiguous fieldnames
|
||||||
return $row;}
|
return $row;}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,12 +13,14 @@ class error_handler_dbwriter extends \SYSTEM\LOG\error_handler {
|
|||||||
\SYSTEM\DBD\SYS_LOG_INSERT::Q1( array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(),
|
\SYSTEM\DBD\SYS_LOG_INSERT::Q1( array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(),
|
||||||
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5),
|
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5),
|
||||||
$_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST),
|
$_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST),
|
||||||
array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null,$_SERVER['HTTP_USER_AGENT'],
|
array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null,
|
||||||
|
array_key_exists('HTTP_USER_AGENT',$_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : null,
|
||||||
($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null, $thrown ? 1 : 0),
|
($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null, $thrown ? 1 : 0),
|
||||||
array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(),
|
array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(),
|
||||||
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5),date('Y-m-d H:i:s', microtime(true)),
|
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5),date('Y-m-d H:i:s', microtime(true)),
|
||||||
$_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST),
|
$_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST),
|
||||||
array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null,$_SERVER['HTTP_USER_AGENT'],
|
array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null,
|
||||||
|
array_key_exists('HTTP_USER_AGENT',$_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : null,
|
||||||
($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null,$thrown));
|
($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null,$thrown));
|
||||||
if(\property_exists(get_class($E), 'logged')){
|
if(\property_exists(get_class($E), 'logged')){
|
||||||
$E->logged = true;} //we just did log
|
$E->logged = true;} //we just did log
|
||||||
|
|||||||
@ -21,12 +21,16 @@ class JsonResult extends \SYSTEM\LOG\AbstractResult {
|
|||||||
//send Header
|
//send Header
|
||||||
\SYSTEM\HEADER::JSON();
|
\SYSTEM\HEADER::JSON();
|
||||||
|
|
||||||
return msgpack_pack($json);
|
if($json = msgpack_pack($json)){
|
||||||
|
return $json;}
|
||||||
|
throw new \SYSTEM\LOG\ERROR('MSGPack could not be encoded');
|
||||||
} else {
|
} else {
|
||||||
//send Header
|
//send Header
|
||||||
\SYSTEM\HEADER::JSON();
|
\SYSTEM\HEADER::JSON();
|
||||||
|
|
||||||
return json_encode($json);
|
if($json = json_encode($json)){
|
||||||
|
return $json;}
|
||||||
|
throw new \SYSTEM\LOG\ERROR('JSON could not be encoded');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,7 @@ class autoload {
|
|||||||
public static function autoload($class){
|
public static function autoload($class){
|
||||||
$classns = self::getClassNamespaceFromClass($class);
|
$classns = self::getClassNamespaceFromClass($class);
|
||||||
|
|
||||||
if(!self::autoload_($classns[0],$classns[1]) || !class_exists($class)){
|
if(!self::autoload_($classns[0],$classns[1]) || (!class_exists($class) && !interface_exists($class))){
|
||||||
throw new \SYSTEM\LOG\ERROR("Class not found: ".$class);}
|
throw new \SYSTEM\LOG\ERROR("Class not found: ".$class);}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user