Re: empty __FILE__ in quercus [message #169674 is a reply to message #169672] |
Wed, 22 September 2010 13:47 |
Erwin Moller
Messages: 228 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 9/22/2010 2:45 PM, Thorsten Kiefer wrote:
> Hi,
> 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
> Thorsten
Hi,
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.
http://php.net/manual/en/language.constants.predefined.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
in.
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.
Regards,
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
|
|
|