Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
679c85a1
Commit
679c85a1
authored
Sep 26, 2014
by
genichyar
Committed by
Alexander Makarov
Sep 27, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #5191: Sandbox was ignored for models and AR relations
parent
0544d775
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
CHANGELOG.md
extensions/twig/CHANGELOG.md
+1
-0
Template.php
extensions/twig/Template.php
+7
-1
No files found.
extensions/twig/CHANGELOG.md
View file @
679c85a1
...
...
@@ -8,6 +8,7 @@ Yii Framework 2 twig extension Change Log
-
Bug #3767: Fixed repeated adding of extensions when using config. One may now pass extension instances as well (grachov)
-
Bug #3877: Fixed
`lexerOptions`
throwing exception (dapatrese)
-
Bug #4290: Fixed throwing exception when trying to access AR relation that is null (samdark, tenitski)
-
Bug #5191: Sandbox was ignored for models and AR relations (genichyar)
-
Enh #1799: Added
`form_begin`
,
`form_end`
to twig extension (samdark)
-
Enh #3674: Various enhancements (samdark)
-
Removed
`FileLoader`
and used
`\Twig_Loader_Filesystem`
instead.
...
...
extensions/twig/Template.php
View file @
679c85a1
...
...
@@ -20,10 +20,16 @@ abstract class Template extends \Twig_Template
protected
function
getAttribute
(
$object
,
$item
,
array
$arguments
=
[],
$type
=
\Twig_Template
::
ANY_CALL
,
$isDefinedTest
=
false
,
$ignoreStrictCheck
=
false
)
{
// Twig uses isset() to check if attribute exists which does not work when attribute exists but is null
if
(
$object
instanceof
\yii\
db\BaseActiveRecord
)
{
if
(
$object
instanceof
\yii\
base\Model
)
{
if
(
$type
===
\Twig_Template
::
METHOD_CALL
)
{
if
(
$this
->
env
->
hasExtension
(
'sandbox'
))
{
$this
->
env
->
getExtension
(
'sandbox'
)
->
checkMethodAllowed
(
$object
,
$item
);
}
return
$object
->
$item
(
$arguments
);
}
else
{
if
(
$this
->
env
->
hasExtension
(
'sandbox'
))
{
$this
->
env
->
getExtension
(
'sandbox'
)
->
checkPropertyAllowed
(
$object
,
$item
);
}
return
$object
->
$item
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment