Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Only variables should be passed by reference error

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
newtosmarty
Smarty Rookie


Joined: 06 Jul 2015
Posts: 5

PostPosted: Mon Jul 06, 2015 10:14 am    Post subject: Only variables should be passed by reference error Reply with quote

Hello,

I am new to smarty and I need some help fixing the following error.
PHP Strict Standards: Only variables should be passed by reference in /home/XXX/public_html/h1.com/includes/Article.class.php on line 30

Here is the code of Article.class.php --> loadByUrl

public static function loadByUrl($url, $type = null)
{
$url = trim($url);

$conditions = array("articleURL = '$url'");

if($type)
$conditions[] = "articleType = '$type'";

Line 30 ----> return array_pop(Article::listAll(new DBEListCriteria(implode(' and ', $conditions), null, new DBEListOffset(1))));
}


I am using smarty 2.6.28 (2.6.25-dev displayed on screen) with PHP5.5

Thank you for your help,
Phil
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Jul 06, 2015 3:02 pm    Post subject: Reply with quote

What is line 30 of Article.class.php? You must be passing a variable by reference, you can likely just get rid of the reference. FYI this is not related to Smarty.
Back to top
View user's profile Send private message Visit poster's website
newtosmarty
Smarty Rookie


Joined: 06 Jul 2015
Posts: 5

PostPosted: Mon Jul 06, 2015 3:19 pm    Post subject: Reply with quote

Called at initialisation time to get all environment variable into $_ENV[site] array:

if($article = Article::loadByUrl(''))
$_ENV[site]->Article = $article;
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Jul 06, 2015 7:53 pm    Post subject: Reply with quote

Your definition of Article::getByUrl() contains a reference in parameters list, but you are passing a constant. That will just not work.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP