jani Tue Nov 6 17:11:57 2007 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/standard file.c link.c
/php-src/ext/standard/tests/file fgetc_variation2.phpt
readlink_realpath_error.phpt
symlink_link_linkinfo_is_link_error1.phpt
symlink_link_linkinfo_is_link_error2.phpt
Log:
MFH: sync
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.2&r2=1.409.2.6.2.28.2.3&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.2
php-src/ext/standard/file.c:1.409.2.6.2.28.2.3
--- php-src/ext/standard/file.c:1.409.2.6.2.28.2.2 Mon Nov 5 17:43:04 2007
+++ php-src/ext/standard/file.c Tue Nov 6 17:11:56 2007
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.409.2.6.2.28.2.2 2007/11/05 17:43:04 jani Exp $ */
+/* $Id: file.c,v 1.409.2.6.2.28.2.3 2007/11/06 17:11:56 jani Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -2358,16 +2358,15 @@
Return the resolved path */
PHP_FUNCTION(realpath)
{
- zval **path;
+ char *filename;
+ int filename_len;
char resolved_path_buff[MAXPATHLEN];
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(),
&path) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename,
&filename_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(path);
-
- if (VCWD_REALPATH(Z_STRVAL_PP(path), resolved_path_buff)) {
+ if (VCWD_REALPATH(filename, resolved_path_buff)) {
if (PG(safe_mode) && (!php_checkuid(resolved_path_buff, NULL,
CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/link.c?r1=1.52.2.1.2.3&r2=1.52.2.1.2.3.2.1&diff_format=u
Index: php-src/ext/standard/link.c
diff -u php-src/ext/standard/link.c:1.52.2.1.2.3
php-src/ext/standard/link.c:1.52.2.1.2.3.2.1
--- php-src/ext/standard/link.c:1.52.2.1.2.3 Tue Jul 10 13:21:11 2007
+++ php-src/ext/standard/link.c Tue Nov 6 17:11:56 2007
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: link.c,v 1.52.2.1.2.3 2007/07/10 13:21:11 dmitry Exp $ */
+/* $Id: link.c,v 1.52.2.1.2.3.2.1 2007/11/06 17:11:56 jani Exp $ */
#include "php.h"
#include "php_filestat.h"
@@ -54,24 +54,24 @@
Return the target of a symbolic link */
PHP_FUNCTION(readlink)
{
- zval **filename;
+ char *link;
+ int link_len;
char buff[MAXPATHLEN];
int ret;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) ==
FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &link,
&link_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(filename);
- if (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(filename), NULL,
CHECKUID_CHECK_FILE_AND_DIR)) {
+ if (PG(safe_mode) && !php_checkuid(link, NULL,
CHECKUID_CHECK_FILE_AND_DIR)) {
RETURN_FALSE;
}
- if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
+ if (php_check_open_basedir(link TSRMLS_CC)) {
RETURN_FALSE;
}
- ret = readlink(Z_STRVAL_PP(filename), buff, MAXPATHLEN-1);
+ ret = readlink(link, buff, MAXPATHLEN-1);
if (ret == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s",
strerror(errno));
@@ -88,16 +88,16 @@
Returns the st_dev field of the UNIX C stat structure describing the link */
PHP_FUNCTION(linkinfo)
{
- zval **filename;
+ char *link;
+ int link_len;
struct stat sb;
int ret;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) ==
FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &link,
&link_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(filename);
- ret = VCWD_LSTAT(Z_STRVAL_PP(filename), &sb);
+ ret = VCWD_LSTAT(link, &sb);
if (ret == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s",
strerror(errno));
RETURN_LONG(-1L);
@@ -111,18 +111,17 @@
Create a symbolic link */
PHP_FUNCTION(symlink)
{
- zval **topath, **frompath;
+ char *topath, *frompath;
+ int topath_len, frompath_len;
int ret;
char source_p[MAXPATHLEN];
char dest_p[MAXPATHLEN];
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &topath,
&frompath) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &topath,
&topath_len, &frompath, &frompath_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(topath);
- convert_to_string_ex(frompath);
- if (!expand_filepath(Z_STRVAL_PP(frompath), source_p TSRMLS_CC) ||
!expand_filepath(Z_STRVAL_PP(topath), dest_p TSRMLS_CC)) {
+ if (!expand_filepath(frompath, source_p TSRMLS_CC) ||
!expand_filepath(topath, dest_p TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such file or
directory");
RETURN_FALSE;
}
@@ -151,7 +150,7 @@
}
#ifndef ZTS
- ret = symlink(Z_STRVAL_PP(topath), Z_STRVAL_PP(frompath));
+ ret = symlink(topath, frompath);
#else
ret = symlink(dest_p, source_p);
#endif
@@ -168,18 +167,17 @@
Create a hard link */
PHP_FUNCTION(link)
{
- zval **topath, **frompath;
+ char *topath, *frompath;
+ int topath_len, frompath_len;
int ret;
char source_p[MAXPATHLEN];
char dest_p[MAXPATHLEN];
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &topath,
&frompath) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &topath,
&topath_len, &frompath, &frompath_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(topath);
- convert_to_string_ex(frompath);
- if (!expand_filepath(Z_STRVAL_PP(frompath), source_p TSRMLS_CC) ||
!expand_filepath(Z_STRVAL_PP(topath), dest_p TSRMLS_CC)) {
+ if (!expand_filepath(frompath, source_p TSRMLS_CC) ||
!expand_filepath(topath, dest_p TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such file or
directory");
RETURN_FALSE;
}
@@ -208,7 +206,7 @@
}
#ifndef ZTS
- ret = link(Z_STRVAL_PP(topath), Z_STRVAL_PP(frompath));
+ ret = link(topath, frompath);
#else
ret = link(dest_p, source_p);
#endif
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fgetc_variation2.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u
Index: php-src/ext/standard/tests/file/fgetc_variation2.phpt
diff -u php-src/ext/standard/tests/file/fgetc_variation2.phpt:1.1.2.1
php-src/ext/standard/tests/file/fgetc_variation2.phpt:1.1.2.1.2.1
--- php-src/ext/standard/tests/file/fgetc_variation2.phpt:1.1.2.1 Sat Jul
21 07:55:07 2007
+++ php-src/ext/standard/tests/file/fgetc_variation2.phpt Tue Nov 6
17:11:57 2007
@@ -50,16 +50,3 @@
Warning: fgetc(): supplied argument is not a valid stream resource in %s on
line %d
bool(false)
Done
---UEXPECTF--
-*** Testing fgetc() : usage variations ***
--- Testing fgetc() with closed handle --
-
-Warning: fgetc(): 6 is not a valid stream resource in %s on line %d
-bool(false)
--- Testing fgetc() with unset handle --
-
-Notice: Undefined variable: file_handle in %s on line %d
-
-Warning: fgetc(): supplied argument is not a valid stream resource in %s on
line %d
-bool(false)
-Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/readlink_realpath_error.phpt?r1=1.1.2.2&r2=1.1.2.2.2.1&diff_format=u
Index: php-src/ext/standard/tests/file/readlink_realpath_error.phpt
diff -u php-src/ext/standard/tests/file/readlink_realpath_error.phpt:1.1.2.2
php-src/ext/standard/tests/file/readlink_realpath_error.phpt:1.1.2.2.2.1
--- php-src/ext/standard/tests/file/readlink_realpath_error.phpt:1.1.2.2
Mon Jul 9 17:38:33 2007
+++ php-src/ext/standard/tests/file/readlink_realpath_error.phpt Tue Nov
6 17:11:57 2007
@@ -40,10 +40,10 @@
--EXPECTF--
*** Testing readlink(): error conditions ***
-Warning: Wrong parameter count for readlink() in %s on line %d
+Warning: readlink() expects exactly 1 parameter, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for readlink() in %s on line %d
+Warning: readlink() expects exactly 1 parameter, 2 given in %s on line %d
NULL
*** Testing readlink() on a non-existent link ***
@@ -62,10 +62,10 @@
bool(false)
*** Testing realpath(): error conditions ***
-Warning: Wrong parameter count for realpath() in %s on line %d
+Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for realpath() in %s on line %d
+Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d
NULL
*** Testing realpath() on a non-existent file ***
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt?r1=1.1.2.3&r2=1.1.2.3.2.1&diff_format=u
Index: php-src/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt
diff -u
php-src/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt:1.1.2.3
php-src/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt:1.1.2.3.2.1
---
php-src/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt:1.1.2.3
Mon Jul 16 17:55:39 2007
+++ php-src/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt
Tue Nov 6 17:11:57 2007
@@ -6,7 +6,7 @@
die('skip no symlinks on Windows');
}
if (substr(PHP_OS, 0, 3) == 'SUN') {
- die('skip Not valid for Sun Solaris');
+ die('skip Not valid for Sun Solaris');
}
if (PHP_INT_SIZE != 4) {
die("skip this test is for 32bit platform only");
@@ -72,10 +72,10 @@
--EXPECTF--
*** Testing symlink() for error conditions ***
-Warning: Wrong parameter count for symlink() in %s on line %d
+Warning: symlink() expects exactly 2 parameters, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for symlink() in %s on line %d
+Warning: symlink() expects exactly 2 parameters, 3 given in %s on line %d
NULL
Warning: symlink(): %s in %s on line %d
@@ -98,10 +98,10 @@
*** Testing linkinfo() for error conditions ***
-Warning: Wrong parameter count for linkinfo() in %s on line %d
+Warning: linkinfo() expects exactly 1 parameter, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for linkinfo() in %s on line %d
+Warning: linkinfo() expects exactly 1 parameter, 2 given in %s on line %d
NULL
Warning: linkinfo(): %s in %s on line %d
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt?r1=1.1.2.2.2.1&r2=1.1.2.2.2.2&diff_format=u
Index: php-src/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt
diff -u
php-src/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt:1.1.2.2.2.1
php-src/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt:1.1.2.2.2.2
---
php-src/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt:1.1.2.2.2.1
Mon Nov 5 17:43:21 2007
+++ php-src/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt
Tue Nov 6 17:11:57 2007
@@ -5,7 +5,7 @@
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip no symlinks on Windows');
}
-if (PHP_INT_SIZE != 4) {
+if (PHP_INT_SIZE != 4 ) {
die("skip this test is for 32bit platform only");
}
?>
@@ -69,10 +69,10 @@
--EXPECTF--
*** Testing link() for error conditions ***
-Warning: Wrong parameter count for link() in %s on line %d
+Warning: link() expects exactly 2 parameters, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for link() in %s on line %d
+Warning: link() expects exactly 2 parameters, 3 given in %s on line %d
NULL
Warning: link(): %s in %s on line %d
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php