Warning: Parameter 2 to plgContentJoomla::onContentAfterSave

Phoca Download - download manager
patient_boy
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 04 Apr 2011, 06:22

Warning: Parameter 2 to plgContentJoomla::onContentAfterSave

Post by patient_boy »

Getting the below warning everytime add a new file to Phocadownload (2.0.0 RC2). Not sure if that is causing by Joomla! 1.6 :o

Warning: Parameter 2 to plgContentJoomla::onContentAfterSave() expected to be a reference, value given in D:\xampp\htdocs\libraries\joomla\event\event.php on line46

By the way, it is having problem with very large files, e.g. over 1Gb. The file size in the file listing is either fraction of the original file size or -1651469146 and wont be able to download at all.

Anybody having the same experience?

Thanks in advance
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Warning: Parameter 2 to plgContentJoomla::onContentAfter

Post by Jan »

Hi, not sure why the system plugin returns the error? :idea:
over 1Gb
Maybe there is somewhere INT type which can limit it, where exactly do you get the first problem - in which view and where exactly the second issue?
If you find Phoca extensions useful, please support the project
bornakke
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 05 Oct 2008, 17:42

Re: Warning: Parameter 2 to plgContentJoomla::onContentAfter

Post by bornakke »

Seem to be server related. I'm experiencing it too.... but only on my local test server.
bornakke
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 05 Oct 2008, 17:42

Re: Warning: Parameter 2 to plgContentJoomla::onContentAfter

Post by bornakke »

Hi Jan,

I have investigated the problem with 2 parameters since it is now also showing up in a third server. So far I have tracked it down being related to the plugin "Content - Joomla" which is being called with this line:

$dispatcher->trigger($this->event_after_save, array($this->option.'.'.$this->name, $table, $isNew));
in /administrator/components/com_phocagallery/models/phocagalleryc.php line 274.

The plugin is a basic part of Joomla 1.6. It is actually not a surprise that this is the one giving problems since the error happens when trying to add a category and the description states that it: "Does category processing for core extensions; send email when new article is submitted in the frontend."

Looking into this plugin shows that it expect the following values:

public function onContentAfterSave($context, &$article, $isNew). Leaving out the & (so that it isn't a reference) makes everything work.

I'm however not very strong in objects and references and can't figure out if this will give problems other places. Also what is causing this problem: Phoca, Joomla 1.6 Core or something in my setup?

Sls
Tobias
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Warning: Parameter 2 to plgContentJoomla::onContentAfter

Post by Jan »

Hi, I think, this function is not necessary there, try to comment it.
// Trigger the onContentBeforeSave event.
$result = $dispatcher->trigger($this->event_before_save, array($this->option.'.'.$this->name, $table, $isNew));
if (in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
}
I will remove it for the next version (it was prepared for some feature but this was not implemented)

Jan
If you find Phoca extensions useful, please support the project
bornakke
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 05 Oct 2008, 17:42

Re: Warning: Parameter 2 to plgContentJoomla::onContentAfter

Post by bornakke »

Hi Jan,

Thank you for your answear. The problem is however that it is not $this->event_before_save that is the problem but $this->event_after_save

I have solved the problem by adding a & infront of the $table value like this:

$dispatcher->trigger($this->event_after_save, array($this->option.'.'.$this->name, &$table, $isNew));

Don't know if this is a bad solution, but we are not getting any more errors and the categories are being created, so I guess we are good to go :)

Best regards
Tobias
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Warning: Parameter 2 to plgContentJoomla::onContentAfter

Post by Jan »

Ok, I will take a look at it for the next version.

Jan
If you find Phoca extensions useful, please support the project
Post Reply