#50414 [Opn->Bgs]: strange return attitude in user functions
| From: | jani@php.net | Date: | Tue, 08 Dec 2009 21:53:47 +0000 |
| Subject: | #50414 [Opn->Bgs]: strange return attitude in user functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-145541@lists.php.net to get a copy of this message | ||
ID: 50414
Updated by: jani@php.net
Reported By: bakhtiyor dot bahriddinov at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows XP SP2
PHP Version: 5.2.11
New Comment:
Sorry, but 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 as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2009-12-08 19:08:52] bakhtiyor dot bahriddinov at gmail dot com
Description:
------------
Why return functions in recursive functions doesn't exit and return
value from function but instead loops until end of loop?
Reproduce code:
---------------
<?php
function check_folder($directory){
if ($dir = @opendir($directory)){
while ($file = readdir($dir)) {
if (($file != ".")&&($file != "..")) {
$tempDir = $directory."/".$file;
if (is_dir($tempDir)) {
check_folder($tempDir);
} else {
$file_name = $directory."/".$file;
$file_in_use=check_in_resources($file_name);
if ($file_in_use!=false){ /
return 1;
}
}
}
}
}
return 0;
}
Expected result:
----------------
i expected function to return 1 when var $file_in_use!=false. but it
everytime returns 0
Actual result:
--------------
i expected function to return 1 when var $file_in_use!=false. but it
everytime returns 0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50414&edit=1