Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 0c0d9aa

Browse files
committed
remove restriction on hasKey. Context should always invokeDrop
1 parent f88d8e0 commit 0c0d9aa

File tree

4 files changed

+3
-18
lines changed

4 files changed

+3
-18
lines changed

lib/liquid/LiquidContext.cfc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,6 @@
201201

202202
<cfif IsInstanceOf(loc.object, "LiquidDrop")>
203203

204-
<cfif !loc.object.hasKey(loc.next_part_name)>
205-
<cfreturn "">
206-
</cfif>
207-
208204
<cfset loc.object = loc.object.invokeDrop(loc.next_part_name)>
209205

210206
<cfelseif StructKeyExists(loc.object, application.LiquidConfig.LIQUID_HAS_PROPERTY_METHOD) AND IsCustomFunction(loc.next_part_name)>

lib/liquid/LiquidDrop.cfc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@ Your drop can either implement the methods sans any parameters or implement the
6262

6363
<cffunction name="hasKey" hint="Returns true if the drop supports the given method">
6464
<cfargument name="name" type="string" required="true">
65-
<cfif !ListFindNoCase(variables.PROTECTED_METHODS, arguments.name) && StructKeyExists(this, arguments.name)>
66-
<cfreturn true>
67-
</cfif>
68-
<cfreturn false>
65+
<cfreturn StructKeyExists(this, arguments.name)>
6966
</cffunction>
7067

7168
<cffunction name="toLiquid" hint="return this drop instance">

tests/index.cfm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
<cfelse>
1616

17-
<cfset test = createObject("component", "cfml-liquid.tests.tests.OutputTest")>
18-
<cfset test.runTest("test", "test_filter_with_default_arguments")>
17+
<cfset test = createObject("component", "cfml-liquid.tests.tests.DropTest")>
18+
<cfset test.runTest("test", "TEST_CONTEXT_DROP")>
1919

2020
</cfif>
2121

tests/tests/DropTest.cfc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,6 @@
8080

8181
</cffunction>
8282

83-
<cffunction name="test_haskey_should_return_false_for_protected_methods">
84-
85-
<cfset loc.ProductDrop = createObject("component", "classes.ProductDrop")>
86-
<cfset loc.e = loc.ProductDrop.hasKey("beforeMethod")>
87-
<cfset assert("loc.e eq false")>
88-
89-
</cffunction>
90-
9183
<cffunction name="test_haskey_should_return_true_if_method_exists">
9284

9385
<cfset loc.ProductDrop = createObject("component", "classes.ProductDrop")>

0 commit comments

Comments
 (0)