Tim
05/06/2024, 7:34 PMpackage access to functions doesn't work correctly. Unfortunately, none of these have been on my server -- it's all clients, where I don't have any access. But in all of the cases, I have an error message like this one:
The <methodName> package method in the <webroot>\conversion\<component>.cfc component cannot be accessed from <webroot>\Conversion\<template>.cfm.It's also not consistent among clients. Client A might have this problem appear on page A, but page B will be fine. But Client B might have no problem on page A, but page B will be a problem. These are all on Windows, on which the file system is supposed to be case-insensitive. But you can see from the message that the paths are identical except for the case. Has anyone else run into this, and have a solution? So far the only one I've found is to take the offending
package method, and make it public instead. But it would be nice to understand why it's breaking.websolete
05/06/2024, 8:37 PMTim
05/06/2024, 8:41 PM<cfset genericEncrypt = createObject("component", "GenericEncryption")>
// some more code that runs a query
<cfscript>
genericEncrypt.encryptFieldQuery(passportPassnumQuery, "jbPassport", "passnum");
</cfscript>
It's really pretty straight forward.Tim
05/06/2024, 8:42 PMwebsolete
05/06/2024, 8:46 PMpackage with respect to anything other than cfcs invoking methods from other cfcs, not cfm templates.
typically (for me), if you have a service.cfc and a dao.cfc in the same dir, service.cfc has public methods that front those in the dao.cfc whose methods have access package, so that you MUST go through the service to ultimately access dao methods, controlling how/where daos (or other 'protected' objects) may be composited together or leveraged by other areas.
this is how i've traditionally used package access, and really for this purpose only, to isolate daos and prevent them from being called/injected from anything other than their service siblingwebsolete
05/06/2024, 8:47 PMwebsolete
05/06/2024, 8:50 PMin service:
public any function encryptFieldQuery( ... ) {
return dao.encryptFieldQuery( argumentCollection=arguments );
}
in dao:
package any function encryptFieldQuery( ... ) { ... }websolete
05/06/2024, 8:51 PMAdam Cameron
<webroot>\conversion\<component>
<webroot>\Conversion\<template>.cfm
Notice the difference?Tim
05/07/2024, 6:24 PMAnd to be clear, the CFC is in the same dir as the code calling it, and yer using just the CFC name, not any sort of path.Yes. Right.
Tim
05/07/2024, 6:26 PMAlso... I smell a rat here:
```<webroot>\conversion\<component>
<webroot>\Conversion\<template>.cfm```
Notice the difference? (edited)I'm assuming you mean the case difference, which I already called out. If there's another difference, I'm not seeing it. But yeah, that's the rat I smell too. I just don't know how to follow my nose.
Adam Cameron
Adam Cameron
Tim
05/07/2024, 7:12 PMTim
05/07/2024, 7:13 PMAdam Cameron
Adam Cameron
GenericEncryption class. You're not also accessing it elsewhere via some.path.to.GenericEncryption?Tim
05/07/2024, 8:37 PMTim
05/07/2024, 8:45 PM