# Showstopper? copy() broken for urls and on windows

- Thread: https://externals.io/message/15626
- Original archive: https://news-web.php.net/php.internals/15626
- Started by Edin Kadribasic on 2005-03-26T20:42:40+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #15626 — Edin Kadribasic — 2005-03-26T20:42:40+00:00

URL: https://externals.io/message/15626#15626

Hi,

Patch to fix  #32160 (file truncation in `copy()` when source & destination
are
the same)

http://viewcvs.php.net/viewcvs.cgi/php-src/ext/standard/file.c.diff?r1=1.398&r2=1.399

broke `copy()` on windows alltogether it seems. It also broke copy($url,
$local_file) on other platforms since it tries to `stat()` urls.

I suggest that we remove this fix and release 4.3.11 and 5.0.4 without it. I
do not think that this change requires additional RC.

Edin

---

## #15629 — Sara Golemon — 2005-03-27T05:54:52+00:00

URL: https://externals.io/message/15626#15629 · In reply to: #15626

> Patch to fix  #32160 (file truncation in `copy()` when source & destination
> are
> the same)
>
> http://viewcvs.php.net/viewcvs.cgi/php-src/ext/standard/file.c.diff?r1=1.398&r2=1.399
>
> broke `copy()` on windows alltogether it seems. It also broke copy($url,
> $local_file) on other platforms since it tries to `stat()` urls.
>
> I suggest that we remove this fix and release 4.3.11 and 5.0.4 without it. 
> I
> do not think that this change requires additional RC.
>
Holy crap!

I mean, um... yes, nix that.  Or if the stat approach must be used, use 
php_stream_url_stat() instead and only `return ret;` IF both stats succeed 
AND their inodes are non-zero (wrappers which do not support inode values 
but do support some statting are expected to leave these values as 0) AND 
their inodes are identical.

-Sara

---

## #15630 — Rasmus Lerdorf — 2005-03-27T05:57:23+00:00

URL: https://externals.io/message/15626#15630 · In reply to: #15629

Sara Golemon wrote:
> > […]
> 
> Holy crap!
> 
> I mean, um... yes, nix that.  Or if the stat approach must be used, use 
> php_stream_url_stat() instead and only `return ret;` IF both stats succeed 
> AND their inodes are non-zero (wrappers which do not support inode values 
> but do support some statting are expected to leave these values as 0) AND 
> their inodes are identical.

This still needs a device check on UNIX as well.  Inodes are only unique 
within a single filesystem.

-Rasmus
