Warning when sending message to user

Bug #1216453 reported by Kristina Hoeppner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Invalid
High
Aaron Wells

Bug Description

latest Mahara 1.8.0dev

This is a regression.

When I send a message to a user, I get the following warning after sending the message:

[WAR] 11 (lib/activity.php:391) Creating default object from empty value
Call stack (most recent first):

    log_message("Creating default object from empty value", 8, true, true, "/home/kristina/code/18stable/htdocs/lib/activity.p...", 391) at /home/kristina/code/18stable/htdocs/lib/errors.php:446
    error(2, "Creating default object from empty value", "/home/kristina/code/18stable/htdocs/lib/activity.p...", 391, array(size 2)) at /home/kristina/code/18stable/htdocs/lib/activity.php:391
    ActivityType->add_urltext(array(size 2)) at /home/kristina/code/18stable/htdocs/lib/activity.php:796
    ActivityTypeUsermessage->__construct(object(stdClass), false) at /home/kristina/code/18stable/htdocs/lib/activity.php:77
    handle_activity(object(stdClass), array(size 4)) at /home/kristina/code/18stable/htdocs/lib/activity.php:50
    activity_occurred("usermessage", array(size 4)) at /home/kristina/code/18stable/htdocs/lib/user.php:1512
    send_user_message(object(stdClass), "Hello Paula, Do you want to meet for lunch next w...", null) at /home/kristina/code/18stable/htdocs/user/sendmessage.php:117
    sendmessage_submit(object(Pieform), array(size 4)) at Unknown:0
    call_user_func_array("sendmessage_submit", array(size 2)) at /home/kristina/code/18stable/htdocs/lib/pieforms/pieform.php:528
    Pieform->__construct(array(size 3)) at /home/kristina/code/18stable/htdocs/lib/pieforms/pieform.php:170
    Pieform::process(array(size 3)) at /home/kristina/code/18stable/htdocs/lib/pieforms/pieform.php:71
    pieform(array(size 3)) at /home/kristina/code/18stable/htdocs/user/sendmessage.php:105

Tags: regression
Aaron Wells (u-aaronw)
tags: added: regression
Aaron Wells (u-aaronw)
Changed in mahara:
assignee: nobody → Aaron Wells (u-aaronw)
Revision history for this message
Aaron Wells (u-aaronw) wrote :

Hi Kristina,

I was unable to replicate the error. Can you provide some more details?

 - Are you still able to replicate the error?

 - Does it matter what text the message contains?

 - Does it matter whether the recipient has user messages set to go to their Inbox, email, or email digest?

Cheers,
Aaron

Revision history for this message
Aaron Wells (u-aaronw) wrote :

While testing this I did get an error in my cron logs for activity_process_queue, which is the cron task that handles notifications. So this may be related. It appears to be trying to get the URL for a non-existent group.

[INF] 9e (lib/cron.php:153) Running core cron activity_process_queue
[DBG] 9e (lib/activity.php:224) profile_url called with no user id
[WAR] 9e (lib/errors.php:749) Failed to get a recordset: postgres7 error: [-2: ERROR: syntax error at or near "LIMIT"
[WAR] 9e (lib/errors.php:749) LINE 1: SELECT * FROM "group" WHERE "id" = ? LIMIT 2
[WAR] 9e (lib/errors.php:749) ^] in adodb_throw(SELECT * FROM "group" WHERE "id" = ? LIMIT 2, )
[WAR] 9e (lib/errors.php:749) Command was: SELECT * FROM "group" WHERE "id" = ?
Call stack (most recent first):
  * log_message("Failed to get a recordset: postgres7 error: [-2: E...", 8, true, true) at /home/aaronw/www/mahara/htdocs/lib/errors.php:109
  * log_warn("Failed to get a recordset: postgres7 error: [-2: E...") at /home/aaronw/www/mahara/htdocs/lib/errors.php:749
  * SQLException->__construct("Failed to get a recordset: postgres7 error: [-2: E...") at /home/aaronw/www/mahara/htdocs/lib/dml.php:492
  * get_recordset_sql("SELECT * FROM "group" WHERE "id" = ? ", array(size 0), 0, 2) at /home/aaronw/www/mahara/htdocs/lib/dml.php:333
  * get_record_sql("SELECT * FROM "group" WHERE "id" = ? ", array(size 0)) at /home/aaronw/www/mahara/htdocs/lib/dml.php:310
  * get_record("group", "id", null) at /home/aaronw/www/mahara/htdocs/lib/view.php:775
  * View->get_group_object() at /home/aaronw/www/mahara/htdocs/lib/view.php:4428
  * View->get_url(false) at /home/aaronw/www/mahara/htdocs/lib/activity.php:960
  * ActivityTypeViewaccess->__construct(object(stdClass), true) at /home/aaronw/www/mahara/htdocs/lib/activity.php:77
  * handle_activity("4", object(stdClass), true) at /home/aaronw/www/mahara/htdocs/lib/activity.php:219
  * activity_process_queue() at /home/aaronw/www/mahara/htdocs/lib/cron.php:158

[DBG] 9e (lib/activity.php:224) Failed to get a recordset: postgres7 error: [-2: ERROR: syntax error at or near "LIMIT"
[DBG] 9e (lib/activity.php:224) LINE 1: SELECT * FROM "group" WHERE "id" = ? LIMIT 2
[DBG] 9e (lib/activity.php:224) ^] in adodb_throw(SELECT * FROM "group" WHERE "id" = ? LIMIT 2, )
[DBG] 9e (lib/activity.php:224) Command was: SELECT * FROM "group" WHERE "id" = ?

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

This actually is also a problem on my local 1.7 instance that I use for the user manual. DB sent to Aaron.

Aaron Wells (u-aaronw)
Changed in mahara:
milestone: 1.8rc1 → 1.8.0
Aaron Wells (u-aaronw)
Changed in mahara:
milestone: 1.8.0 → 1.7.4
Revision history for this message
Robert Lyon (robertl-9) wrote :

This might have been fixed by patch https://reviews.mahara.org/#/c/2621

Newer versions of php like to have objects created before adding things to them.

So one can't do this:
 $this->strings->urltext = (object) $def;

If $this->strings is not yet an object

so declaring it first

if (!is_object($this->strings)) {
 $this->strings = new stdClass();
}

fixes the error

Revision history for this message
Jono M (jonom) wrote :

I can't reproduce in the latest master (1.9 dev) (and I do have a PHP version which complains about that sort of thing)

Revision history for this message
Aaron Wells (u-aaronw) wrote :

We'll set it to "invalid" for now, then.

Changed in mahara:
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.