ID: 42096
User updated by: michael202 at gmx dot de
Reported By: michael202 at gmx dot de
Status: Open
Bug Type: Streams related
Operating System: Windows only
PHP Version: 5.2CVS-2007-07-24
New Comment:
running a script that makes a few thousand accesses to a samba server
(that is used by approx. 30 other hosts) causes this server to "crash"
and dismount the samba share.
Previous Comments:
------------------------------------------------------------------------
[2007-07-25 17:01:20] thinktank2002 at netcologne dot de
I can confirm this behavior. Tested with PHP 5.2.0 on Windows XP. And
the bug appears not only when using is_dir, it appears also using
is_file.
To make it clear: both functions are working well. But they produce
network errors.
I used this code:
$path = '\\\\Ralf\\postbox\\Public\\xy\\';
if ( is_dir( $path ) ) {
echo 'found';
}
You can see it well using wireshark. Extract:
Tree Connect AndX Request, Path: \\RALF\IPC$
Tree Connect AndX Response
Tree Connect AndX Request, Path: \\RALF\POSTBO
Tree Connect AndX Response, Error: STATUS_BAD_NETWORK_NAME
Trans2 Request, QUERY_PATH_INFO, Query File Basic Info, Path:
Trans2 Response, QUERY_PATH_INFO
Trans2 Request, FIND_FIRST2, Pattern: \Public
Trans2 Response, FIND_FIRST2, Files: Public
Trans2 Request, QUERY_PATH_INFO, Query File Basic Info, Path: \Public
Trans2 Response, QUERY_PATH_INFO
and so on...
------------------------------------------------------------------------
[2007-07-25 14:43:22] michael202 at gmx dot de
tested with php5.2-win32-latest.zip
from today morning 2007-07-25 08h08
error is still in there
------------------------------------------------------------------------
[2007-07-25 08:48:13] michael202 at gmx dot de
Description:
------------
calling is_dir() with an UNC path truncates each part of the path. The
last character is missing.
This results in unnecessary errors (on the host side) and slowdowns (on
client side).
Reproduce code:
---------------
windows only (php 5.2.3, Windows XP with cmd.exe) and linux host.
<?php
$p = '\\hostA\volumeB\dirC';
echo(is_dir($p) . "\n");
and then trace network IO for service/port SMB.
Beware of posssible side effects though caching of SMB connections
Expected result:
----------------
no error messages in /var/log/messages on 'hostA'
Actual result:
--------------
I traced these SMB Commands sent over the network:
Connect AndX Request \\hostA\IPC$
Connect AndX Request \\hostA\volume -> STATUS_BAD_NETWORK_NAME
FindFirst2, Pattern: \dir
these are in /var/log/messages in 'hostA'
... smbd/service.c:make_connection(252)
... couldn't find service volume
I think this is another problem with tsrm_virtual_cwd.c where around
line 500 state_cwd_length is set to 2 if a slash is found at the
beginning. Perhaps the existence of UNC paths is not checked for.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42096&edit=1