Objects are not allowed

Objects are not allowed

by Luis H. Wu -
Number of replies: 5

Hi,

We are trying to create a feedback in a course and we get this error. :

 

Coding error detected, it must be fixed by a programmer: Invalid database query parameter value

More information about this error

Debug info: Objects are are not allowed: stdClass
Error code: codingerror
Stack trace:
  • line 716 of /lib/dml/moodle_database.php: coding_exception thrown
  • line 731 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->detect_objects()
  • line 1089 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->normalise_value()
  • line 107 of /mod/assign/index2.php: call to mysqli_native_moodle_database->insert_record()

 

Someby help me?

 


Thanks!

Average of ratings: -
In reply to Luis H. Wu

Re: Objects are not allowed

by Andrew Normore -

Some times you can get away with

(array) $objectName

In reply to Andrew Normore

Re: Objects are not allowed

by Damyon Wiese -

mod/assign/index2.php

is not a file shipped with Moodle and so it must be a local customisation. You should report this to you system administrator and get them to debug the problem.

Regards, Damyon

In reply to Damyon Wiese

Re: Objects are not allowed

by Luis H. Wu -

index2.php is a copy of index.php in order to not modify the original one. We are trying to design a new mod making some testing and we can't solve that problem...

In reply to Andrew Normore

Re: Objects are not allowed

by Luis H. Wu -

We have tryed that too, and it doesn't work.

 

Thank you anyway!

In reply to Luis H. Wu

Re: Objects are not allowed

by Arindam Das -
Rather later response... but still..

When you save objects like 
$DB->insert_record('my_table', $myobject);

Moodle expects $myobject to be a simple object each attribute mapping to same named objects in database. Probably in your insert (there can be other type statements too) you have a complex object inside myobject, hence the problem.