warning: Attempt to modify property of non-object in [..]\sites\all\modules\contrib\date\includes\date_plugin_display_attachment.inc on line 24.

File: date/includes/date_plugin_display_attachment.inc
Class: date_plugin_display_attachment
Method: date_plugin_display_attachment::options(&$display)

<?php
  function options(&$display) {
    parent::options($display);
    $display->display_options['style_plugin'] = 'date_nav';
    $display->display_options['items_per_page'] = 0;
    $display->display_options['row_plugin'] = '';
    //$display->display_options['defaults']['style_plugin'] = FALSE;
    $display->display_options['defaults']['style_options'] = FALSE;
    $display->display_options['defaults']['items_per_page'] = FALSE;
    $display->display_options['defaults']['row_plugin'] = FALSE;
    $display->display_options['defaults']['row_options'] = FALSE;
  }
?>

Called here:
File: views/includes/base.inc, line 57
Class: views_object
Method: views_object::set_default_options()

<?php
  /**
   * Set default options.
   * For backward compatibility, it sends the options array; this is a
   * feature that will likely disappear at some point.
   */
  function set_default_options() {
    $this->_set_option_defaults($this->options, $this->option_definition());

    // Retained for complex defaults plus backward compatibility.
    $this->options($this->options);
  }
?>

Problems/Questions:
- Obviously the argument is an array, whereas the function assumes an object.
- Moreover, I get the idea the function is not intend to take $this->options as the argument.
- If the argument is supposed to be an object, then why the call by reference?
- Where is that function supposed to be called with an object?

The problem did not cause any error messages before I moved to PHP 5.3. But in this case, I think it's quite obvious that the error message (or warning) is justified.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

designerbrent’s picture

subscribing

arosemartin’s picture

subscribing

thekevinday’s picture

This problem happens to me when I run update.php.

    * warning: Attempt to modify property of non-object in /var/www/html/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 24.
    * warning: Attempt to modify property of non-object in /var/www/html/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 25.
    * warning: Attempt to modify property of non-object in /var/www/html/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 26.
    * warning: Attempt to modify property of non-object in /var/www/html/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 28.
    * warning: Attempt to modify property of non-object in /var/www/html/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 29.
    * warning: Attempt to modify property of non-object in /var/www/html/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 30.
    * warning: Attempt to modify property of non-object in /var/www/html/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 31.
izmeez’s picture

I encountered the same problem today while trying to bring a live site with Drupal 6.14 locally onto xampp 1.72 which is using PHP 5.3

I'll take a step back to an earlier version of xampp and see if it solves my problems.

Izzy

karimansu’s picture

Same here.

This is my first time with Drupal and i am getting the same error.
XAMPP 1.72 over windows here.

And i am getting this too:
warning: Parameter 1 to admin_menu_admin_menu() expected to be a reference, value given in F:\xampp\htdocs\drupal\includes\module.inc on line 471.

just_N’s picture

Version: 6.x-2.x-dev » 6.x-2.4

This is happening to me on both Drupal 6.13 and 6.14 running php 5.3.

Running apache and php through Snow Leopard.

Lars Vandergraaf’s picture

I get the following errors with 6.14. Modules installed: Core 6.14, CCK 6.x-2.5, Calendar 6.x-2.2, Date 6.x-2.4, Views 6.x-2.6. This is a XP OS and xampp 1.7.2 which includes PHP 5.3.

warning: Attempt to modify property of non-object in C:\xampp-win32-1.7.2\xampp\htdocs\drupal-6.14\modules\date\includes\date_plugin_display_attachment.inc on line 24.
(lines 24-31)

warning: Attempt to modify property of non-object in C:\xampp-win32-1.7.2\xampp\htdocs\drupal-6.14\modules\calendar\includes\calendar_plugin_display_page.inc on line 47.
(lines 47-55)

warning: Attempt to modify property of non-object in C:\xampp-win32-1.7.2\xampp\htdocs\drupal-6.14\modules\calendar\includes\calendar_plugin_display_block.inc on line 50.
(lines 50-58)

warning: Attempt to modify property of non-object in C:\xampp-win32-1.7.2\xampp\htdocs\drupal-6.14\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 164.
(lines 164-167) 5 Times

If I toggle off calendar I only get the warning: Attempt to modify property of non-object in C:\xampp-win32-1.7.2\xampp\htdocs\drupal-6.14\modules\date\includes\date_plugin_display_attachment.inc on line 24.
(lines 24-31) which would indicate the date and view are not playing well together.

If I toggle off view and calendar, all errors go away as well as my cunning plan to include the ability to define events with a calendar.

PS. I have no skills at fishing, I live off the kindness of those that can fish.

izmeez’s picture

The problem goes away with an earlier version of XAMPP with php 5.2.x
Also, if you are transferring data back and forth between test and live sites it was VERY important to make sure the xampp php version matches that on the live server.

Izzy

Lars Vandergraaf’s picture

Do you have a link for an earlier version of xampp with php 5.2.x?

thekevinday’s picture

For the time being I wrote a band-aid that just works around the warning.
This probably does not solve the problem, but on production systems it at least keeps things a little quieter until a proper solution is made.

all this patch does is wrap the problematic section in the following if condition:

<?php
  if (is_object($display)){
  }
?>
izmeez’s picture

The XAMPP page gives a link to all earlier versions, they are housed on SourceForge. Look at the release notes to decide which you want. http://sourceforge.net/projects/xampp/files/

I believe,
1.6.8 uses php 5.2.6
1.70 uses php 5.2.8
1.7.1 uses 5.2.9
1.7.2 uses 5.3

mikeytown2’s picture

subscribe

drasgardian’s picture

subscribing.

applied patch from #10 for the time being.

infojunkie’s picture

subscribe

davepoon’s picture

Same problem here.
I use acquia-drupal-1.2.16.5106, PHP5.3 and Zend Server CE.
Just subscribe this to wait for the update.

Martijn de Wit’s picture

subscribe

The new PHP version is not only causing problems with Date...
I get errors with Admin and Views 2 !

I went back to PHP Version 5.2.9. Everything works fine now...

highfellow’s picture

subscribing. The bug doesn't seem to break any calendar functions, so I'll try just applying patch #10.

Geoffrey-2’s picture

subscribing

Sree’s picture

subscribing

vasike’s picture

subscribe
#10 works for me

Rosamunda’s picture

+1!

W32’s picture

I also have this warning.

Apache/2.2.13 (Win32) PHP/5.3.0

W32’s picture

No you should remove '&' in &$display argument.
In PHP 5.3 function must be: function options($display).

kentr’s picture

+1

Agree with W32 that just removing the ampersand may be sufficient. Appears to be general php 5.3 pass by reference problem.

kdhartstrom’s picture

I am also running PHP 5.3 and getting the error. I tried removing the & ampersand from the options function and I'm still getting the error.

So my date_plugin_display_attachment.inc line 22 reads:
function options($display) {

and i still the following errors when I visit the modules page:
* warning: Attempt to modify property of non-object in /home/drupal/drupal/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 24.
* warning: Attempt to modify property of non-object in /home/drupal/drupal/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 25.
* warning: Attempt to modify property of non-object in /home/drupal/drupal/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 26.
* warning: Attempt to modify property of non-object in /home/drupal/drupal/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 28.
* warning: Attempt to modify property of non-object in /home/drupal/drupal/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 29.
* warning: Attempt to modify property of non-object in /home/drupal/drupal/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 30.
* warning: Attempt to modify property of non-object in /home/drupal/drupal/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 31.

thisgeek’s picture

Simply removing the ampersand did not work for me. Instead, I assumed that $display is an array. I'm not sure why it is expected to be an object, but I think I must be missing something.

This is related to an issue with the calendar module: http://drupal.org/node/613528, http://drupal.org/node/587424

davidwatson’s picture

Confirmed that removing the ampersand doesn't work. To clarify, PBR still works just fine, but passing variables by reference at runtime (calling foo(&$bar) rather than defining function foo(&$baz) and passing $bar) has been deprecated. See http://php.net/manual/en/language.references.pass.php.

davidwatson’s picture

Did some more digging... To the best of my understanding, the set_default_options() method in views_object (that ultimately calls this) exists mostly for backwards compatibility, and it always deals with arrays - not objects. So I'd agree that the warning is justified, and would add that patch #10 may break the backwards compatibility the function affords - albeit in a way harmless to most environments. In theory, it should only be getting an array, so testing whether it's an object should always result in a failure, leaving some defaults unset. It seems a better solution would be to do something similar to the else block in #21, manipulating the array as it was originally intended.

Anyone more familiar with the codebase, please feel free to correct me if I'm completely off-base here. :]

davidwatson’s picture

Status: Active » Needs review
FileSize
1.4 KB

Just tested the following fix; everything appears to work as it should. I just submitted a similar patch for review on the Calendar issue queue (http://drupal.org/node/613528#comment-2250424) for those interested. Review and feedback welcome!

fuerst’s picture

Status: Needs review » Reviewed & tested by the community

Patch works. I double checked by looking in the Views code for the options() method. Only found one in the class views_object which is empty and does lack documentation of its parameters. But by looking around it seems usual for the $option parameter to be an array, not an object.

tnanek’s picture

Works for me as well.

WSRyu’s picture

Nope, patch doesn´t work for me! this is the error i get upon clickin on save.

Parse error: parse error in C:\wamp\www\drupal-6_14\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 47

i edited the patch by hand and im pretty sure i did exactly as the patch mentioned.
any ideas?

davidwatson’s picture

What you have above is an issue with the calendar module, where you have already posted. Please be sure that you are posting in the right issue queue in the future.

misahs’s picture

subscribing

baldrick’s picture

Patch #30 works for me on IIS 6, PHP 5.3.1

baldrick’s picture

Ups, not really working... got warning: Attempt to modify property of non-object in calendar_plugin_display_page.inc for admin/views
Applied the patch from http://drupal.org/node/613528
calendar-6.x-2.2-613528-5.patch
It seems ok now.

davidwatson’s picture

That's because if you look at the warning, it was from the calendar module, not date. ;]

I rolled both patches, they're intended to be used together if you're running calendar+date.

fractile81’s picture

+1 to the patch in #30. I had this same problem, and this fixes it.

KarenS’s picture

Status: Reviewed & tested by the community » Needs work

There are numerous issues like this all around Drupal. If you make this change, it may not work in PHP 4 and we're still supporting PHP4 in this version. This module is not the only one that has this problem, there are many others, including some core modules. PHP 5.3 may just be incompatible with code that tries to support PHP 4. And which version of Views are you testing against, Views 2 or Views 3?

If someone can thoroughly test that this won't break things in PHP 4, I'll consider it, but I don't have time to do that and I can't commit the change without that.

donquixote’s picture

Hi Karen, thanks for showing up!
I think this case is a bit different from the usual call-by-reference problems. The code we have here doesn't make much sense for PHP4 either.

KarenS’s picture

Except that you removed the reference, which looks like it will break things in PHP4. I'm inching closer to just abandoning support for PHP 4 tho, for all it's many problems.

Yes I see that you changed it from an object to an array. That's why I asked about the Views version because at some point it was an object.

davidwatson’s picture

Thanks for the feedback, Karen!

These were tested using the latest Dev of Views 2, at least in my case. Admittedly I'm only just getting accustomed to the codebase, so it makes more sense knowing that this used to be an object at some point. Things are a bit hellish here too, but once I can steal a moment I'd be happy to run some more thorough tests on different environments and roll a new patch if necessary. That said, if anyone else could confirm one way or the other, I'd really prefer not to RTBC my own work. ;]

kcolbe’s picture

So what's wrong with the patch in block #21?

arlinsandbulte’s picture

Title: date_plugin_display_attachment::options(&$display) wrongly assumes an object as argument. » PHP 5.3 issue - Attempt to modify property of non-object

Changed title to match related issue in the Calendar Module: #613528: PHP 5.3 issue - Attempt to modify property of non-object (Calendar Module)

donquixote’s picture

Title: PHP 5.3 issue - Attempt to modify property of non-object » PHP 5.3 issue - Attempt to modify property of non-object (Date module)

The new title is less specific, but it's probably better for googling the error message.
On the other hand, changes in the issue title are never a nice thing for subscribed users. I am undecided. If others want to revert to the old title, feel free to do so.

Anyway: My issue tracker doesn't tell me which project an issue refers to, so I add the project name in the issue title. That is so long as we have the new title.

davidwatson’s picture

I was operating under the assumption that an object would never result (it never did when testing Views 2), unaware that prior versions of Views behaved this way... before my time, I suppose. :] I'd think something like #21 would work, provided we be mindful of references and PHP 4 compatibility as Karen suggests.

I won't be able to touch this for another couple days, at least. If someone else wants to get the ball rolling with testing, I can help review when I'm free again.

Anonymous’s picture

subscribing

Coupon Code Swap’s picture

#30 works for me

veltechh’s picture

how to install patch and which path i will copy patch files?

killua99’s picture

#30 works for me too.

EliseVanLooij’s picture

subscribing

aenw’s picture

subscribing

tauno’s picture

It's not a direct fix, but it seems like making the changes needed for #698522: Make date compatible with both views 2 and views 3 might happen to resolve this issue (at least the specific code targeted in #30) since views_handler::option_definition() doesn't even take an argument.

vorbian’s picture

subscribing

scrowder’s picture

Subscribing

humanoc’s picture

subscribing

duntuk’s picture

subscribing

kentr’s picture

Issue tags: +PHP 5.3

Added tag for PHP 5.3 issue tracking.

humanoc’s picture

I had to downgrade to XAMPP 7.1 to avoid this error.

Dr Jay’s picture

subscribing

killua99’s picture

#30 works for me too. But I didn't apply the patch, I re-write the code at line:

date/includes/date_plugin_display_attachment.inc -> 24
calendar/includes/calendar_plagin_display_page.inc -> 74
calendar/includes/calendar_plagin_display_block.inc -> 50
calendar/includes/calendar_plagin_display_attachment.inc -> 164

Like this;

<?php
  function options($display) {
    parent::options($display);
    if ( is_object($display) ) {
      $display->display_options['displays'] = array();
      $display->display_options['style_plugin'] = 'calendar_nav';
      $display->display_options['items_per_page'] = 0;
      $display->display_options['row_plugin'] = '';
      $display->display_options['defaults']['style_plugin'] = FALSE;
      $display->display_options['defaults']['style_options'] = FALSE;
      $display->display_options['defaults']['items_per_page'] = FALSE;
      $display->display_options['defaults']['row_plugin'] = FALSE;
      $display->display_options['defaults']['row_options'] = FALSE;
    } else {
      $display['display_options']['displays'] = array();
      $display['display_options']['style_plugin'] = 'calendar_nav';
      $display['display_options']['items_per_page'] = 0;
      $display['display_options']['row_plugin'] = '';
      $display['display_options']['defaults']['style_plugin'] = FALSE;
      $display['display_options']['defaults']['style_options'] = FALSE;
      $display['display_options']['defaults']['items_per_page'] = FALSE;
      $display['display_options']['defaults']['row_plugin'] = FALSE;
      $display['display_options']['defaults']['row_options'] = FALSE;
    }
  }
davidwatson’s picture

The $display param in #30 (the patch I submitted) really should be passed by reference anyway; I have no idea why it's not, so I'll go ahead and blame some combination of caffeine and sleep deprivation. If I get a chance to re-roll it today, I'll do that, otherwise it'll probably be pushed off to a future sprint for me.

mukwenhac’s picture

#62 Works for me.

Thanks and these changes have to be applied on every file for it to function!

cksachdev’s picture

Same issue here.. how it can be resolved ?

* warning: Attempt to modify property of non-object in D:\xampp\xampp\htdocs\atrium\sites\all\modules\contrib\date\includes\date_plugin_display_attachment.inc on line 24.
* warning: Attempt to modify property of non-object in D:\xampp\xampp\htdocs\atrium\sites\all\modules\contrib\date\includes\date_plugin_display_attachment.inc on line 25.
* warning: Attempt to modify property of non-object in D:\xampp\xampp\htdocs\atrium\sites\all\modules\contrib\date\includes\date_plugin_display_attachment.inc on line 26.
* warning: Attempt to modify property of non-object in D:\xampp\xampp\htdocs\atrium\sites\all\modules\contrib\date\includes\date_plugin_display_attachment.inc on line 28.
* warning: Attempt to modify property of non-object in D:\xampp\xampp\htdocs\atrium\sites\all\modules\contrib\date\includes\date_plugin_display_attachment.inc on line 29.
* warning: Attempt to modify property of non-object in D:\xampp\xampp\htdocs\atrium\sites\all\modules\contrib\date\includes\date_plugin_display_attachment.inc on line 30.
* warning: Attempt to modify property of non-object in D:\xampp\xampp\htdocs\atrium\sites\all\modules\contrib\date\includes\date_plugin_display_attachment.inc on line 31.

Cherrybark’s picture

#62 works here. Nice job and thanks for simply showing the code.

anthrocks’s picture

subscribing

kash99’s picture

#62 works like a charm

tpainton’s picture

Patch #30 solved for me.

AdrianB’s picture

Manual patch in #62 worked for me.

mikejonesok’s picture

Thanks for the patch #30

yarco’s picture

Same issue as #65 said after i delete a field which created by cck module.
But after wait a few time and then refresh the page, the error disappeared...

sun’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
1.41 KB

$options never seem to be an object anywhere.

Fixed the PBR in #30

iw’s picture

subscribing

innerfly’s picture

#73 work ok thanks

davidwatson’s picture

Thanks for the fix Sun! I was moved to another project not long ago, so this dropped off my radar for a bit.

Confirmed in PHP 5.3 (Views 2).

mikekern’s picture

The patch gets rid of the errors for me, but when I try to go to Date and Time settings in site configuration, I get a blank page. The Apache error log shows segmentation fault (11) error messages every time. Any ideas?

mikekern’s picture

subscribing

mcneill’s picture

Subscribing

roald’s picture

Subscribing

KarenS’s picture

Status: Reviewed & tested by the community » Fixed

Should be fixed with more comprehensive patch in #698522: Make date compatible with both views 2 and views 3.

craigperks’s picture

At work we use version cotrol to work on projects and recently downloading a site from our live server I had a similar error. It turned out that the mod_rewrite within apache wasn't switched on. I turned it on, rebooted wamp and now it's fine.

b3liev3’s picture

I applied the patch and it works.

b3liev3’s picture

It's the same with calendar too.

It's a PHP 5.3 issue. It's happening the same in several modules.

zilched’s picture

#62 worked for me. cheers

hawleyal’s picture

In what way was this fixed?

2.4 and dev still have the bug.

Shouldn't it only get fixed when actually committed?

-AH

hawleyal’s picture

Patch in #73 works in 2.4.

Desmatt-1’s picture

# 62 is ok for WAMP 2.0i and Drupal 6.16

but the views-6.x-2.8 problem, of course, remains...finally worked around

danbrelsford’s picture

Assigned: Unassigned » danbrelsford

#73 seems to work. Much obliged.

cantarella’s picture

I was having the same issue but #10 resolved it.

I see no more warning sign related to date_plugin_display_attachment.inc

Thank you!

chientai’s picture

I follow the method of #62 except on the file date/includes/date_plugin_display_attachment.inc -> 24, I change the code
$display->display_options['style_plugin'] = 'calendar_nav';
to
$display->display_options['style_plugin'] = 'date_nav';

Everything seems ok, but when I want to modified "view", it shows a blank page. Is there anybody encountering this?

a5342346’s picture

subscribing

webel’s picture

subscribing

Sylvain_G’s picture

Subscribe

jweberg’s picture

I'm running on the combination of Calendar+Date on two different servers. One has PHP 5.2 and the other PHP 5.3. No errors on the 5.2 server. Can we get an official patch to 5.3 or maybe a module update that would support both PHP versions?

sbefort’s picture

#62 is a sweet 5-second fix.

aquila’s picture

Having the same issue, subscribing

semantric’s picture

Same issue.

basil.shine’s picture

I had the same problem and fixed it by editing admin_module.
in admin_menu.inc changed this:

function admin_menu_admin_menu(&$deleted) { ...

to this

function admin_menu_admin_menu($deleted) { ...

and this problem with date module disappeared.

bdmak’s picture

subscribing

int’s picture

Assigned: danbrelsford » Unassigned
Status: Fixed » Needs review

It give me the php5.3 error, so isn't fixed

ar-jan’s picture

When I updated to the April 14 (I think) 6.x-2.x-dev version the issue seemed solved, but now that I updated to the latest (May 2) I'm getting the warnings again.

enkara’s picture

subscribing

stif’s picture

subscribing

micksyu’s picture

subscribing

ami7878’s picture

I also encountered this issue after upgrading to php5.3. This patch worked for me :)

Thanks.

n4rky’s picture

Apart from the fact I'm an idiot who has *no clue* about PHP, #62 worked great for me.

Andrew Schulman’s picture

subscribing

davidwatson’s picture

Status: Needs review » Fixed

Please read the entire issue queue before changing the status, especially the fix linked to in #81. If you still have issues, please post the full error message with steps to duplicate the problem, and bear in mind that many similar modules can spit out similar errors. Otherwise, it's a bit tough for us to track down exactly what's causing it. :]

Reg’s picture

Subscribing

Peng.Pif’s picture

Status: Fixed » Needs review

Subscribe.

Reg’s picture

Status: Needs review » Fixed

Sorry, I changed the status before after a long night and missing a critical detail so I'm putting it back as fixed.

charlieman’s picture

suscribing

Is #73 the definitive fix?

aaron.r.carlton’s picture

Subscribing - #73 appeared to fix the issue for me. Looking forward to another release to address this issue.

phunster’s picture

#73 appears to have worked for me.

Thank you sun

wildel’s picture

subscribing

queenielow’s picture

#62 works for me..
Thanks!

mjh2901’s picture

Subscribing #99 worked for me.

eFeS’s picture

#73 worked for me. Thanks!

FreeFox’s picture

Subscribing

Anonymous’s picture

subscribing

elally’s picture

Subscribe

ducdebreme’s picture

patch #73 worked for me

jcicolani’s picture

same problem here... the patches from #30 and #71 sis not resolve. This occurred after moving my modules from root/modules to root/site/all/modules and ran update.php.

XAMPP v.1.7.3
Windows 7
Drupal 6.16

Note: The patch worked when the Date module was in root/modules but did not work in root/sites/all/modules


    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\date\includes\date_plugin_display_attachment.inc on line 24.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\date\includes\date_plugin_display_attachment.inc on line 25.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\date\includes\date_plugin_display_attachment.inc on line 26.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\date\includes\date_plugin_display_attachment.inc on line 28.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\date\includes\date_plugin_display_attachment.inc on line 29.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\date\includes\date_plugin_display_attachment.inc on line 30.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\date\includes\date_plugin_display_attachment.inc on line 31.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 47.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 48.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 49.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 50.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 51.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 52.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 53.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 54.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 55.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_block.inc on line 50.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_block.inc on line 51.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_block.inc on line 52.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_block.inc on line 53.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_block.inc on line 54.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_block.inc on line 55.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_block.inc on line 56.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_block.inc on line 57.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_block.inc on line 58.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 164.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 165.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 166.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 167.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 164.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 165.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 166.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 167.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 164.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 165.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 166.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 167.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 164.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 165.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 166.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 167.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 164.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 165.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 166.
    * warning: Attempt to modify property of non-object in G:\xampp\xampp\htdocs\workshops\sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc on line 167.
jcicolani’s picture

Solved... manually updated code in:

sites\all\modules\calendar\includes\calendar_plugin_display_attachment.inc
sites\all\modules\calendar\includes\calendar_plugin_display_block.inc
sites\all\modules\date\includes\date_plugin_display_attachment.inc

per fix in #62

Patch did not apply properly so I fat fingered it.

krsumani’s picture

Fix #62 did not work. It's failing in the else block with the same messages
" warning: Attempt to modify property of non-object in"

I fixed the code the following way. The error message disappeared. Please comment if you see any problem with the fix. The following should be changed in all the files giving error.

Changed the php code "$display->display_options['inherit_argments'] = TRUE;" to "$display['inherit_argments'] = TRUE;".

kentr’s picture

@krsumani:

Given the other suggested fixes, I'm surprised if everything functioned correctly after the change you made... If not, use this instead:

$display['display_options']['inherit_argments'] = TRUE;

Anyone know why this would suddenly appear on PHP 5.3?

colan’s picture

Subscribe.

fuerst’s picture

I think many of you have shown their interest in this issue now by subscribing to it. To the next Subscribers: Please don't subscribe if you don't have something helpful to say. It is just annoying to have this issue popping up in my issue list just because another Subscriber stepped in. Thanks a lot in advance!

AdrianB’s picture

@fuerst #129: So you decides who should and should not subscribe to issues on d.o.?

The problem is not people subscribing, it's the system which does allow for any other way to subscribing to topics. It is very ease to get lost on issues and topics on d.o. and sometimes you find interesting issues and development that you what to keep a close eye on. Posting a comment is the only way to put an issue or a topic on your watch list. It's a well known problem and people are working on it afaik.

But in the meantime, I think it's rude to say to others that they have no right to subscribe and follow this issue just because you're annoyed.

fuerst’s picture

I appreciate your need to keep you informed about the progress on issues. I also see the information dust provided by subscriptions like described above as a problem. Here is why: every time someone just subscribes to track an issue a red flag will appear in the My issue list of every other subscriber. This will be multiplied by all issues where people are just subscribing. Do you think it is good practice to force people doing real work to manage that unnecessary information dust just because someone wants to track an issue in his My issue list? For me it is not. Why not managing your own list of issues using another system like a simple file, your personal Wiki or Blog or just Emails as long as drupal.org does not allow better tracking of issues? In my point of view it is more important to support module developers than to maintain your own My issue list. May be I'm wrong - then this is just another particle of the information dust..

donquixote’s picture

Why not managing your own list of issues using another system like a simple file, your personal Wiki or Blog or just Emails as long as drupal.org does not allow better tracking of issues?

If you know a good method that actually works, write a tutorial and post it somewhere. So far, I don't see any such alternative.

And btw, even core and contrib developers write "subscribe" posts.

arlinsandbulte’s picture

@fuerst #129: Right now, adding a 'subscribe' comment is the only way for people to subscribe to issues they are interested in.
While I agree with AdrianB, I also feel your pain.

This subscribe issue is being addressed elsewhere:
#34496: [meta] Add Flag module to allow users to subscribe/unsubscribe without posting a comment
http://3281d.com/2009/03/27/death-to-subscribe-comments

You can and should continue this conversation over there.
Better yet, contribute to help that issue along.

Yusuf’s picture

Subscribe.

Zagonetka’s picture

#62 worked for me, thanks!!

cheers!

mari3.14’s picture

#73 worked for me, ta!

Cheerio!

arlinsandbulte’s picture

To all who are having this problem and/or are following this issue:

This issue is FIXED in the -dev version of date!

You do not need apply the patch, just install the -dev version if you are having this problem.

steggall’s picture

Hmmm, I installed the Dev. version of Date module (6.x-2.x-dev), ran update and I'm still getting the same error.

I've got PHP 5.3.2-1ubuntu4.2 with Suhosin-Patch (cli) (built: May 13 2010 20:03:45) running on Ubuntu server 10.04 LTS. Sigh...

warning: Attempt to modify property of non-object in
/var/www/drupal-6.17/sites/all/modules/calendar/includes/calendar_plugin_display_page.inc on line 47

Update: Sorry, I was getting the date_plugin_display_attachment errors too. After installing the 6.x-2.x-dev version of date and the calendar-6.x-2.2-613528-5.patch, I seem to be clear of both problems now...

-js

arlinsandbulte’s picture

@steggall
The error you describe is from the Calendar module, not the Date module.
See this Calendar issue: #613528: PHP 5.3 issue - Attempt to modify property of non-object (Calendar Module)

stixes’s picture

subscribed. #30 worked a charm

tribe_of_dan’s picture

Installing XAMPP 1.7.1 worked for me.

jeff.maes’s picture

#30 worked for me!
I've used Eclipse to install the patch. There is a manual at http://drupal.org/patch/apply

guignonv’s picture

patch #73 worked for me too.

afriend’s picture

code @62 worked for me!. thanks a lot.
just to note. no need to write "else" part of the code.
cheers!

klucid’s picture

Yes, the dev version worked for me! Thanks!

Sylvain_G’s picture

#137 nice job dude

Carlos Miranda Levy’s picture

Nonetheless, installing the dev version brings additional errors, requiring the following patches to be applied against dev:

http://drupal.org/node/518816#comment-3008038

http://drupal.org/node/518816#comment-3027232
(which actually is http://drupal.org/node/772180#comment-2904768 - but that thread has been marked as duplicate).

anionsuarez’s picture

Manual patch in #62 worked for me too, thanks

glazer’s picture

I was able to fix this by setting the timezone in the http://www.example.com/admin/settings/date-time page, which you can get to by going to Site Configuration->Date and time.

alxsvdr’s picture

I tried dev version, it didn't work. Then I applied #73 from sun and it's working fine. PHP 5.3.2 here. Thanks!

int’s picture

Status: Fixed » Active

I think that we need to review again if this is fixed or not.

youngros’s picture

I have this issue with Prosepoint installed on Ubuntu 10.04 and php5.3 is the default php.

Perhaps I am missing something but I don't know how I am supposed to apply these patches, is there anything that tells you how please?

kentr’s picture

@youngros:

Drupal patches follow a standard "diff" format, for which the method of applying a patch to a set of files is also standard in the programming world.

Bottom line is that you need to use a common developer's patching tool, like the unix "patch" command. There are many tools out there - some systems have them built-in, some are more user-friendly, etc.

Search Drupal.org for the handbook page on applying patches, but if it's confusing or you can't find it, google for general information on how to apply patches on the system that you're using.

gfxguru’s picture

subscribe

foka’s picture

subscribe

FiNeX’s picture

subscribe

felix_ugf’s picture

It is simple just to go and modify the files they said that had warning change the
$display->display_options['row_plugin'] = '';

for a

$display['display_options']['row_plugin'] = '';

and that's it.. exactly the same what it said #21

felix_ugf’s picture

Now if after doing that you still getting a error something like this:

warning: Parameter 1 to admin_menu_admin_menu() expected to be a reference, value given in includes/module.inc on line 471.

then you can go ahead and look here... http://drupal.org/node/360605 the path php53_warnings.patch work for me...

agerson’s picture

+1
subscribe

ShutterFreak’s picture

I had the same PHP5.3 errors on the Date module until I applied the patch in #73.

I assume the next official release of Date/Calendar will provide a fix for this issue.

lucascaro’s picture

Status: Active » Patch (to be ported)

patch still working in 6.x-2.4

Please include in the next release.

ukrdrupal’s picture

Inside the following file: date_plugin_display_attachment.inc

It says: "class date_plugin_display_attachment extends views_plugin_display_attachment"

I think most of you in this thread are focusing on the wrong file for the solution. The key is that the says that it extends "views_plugin_display_attachment".

I then did a find ./ -name views_plugin_display_attachment.inc and came up with the following path:

/modules/acquia/views/plugins/views_plugin_display_attachment.inc

I searched for &$. You can do this through pico or nano and just use a Ctrl W, type in &$ and find each one. Just delete the &'s.

This is what fixed it for me. I hope that this will help others.

What I would really like to see is some sort of top level Drupal fix. Is there no possibility for replacement (kind of like string replacement) for &$ to $ if Drupal detects that you are on PHP 5.3.x ?? This seems like the way to fix the whole software, including the plugins, without all of us having to hack away to get it all to work.

Is this possible?

KarenS’s picture

Version: 6.x-2.4 » 6.x-2.x-dev
Status: Patch (to be ported) » Postponed (maintainer needs more info)

I have no clue what to do with this. First, it is not a patch. Second, it is not to be ported. Third, there are confusing comments above about whether or not it is already fixed.

For anyone who wants to make this into something I can do something with, start by using the latest -dev version of Date, which has a ton of fixes that are not in the official release. Testing this against the official release will do no good, I need to know if there is anything that needs to be done in the latest dev version.

Changing the version to make that more clear.

arlinsandbulte’s picture

IIRC, my comment in #137 was based on KarenS' comment in #81 as well as some quick testing I did back then.
I will redo the testing to confirm.

arlinsandbulte’s picture

Update: I was not able to reproduce the above errors in the DATE module (I did reproduce the Calendar module errors, but that is a different issue).
I tested using:
PHP 5.2.11 & 5.3.0 (using WAMP server) & Drupal 6.19 & Date 6.x-2.4 & CCK 6.x-2.8 & Views 6.x-2.11

In order for this issue to proceed, someone MUST PROVIDE A DETAILED METHOD TO REPRODUCE THE ERROR, preferably starting with a clean install of Drupal, CCK, & Date (and possibly Views & Calendar too).
There are almost NO details about how to reproduce the error in any of the comments above.

Epifrin’s picture

I just got the same error upon enabling Views 6.X-2.11 while Date API 6.X-2.4 was already running. No CCK here.
- Drupal 6.19 on Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 Server at localhost Port 80.


    * warning: Attempt to modify property of non-object in /opt/lampp/htdocs/drupal/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 24.
    * warning: Attempt to modify property of non-object in /opt/lampp/htdocs/drupal/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 25.
    * warning: Attempt to modify property of non-object in /opt/lampp/htdocs/drupal/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 26.
    * warning: Attempt to modify property of non-object in /opt/lampp/htdocs/drupal/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 28.
    * warning: Attempt to modify property of non-object in /opt/lampp/htdocs/drupal/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 29.
    * warning: Attempt to modify property of non-object in /opt/lampp/htdocs/drupal/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 30.
    * warning: Attempt to modify property of non-object in /opt/lampp/htdocs/drupal/sites/all/modules/date/includes/date_plugin_display_attachment.inc on line 31.

mikeytown2’s picture

Date API 6.X-2.4

try the dev version of date
http://drupal.org/node/263344

ShutterFreak’s picture

@Epifrin - the Date module asks explicitly for installing CCK.

I just tested with a clean Drupal 6.19 (no optional submodules enabled or disabled here - it's a clean install), and the following modules only:

  1. Content Construction Kit (CCK) 6.x-2.8 - only the "Content" submodule enabled
  2. Date 6.x-2.6 - only "date", "date API" and "date timezone" submodules enabled
  3. Views 6.x-2.11 - only "views and views UI" submodules installed

The PHP error messages seem to have disappeared now.

koyama’s picture

Upgrading from Date 6.x-2.4 to Date 6.x-2.6 fixed the problem. Latest dev probably also works. As #81 says, no need for any patches.

(Windows XP, XAMPP 1.7.3 (PHP 5.3.1), Drupal 6.16, Date 6.x-2.6, Views 6.x-2.10)

arlinsandbulte’s picture

Status: Postponed (maintainer needs more info) » Fixed

Fixed accroding to #168 & #169

Andy B’s picture

subscribe

Going to look at my versions of calendar, date and views. Will give an update after checking around.

Andy B’s picture

Ok. Looks like even after upgrading to views 3 I have the same problem. Looks like downgrading to php5.2 did the trick. I don't think D6 was even suposted to work on php 5.3.

int’s picture

Status: Fixed » Active

#172 don't fixed

Andy B’s picture

Status: Active » Needs review

Setting status to review. Maybe the developer can answer the following questions which would help us figure out if date is really broken:

1. Was D6.X designed to work on php 5.3.X?
2. Based on the answer to question 1, was date designed to work with php 5.3.X?
3. Since I see irrelavent errors about date/calendar (attempted to modify property non-object) in lots of places in D6.19 [all in administrate]: Modules, Blocks, calendar views, date settings pages, taxonomy settings/pages. Could this possibly be a D6.X core bug instead? I couldn't imagine that calendar/date is causing taxonomy settings/pages, modules, blocks not related to the calendar/date to give this error.

Maybe the developer followed standard coding practice and D6.X didn't? Either way, somone is on the wrong page and it is either D6 core or 3-4 more modules.

KarenS’s picture

Status: Needs review » Fixed

I made some fixes to the calendar views handlers and then backed up and made the same ones here. The patches above were not the right solution, but I think I have something now that should work.

Most of the fixes went in today, so you need a current cvs checkout of both date and calendar or wait until tomorrow to get the -dev tarball of both.

If there's still an issue after that, using latest -dev of both Date and Calendar, please start a new issue, this one is polluted by lots of confusion about what versions of everything are being used.

Strae’s picture

Thanks, using 6.x-2.x-dev Calendar module released yesterday (23 aug 2010) seem to work.

Andy B’s picture

It did. Moved back to php5.3 without any problems with date.

glazer’s picture

The error messages went away for a minute but they came right back. Setting the timezone DID NOT fix the issue. Sorry for the false info.

Andy B’s picture

Do you have the latest dev version?

jmcclelland’s picture

On a system running PHP 5.2.6.dfsg.1-1+lenny9 (debian lenny) the current stable calendar (6.x-2.2) and date (6.x-2.6) do not experience this problem.

However, those versions do produce this problem on a system running php 5.3.2-1 (debian squeeze).

Using 6.x-2.x-dev Calendar module released Aug 23 2010 works on php 5.3.2-1 and it doesn't seem to break anything on 5.2.6.dfsg.1-1+lenny9, so for me this problem is solved.

jamie

fm’s picture

I am confused. The latest -dev version as of right now appears to be dated August 14th, prior to Karen's commitment above. Where is the August 22nd (or 23rd?) tarball?

jmcclelland’s picture

Woops - I meant to say latest dev version August 22 (not 23). That's the latest dev version of the calendar module - maybe, fm, you are looking at the date module downloads?

jamie

fm’s picture

Yes, I meant the date module; sorry for the lack of clarity.
I was responding to KarenS in #175 and am still hoping of an answer.

sunchaser’s picture

#137 worked for me !

Slovak’s picture

Had the same issue. Installed the 6.x-2.x-dev release from 2010-Aug-22 and the errors went away.

Setimika’s picture

#30 applying the patch on the calendar issue works perfectly

http://drupal.org/node/613528

kendouglass’s picture

Had the same issue.
Installed Calendar-6.x-2.x-dev [from 2010-Aug-22] and the errors went away.
Using PHP 5.3.3

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

geerlingguy’s picture

Had same error, same solution as #187 - hopefully we can get the -dev rolled into the main line soon, for those using 5.3.x.

micnap’s picture

Had to apply the patch from #73 AND install the calendar-6.x-2.x-dev for all the errors to go away. PHP 5.3.2.

Mickey

diglo_umair’s picture

i am stuck with these errors.
can anybody help plz

warning: Attempt to modify property of non-object in D:\wamp\www\bilt\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 47.
warning: Attempt to modify property of non-object in D:\wamp\www\bilt\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 48.
warning: Attempt to modify property of non-object in D:\wamp\www\bilt\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 49.
warning: Attempt to modify property of non-object in D:\wamp\www\bilt\sites\all\modules\calendar\includes\calendar_plugin_display_page.inc on line 50.

ionmedia’s picture

dev calendar and date fix my issue

geekgirlweb’s picture

+1 subscribing

geekgirlweb’s picture

Even with the latest dev versions of calendar and date I still have the same error message.

jmcclelland’s picture

gamerxgirl: can you paste in the exact errors that you are getting? And, what version of PHP you are running? And, if possible, a link to the site? I just updated a site to both the dev versions of calendar and date on a server running php 5.2.6 and a development machine running php 5.3.3 and neither seem to exhibit this problem.

jamie

wjackson’s picture

I was having issues with calendar as well, and updating to the dev version fixed my issue!

aharown07’s picture

Encountered this problem when I moved my site to a server with PHP5.3.2-1ubuntu4.7ppa5~lucid1
(In my case, the errors were displaying for Calendar... have a page with a Views events calendar that uses Date & Date Repeat API for the nodes and for displaying date info in the View)

Updating the modules to Calendar 6x2.4 and Date 6x2.7 took care of it.

luf’s picture

Was able to duplicate, this issue does occur when PHP is upgraded from 5.2 or lower to 5.3 or higher.
The best way to solve this problem is to go into your website's available updates list and start updating your modules so that they understand the php 5.3+.
Updating Calander / Date module to the latest releases should solve this issue for anyone.

Enjoy.

Dave Cohen’s picture

Thanks sun for #73.

Posting in big bold letters that it is fixed in the .dev release is nice and all, but it would be nice to be told which patch was used to fix it. Since date.module is included in acquia's distribution, I don't plan to upgrade to .dev. Instead I'll just patch the version that comes with Acquia until the fix makes it's way through.

carn1x’s picture

subscribe

cubeinspire’s picture

subscribe

colan’s picture

Please stop "subscribe"ing as it is no longer necessary. Instead, click on the "Follow" button at the top of the issue.

I might add that there is nothing to subscribe to as the issue is closed (fixed). If you cannot upgrade to the dev version, look through the commit history to find the relevant commit, and use that as your patch. I agree that having to search for it is less than optimal, but we don't have an issue tracker (like ChiliProject) that automatically cross-references these. For issues I work on, I post a link directly to the commit(s) when I mark an issue as fixed, but not all maintainers do this. We should probably all start doing this as a best practice.

regx’s picture

Why not just cast the variable to the type the module expects.

I had a similar issue with the taxonomyblock module
From watchdog:
Attempt to modify property of non-object in /var/www/mysite/public_html/sites/default/modules/taxonomyblocks/taxonomyblocks.module on line 616.

original code:

    case 'view':
      $cache = cache_get($cache_key);
      if(isset($cache->data[$delta])){
        return $cache->data[$delta];
      } .....

The code is expecting cache to be an object, but it is getting an array so I just cast the array into an object

fixed code:

    case 'view':
      $cache = (object) cache_get($cache_key);
      if(isset($cache->data[$delta])){
        return $cache->data[$delta];
      } .....

The only difference is (object) which cast the array returned from get_cache into an object so $cache->data[$delta] doesn't cause the "Attempt to modify property of non-object" error.

I also noticed I was getting a bunch of the call by reference errors when switching to php 5.3.
I created a small patch to fix this issue globally for all modules. This is a git patch so just place it one dir up from your public_html dir and run git apply includes_modules.inc-fix-call-by-ref.git.patch
If you do not have git try patch -p1 < includes_modules.inc-fix-call-by-ref.git.patch
or just read the patchfile in a text editor and manually apply the changes.
It just adds an ampersand in 2 places.

SeanA’s picture

Whenever you get warnings like "Attempt to modify property of non-object...", you should be able to fix it by defining the object beforehand. First declare

$thingy = new stdClass();

then you can go ahead and do $thingy->stuff.