Commit Graph

555 Commits

Author SHA1 Message Date
Ilia Alshanetsky
753529325e MFB: Fixed bug #44034 (FILE_IGNORE_NEW_LINES in file() does not work as
expected when lines end in \r\n)
2008-04-15 15:48:20 +00:00
Ilia Alshanetsky
f704d2d37d Added a warning message 2008-03-30 15:05:48 +00:00
Ilia Alshanetsky
17d22a50d9 Fixed bug #44501 (LOCK_EX mode in file_put_contents() is impropertly
handled in combination with url wrappers)
2008-03-26 23:06:47 +00:00
Felipe Pena
e947263bda Removed internal warning 2008-02-24 11:45:55 +00:00
Marcus Boerger
d3e5026564 - MFH Add E_DEPRECATED (Lars Strojny, Felipe Pena, Marcus)
[DOC] Finally added deprecation messages
2008-02-23 17:06:22 +00:00
Sebastian Bergmann
d1dded8751 MFH: Bump copyright year, 2 of 2. 2007-12-31 07:17:19 +00:00
Antony Dovgal
afc76bc71f fix typo (nice catch, Nuno!) 2007-11-13 10:31:24 +00:00
Ilia Alshanetsky
6a792bed75 Fixed bug #43182 (file_put_contents() LOCK_EX does not work properly on file
truncation).
2007-11-12 18:44:18 +00:00
Dmitry Stogov
f95ac18b82 Conditions optimization 2007-11-09 11:08:22 +00:00
Jani Taskinen
77d2a15a97 MFH: sync 2007-11-06 17:11:57 +00:00
Jani Taskinen
43e73a56ab MFH: Sync
[DOC]: note
[DOC] -/* {{{ proto bool copy(string source_file, string destination_file)
[DOC] +/* {{{ proto bool copy(string source_file, string destination_file [, resource context])
[DOC]
[DOC] Apparently this was undocumented so far anyway..
2007-11-05 17:43:04 +00:00
David Soria Parra
d4e8fa62c6 MFH: Add an escape parameter to fgetcsv to satisfy rfc4180 and bug #40501.
[DOC] 5th parameter available since PHP 5.3+
2007-10-03 10:44:32 +00:00
Ilia Alshanetsky
72f910c012 Fixed possible buffer overflows inside the fnmatch() and glob() functions 2007-09-04 12:51:49 +00:00
Ilia Alshanetsky
09cad322fa Fixed bug #42468 (Write lock on file_get_contents fails when using a
compression stream).
2007-09-03 02:53:56 +00:00
Ilia Alshanetsky
fb8e3abe88 Fixed copy test as well as the directory check inside copy() function 2007-08-12 17:09:59 +00:00
Rui Hirokawa
e2a13a5c50 fixed compilation error: S_ISDIR is undefined. 2007-08-11 04:34:59 +00:00
Antony Dovgal
7fbcb745ab nuke the dot 2007-08-10 08:58:44 +00:00
Ilia Alshanetsky
e9b8f37341 Fixed bug #42243 (copy() does not ouput an error when the first arg is a
dir).
2007-08-10 00:36:57 +00:00
Antony Dovgal
08286bcb9f fix ws & folding 2007-08-08 22:32:24 +00:00
foobar
320a41603e MFH: - Fixed bug #41865 (fputcsv(): 2nd parameter is not optional) 2007-07-01 21:28:16 +00:00
Ilia Alshanetsky
6f61e84727 Fixed bug #41492 (open_basedir/safe_mode bypass inside realpath()). 2007-05-27 17:33:39 +00:00
Antony Dovgal
7e80ad9407 fix leak and check for < 0 only of the 5th arg was passed 2007-05-18 20:34:13 +00:00
Antony Dovgal
6d41d020df MFH: fix #41430 (Fatal error with negative values of maxlen parameter of file_get_contents()) 2007-05-18 12:06:44 +00:00
Antony Dovgal
f3a9413b28 MFH: fix #40606 (umask is not being restored when request is finished) 2007-02-23 16:22:20 +00:00
Antony Dovgal
60c435df5e MFH 2007-02-13 12:56:36 +00:00
Sebastian Bergmann
4223aa4d5e MFH: Bump year. 2007-01-01 09:36:18 +00:00
Dmitry Stogov
03312cc0d9 Added function stream_socket_shutdown(). It is a wraper for system shutdown() function, that shut downs part of a full-duplex connection 2006-12-19 08:58:58 +00:00
Hannes Magnusson
d9f03aac34 MFH: sys_get_temp_dir() 2006-12-09 18:00:52 +00:00
Pierre Joye
efa9b7e20b - MFH: #39538, fgetcsv can't handle starting newlines and trailing odd
number of backslashes (David Soria Parra, Pierre)
2006-11-22 12:59:49 +00:00
Antony Dovgal
296e2a3775 MFH 2006-11-20 11:12:42 +00:00
Ilia Alshanetsky
fca0e24410 Added missing object support to file_put_contents(). 2006-11-15 00:20:40 +00:00
Antony Dovgal
017f3ae479 don't forget to close the stream when/if flock() fails 2006-11-13 20:31:27 +00:00
Antony Dovgal
34db368fe4 MFH: fix leaks in get_meta_tags() when used with b0rked HTML
add test
2006-11-13 20:18:12 +00:00
Ilia Alshanetsky
bc59416ff2 Fixed bug #38934 (move_uploaded_file() cannot read uploaded file outside of
open_basedir).
2006-10-13 01:42:20 +00:00
Antony Dovgal
a33913d960 MFH: add a notice to fgetcsv() when delimiter or enclosure is longer than 1 char
(feature request #38496)
2006-08-18 12:50:57 +00:00
Marcus Boerger
9c30e20bd6 - MFH Implement todo: SplFileObject: ability to set the CSV separator per object 2006-07-15 15:08:41 +00:00
Antony Dovgal
54dba635a3 rephrase the error message (fixes #38106) 2006-07-14 20:44:04 +00:00
Antony Dovgal
be0b8c71bc initialize srcstream 2006-05-29 10:39:59 +00:00
Antony Dovgal
1a63feffd1 MFH: prevent resource leaking when passing invalid stream resource as second argument 2006-05-29 10:24:49 +00:00
Ilia Alshanetsky
4ab6eb3d19 MFH: Fixed bug #36630 (umask not reset at the end of the request). 2006-05-14 16:06:48 +00:00
Ilia Alshanetsky
8f7319a49f Fixed safe_mode check for source argument of the copy() function. 2006-04-06 02:39:55 +00:00
Ilia Alshanetsky
4ca3df56d3 Check 2nd parameter of tempnam() against path components. 2006-03-27 23:40:41 +00:00
Pierre Joye
6c509aa837 - add php_mkdir_ex, works like php_mkdir but allows to silent any error
when no options are used
2006-01-13 04:06:00 +00:00
foobar
5bd93221a8 bump year and license version 2006-01-01 12:51:34 +00:00
foobar
d0a54af4c5 MFH: Nuke php3 legacy 2005-12-05 22:54:01 +00:00
Dmitry Stogov
af0adbed39 Fixed fgetcsv() and fputcsv() inconsistency. 2005-10-21 12:13:39 +00:00
foobar
23e671a51e - Bumber up year 2005-08-03 14:08:58 +00:00
Ilia Alshanetsky
fa4ea0fff4 Added support for LOCK_EX flag for file_put_contents(). 2005-07-12 17:55:38 +00:00
Ilia Alshanetsky
49c233212b Fixed bug #32160 (copying a file into itself leads to data loss). 2005-06-22 16:13:47 +00:00
Ilia Alshanetsky
a7ae41bf89 Fixed bug #31363 (broken non-blocking flock()).
# Patch by ian at snork dot net
2005-04-06 13:57:30 +00:00
Ilia Alshanetsky
f95651e338 revert copy patch. 2005-03-27 15:52:49 +00:00
Marcus Boerger
6bd8257607 - Fix proto
- Do not try to write zero bytes
2005-03-07 22:10:08 +00:00
Marcus Boerger
cf6711abfa - Length needs to be positive 2005-03-07 21:54:08 +00:00
Marcus Boerger
97655f8a3b - Make maic qutes runtime work if length is specified too 2005-03-07 21:52:34 +00:00
Marcus Boerger
85ebbd28a0 - Delay memory allocation, speeds up faiure case 2005-03-07 21:28:38 +00:00
Marcus Boerger
7fbc91acce - Allow length 0 as default (e.g. skip param) 2005-03-07 00:16:18 +00:00
Ilia Alshanetsky
09a8f38e39 Fixed bug #32160 (file truncation in copy() when source & destination are
the same).
2005-03-03 03:29:23 +00:00
Anantha Kesari H Y
67a2998335 NetWare libc has pwd.h 2005-02-17 13:56:49 +00:00
Ilia Alshanetsky
55fd7ac601 Added optional maxlen parameter to file_get_contents(). 2005-02-08 15:25:45 +00:00
Wez Furlong
1069cefada support sucking data from streams in file_put_contents() 2005-02-06 23:05:24 +00:00
Wez Furlong
d213b67cdf Add missing constants for socketpair().
I thought I had included these...
Good catch Nuno :)
2004-12-12 23:21:53 +00:00
Wez Furlong
d10b86f8f4 Add stream_socket_pair(), a streams based version of socketpair().
Modified patch from Vincent [six at t0x dot net]
2004-12-12 16:10:35 +00:00
Antony Dovgal
01b996b98b fix buffer overrun & segfault in get_meta_tags() when there is no tag value 2004-12-10 10:30:01 +00:00
Ilia Alshanetsky
6883a3f09c Fixed bug #30990 (allow popen() on *NIX to accept 'b' flag). 2004-12-06 23:30:37 +00:00
Andi Gutmans
939a0f136e - [PATCH] Bug fix for #29770, but for PHP 4.3.9 (Vladimir Zidar) 2004-10-29 00:37:22 +00:00
Ilia Alshanetsky
c5e2e02b0a Simplify code. 2004-10-19 22:25:15 +00:00
Ilia Alshanetsky
51ffc01776 Added optional offset parameter to file_get_contents(). 2004-10-13 23:26:29 +00:00
Anantha Kesari H Y
32788092da removed redundant NEW_LIBC and CLIB_STAT_PATCH checks 2004-09-27 15:37:33 +00:00
Marcus Boerger
32e478b9fc - Add fputcsv() (David Sklar) 2004-09-26 21:55:22 +00:00
Wez Furlong
751f67d5d1 avoid ANSI stdio when calling tempnam() to avoid limitations of AT&T libc. 2004-09-09 19:41:07 +00:00
Andrey Hristov
945f7d68b9 remove "." at the end of messages 2004-09-05 13:27:58 +00:00
Wez Furlong
17adf438a2 Added stream_context_get_default() which returns the default context option.
You may then set options that affect streams operations for the whole script.

Added stream_socket_enable_crypto() which allows you to turn on or off a crypto
layer (eg: SSL/TLS) on stream, if supported by the underlying transport.

Registered a bunch of constants for that.
2004-07-22 12:12:28 +00:00
Andi Gutmans
56f8195fe5 - Nuke empty_string. It is a reminanent from the time where RETURN_FALSE()
used to return "" and not bool(false). It's not worth keeping it because
  STR_FREE() and zval_dtor() always have to check for it and it slows down
  the general case. In addition, it seems that empty_string has been abused
  quite a lot, and was used not only for setting zval's but generally in
  PHP code instead of "", which wasn't the intention. Last but not least,
  nuking empty_string should improve stability as I doubt every place
  correctly checked if they are not mistakenly erealloc()'ing it or
  calling efree() on it.
  NOTE: Some code is probably broken. Each extension maintainer should
  check and see that my changes are OK. Also, I haven't had time to touch
  PECL yet. Will try and do it tomorrow.
2004-07-19 07:19:50 +00:00
Ard Biesheuvel
5232a5afea 64-bit bugsquash party 2004-06-16 23:57:25 +00:00
Ilia Alshanetsky
5b4dc50c01 Fixed possible memory leak inside popen(). 2004-05-14 16:12:03 +00:00
Ard Biesheuvel
81f05c18f5 Wordsize fixes 2004-02-25 20:16:27 +00:00
foobar
2a05750281 Fixed bug #27020 (Compile failure; sys/select.h: No such file or directory) 2004-01-25 06:09:36 +00:00
Ilia Alshanetsky
39b62f26cf Fixed bug #26967 (make various file operations return FALSE on error). 2004-01-19 18:40:39 +00:00
Moriyoshi Koizumi
abfda09eda Fix fgetcsv() to reflect the change on 4.3.5 behaviour. 2004-01-18 20:29:34 +00:00
Wez Furlong
09fb5dc1e6 Remove stale code from flock();
spotted by Hartmut.
2004-01-14 14:37:38 +00:00
Wez Furlong
cd4262eedd Fix #26772: fgets returns NULL instead of FALSE. 2004-01-14 14:25:01 +00:00
Andi Gutmans
dbeb4158d2 - A belated happy holidays and PHP 5 2004-01-08 08:18:22 +00:00
Ilia Alshanetsky
939a70a86d s/then/than/ Thanks Jani & Andi 2004-01-03 00:48:55 +00:00
Ilia Alshanetsky
6f7fe1dfa0 Fixed bug #26752 (Silent unterminated loop when length parameter for
fgets(), fread() and fgetss() is 0).
2004-01-02 00:57:23 +00:00
Moriyoshi Koizumi
93cc95e9db - fixes for compatibility. now fgetcsv() treats a null line to be a single
null component.
2003-12-24 21:30:43 +00:00
Sara Golemon
c56647833b Route mkdir()/rmdir() via wrapper ops.
Move current rmdir()/rmdir() code to plain_wrappers.c
Implement mkdir()/rmdir() in ftp:// wrapper
2003-12-13 04:07:18 +00:00
Sara Golemon
b1f8236b63 Route rename() via wrapper ops.
Move current rename() code to main/streams/plain_wrapper.c
Implement ftp/rename()
Implement userstreams/rename()
2003-12-12 23:06:42 +00:00
Moriyoshi Koizumi
35c3a7f525 Expose the macro globally 2003-12-10 06:08:39 +00:00
Wez Furlong
37f135ceef Add stream_socket_sendto and stream_socket_recvfrom which work very much
like sendto() and recvfrom() syscalls.
2003-11-29 21:46:50 +00:00
Ilia Alshanetsky
c722ab91ee Fixed bug #26355 (flock() doesn't initialize the wouldblock argument) 2003-11-24 01:42:43 +00:00
Moriyoshi Koizumi
e6feb47f00 Some clean-ups 2003-10-29 22:25:57 +00:00
Moriyoshi Koizumi
1085c08aa5 Add missing reinitialization call 2003-10-27 22:45:58 +00:00
Moriyoshi Koizumi
69dcdcb7c1 Fixed bug #26003 (fgetcsv() not binary-safe on null bytes) 2003-10-27 22:36:44 +00:00
Moriyoshi Koizumi
2c95c42404 Fix the macro to prevent it from falling over in a mess 2003-10-05 13:59:15 +00:00
Moriyoshi Koizumi
80edbeba2f Change fgetcsv() so that the second parameter is also optional. 2003-10-04 21:06:29 +00:00
Moriyoshi Koizumi
921e5b47c5 Fix fgetcsv() to correctly support international characters
# note: mblen() is not a mbstring function, but is part of the ANSI standard
# which is even supported by Microsoft's libc.
2003-10-04 02:51:19 +00:00
Stanislav Malyshev
e21669502b MF4: allow realpath() for win32 non-ZTS 2003-09-30 09:52:11 +00:00
Ilia Alshanetsky
dfe3f32ec6 Cleanup previous patch. 2003-09-10 01:07:01 +00:00
Ilia Alshanetsky
29e829fdcf Fixed bug #14049 (realpath() w/ZTS returns invalid results for non-existent
paths)
2003-09-10 00:22:10 +00:00
Sascha Schumann
436a07176c fix format strings 2003-08-28 16:49:57 +00:00
Ilia Alshanetsky
ed40ae2650 emalloc -> safe_emalloc 2003-08-11 23:16:54 +00:00
Ilia Alshanetsky
4d98e9ec97 Finalize the closing process of persistent streams. The current
behavior/API is as follows:

1) To close a persistent use php_stream_pclose(), it will close the stream
and remove it from the persistent list.

2) Inside PHP code only explicit fclose() will close persistent streams,
all other actions such as unset() or assigning a value to stream handle
will not.

3) Regular streams can still be closed by either fclose(), unset() or an
assignment of a value to the stream handler.
2003-07-29 18:26:34 +00:00
Ilia Alshanetsky
abe2afcf6e Make pclose() respect references. 2003-07-28 14:42:42 +00:00
Ilia Alshanetsky
cd4a281364 Fixed bug #24557 (make fclose() respect refcount on the resource). 2003-07-27 18:45:02 +00:00
Ilia Alshanetsky
a6fd611c5e Added array handling to file_put_contents()
More verbose error reporting mechanism.
Test case for file_put_contents().
2003-06-28 20:06:13 +00:00
Derick Rethans
f2acb42223 - Return number of bytes written instead of just TRUE. (Path by Paul Hudson,
hudzilla@php.net)
2003-06-28 08:21:02 +00:00
Marcus Boerger
f304458bdb Fix ZTS mode (hopefully all is working fine now again) 2003-06-14 19:30:42 +00:00
Marcus Boerger
9605db43ed Fix ZTS mode 2003-06-14 17:08:49 +00:00
Sara Golemon
99db19661a Plug leak (context options not freed)
Make contexts auto-registered, ensures userland contexts
and C API contexts are both dealt with on request shutdown.
Also brings contexts in keeping with streams which are already
auto-registered.
2003-06-13 21:33:59 +00:00
James Cox
f68c7ff249 updating license information in the headers. 2003-06-10 20:04:29 +00:00
foobar
9e71e39fa9 WS 2003-06-06 08:10:02 +00:00
Ilia Alshanetsky
32a0044a21 Fixed bug #23913 (make rename() work across partitions on *nix) 2003-05-31 00:32:45 +00:00
Sara Golemon
af5e2af752 Setup FG(default_context) in RINIT/RSHUTDOWN instead of fg_ctor/fg_dtor.
Frees context at right time without double freeing.
2003-05-21 21:36:51 +00:00
Wez Furlong
2d1a6e5dc2 MFB context refcounting and text-mode fopen fixes 2003-05-21 13:33:55 +00:00
Sara Golemon
83b7b75c3c Implement default contexts. For the moment this is useless
but it will be used soon for connection pooling.
2003-05-21 04:04:50 +00:00
Sara Golemon
65d359d71a Fold 'options' parameter into wops->unlink method 2003-05-14 15:12:07 +00:00
Sascha Schumann
31dc62a905 MFB segfault fix 2003-05-14 08:27:48 +00:00
Sara Golemon
5126fbe556 Setup unlink() method in wrapper_ops structure, implement unlink in plainfiles wrapper, explicitly set method NULL in other wrappers (for now), and rewrite unlink userland function to call into wrapper_ops 2003-05-14 06:10:04 +00:00
Hartmut Holzgraefe
e364d1f589 proto fix 2003-05-05 12:36:35 +00:00
Moriyoshi Koizumi
f4c9feb774 Added missing sanity check in fgetcsv() 2003-04-28 15:04:56 +00:00
Sara Golemon
8da5e8e48e Export constants to userland 2003-04-11 02:55:00 +00:00
Sara Golemon
87c5019dd2 Switch file_put_contents 'bool use_include_path' to 'int flags' to allow other options such as appending 2003-04-08 23:24:53 +00:00
Sara Golemon
41d4fcd0da Add context support to file_put_contents() and readfile(), convert readfile() to zend_parse_parameters usage, fix proto for file_put_contents() 2003-04-08 22:10:15 +00:00
Sara Golemon
1e853b74a3 Added context support to file() 2003-04-08 21:00:07 +00:00
foobar
a45b4258f0 file_set_contents -> file_put_contents 2003-04-08 14:12:52 +00:00
Sara Golemon
8001f2922c Add context support to file_get_contents 2003-04-08 00:02:47 +00:00
Ilia Alshanetsky
0e73275429 CS 2003-03-28 14:31:31 +00:00
Sterling Hughes
0a4282eabf fix segfault in file_set_contents() when the file could not successfully
be opened.
2003-03-21 22:22:15 +00:00
Wez Furlong
862586e376 CS fixes 2003-03-18 14:35:15 +00:00
Stig Bakken
0e6fca4f22 * email address change 2003-03-18 12:06:09 +00:00
Sterling Hughes
39b8f06f9b @ Add the file_set_contents() function, as a complement to the file_get_contents()
@ function. (Sterling)
2003-03-12 06:47:34 +00:00
foobar
3c9155e0cb Renamed OnUpdateInt -> OnUpdateLong to prevent further misunderstandings.
# Intentionally left out any 'alias' for it, this way 3rd party extension
# maintainers will really NOTICE the change.
2003-03-07 05:15:28 +00:00
Stefan Esser
af4aa97d1e Fixing functionicalls with variable number of parameters... 2003-03-06 20:31:20 +00:00
Wez Furlong
1b53a2d12e New user-space functions:
. stream_socket_client() - similar to fsockopen(), but more powerful.
  . stream_socket_server() - Creates a server socket.
  . stream_socket_accept() - Accept a client connection.
  . stream_socket_get_name() - Get local or remote name of socket.

Tidy up some leaks and debug printfs.
Move more streams functions into streamsfuncs.c and streamsfuncs.h.
2003-02-28 19:53:21 +00:00
Hartmut Holzgraefe
050e86fde4 it is still to early in the morning for coding :( 2003-02-28 07:57:00 +00:00
Hartmut Holzgraefe
80d267e271 make sure that GNU extensions exist for fnmatch() 2003-02-28 07:52:23 +00:00
Wez Furlong
5def83df0b Move streams specific stuff from ext/standard/file.c -> ext/standard/streams.c
Move win32 select implementation into win32/.
Will update win32 build in a moment.
2003-02-27 22:23:39 +00:00
Wez Furlong
cfd8150b30 Add a generic meta data api for streams. 2003-02-27 19:10:24 +00:00
Wez Furlong
76ebaa6ee7 - Move https:// and ftps:// wrapper registration into the openssl module.
- Expose the http:// and ftp:// wrappers as PHPAPI
- Remove unused variables
2003-02-27 18:16:35 +00:00
Wez Furlong
fd61f69077 Another big commit (tm).
Main Changes:
- Implement a socket transport layer for use by all code that needs to open
  some kind of "special" socket for network or IPC.
- Extensions can register (and override) transports.
- Implement ftruncate() on streams via the ioctl-alike option interface.
- Implement mmap() on streams via the ioctl-alike option interface.
- Implement generic crypto API via the ioctl-alike option interface.
  (currently only supports OpenSSL, but could support other SSL toolkits,
  and other crypto transport protocols).

Impact:
- tcp sockets can be overloaded by the openssl capable sockets at runtime,
  removing the link-time requirement for ssl:// and https:// sockets and
  streams.
- checking stream types using PHP_STREAM_IS_SOCKET is deprecated, since
  there are now a range of possible socket-type streams.

Working towards:
- socket servers using the new transport layer
- mmap support under win32
- Cleaner code.

# I will be updating the win32 build to add the new files shortly
# after this commit.
2003-02-27 17:43:38 +00:00
Derick Rethans
17acc55ad0 - Fix proto 2003-02-26 19:34:16 +00:00
Moriyoshi Koizumi
991da29849 Set fgetss() free from the length parameter 2003-02-25 20:12:18 +00:00
Ilia Alshanetsky
862634ffa5 Added locking to streams.
Allow PHP to automatically release locks on files when terminating the
stream.
Fixed bugs in the handling of the 3rd optional parameter to flock().
2003-02-25 01:39:06 +00:00
Moriyoshi Koizumi
b44b0b80e0 Made fgetss() binary safe too 2003-02-24 22:39:47 +00:00
Wez Furlong
088e2692c3 MFB: Bunch of streams related fixes. 2003-02-24 21:40:23 +00:00
Ilia Alshanetsky
a3cb589b71 Fixed bug #22382 (fgetcsv did not handle \" correctly). 2003-02-24 03:13:25 +00:00
Ilia Alshanetsky
8908faa47f Revent previous patch, adding of file_write_content() was premature. 2003-02-22 20:35:22 +00:00
Ilia Alshanetsky
d2e2fbcc5b int/long change. 2003-02-22 20:33:11 +00:00
Moriyoshi Koizumi
d4e9d48b18 Fixed bug #21689 (fgetcsv suppresses some characters before a separator)
The fix is suggested by Masahiro Nakayama <masa@sfc.wide.ad.jp>

# is* functions expect their argument to be an integer in range of 0-255
2003-02-18 15:15:22 +00:00
Sara Golemon
6fe4ab41f0 Fix stream_filter_(ap|pre)pend to allow attaching on the read and/or write chains. Automagically decide what to do if noone tells us. 2003-02-18 02:53:24 +00:00