diff --git a/ext/standard/file.c b/ext/standard/file.c index f31c3718ded..e552cb77585 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1391,6 +1391,14 @@ PHP_FUNCTION(rename) ret = VCWD_RENAME(old_name, new_name); if (ret == -1) { +#ifdef EXDEV + if (errno == EXDEV) { + if (php_copy_file(old_name, new_name TSRMLS_CC) == SUCCESS) { + VCWD_UNLINK(old_name); + RETURN_TRUE; + } + } +#endif php_error_docref2(NULL TSRMLS_CC, old_name, new_name, E_WARNING, "%s", strerror(errno)); RETURN_FALSE; }