ID:               28630
 Updated by:       [EMAIL PROTECTED]
 Reported By:      full_ot at directbox dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Win2k
 PHP Version:      4.3.6
 New Comment:

User/browser error, nothing to do with PHP.



Previous Comments:
------------------------------------------------------------------------

[2004-06-08 11:25:57] m dot tschursch at ic3s dot de

browser used: mozilla firefox 0.7

------------------------------------------------------------------------

[2004-06-08 10:55:34] m dot tschursch at ic3s dot de

same behavior on my system:
Windows NT BERT 5.1 build 2600 
Apache: Apache/2.0.49 (Win32) 
PHP: PHP/4.3.6 

This seems to be a browser thingy and not a bug:
the php-skript gets simply called twice as u write a <img> tag with
empty src. The browser tried to load the image from the same url.

just initialize $image_url with an non-empty but invalid value, like: 
=======================================================

  class news {
   var $image_url, $timestamp;

   function news()  { // constructor
       $this->image_url = "none.gif";
       $this->timestamp = microtime();
   }

   ...........

=========================================================

------------------------------------------------------------------------

[2004-06-04 14:10:10] full_ot at directbox dot com

Description:
------------
System: Win2k SP4, Apache 2.0.49 PHP 4.3.6
(also tested on Win2k SP4, Apache 2.0.48 PHP 4.3.4 with same result)

I have a class that handle news in a CMS. So it also have to save the
news in single files.
The srcipt below is the essence of that class. But it seems to run
twice, because the save-function creates two files with different
timestamps. Regardless it is only called once.

If u use the first line of show() all is working fine, but the second
line with the img-tag causes trouble.

The variable $image_url ist know to the class but its uninitialized.
Nevertheless this shouldnt cause such unexpected behaviour.

Reproduce code:
---------------
class news{
  var $image_url, $timestamp;

  function show(){
//  echo $this->image_url; echo $this->image_url;   //working fine
(returns nothing, create one file)
    echo "<img src=\"".$this->image_url."\"
alt=\"".$this->image_url."\">";   //this causes the script to run
twice
  }

  function save(){
    $fp = fopen($this->timestamp, "w");
    fclose($fp);
  }
}

$news = new news;
$news->timestamp = microtime();
$news->save();
$news->show();

Expected result:
----------------
It should save one! file to disk and print nothing on the screen (cause
$image_url is empty). The name of the file is the timestamp of its
creation.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=28630&edit=1

Reply via email to