Admin Login Error for Lib

A place to discuss and receive support for the Library DB application.

Admin Login Error for Lib

Postby ertewebmaster » Wed Dec 24, 2008 5:18 am

Hello,

I have this error when I try to access to the admin section:

Failed to serialize field user with value josejose
Fatal error: Cannot use object of type PEAR_Error as array in D:\xampp\htdocs\biblioteca\dataface\Dataface\Serializer.php on line 78


I've change admin name with jose and deactivated the password. I had the same error with those originals parameters.

Anybody can help me? Thanks.

Merry Chritsmas and best wishes for the New Year.

Jose
ertewebmaster
 
Posts: 3
Joined: Wed Dec 24, 2008 5:09 am

Postby shannah » Wed Dec 24, 2008 9:52 am

Hmm... This is a strange error. In the default install there are no fields in any table named 'user'. Have you added a field by that name?
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

The table

Postby ertewebmaster » Mon Dec 29, 2008 1:10 am

Hi,
This is the users table I have.

userid int(11) Null=No auto_increment
username varchar(32) latin1_swedish_ci Null=No password varchar(32) latin1_swedish_ci Null=Sí NULL
role enum('READ ONLY', 'ADMIN') latin1_swedish_ci Null=No READ ONLY

I have no user named user, the only one I have is Jose and his role is Admin.

Thanks.
ertewebmaster
 
Posts: 3
Joined: Wed Dec 24, 2008 5:09 am

Postby shannah » Mon Dec 29, 2008 8:29 pm

I can't seem to find any error messages that match exactly the errors listed here. Are these the exact messages you get, or have your paraphrased some of it?

Questions:

1. What version of librariandb are you using?
2. Can you please check the dataface/Dataface/Serializer.php file and let me know what is on line 78 and the surrounding lines?
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Librarian BD

Postby ertewebmaster » Tue Dec 30, 2008 1:23 am

Hi,

The version is 0.2 309.

And here is the serializer.php.

import( 'Dataface/Table.php');
import( 'Dataface/Error.php');
class Dataface_Serializer {


var $_table;

function Dataface_Serializer($tablename){
$this->_table =& Dataface_Table::loadTable($tablename);
}


/**
* Serializes a value that comes from the field '$fieldname'. The output from this is meant to be inserted
* into a database. Note that this output is not escaped. You will still have to do that.
*
* @param $fieldname The name of the field from which this value supposedly comes.
* @param $value The value to be serialized.
* @param handleRepeat If true (default) this will recursively serialize the individual fields of a repeat field.
*/
function serialize($fieldname, $value, $handleRepeat=true){

// check to see if the input value is a placeholder. If it is, we should pass it
// through untouched.
if ( is_string($value) and preg_match('/^__(.*)__$/', $value)){
// This fixes an issue with addRelatedRecord();
return $value;
}

if ( $value === null ){
return null;
}

if ( strpos($fieldname, '.') !== false ){
// This is a related field.
$table =& $this->_table->getTableTableForField($fieldname);
list( $relname, $fieldname) = explode('.', $fieldname);
$serializer =& new Dataface_Serializer($table->tablename);
$out = $serializer->serialize($fieldname, $value, $handleRepeat);

return $out;

}

$table =& $this->_table;
$field =& $table->getField($fieldname);

$delegate =& $table->getDelegate();
if ( $delegate !== null and method_exists($delegate, $fieldname."__serialize") ){
$val = call_user_func(array(&$delegate, $fieldname."__serialize"), $value);

return $val;
}
if ( PEAR::isError($field) ){
echo "Failed to serialize field $fieldname with value $value";
print_r($value);
}
$widget = $field['widget'];
$type = $widget['type'];


if ( $handleRepeat and $field['repeat'] and is_array($value) ){
foreach ($value as $key=>$val){
$value[$key] = $this->serialize($fieldname, $val, false);
}

$value = implode($field['separator'], $value);

}

if ($table->isDate( $fieldname ) ){
if ( !isset($value) || !$value ) return null;
$params = $value; //$field['value'];
if ( is_string($params) and strtotime($params) ){
$timestamp = strtotime($params);
switch ($table->getType($fieldname)){
case 'date':
return date('Y-m-d', $timestamp);
case 'datetime':
case 'timestamp':
return date('Y-m-d h:i:s', $timestamp);
case 'time':
return date('h:i:s', $timestamp);
case 'year':
return date('Y', $timestamp);
}

}
if ( !is_array($params) ) return null;


$datestr = str_pad($params['year'],4,"0",STR_PAD_LEFT).'-'.str_pad($params['month'],2,"0",STR_PAD_LEFT).'-'.str_pad($params['day'],2,"0",STR_PAD_LEFT);
$timestr = str_pad($params['hours'],2,"0",STR_PAD_LEFT).':'.str_pad($params['minutes'],2,"0",STR_PAD_LEFT).':'.str_pad($params['seconds'], 2,"0",STR_PAD_LEFT);

switch ( $table->getType($fieldname) ){
case 'date':
return $datestr;
//return "FROM_UNIXTIME('$datestr')";
case 'datetime':
return $datestr.' '.$timestr;
//return "FROM_UNIXTIME('$datestr $timestr')";
case 'timestamp':
return str_pad($params['year'],4,"0",STR_PAD_LEFT).str_pad($params['month'],2,"0",STR_PAD_LEFT).str_pad($params['day'],2,"0",STR_PAD_LEFT).str_pad($params['hours'],2,"0",STR_PAD_LEFT).str_pad($params['minutes'],2,"0",STR_PAD_LEFT).str_pad($params['seconds'],2,"0",STR_PAD_LEFT);
case 'time':
return $timestr;
case 'year':
return str_pad($params['year'],4,"0",STR_PAD_LEFT);
}

}

if ( $table->isInt( $fieldname ) ){
return intval($value);
}

if ( $table->isFloat( $fieldname) ){
return doubleval($value);
}




if ( is_array( $value ) ){
if ( $widget['type'] == 'table' or $widget['type'] == 'group'){
import( 'XML/Serializer.php');
$serializer =& new XML_Serializer(array('typeHints'=>true));
$ser_res =& $serializer->serialize($value);
if (!PEAR::isError($ser_res) ){
return $serializer->getSerializedData();
}
}

trigger_error("Trying to serialize value for field '$fieldname' that we don't know what to do with. The value is an array and we don't know how to parse it.\n<br>". Dataface_Error::printStackTrace(), E_USER_ERROR);

} else {


return $value;
}



}



/**
* This functions is not implemented yet, but its functionality is implicit any record's setValue() method.
* The delegate's *__parse() methods are supposed to handle deserialization.
*/
function unserialize($fieldname, $value){
trigger_error("Not implemented yet.\n<br>".Dataface_Error::printStackTrace(), E_USER_ERROR);

}


/**
* Wraps the value inside a mysql function to encrypt the input (if the 'crypt')
* attribute is selected.
*/
function encrypt($fieldname, $value=null){
if ( !isset($value) ) echo Dataface_Error::printStackTrace();
if ( strpos($fieldname, '.') !== false ){
// This is a related field.
$table =& $this->_table->getTableTableForField($fieldname);
list( $relname, $fieldname) = explode('.', $fieldname);
$serializer =& new Dataface_Serializer($table->tablename);
$out = $serializer->encrypt($fieldname, $value);

return $out;

}
$field = $this->_table->getField($fieldname);
if ( PEAR::isError($field) ){
echo $field->getMessage();
echo Dataface_Error::printStackTrace();
exit;
}
if ( isset($field['encryption']) ){
switch(strtolower($field['encryption'])){
case 'md5':
return 'MD5('.$value.')';
case 'password':
return 'PASSWORD('.$value.')';
case 'sha1':
return 'SHA1('.$value.')';
case 'encrypt':
return 'ENCRYPT('.$value.')';
}
}
return $value;
}

Thanks.
ertewebmaster
 
Posts: 3
Joined: Wed Dec 24, 2008 5:09 am

Postby shannah » Tue Dec 30, 2008 10:09 am

Actually, I was curious what was on line 78 of your Serializer.php class?
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

error adm login

Postby Skimenok » Wed May 06, 2009 1:04 am

Fatal error: Cannot use object of type PEAR_Error as array in C:\xampp\htdocs\librariandb-0.2\dataface\Dataface\Serializer.php on line 75

75-76
Code: Select all
$widget = $field['widget'];
$type = $widget['type'];


help pls.
Skimenok
 
Posts: 2
Joined: Wed May 06, 2009 12:52 am


Return to Library DB Discussion

Who is online

Users browsing this forum: No registered users and 6 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved