Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
Dwoo
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Common
Dwoo
Commits
ea7de4ee
Commit
ea7de4ee
authored
Jun 09, 2010
by
Jordi Boggiano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
properly strip enclosing quotes within ['foo'] in some edge cases
parent
44cf0559
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
Compiler.php
lib/Dwoo/Compiler.php
+2
-2
Core.php
lib/Dwoo/Core.php
+3
-0
No files found.
lib/Dwoo/Compiler.php
View file @
ea7de4ee
...
@@ -2094,8 +2094,8 @@ class Dwoo_Compiler implements Dwoo_ICompiler
...
@@ -2094,8 +2094,8 @@ class Dwoo_Compiler implements Dwoo_ICompiler
$pointer
+=
$matchedLength
;
$pointer
+=
$matchedLength
;
}
}
// replace useless brackets by dot accessed vars
// replace useless brackets by dot accessed vars
and strip enclosing quotes if present
$key
=
preg_replace
(
'#\[([
^$%\[.>-]+)\]#'
,
'.$1
'
,
$key
);
$key
=
preg_replace
(
'#\[([
"\']?)([^$%\[.>-]+)\1\]#'
,
'.$2
'
,
$key
);
// prevent $foo->$bar calls because it doesn't seem worth the trouble
// prevent $foo->$bar calls because it doesn't seem worth the trouble
if
(
strpos
(
$key
,
'->$'
)
!==
false
)
{
if
(
strpos
(
$key
,
'->$'
)
!==
false
)
{
...
...
lib/Dwoo/Core.php
View file @
ea7de4ee
...
@@ -1249,6 +1249,9 @@ class Dwoo_Core
...
@@ -1249,6 +1249,9 @@ class Dwoo_Core
while
(
list
(
$k
,
$sep
)
=
each
(
$m
[
1
]))
{
while
(
list
(
$k
,
$sep
)
=
each
(
$m
[
1
]))
{
if
(
$sep
===
'.'
||
$sep
===
'['
||
$sep
===
''
)
{
if
(
$sep
===
'.'
||
$sep
===
'['
||
$sep
===
''
)
{
// strip enclosing quotes if present
$m
[
2
][
$k
]
=
preg_replace
(
'#^(["\']?)(.*?)\1$#'
,
'$2'
,
$m
[
2
][
$k
]);
if
((
is_array
(
$data
)
||
$data
instanceof
ArrayAccess
)
&&
(
$safeRead
===
false
||
isset
(
$data
[
$m
[
2
][
$k
]])))
{
if
((
is_array
(
$data
)
||
$data
instanceof
ArrayAccess
)
&&
(
$safeRead
===
false
||
isset
(
$data
[
$m
[
2
][
$k
]])))
{
$data
=
$data
[
$m
[
2
][
$k
]];
$data
=
$data
[
$m
[
2
][
$k
]];
}
else
{
}
else
{
...
...
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