}
/* }}} */
-/* {{{ proto bool touch(string filename [, int time])
+/* {{{ proto bool touch(string filename [, int time [, int atime]])
Set modification time of file */
PHP_FUNCTION(touch)
{
#if HAVE_UTIME
- pval **filename, **filetime;
+ pval **filename, **filetime, **fileatime;
int ret;
struct stat sb;
FILE *file;
php_error(E_WARNING, "unable to emalloc memory for changing time");
return;
}
- newtime->actime = time(NULL);
- newtime->modtime = newtime->actime;
+ newtime->modtime = newtime->actime = time(NULL);
#endif
} else if (ac == 2 && zend_get_parameters_ex(2, &filename, &filetime) != FAILURE) {
newtime = (struct utimbuf *)emalloc(sizeof(struct utimbuf));
return;
}
convert_to_long_ex(filetime);
- newtime->actime = Z_LVAL_PP(filetime);
+ newtime->modtime = newtime->actime = Z_LVAL_PP(filetime);
+ } else if (ac == 3 && zend_get_parameters_ex(3, &filename, &filetime, &fileatime) != FAILURE) {
+ newtime = (struct utimbuf *)emalloc(sizeof(struct utimbuf));
+ if (!newtime) {
+ php_error(E_WARNING, "unable to emalloc memory for changing time");
+ return;
+ }
+ convert_to_long_ex(fileatime);
+ convert_to_long_ex(filetime);
+ newtime->actime = Z_LVAL_PP(fileatime);
newtime->modtime = Z_LVAL_PP(filetime);
} else {
WRONG_PARAM_COUNT;