|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
sm@rty Smarty Regular
Joined: 01 Oct 2014 Posts: 65
|
Posted: Wed Mar 11, 2015 7:27 pm Post subject: new bug in smarty (_ problem in calling method of object) |
|
|
hi
please only run this smarty code :
smarty error :
Syntax error on line 1 "{$a->_s()}" Security error: Call to private object member not allowed
$a not defined !
smarty can not proccess on _(underline) |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Mar 11, 2015 9:04 pm Post subject: |
|
|
You're trying to access private method, the error clearly states that.
This has nothing to do with Smarty. |
|
Back to top |
|
sm@rty Smarty Regular
Joined: 01 Oct 2014 Posts: 65
|
Posted: Thu Mar 12, 2015 7:28 am Post subject: |
|
|
ooops AnrDaemon please look carefully at post !
$a is not defined !!!!!!!
$a no object !
$a no exists !
There is no method !
for example :
Code: | {$a->_asdadwqiudiuqou9du()}
{$a->_lkkkkkskkkksksksksksksksksksksksksk()} |
this is a bug ! ok ? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Mar 12, 2015 3:41 pm Post subject: |
|
|
Then this is a bug in your code.
Smarty is not a PHP interpreter. It doesn't care what you write, it merely arrange the vars and templates to a code that is then executed by PHP.
If you use variable incorrectly, PHP yell at you.
If you know a variable can be unset, then test for it explicitly. |
|
Back to top |
|
sm@rty Smarty Regular
Joined: 01 Oct 2014 Posts: 65
|
Posted: Thu Mar 12, 2015 4:37 pm Post subject: |
|
|
ok !
please write this code in php :
Code: |
class test{
public function _myPublicMethod()
{
return 'ok';
}
}
function test(){
return new test;
}
|
and in smarty template :
Code: | {$obj = test()}
{$obj->_myPublicMethod()}
|
now give me result. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
|
Back to top |
|
sm@rty Smarty Regular
Joined: 01 Oct 2014 Posts: 65
|
Posted: Sat Mar 14, 2015 7:08 am Post subject: |
|
|
ok.
thanks. |
|
Back to top |
|
|
|
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
|