Bug #18013 Updated: Local variable losing value

From: Date: Thu, 27 Jun 2002 11:32:48 +0000
Subject: Bug #18013 Updated: Local variable losing value
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-12230@lists.php.net to get a copy of this message
ID: 18013 Updated by: sander@php.net Reported By: miguel@ipatimup.pt -Status: Open +Status: Feedback Bug Type: Variables related Operating System: Linux 2.2.16 - Suse 7.x PHP Version: 4.2.1 New Comment: Can you provide a _simple_ and _selfcontained_ sample script, say about 5 lines long, so we can play with it a little? Previous Comments: ------------------------------------------------------------------------ [2002-06-27 07:25:15] miguel@ipatimup.pt I, i'm sorry to upset you again....but i have some extra things to tell you about the bug: The code seams to be right, doesnt it? Please take a look at the explanations below. >$temp_file_path="/temp/x/1234.IMG.gz"; >$interfile_final_path="/temp/1234.IMG.gz"; >printf("<P>BEFORE:temp_file_path=%s<BR>interfile_final_path=%s</P>", > > $temp_file_path,$interfile_final_path > ); Output: BEFORE:temp_file_path=/temp/x/1234.IMG.gz<BR>interfile_final_path=/t >$file_name = $interf->getFileName(); >>printf("<P>AFTER:temp_file_path=%s<BR>interfile_final_path=%s</P>", $temp_f Output: AFTER:temp_file_path=/temp/x/1234<BR>interfile_final_path=/temp/1234 After this line, var $temp_file_path has changed...reason???? If i comment out the getFileName() line, the output is correct. It seams that PHP is executing something like: $temp_file_name = $file_name after getFileName() method. Again, i'm very sorry if you dont think this a bug, but this anormal beaviour isnt right. Dont you agree? Regards Miguel ------------------------------------------------------------------------ [2002-06-27 05:52:34] sander@php.net Sorry, but the bug system is not the appropriate forum for asking support questions. Your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php Thank you for your interest in PHP. There are no pointers in PHP, but in some cases references will do. ------------------------------------------------------------------------ [2002-06-27 05:20:55] miguel@ipatimup.pt This is a big snip of the code: $temp_file_path="/temp/x/1234.IMG.gz"; $interfile_final_path="/temp/1234.IMG.gz"; printf("<P>BEFORE:temp_file_path=%s<BR>interfile_final_path=%s</P>", $temp_file_path,$interfile_final_path ); $file_name = $interf->getFileName(); printf("<P>AFTER:temp_file_path=%s<BR>interfile_final_path=%s</P>", $temp_file_path,$interfile_final_path ): Object $interf, is a class created by me. The method getFileName() of the class is implemented like this: function getFileName() { $aux = $this->_getFileName(); //print "aux= $aux<BR>"; $ret = basename( $aux, ".IMG.gz" ); //print "ret=$ret<BR>"; return $ret; } My problem is that var $temp_file_path after a call to method getFileName, gets the value returned by getFileName Is there any way of knowing the address( pointer like ) of a variable? My configure line: './configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-pgsql' '--with-oci8=/usr/local/oracle' '--with-oracle=/usr/local/oracle' '--with-debug' Also, ftp functions are active. If any adicional information is needed please let me know. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18013&edit=1

« previous php.bugs (#12230) next »