PHAR_G(cwd_len) = 0;
if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) {
if ((cwd = strrchr(entry, '/'))) {
- if (entry[0] == '/') {
+ if (entry == cwd) {
+ /* root directory */
+ PHAR_G(cwd_len) = 0;
+ PHAR_G(cwd) = NULL;
+ } else if (entry[0] == '/') {
PHAR_G(cwd_len) = cwd - (entry + 1);
PHAR_G(cwd) = estrndup(entry + 1, PHAR_G(cwd_len));
} else {