Re: Anyone wrote persistent variable extension?
| From: | Yasuo Ohgaki | Date: | Wed, 10 Apr 2002 10:42:36 +0000 |
| Subject: | Re: Anyone wrote persistent variable extension? | ||
| References: | 1 2 3 4 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-82460@lists.php.net to get a copy of this message | ||
Ivan Ristic wrote:
Some kind of scoping is needed for shared environment, even if I don't share my servers :) How about this one? bool psv_register(string var_name, array values, string access_key); where var_name is variable name, values are array to regieter, key is access key for the variable. bool psv_is_registered(string var_name, string access_key); Return TRUE is var_name is registered with the access_key. bool psv_unregister(string var_name, string access_key); Unregister persistent variable. bool psv_get(string var_name, string access_key, [bool copy]); Get a persistent variable into global scope. If copy is TRUE, set copy of persistent variable so that users can modify as they want. BTW, There is CONSTANT_ARRAY type in Zend, but it seems it does not work. Is CONSTANT_ARRAY fully implemented? How does it supposed to work? -- Yasuo OhgakiUsage: <?php if (!isset($_PERSISTENT['VAR'])) { include('register_very_large_array.inc'); } ?>What would the scope of this variable be? If it is global (as in PHP engine global) then the solution would not work in an shared environment (and it would not be practical for multiple applications anyway). Ideally, there would be one copy of the variable per application, but we need to somehow define what application is. I think that the best approach would be to introduce a new php configuration option, something like "application_name", and that would then define security for these kinds of things (naturally, you won't be able to change this one from the script :).