empty __FILE__ in quercus

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I use quercus through the java scripting api.
My problem is that I cannot set the __FILE__ constant.
I tried to set it in the bindings and in the ScriptContext.
Neither works.
Is there a way to tell quercus the file path throught the scripting api ?

Best Regards

Re: empty __FILE__ in quercus

On 9/22/2010 2:45 PM, Thorsten Kiefer wrote:
Quoted text here. Click to load it


Are you sure you should be able to set that 'magic constant'?
I wouldn't know how to change its value using 'normal' PHP.
Many of these constants change during the script execution, so I am
unsure what it means that you set them.
(See the __LINE__ example below from the php website.)

And many of these magic constants are produced by the environment of PHP.

PHP provides a large number of predefined constants to any script which
it runs. Many of these constants, however, are created by various
extensions, and will only be present when those extensions are
available, either via dynamic loading or because they have been compiled
There are seven magical constants that change depending on where they
are used. For example, the value of __LINE__ depends on the line that
it's used on in your script.

If PHP/quercus cannot fix it for you, you could maybe use something like
$_SERVER["SCRIPT_NAME"] instead.
But that would mean you have to change the PHP scripts of course...

Or maybe you better ask the quercus developers.

Just my 2 cent.
Good luck.

Erwin Moller

"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare

Re: empty __FILE__ in quercus

El 22/09/2010 14:45, Thorsten Kiefer escribió/wrote:
Quoted text here. Click to load it

I've never heard about Quercus but according to Google it appears to be
a PHP interpreter written in Java.

Whey you say "set", is it a typo or do you really mean so?

In the original PHP specification, you cannot modify constants after
they've been defined. And  __FILE__ is a magic constant: it's not really
"constant" (its value changes depending on the file where it's read) but
it's already set for you by PHP.

If you actually meant "get", then it's an entirely different issue I
have no clue about, sorry.

-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com

Site Timeline