php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26370 BUG with src=""
Submitted: 2003-11-23 16:49 UTC Modified: 2004-01-11 14:01 UTC
From: kreny at dalouis dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.3.4 OS: Linux (Redhat 9.0)
Private report: No CVE-ID: None
 [2003-11-23 16:49 UTC] kreny at dalouis dot com
Description:
------------
1. Configure line of my PHP 4.3.4
***************************************
'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-apache2=/usr/local/apache2' '--with-mysql=/usr/local/mysql' '--enable-force-cgi-redirect' '--with-zlib' '--with-jpeg-dir' '--with-png-dir' '--with-freetype-dir' '--with-gd' '--with-mcrypt=/usr/local/lib' '--enable-bcmath' 

2. Changes of my php.ini
***************************************
asp_tags = On
safe_mode = Off
disable_functions = system exec
default_charset = 
session.name = D
session.cookie_domain = 
[Zend]
zend_optimizer.optimization_level=15
zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-2.1.0
zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-2.1.0
zend_extension=/usr/local/Zend/lib/ZendExtensionManager.so
zend_extension_ts=/usr/local/Zend/lib/ZendExtensionManager_TS.so

3. Information of MySQL
MySQL Support 			enabled 
Client API version  		4.0.13  
MYSQL_MODULE_TYPE 	external  
MYSQL_SOCKET  		/tmp/mysql.sock  
MYSQL_INCLUDE  		-I/usr/local/mysql/include  
MYSQL_LIBS  			-L/usr/local/mysql/lib -lmysqlclient  

4. Description:
***************************************
Because I want to log the accesses to the authenticating page of my site I created a table named ??log_access?? in MySQL which had a structure like below:
??
CREATE TABLE `log_access` (
  `id` int(7) unsigned NOT NULL auto_increment,
  `ip` varchar(16) NOT NULL default '',
  `access_time` varchar(14) NOT NULL default '',
  `sql_access_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `hostname` varchar(35) default NULL,
  `times` int(10) NOT NULL default '0',
  UNIQUE KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=138 ;
??
I also built a function called Create_Log_Access(), saved in an extral file named fun_log.inc.php, which can return a log_access-SQL-query. 
In my authenticating page which I request user to enter the username and password, I added such three lines like below to run Create_Log_Access():
??
	require("./myadmin/connect.inc.php");		// Connection to MySQL
	require_once("./myadmin/fun_log.inc.php");		// Include the funtion.
	$query_log_access = Create_Log_Access();
	mysql_query($query_log_access);
	mysql_close();
??
This can be done even if a user does nothing but just access the authenticating page. And if the user is accepted, this page will redirect the user to another page which named user.php by using the script

 header('Location: user.php'); 

. And of course I didn??t add any scripts that can include or can run the Create_Log_Access() in my other pages except the authenticating page.
Problem:  But I still found the number in my table ??log_access?? is increasing when I access some other pages even if in which I only use pure html scripts. I cut any html scripts which will not effect the wrong result and finally found that the script in the line below result the problem.

<img src="" width="6" height="6" alt="" hspace="0"  vspace="0" border="1" style="background-color: #617EBA">

This is a script which can display a colorful square in my page just for beauty. But when I delete the src="" part, everything return to normal -- the number in the table will not increase.

So I am wondering whether it is a bug of PHP or something else because this happened after I just updated the PHP from 4.3.2 to 4.3.4. 

Thank you.


Reproduce code:
---------------
http://www.s.fpu.ac.jp/t-yuan/php4.3.4_bug.htm

Expected result:
----------------
Do not do any counting in my 'log_access' table.

Actual result:
--------------
Do the counting in my 'log_access' table.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-23 17:20 UTC] yuanhuanglin at hotmail dot com
It is also effected by name="" part in <img>.
 [2003-11-23 20:12 UTC] iliaa@php.net
Does this happen when the zend extensions are not loaded.
 [2003-11-23 20:33 UTC] yuanhuanglin at hotmail dot com
I commented the Zend part like below in php.ini, but it still occurrs.


----------------------------------
[Zend]
zend_optimizer.optimization_level=15
zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-2.1.0
zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-2.1.0
zend_extension=/usr/local/Zend/lib/ZendExtensionManager.so
zend_extension_ts=/usr/local/Zend/lib/ZendExtensionManager_TS.so
 [2003-11-23 21:07 UTC] sniper@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Invalid HTML sometimes cause the pages to get loaded twice.

 [2003-11-24 00:31 UTC] yuanhuanglin at hotmail dot com
Thank you very much for your reply.
I also hope that it is not a bug, but may I have your attention again that wheather a non-mysql-script-connected page can run a MySQL query in the pages? This pages just start with the code I posted in 
http://www.s.fpu.ac.jp/t-yuan/php4.3.4_bug.htm
On that page I wrote some more details of my problem. It will be very nice of you to read my problem description.
 [2003-12-05 13:44 UTC] kreny at dalouis dot com
Anyone who has the idea please feel free to contact me at kreny@dalouis.com, or write the feedback at http://www.dalouis.com/en/feedback.php
I also want to take part in the Chinese Man Page Project and Chinese-translation project for any open source, so anybody please feel free to ask me to translate the English man page or introduction for OPEN SOURCE. 
BTW, the lastest source of bug is at http://www.dalouis.com/~kreny/php4.3.4_bug.htm
Thank you!
 [2003-12-14 00:09 UTC] kreny at dalouis dot com
New address:

http://linux.dalouis.com/php4.3.4_bug.htm
 [2004-01-11 13:46 UTC] dodu at hotmail dot com
Hello, I got a very similar issue.

Decription :

1. On my first page, I included a "write logfile" instructions such as :
----------------------------------------------------
if (@$file_stat=fopen('../stat/stat.txt, 'a')) {
$p_stat = fputs($file_stat, 'pageview=1 and so on; ');
fclose($file_stat);
}

2. On another page it appears I had a broken image

Although my "write logfile" instruction does exist only in first page, when loading the second one, the stat logfile was incremented !

Furthermore, in case the broken image was located in first page, then the logfile were incremented twice at each request of the page !

Explanation :
-------------
I must say I took several hours to understand the logic behind :) Actually, it was a very easy issue :(

My first page is set up as the default target for Error 404 redirection, that is the reason why all broken items (even images) perform a request to it ... and then increment my logfile :) That's it :)

You can easily check it by logging the $REQUEST_URI (At that way you will get the name of the original requested item :) Also, this is a way to track the broken links. Isn't it ?

Regards.
 [2004-01-11 14:01 UTC] kreny at dalouis dot com
Thank you Dodu. Your comment is really a new idea to me.
I have checked my Error 404 page. As my Error 404 page also quote the  "write logfile" function so I think that is just the reason! I think we've found it out.

BTW, although the broken image code make a redirection to 404 page, but in my page, I have several broken images. But why it effects just one time? Maybe because of the configuration?

I also added your commend to my full page at 
http://linux.dalouis.com/php4.3.4_bug.htm

Regards!
 [2004-02-06 07:45 UTC] stanprog at stanprog dot com
I have the same problem with <SCRIPT> and src=

Here is what I found (This is block of one my class):

The following code didn't work:
foreach($this->addJS as $srcLocation) {
  $head .= '<script src="'.$srcLocation.'" />';
}

But the following works fine:
foreach($this->addJS as $srcLocation) {
  $head .= '<script src="'.$srcLocation.'"></script>';
}

In the beginning, I thought that the problem is with the way I close the SCRIPT element, but the following works too (I just remove forech loop):
$head .= '<script src="'.$srcLocation.'" />';

If instead src= I write sra= it works(I mean didn't crash), also if I write srca= instead src= it works too. 

So now I think that it's a bug, some kind of conflict between src= and foreach loop, something internally may be.
I try this without classes and the problem is the same, it's not in the class context.

Best Regards!
Stanislav Yordanov
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 14:01:31 2024 UTC