Edit report at https://bugs.php.net/bug.php?id=61148&edit=1
ID: 61148
User updated by: khaos337 at gmail dot com
Reported by: khaos337 at gmail dot com
Summary: auto_prepend_file and auto_append_file seemingly
load on favicon request
-Status: Feedback
+Status: Open
Type: Bug
Package: *General Issues
Operating System: FreeBSD7.3 (amd64)
PHP Version: 5.3.10
Block user comment: N
Private report: N
New Comment:
I do have a 404 handler pointed at a .php script but I didn't even think of
that
because I didn't think it had anything to do with a favicon. As for how the
web
server is configure I'm not sure because I'm on a managed server so I don't
have
that access. I will test it with out the 404 redirect and get back to you.
Previous Comments:
------------------------------------------------------------------------
[2012-02-20 20:26:09] [email protected]
Wouldn't this only happen if you have your web server configured to send
favicon.ico request through PHP? Or, perhaps if you have a 404 handler pointed
at
a PHP script? In a normally configured web server I don't see this happening.
------------------------------------------------------------------------
[2012-02-20 20:23:34] khaos337 at gmail dot com
I was able to confirm the issue occurs across all browsers including firefox
------------------------------------------------------------------------
[2012-02-20 19:55:19] khaos337 at gmail dot com
Description:
------------
Pages that are loaded with auto_prepend_file and auto_append_file load multiple
times per page request if there is no favicon.ico located in the root
directory.
I believe this only happens with chrome and IE, have not been able to replicate
the issue with firefox.
You will see using this configuration, if you load index.php your database will
get at least 2 entries, one for '/index.php', and one for and one for
'/favicon.ico/'
This might just be a matter of appending the documentation if this is deemed
"not
a bug" because according the php.net manual auto_prepend_file and
auto_append_file
should function exactly as the require() function. However if this code was
put
in index.php as "require('prepend.php')" instead of being autoloaded it would
always only load once.
Test script:
---------------
.htaccess:
php_value auto_prepend_file /path_to_file/prepend.php
prepend.php:
<?php
$mysqli = new mysqli('localhost', 'user', 'pass', 'database');
$mysqli->query("INSERT INTO uri_test (uri, time) VALUES
('$_SERVER[REQUEST_URI]',now())");
?>
Expected result:
----------------
expected result is that the prepend.php file only runs once per page load.
Actual result:
--------------
prepend.php loads when the browser is seemingly requesting the URI for the
favicon.ico
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61148&edit=1