RETURN_FALSE;
}
- add_assoc_string(return_value, "lifetime", PS(cookie_lifetime), 1);
+ add_assoc_long(return_value, "lifetime", PS(cookie_lifetime));
add_assoc_string(return_value, "path", PS(cookie_path), 1);
add_assoc_string(return_value, "domain", PS(cookie_domain), 1);
}
if (filepath[0] == '.') {
char *cwd = malloc(MAXPATHLEN + 1);
- if (getcwd(cwd, MAXPATHLEN)) {
+ if (PHP_GETCWD(cwd, MAXPATHLEN)) {
char *cwd_end = cwd + strlen(cwd);
if (filepath[1] == '.') { /* parent directory - .. */
#define PUTS_H(str) php_header_write((str), strlen((str)))
#define PUTC_H(c) (php_header_write(&(c), 1), (c))
+/* Virtual current directory support */
+#ifdef VIRTUAL_DIR
+#define PHP_GETCWD(buff, size) virtual_getcwd(buff,size)
+#define PHP_FOPEN(path, mode) virtual_fopen(path, mode)
+#define PHP_CHDIR(path) virtual_chdir(path)
+#else
+#define PHP_GETCWD(buff, size) getcwd(buff,size)
+#define PHP_FOPEN(path, mode) fopen(path, mode)
+#define PHP_CHDIR(path) chdir(path)
+#endif
#include "zend_constants.h"
if ((*workpos == '\\') || (*workpos == '/')) {
/* We start at the root of the current drive */
/* Get the current directory */
- if (getcwd(path_construction, MAXPATHLEN-1) == NULL) {
+ if (PHP_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
/* Unable to get cwd */
resolved_path[0] = 0;
return NULL;
workpos++;
} else {
/* Use the current directory */
- if (getcwd(path_construction, MAXPATHLEN-1) == NULL) {
+ if (PHP_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
/* Unable to get cwd */
resolved_path[0] = 0;
return NULL;
workpos++;
} else {
/* Use the current directory */
- if (getcwd(path_construction, MAXPATHLEN-1) == NULL) {
+ if (PHP_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
/* Unable to get cwd */
resolved_path[0] = 0;
return NULL;
duid = sb.st_uid;
} else {
s = emalloc(MAXPATHLEN+1);
- if (!getcwd(s,MAXPATHLEN)) {
+ if (!PHP_GETCWD(s,MAXPATHLEN)) {
php_error(E_WARNING, "Unable to access current working directory");
return(0);
}