#32924 [Csd]: file included with "auto_prepend_file" can be called with require|include_once()

From: Date: Mon, 09 May 2005 10:00:47 +0000
Subject: #32924 [Csd]: file included with "auto_prepend_file" can be called with require|include_once()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-78792@lists.php.net to get a copy of this message
ID: 32924 Updated by: stas@php.net Reported By: stas at zend dot com Status: Closed Bug Type: *General Issues PHP Version: 5.0.4 Assigned To: stas New Comment: I don't think there's any problem with the fix - since include() is not supposed to check included files, this fix does not affect include() in any way. Previous Comments: ------------------------------------------------------------------------ [2005-05-09 11:35:22] sniper@php.net It's exactly same now how it works in PHP4 too. ------------------------------------------------------------------------ [2005-05-06 12:26:34] derick@php.net IMO, the following SHOULD include the file twice: <? include('foo'); include_once('foo'); ?> normal includes should not get their file names put into the included_files list... only ones that are included with include_once/require_once. So I think you fixed the bug in the wrong way here. ------------------------------------------------------------------------ [2005-05-04 18:18:14] stas@php.net Fixed for 5HEAD. ------------------------------------------------------------------------ [2005-05-04 18:17:45] stas@php.net This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2005-05-03 11:35:17] stas at zend dot com Description: ------------ At least starting from 4.3.x, when file is included via include(), it is added to the list of included files, so that the code: <? include('foo'); include_once('foo'); ?> woould include 'foo' only once. However, if you put foo in auto_prepend_file and then do <? include_once('foo'); ?> - 'foo' would be included twice. I see this behaviour as inconsistent and needing to be fixed, though there can be some BC issues with that. Reproduce code: --------------- 1. <? include('foo'); include_once('foo'); ?> foo: <? echo "Whatever..."; ?> 2. auto_prepend_file=foo <? include_once('foo'); ?> Expected result: ---------------- "Whatever..." once in both cases Actual result: -------------- "Whatever..." once in the first case, twice in the second. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32924&edit=1

« previous php.bugs (#78792) next »