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

Patch for PHP 5.3

 
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 -> Smarty Development
View previous topic :: View next topic  
Author Message
ltiefland
Smarty Rookie


Joined: 19 Jul 2005
Posts: 6
Location: Marl

PostPosted: Mon Jan 31, 2011 8:55 am    Post subject: Patch for PHP 5.3 Reply with quote

Hi all,

in sysplugins/smarty_internal_resource_registered.php there are som lines which have to be edited in order to work properly.The 3rd parameter of the functions has to be a reference, but you pass a value which leads to a PHP notice. As a side effect you'll get problems i. e. reading a template from a database.

Here's my patch for it:

Code:
--- smarty_internal_resource_registered.php     (revision 391)
+++ smarty_internal_resource_registered.php     (working copy)
@@ -65,7 +65,7 @@
         // return timestamp
         $time_stamp = false;
         call_user_func_array($this->smarty->_plugins['resource'][$_template->resource_type][0][1],
-            array($_template->resource_name, &$time_stamp, $this->smarty));
+            array($_template->resource_name, &$time_stamp, &$this->smarty));
         return is_numeric($time_stamp) ? (int)$time_stamp : $time_stamp;
     }
     /**
@@ -79,7 +79,7 @@
         // return timestamp
         $time_stamp = false;
         call_user_func_array($this->smarty->_plugins['resource'][$_resource_type][0][1],
-            array($_resource_name, &$time_stamp, $this->smarty));
+            array($_resource_name, &$time_stamp, &$this->smarty));
         return is_numeric($time_stamp) ? (int)$time_stamp : $time_stamp;
     }

@@ -93,7 +93,7 @@
     {
         // return template string
         return call_user_func_array($this->smarty->_plugins['resource'][$_template->resource_type][0][0],
-            array($_template->resource_name, &$_template->template_source, $this->smarty));
+            array($_template->resource_name, &$_template->template_source, &$this->smarty));
     }

     /**
Back to top
View user's profile Send private message Send e-mail AIM Address
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Mon Jan 31, 2011 9:04 am    Post subject: Reply with quote

As you no longer need to pass objects in PHP5 by reference we did change in Smarty3 the interface when passing them.

So you registerned functions should no longer use &smarty as parameter, but just $smarty.
See Example 15.22 at http://www.smarty.net/docs/en/template.resources.tpl


Last edited by U.Tews on Mon Jan 31, 2011 9:21 am; edited 1 time in total
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Mon Jan 31, 2011 9:06 am    Post subject: Reply with quote

Passing objects by reference is a PHP4 thing. I really don't see how your patch should fix anything?!

I'm running 5.3.4 and the resource API is working just fine over here…?!
Back to top
View user's profile Send private message Visit poster's website
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 -> Smarty Development 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