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
2c45013f
Commit
2c45013f
authored
Oct 07, 2011
by
Jordi Boggiano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed endless loop when parsing an invalid else block
parent
586ef2ac
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
CHANGELOG
CHANGELOG
+1
-0
else.php
lib/plugins/builtin/blocks/else.php
+3
-0
CompilerTests.php
tests/CompilerTests.php
+10
-0
No files found.
CHANGELOG
View file @
2c45013f
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
thanks
to
Dominik
del
Bondio
for
the
patch
thanks
to
Dominik
del
Bondio
for
the
patch
*
Adapters
:
Agavi
:
Added
support
for
multiple
plugin
directories
in
the
*
Adapters
:
Agavi
:
Added
support
for
multiple
plugin
directories
in
the
config
,
thanks
to
Mike
Seth
for
the
patch
config
,
thanks
to
Mike
Seth
for
the
patch
*
Fixed
endless
loop
when
parsing
an
invalid
else
block
*
Fixed
custom
compilable
plugins
not
being
recognized
as
such
*
Fixed
custom
compilable
plugins
not
being
recognized
as
such
[
2010
-
02
-
07
]
1.1.1
[
2010
-
02
-
07
]
1.1.1
...
...
lib/plugins/builtin/blocks/else.php
View file @
2c45013f
...
@@ -39,6 +39,9 @@ class Dwoo_Plugin_else extends Dwoo_Block_Plugin implements Dwoo_ICompilable_Blo
...
@@ -39,6 +39,9 @@ class Dwoo_Plugin_else extends Dwoo_Block_Plugin implements Dwoo_ICompilable_Blo
while
(
true
)
{
while
(
true
)
{
$preContent
.=
$compiler
->
removeTopBlock
();
$preContent
.=
$compiler
->
removeTopBlock
();
$block
=&
$compiler
->
getCurrentBlock
();
$block
=&
$compiler
->
getCurrentBlock
();
if
(
!
$block
)
{
throw
new
Dwoo_Compilation_Exception
(
$compiler
,
'An else block was found but it was not preceded by an if or other else-able construct'
);
}
$interfaces
=
class_implements
(
$block
[
'class'
],
false
);
$interfaces
=
class_implements
(
$block
[
'class'
],
false
);
if
(
in_array
(
'Dwoo_IElseable'
,
$interfaces
)
!==
false
)
{
if
(
in_array
(
'Dwoo_IElseable'
,
$interfaces
)
!==
false
)
{
break
;
break
;
...
...
tests/CompilerTests.php
View file @
2c45013f
...
@@ -748,6 +748,16 @@ fail
...
@@ -748,6 +748,16 @@ fail
$tpl
->
forceCompilation
();
$tpl
->
forceCompilation
();
$this
->
assertEquals
(
'foo'
,
$this
->
dwoo
->
get
(
$tpl
,
array
()));
$this
->
assertEquals
(
'foo'
,
$this
->
dwoo
->
get
(
$tpl
,
array
()));
}
}
/**
* @expectedException Dwoo_Compilation_Exception
*/
public
function
testElseWithoutIfIsInvalid
()
{
$tpl
=
new
Dwoo_Template_String
(
'{else}1{/}'
);
$tpl
->
forceCompilation
();
$this
->
dwoo
->
get
(
$tpl
,
array
(),
$this
->
compiler
);
}
}
}
function
excessArgsHelper
(
$a
)
{
function
excessArgsHelper
(
$a
)
{
...
...
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