[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Dolibarr-dev] actioncomm class : Question on error $this fordiden n
From: |
Laurent Destailleur (eldy) |
Subject: |
Re: [Dolibarr-dev] actioncomm class : Question on error $this fordiden not in object context |
Date: |
Mon, 07 Jan 2013 23:23:14 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
The error is using
$this->xxx
into a static method.
Good method is
self::$xxx
But xxx must also be declared as static and you can't have both a
property xxx for static return and another with same name for
instanciated returns.
For the pointed bug, i pushed a fix into git 3.3 branch.
Le 07/01/2013 15:02, Florian Henry a écrit :
> Happy new year every body !
>
> In class /htdocs/comm/action/actioncomm.class.php, i found
> something that I don't know how to solve.
>
> In Branch 3.3 and Dev (may be older, I didn't check), the static
> method getActions (line 546) we have that
> $this->error=$db->lasterror(); (line 584) if the SQL is bad. This is a
> normal SQL error statement, but as the method is static I got this error.
>
> Fatal error: Using $this when not in object context in
> /home/bobby/Eclipse/workspace/dolibarr/htdocs/comm/action/class/actioncomm.class.php
> on line 584
>
> I know where is the error, it's in my SQL filter statement, but
> this mail is more to ask "What is the correct way in dolibarr to
> affect error on this non-object in static method?"
>
> I call it into pages with this instruction :
> ActionComm::getActions($db,$user->societe_id,0,'','bala');
>
> Kind regards
>
--
Eldy (Laurent Destailleur).
EMail: address@hidden
Web: http://www.destailleur.fr
Dolibarr (Project leader): http://www.dolibarr.org
To make a donation for Dolibarr project via Paypal: address@hidden
AWStats (Author) : http://awstats.sourceforge.net
To make a donation for AWStats project via Paypal: address@hidden
AWBot (Author) : http://awbot.sourceforge.net
CVSChangeLogBuilder (Author) : http://cvschangelogb.sourceforge.net