Re: [PHP] Local variable protection

2011-10-14 Thread Tedd Sperling
On Oct 13, 2011, at 11:37 AM, Tim Streater wrote: On 13 Oct 2011 at 16:25, Tedd Sperling tedd.sperl...@gmail.com wrote: So, if you want a main script variable (i.e., $myVar) to be accessed by a function, you can do it by stating: myFunction { global $myVar; // and then using $myVar

Re: Re: [PHP] Local variable protection

2011-10-14 Thread Tim Streater
On 14 Oct 2011 at 16:46, Tedd Sperling tedd.sperl...@gmail.com wrote: On Oct 13, 2011, at 11:37 AM, Tim Streater wrote: On 13 Oct 2011 at 16:25, Tedd Sperling tedd.sperl...@gmail.com wrote: So, if you want a main script variable (i.e., $myVar) to be accessed by a function, you can do it by

Re: [PHP] Local variable protection

2011-10-14 Thread kd_jm
Hi, I want to use the function fputcsv, but have the results in a local variable, not a file. So I thought I could use php://temp Like in this code sample: $fp = fopen( php://temp, 'r+' ); if ( fputcsv( $fp, $data, ,, ' ) === FALSE ) { // error } else { rewind( $fp ); $csvString =

Re: [PHP] Local variable protection

2011-10-13 Thread Stuart Dallas
On 12 Oct 2011, at 21:06, Benjamin Coddington wrote: Are there any assurances that function local variables are protected from code calling the function? For example, I would like to provide some cryptographic functions such as function org_secure_string($string) { $org_key = a

Re: [PHP] Local variable protection

2011-10-13 Thread Benjamin Coddington
On Oct 13, 2011, at 5:05 AM, Stuart Dallas wrote: On 12 Oct 2011, at 21:06, Benjamin Coddington wrote: Are there any assurances that function local variables are protected from code calling the function? For example, I would like to provide some cryptographic functions such as

Re: [PHP] Local variable protection

2011-10-13 Thread Tedd Sperling
On Oct 12, 2011, at 4:24 PM, Ken Robinson wrote: Yes, but scope does not necessarily protect a value. Within a function globals are out of scope, but their values can still be accessed through $GLOBALS. Tangental to the main point (and probably obvious to many) but I used to believe (until

Re: Re: [PHP] Local variable protection

2011-10-13 Thread Tim Streater
On 13 Oct 2011 at 16:25, Tedd Sperling tedd.sperl...@gmail.com wrote: So, if in your main script you have the statement: $myVar = 'test'; Then the $GLOBAL['myVar'] has also been created and will hold the value of 'test' without any additional coding. While many of you will say But of

[PHP] Local variable protection

2011-10-12 Thread Benjamin Coddington
Are there any assurances that function local variables are protected from code calling the function? For example, I would like to provide some cryptographic functions such as function org_secure_string($string) { $org_key = a very random key; return hash($string, $key); }

Re: [PHP] Local variable protection

2011-10-12 Thread Ken Robinson
Quoting Benjamin Coddington bcodd...@uvm.edu: Are there any assurances that function local variables are protected from code calling the function? For example, I would like to provide some cryptographic functions such as function org_secure_string($string) { $org_key = a very random

Re: [PHP] Local variable protection

2011-10-12 Thread Benjamin Coddington
On Oct 12, 2011, at 4:24 PM, Ken Robinson wrote: Quoting Benjamin Coddington bcodd...@uvm.edu: Are there any assurances that function local variables are protected from code calling the function? For example, I would like to provide some cryptographic functions such as function

Re: [PHP] Local variable protection

2011-10-12 Thread Tommy Pham
On Wed, Oct 12, 2011 at 4:51 PM, Benjamin Coddington bcodd...@uvm.eduwrote: On Oct 12, 2011, at 4:24 PM, Ken Robinson wrote: Quoting Benjamin Coddington bcodd...@uvm.edu: Are there any assurances that function local variables are protected from code calling the function? For example,