Lines Matching refs:u
82 if (!(spl_filesystem_object_pointer)->u.file.stream) { \
88 if (!(intern)->u.dir.dirp) { \
95 if (intern->u.file.current_line) { in spl_filesystem_file_free_line()
96 zend_string_release_ex(intern->u.file.current_line, /* persistent */ false); in spl_filesystem_file_free_line()
97 intern->u.file.current_line = NULL; in spl_filesystem_file_free_line()
99 if (!Z_ISUNDEF(intern->u.file.current_zval)) { in spl_filesystem_file_free_line()
100 zval_ptr_dtor(&intern->u.file.current_zval); in spl_filesystem_file_free_line()
101 ZVAL_UNDEF(&intern->u.file.current_zval); in spl_filesystem_file_free_line()
113 if (intern->u.dir.dirp) { in spl_filesystem_object_destroy_object()
114 php_stream_close(intern->u.dir.dirp); in spl_filesystem_object_destroy_object()
115 intern->u.dir.dirp = NULL; in spl_filesystem_object_destroy_object()
119 if (intern->u.file.stream) { in spl_filesystem_object_destroy_object()
125 if (!intern->u.file.stream->is_persistent) { in spl_filesystem_object_destroy_object()
126 php_stream_close(intern->u.file.stream); in spl_filesystem_object_destroy_object()
128 php_stream_pclose(intern->u.file.stream); in spl_filesystem_object_destroy_object()
130 intern->u.file.stream = NULL; in spl_filesystem_object_destroy_object()
131 ZVAL_UNDEF(&intern->u.file.zresource); in spl_filesystem_object_destroy_object()
159 if (intern->u.dir.sub_path) { in spl_filesystem_object_free_storage()
160 zend_string_release(intern->u.dir.sub_path); in spl_filesystem_object_free_storage()
164 if (intern->u.file.open_mode) { in spl_filesystem_object_free_storage()
165 zend_string_release(intern->u.file.open_mode); in spl_filesystem_object_free_storage()
193 MAX(XtOffsetOf(spl_filesystem_object, u.dir.entry), in spl_filesystem_object_new()
194 XtOffsetOf(spl_filesystem_object, u.file.escape) + sizeof(int))); in spl_filesystem_object_new()
209 if (intern->type == SPL_FS_DIR && php_stream_is(intern->u.dir.dirp, &php_glob_stream_ops)) { in spl_filesystem_object_get_path()
211 char *tmp = php_glob_stream_get_path(intern->u.dir.dirp, &len); in spl_filesystem_object_get_path()
243 name_len = strlen(intern->u.dir.entry.d_name); in spl_filesystem_object_get_file_name()
245 intern->file_name = zend_string_init(intern->u.dir.entry.d_name, name_len, 0); in spl_filesystem_object_get_file_name()
251 ZSTR_VAL(path), ZSTR_LEN(path), &slash, 1, intern->u.dir.entry.d_name, name_len); in spl_filesystem_object_get_file_name()
267 if (!intern->u.dir.dirp || !php_stream_readdir(intern->u.dir.dirp, &intern->u.dir.entry)) { in spl_filesystem_dir_read()
268 intern->u.dir.entry.d_name[0] = '\0'; in spl_filesystem_dir_read()
292 intern->u.dir.dirp = php_stream_opendir(ZSTR_VAL(path), REPORT_ERRORS, FG(default_context)); in spl_filesystem_dir_open()
299 intern->u.dir.index = 0; in spl_filesystem_dir_open()
301 if (EG(exception) || intern->u.dir.dirp == NULL) { in spl_filesystem_dir_open()
302 intern->u.dir.entry.d_name[0] = '\0'; in spl_filesystem_dir_open()
311 } while (skip_dots && spl_filesystem_is_dot(intern->u.dir.entry.d_name)); in spl_filesystem_dir_open()
325 zend_string_release(intern->u.file.open_mode); in spl_filesystem_file_open()
326 intern->u.file.open_mode = NULL; in spl_filesystem_file_open()
332 intern->u.file.context = php_stream_context_from_zval(intern->u.file.zcontext, 0); in spl_filesystem_file_open()
333 …u.file.stream = php_stream_open_wrapper_ex(ZSTR_VAL(intern->file_name), ZSTR_VAL(intern->u.file.op… in spl_filesystem_file_open()
335 if (!ZSTR_LEN(intern->file_name) || !intern->u.file.stream) { in spl_filesystem_file_open()
339 zend_string_release(intern->u.file.open_mode); in spl_filesystem_file_open()
340 intern->u.file.open_mode = NULL; in spl_filesystem_file_open()
346 intern->u.file.stream->flags |= PHP_STREAM_FLAG_NO_FCLOSE; in spl_filesystem_file_open()
361 …intern->orig_path = zend_string_init(intern->u.file.stream->orig_path, strlen(intern->u.file.strea… in spl_filesystem_file_open()
364 ZVAL_RES(&intern->u.file.zresource, intern->u.file.stream->res); in spl_filesystem_file_open()
369 intern->u.file.delimiter = ','; in spl_filesystem_file_open()
370 intern->u.file.enclosure = '"'; in spl_filesystem_file_open()
371 intern->u.file.escape = (unsigned char) '\\'; in spl_filesystem_file_open()
372 intern->u.file.is_escape_default = true; in spl_filesystem_file_open()
374 …intern->u.file.func_getCurr = zend_hash_str_find_ptr(&intern->std.ce->function_table, "getcurrentl… in spl_filesystem_file_open()
412 for (index = 0; index < source->u.dir.index; ++index) { in spl_filesystem_object_clone()
415 } while (skip_dots && spl_filesystem_is_dot(intern->u.dir.entry.d_name)); in spl_filesystem_object_clone()
417 intern->u.dir.index = index; in spl_filesystem_object_clone()
504 if (!source->u.dir.entry.d_name[0]) { in spl_filesystem_object_create_type()
559 intern->u.file.open_mode = zend_string_copy(open_mode); in spl_filesystem_object_create_type()
560 intern->u.file.zcontext = resource; in spl_filesystem_object_create_type()
593 if (intern->u.dir.entry.d_name[0]) { in spl_filesystem_object_get_pathname()
639 if (intern->u.dir.dirp && php_stream_is(intern->u.dir.dirp ,&php_glob_stream_ops)) { in spl_filesystem_object_get_debug_info()
646 if (intern->u.dir.sub_path) { in spl_filesystem_object_get_debug_info()
647 ZVAL_STR_COPY(&tmp, intern->u.dir.sub_path); in spl_filesystem_object_get_debug_info()
654 ZVAL_STR_COPY(&tmp, intern->u.file.open_mode); in spl_filesystem_object_get_debug_info()
657 ZVAL_STR(&tmp, ZSTR_CHAR((zend_uchar)intern->u.file.delimiter)); in spl_filesystem_object_get_debug_info()
660 ZVAL_STR(&tmp, ZSTR_CHAR((zend_uchar)intern->u.file.enclosure)); in spl_filesystem_object_get_debug_info()
672 if (fsobj->u.dir.dirp == NULL && fsobj->orig_path == NULL) { in spl_filesystem_object_get_method_check()
750 intern->u.dir.index = 0; in PHP_METHOD()
751 php_stream_rewinddir(intern->u.dir.dirp); in PHP_METHOD()
766 RETURN_LONG(intern->u.dir.index); in PHP_METHOD()
793 intern->u.dir.index++; in PHP_METHOD()
796 } while (skip_dots && spl_filesystem_is_dot(intern->u.dir.entry.d_name)); in PHP_METHOD()
816 if (intern->u.dir.index > pos) { in PHP_METHOD()
818 …zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_rewin… in PHP_METHOD()
821 while (intern->u.dir.index < pos) { in PHP_METHOD()
823 …zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_valid… in PHP_METHOD()
830 …zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_next,… in PHP_METHOD()
844 RETURN_BOOL(intern->u.dir.entry.d_name[0] != '\0'); in PHP_METHOD()
907 RETURN_STRING(intern->u.dir.entry.d_name); in PHP_METHOD()
972 fname = php_basename(intern->u.dir.entry.d_name, strlen(intern->u.dir.entry.d_name), NULL, 0); in PHP_METHOD()
1035 fname = php_basename(intern->u.dir.entry.d_name, strlen(intern->u.dir.entry.d_name), suffix, slen); in PHP_METHOD()
1069 RETURN_STRING(intern->u.dir.entry.d_name); in PHP_METHOD()
1114 RETURN_BOOL(spl_filesystem_is_dot(intern->u.dir.entry.d_name)); in PHP_METHOD()
1275 if (intern->type == SPL_FS_DIR && !intern->file_name && intern->u.dir.entry.d_name[0]) { in PHP_METHOD()
1415 intern->u.dir.index = 0; in PHP_METHOD()
1416 if (intern->u.dir.dirp) { in PHP_METHOD()
1417 php_stream_rewinddir(intern->u.dir.dirp); in PHP_METHOD()
1421 } while (skip_dots && spl_filesystem_is_dot(intern->u.dir.entry.d_name)); in PHP_METHOD()
1462 if (spl_filesystem_is_invalid_or_dot(intern->u.dir.entry.d_name)) { in PHP_METHOD()
1465 if (intern->u.dir.entry.d_type == DT_DIR) { in PHP_METHOD()
1467 } else if (intern->u.dir.entry.d_type == DT_REG) { in PHP_METHOD()
1516 size_t name_len = strlen(intern->u.dir.entry.d_name); in PHP_METHOD()
1517 if (intern->u.dir.sub_path && ZSTR_LEN(intern->u.dir.sub_path)) { in PHP_METHOD()
1518 zend_string *sub_path = zend_string_alloc(ZSTR_LEN(intern->u.dir.sub_path) + 1 + name_len, 0); in PHP_METHOD()
1519 memcpy(ZSTR_VAL(sub_path), ZSTR_VAL(intern->u.dir.sub_path), ZSTR_LEN(intern->u.dir.sub_path)); in PHP_METHOD()
1520 ZSTR_VAL(sub_path)[ZSTR_LEN(intern->u.dir.sub_path)] = slash; in PHP_METHOD()
1521 …memcpy(ZSTR_VAL(sub_path) + ZSTR_LEN(intern->u.dir.sub_path) + 1, intern->u.dir.entry.d_name, name… in PHP_METHOD()
1522 ZSTR_VAL(sub_path)[ZSTR_LEN(intern->u.dir.sub_path) + 1 + name_len] = 0; in PHP_METHOD()
1523 subdir->u.dir.sub_path = sub_path; in PHP_METHOD()
1525 subdir->u.dir.sub_path = zend_string_init(intern->u.dir.entry.d_name, name_len, 0); in PHP_METHOD()
1543 if (intern->u.dir.sub_path) { in PHP_METHOD()
1544 RETURN_STR_COPY(intern->u.dir.sub_path); in PHP_METHOD()
1561 if (intern->u.dir.sub_path) { in PHP_METHOD()
1562 …RETURN_NEW_STR(strpprintf(0, "%s%c%s", ZSTR_VAL(intern->u.dir.sub_path), slash, intern->u.dir.entr… in PHP_METHOD()
1564 RETURN_STRING(intern->u.dir.entry.d_name); in PHP_METHOD()
1593 if (intern->u.dir.dirp && php_stream_is(intern->u.dir.dirp ,&php_glob_stream_ops)) { in PHP_METHOD()
1594 RETURN_LONG(php_glob_stream_get_count(intern->u.dir.dirp, NULL)); in PHP_METHOD()
1660 return object->u.dir.entry.d_name[0] != '\0' ? SUCCESS : FAILURE; in spl_filesystem_dir_it_valid()
1678 ZVAL_LONG(key, object->u.dir.index); in spl_filesystem_dir_it_current_key()
1687 object->u.dir.index++; in spl_filesystem_dir_it_move_forward()
1701 object->u.dir.index = 0; in spl_filesystem_dir_it_rewind()
1702 if (object->u.dir.dirp) { in spl_filesystem_dir_it_rewind()
1703 php_stream_rewinddir(object->u.dir.dirp); in spl_filesystem_dir_it_rewind()
1752 ZVAL_STRING(key, object->u.dir.entry.d_name); in spl_filesystem_tree_it_current_key()
1769 object->u.dir.index++; in spl_filesystem_tree_it_move_forward()
1772 } while (skip_dots && spl_filesystem_is_dot(object->u.dir.entry.d_name)); in spl_filesystem_tree_it_move_forward()
1791 object->u.dir.index = 0; in spl_filesystem_tree_it_rewind()
1792 if (object->u.dir.dirp) { in spl_filesystem_tree_it_rewind()
1793 php_stream_rewinddir(object->u.dir.dirp); in spl_filesystem_tree_it_rewind()
1797 } while (skip_dots && spl_filesystem_is_dot(object->u.dir.entry.d_name)); in spl_filesystem_tree_it_rewind()
1850 if (php_stream_eof(intern->u.file.stream)) { in spl_filesystem_file_read_ex()
1857 if (intern->u.file.max_line_len > 0) { in spl_filesystem_file_read_ex()
1858 buf = safe_emalloc((intern->u.file.max_line_len + 1), sizeof(char), 0); in spl_filesystem_file_read_ex()
1859 …if (php_stream_get_line(intern->u.file.stream, buf, intern->u.file.max_line_len + 1, &line_len) ==… in spl_filesystem_file_read_ex()
1866 buf = php_stream_get_line(intern->u.file.stream, NULL, 0, &line_len); in spl_filesystem_file_read_ex()
1870 intern->u.file.current_line = ZSTR_EMPTY_ALLOC(); in spl_filesystem_file_read_ex()
1882 intern->u.file.current_line = zend_string_init(buf, line_len, /* persistent */ false); in spl_filesystem_file_read_ex()
1885 intern->u.file.current_line_num += line_add; in spl_filesystem_file_read_ex()
1892 zend_long line_add = (intern->u.file.current_line) ? 1 : 0; in spl_filesystem_file_read()
1898 const char *current_line = ZSTR_VAL(intern->u.file.current_line); in is_line_empty()
1899 size_t current_line_len = ZSTR_LEN(intern->u.file.current_line); in is_line_empty()
1922 size_t buf_len = ZSTR_LEN(intern->u.file.current_line); in spl_filesystem_file_read_csv()
1923 char *buf = estrndup(ZSTR_VAL(intern->u.file.current_line), buf_len); in spl_filesystem_file_read_csv()
1925 if (!Z_ISUNDEF(intern->u.file.current_zval)) { in spl_filesystem_file_read_csv()
1926 zval_ptr_dtor(&intern->u.file.current_zval); in spl_filesystem_file_read_csv()
1927 ZVAL_UNDEF(&intern->u.file.current_zval); in spl_filesystem_file_read_csv()
1930 HashTable *values = php_fgetcsv(intern->u.file.stream, delimiter, enclosure, escape, buf_len, buf); in spl_filesystem_file_read_csv()
1934 ZVAL_ARR(&intern->u.file.current_zval, values); in spl_filesystem_file_read_csv()
1936 ZVAL_COPY(return_value, &intern->u.file.current_zval); in spl_filesystem_file_read_csv()
1948 …turn spl_filesystem_file_read_csv(intern, intern->u.file.delimiter, intern->u.file.enclosure, inte… in spl_filesystem_file_read_line_ex()
1950 if (intern->u.file.func_getCurr->common.scope != spl_ce_SplFileObject) { in spl_filesystem_file_read_line_ex()
1953 if (php_stream_eof(intern->u.file.stream)) { in spl_filesystem_file_read_line_ex()
1959 …zend_call_method_with_0_params(Z_OBJ_P(this_ptr), Z_OBJCE_P(this_ptr), &intern->u.file.func_getCur… in spl_filesystem_file_read_line_ex()
1971 if (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) { in spl_filesystem_file_read_line_ex()
1972 intern->u.file.current_line_num++; in spl_filesystem_file_read_line_ex()
1975 intern->u.file.current_line = zend_string_copy(Z_STR(retval)); in spl_filesystem_file_read_line_ex()
1998 if (!intern->u.file.stream) { in spl_filesystem_file_rewind()
2002 if (-1 == php_stream_rewind(intern->u.file.stream)) { in spl_filesystem_file_rewind()
2008 intern->u.file.current_line_num = 0; in spl_filesystem_file_rewind()
2031 if (UNEXPECTED(intern->u.file.stream)) { in PHP_METHOD()
2036 intern->u.file.open_mode = zend_string_copy(open_mode); in PHP_METHOD()
2039 intern->u.file.zcontext = stream_context; in PHP_METHOD()
2049 path_len = strlen(intern->u.file.stream->orig_path); in PHP_METHOD()
2051 if (path_len > 1 && IS_SLASH_AT(intern->u.file.stream->orig_path, path_len-1)) { in PHP_METHOD()
2055 while (path_len > 1 && !IS_SLASH_AT(intern->u.file.stream->orig_path, path_len-1)) { in PHP_METHOD()
2063 intern->path = zend_string_init(intern->u.file.stream->orig_path, path_len, 0); in PHP_METHOD()
2079 if (UNEXPECTED(intern->u.file.stream)) { in PHP_METHOD()
2092 intern->u.file.open_mode = ZSTR_INIT_LITERAL("wb", 0); in PHP_METHOD()
2126 RETURN_BOOL(php_stream_eof(intern->u.file.stream)); in PHP_METHOD()
2139 RETURN_BOOL(intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)); in PHP_METHOD()
2141 if (!intern->u.file.stream) { in PHP_METHOD()
2144 RETURN_BOOL(!php_stream_eof(intern->u.file.stream)); in PHP_METHOD()
2161 RETURN_STR_COPY(intern->u.file.current_line); in PHP_METHOD()
2175 if (!intern->u.file.current_line && Z_ISUNDEF(intern->u.file.current_zval)) { in PHP_METHOD()
2178 …if (intern->u.file.current_line && (!SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_CSV) || Z_IS… in PHP_METHOD()
2179 RETURN_STR_COPY(intern->u.file.current_line); in PHP_METHOD()
2180 } else if (!Z_ISUNDEF(intern->u.file.current_zval)) { in PHP_METHOD()
2181 ZEND_ASSERT(!Z_ISREF(intern->u.file.current_zval)); in PHP_METHOD()
2182 ZEND_ASSERT(Z_TYPE(intern->u.file.current_zval) == IS_ARRAY); in PHP_METHOD()
2183 RETURN_COPY(&intern->u.file.current_zval); in PHP_METHOD()
2201 RETURN_LONG(intern->u.file.current_line_num); in PHP_METHOD()
2217 intern->u.file.current_line_num++; in PHP_METHOD()
2258 intern->u.file.max_line_len = max_len; in PHP_METHOD()
2270 RETURN_LONG((zend_long)intern->u.file.max_line_len); in PHP_METHOD()
2295 if (intern->u.file.is_escape_default) { in spl_csv_enclosure_param_handling()
2303 return intern->u.file.escape; in spl_csv_enclosure_param_handling()
2313 char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure; in PHP_METHOD()
2353 char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure; in PHP_METHOD()
2384 ret = php_fputcsv(intern->u.file.stream, fields, delimiter, enclosure, escape_char, eol); in PHP_METHOD()
2424 intern->u.file.is_escape_default = false; in PHP_METHOD()
2427 intern->u.file.delimiter = delimiter; in PHP_METHOD()
2428 intern->u.file.enclosure = enclosure; in PHP_METHOD()
2429 intern->u.file.escape = escape_char; in PHP_METHOD()
2445 delimiter[0] = intern->u.file.delimiter; in PHP_METHOD()
2447 enclosure[0] = intern->u.file.enclosure; in PHP_METHOD()
2449 if (intern->u.file.escape == PHP_CSV_NO_ESCAPE) { in PHP_METHOD()
2452 escape[0] = (unsigned char) intern->u.file.escape; in PHP_METHOD()
2475 php_flock_common(intern->u.file.stream, operation, 1, wouldblock, return_value); in PHP_METHOD()
2490 RETURN_BOOL(!php_stream_flush(intern->u.file.stream)); in PHP_METHOD()
2505 ret = php_stream_tell(intern->u.file.stream); in PHP_METHOD()
2527 RETURN_LONG(php_stream_seek(intern->u.file.stream, pos, (int)whence)); in PHP_METHOD()
2543 int result = php_stream_getc(intern->u.file.stream); in PHP_METHOD()
2549 intern->u.file.current_line_num++; in PHP_METHOD()
2566 RETURN_LONG(php_stream_passthru(intern->u.file.stream)); in PHP_METHOD()
2588 …int result = php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), ZSTR_VAL(format_str), (int… in PHP_METHOD()
2623 written = php_stream_write(intern->u.file.stream, str, str_len); in PHP_METHOD()
2647 str = php_stream_read_to_str(intern->u.file.stream, length); in PHP_METHOD()
2665 php_fstat(intern->u.file.stream, return_value); in PHP_METHOD()
2681 if (!php_stream_truncate_supported(intern->u.file.stream)) { in PHP_METHOD()
2686 RETURN_BOOL(0 == php_stream_truncate_set_size(intern->u.file.stream, size)); in PHP_METHOD()
2714 intern->u.file.current_line_num++; in PHP_METHOD()
2729 if (!intern->u.file.current_line) { in PHP_METHOD()
2730 ZEND_ASSERT(Z_ISUNDEF(intern->u.file.current_zval)); in PHP_METHOD()
2737 RETURN_STR_COPY(intern->u.file.current_line); in PHP_METHOD()