Commit Graph

217 Commits

Author SHA1 Message Date
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Nikita Popov
7f78f839dc php_stream_from_zval can no longer return false 2019-09-03 09:25:50 +02:00
Nikita Popov
d59aac58b3 Report errors from stream read and write operations
The php_stream_read() and php_stream_write() functions now return
an ssize_t value, with negative results indicating failure. Functions
like fread() and fwrite() will return false in that case.

As a special case, EWOULDBLOCK and EAGAIN on non-blocking streams
should not be regarded as error conditions, and be reported as
successful zero-length reads/writes instead. The handling of EINTR
remains unclear and is internally inconsistent (e.g. some code-paths
will automatically retry on EINTR, while some won't).

I'm landing this now to make sure the stream wrapper ops API changes
make it into 7.4 -- however, if the user-facing changes turn out to
be problematic we have the option of clamping negative returns to
zero in php_stream_read() and php_stream_write() to restore the
old behavior in a relatively non-intrusive manner.
2019-07-22 17:17:28 +02:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Zeev Suraski
0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Dmitry Stogov
e17fc0d73c Added parentheses 2018-06-06 15:29:59 +03:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Dmitry Stogov
0f06df310c Turn "php_stream_wrapper"s into constants
Keep non-constant "php_stream_wrapper"s in API functions and callbacks for compatibility.
2017-12-14 22:46:22 +03:00
Dmitry Stogov
83e495e0fd Move constants into read-only data segment 2017-12-14 22:14:36 +03:00
Dmitry Stogov
bbfd0df9d3 Use interned strings for persistent stream wrappers and filters 2017-10-31 18:51:35 +03:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Anatol Belski
46f4470e0d ensure the flag doesn't overflow
In certain case, it could take more than just 0/1, but 2 bits should
be enough.
2016-10-06 10:18:31 +02:00
Anatol Belski
1e986c709c handle the stream->__exposed flag correctly
as it's a flag now, just set the value
2016-10-06 02:15:29 +02:00
Anatol Belski
02acb056b3 uint vs. uint32_t 2016-10-05 22:53:21 +02:00
Anatol Belski
0ca15cbeba reduce size of stream struct
32 bytes are spared on 64-bit build
2016-10-05 22:53:21 +02:00
Anatol Belski
4b41973ba1 prevent flags overflows
Sometimes int is overflown. That might still come out with a right
result, but is ofc not clean.
2016-10-05 22:53:21 +02:00
Anatol Belski
6de67244d4 fix blocking pipe stream option value
As revealed by #72857, this value conflicts with the xport option.
Wrong code can otherwise cause streams misbehave, fe if local and
network streams APIs are mixed.
2016-08-17 00:53:15 +02:00
Nikita Popov
5602f64213 Eliminate usages of _PP macros
These are either in debug code (fix them), commented out (drop
them) or in dead compatibility macros (drop them).

One usage was in php_stream_get_from_zval(), which we have not used
since at least PHP 5.2 and, judging from the fact that nobody
complained about it causing compile errors in PHP 7, nobody else
uses it either, so drop it.

There are still remaining uses in mysqli embedded and odbc birdstep.
These probably need to be dropped outright.
2016-03-03 23:20:12 +01:00
Nikita Popov
5983378364 Fix format attributes in ZTS 2016-02-14 14:44:27 +01:00
Lior Kaplan
ed35de784f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Happy new year (Update copyright to 2016)
2016-01-01 19:48:25 +02:00
Lior Kaplan
49493a2dcf Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
Jakub Zelenka
e6e77d9e27 Fix typo in php_stream_from_res_no_verify
This macro is not used but it's wrong as zend_fetch_resource
accepts only 3 args and just one res index. So obviously
we need to use zend_fetch_resource2 here.
2015-11-29 19:28:25 +00:00
Anatol Belski
d6130fada6 fixed wrong number for the new option 2015-07-02 14:22:59 +02:00
Anatol Belski
1a5a4d546e add missing stuff is the header 2015-07-02 14:22:56 +02:00
Bob Weinand
6ad9cd5367 Only call stream_flush if anything was written
This avoids flushing in readonly mode upon close
2015-06-30 03:49:54 +02:00
Dmitry Stogov
4d9a1883aa Fixed bug #68887 (resources are not freed correctly) 2015-04-08 13:29:42 +03:00
Kalle Sommer Nielsen
a141ccb4ff Another minor cleanup, drop ENFORCE_SAFE_MODE (all except pdo_pgsql have #if's for checking already) 2015-03-29 09:34:05 +02:00
Daniel Lowrey
88cfc6ccb6 Merge branch 'PHP-5.6'
* PHP-5.6:
  Fix stream_select() issue with OpenSSL buffer

Conflicts:
	main/streams/streams.c
2015-03-05 17:53:04 -07:00
Chris Wright
e7df9d710c Fix stream_select() issue with OpenSSL buffer
Ensure data from OpenSSL internal buffer has been
transfered to PHP stream buffer before a select()
emulation operation is performed

Addresses bug #65137
https://bugs.php.net/bug.php?id=65137

Conflicts:
	ext/openssl/xp_ssl.c
2015-03-05 17:18:14 -07:00
Dmitry Stogov
2fa8d67a5c Use zend_string* instead of char* for opened_patch handling. Avoid reallocations and improve string reuse. 2015-03-04 02:05:28 +03:00
Xinchen Hui
e98caf27ea found type is unnecessary 2015-02-02 14:45:19 +08:00
Xinchen Hui
7ec8eb380d Use resource directly 2015-02-02 13:56:20 +08:00
Xinchen Hui
38efb690c0 Ported ftp 2015-02-02 13:53:03 +08:00
Xinchen Hui
942809909e Cleanup resource handling APIs 2015-02-02 13:23:16 +08:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Xinchen Hui
0579e8278d bump year 2015-01-15 23:26:37 +08:00
Anatol Belski
f62ad3bc57 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  made the apache ini holders to be zend_bool
  Removed useless local variable
  Use simpler functions
  Fixed test
  small fixes to UPGRADING
  Reorder to save alignment size (of course, only for common used structs)
2014-12-15 13:57:43 +01:00
Xinchen Hui
7081c9bca6 Reorder to save alignment size (of course, only for common used structs) 2014-12-15 01:44:53 -05:00
Anatol Belski
e112f6a04e second shot on removing TSRMLS_* 2014-12-14 14:07:59 +01:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Ferenc Kovacs
d2ab6e1d15 Merge branch 'PHP-5.6'
* PHP-5.6:
  removing the NEWS entry as we had to revert this fix for now
  Revert "Merge branch 'PHP-5.5' into PHP-5.6"
  Revert "fix TS build"
  Revert "Merge branch 'PHP-5.4' into PHP-5.5"
  Revert "Bug #67965: Fix blocking behavior in non-blocking crypto streams"
  Revert "Bug #41631: Fix regression from first attempt (6569db8)"
2014-10-15 19:41:27 +02:00
Ferenc Kovacs
7b8222aa44 Revert "Merge branch 'PHP-5.4' into PHP-5.5"
This reverts commit 30a73658c6, reversing
changes made to 7fac56e072.
2014-10-15 19:33:31 +02:00
Johannes Schlüter
d0cb715373 s/PHP 5/PHP 7/ 2014-09-19 18:33:14 +02:00
Nikita Popov
fdd1e96f3e Revert "remove a few gcc format attributes from some printf-like functions"
This reverts commit 25f5ba94ac.
2014-09-03 15:22:08 +02:00
Nuno Lopes
25f5ba94ac remove a few gcc format attributes from some printf-like functions
Since now PHP's printf-like functions have many custom specifiers, the amount of false-positives wasnt worth it
2014-08-31 11:45:11 -04:00
Chris Wright
0a1df74895 Merge branch 'PHP-5.6'
* PHP-5.6:
  Fix stream_select() issue with OpenSSL buffer
2014-08-27 16:35:28 +01:00
Chris Wright
db03216e62 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fix stream_select() issue with OpenSSL buffer
2014-08-27 16:06:28 +01:00
Chris Wright
30a73658c6 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Fix stream_select() issue with OpenSSL buffer

Conflicts:
	ext/openssl/xp_ssl.c
2014-08-27 16:01:18 +01:00
Chris Wright
32be79dcfa Fix stream_select() issue with OpenSSL buffer
Ensure data from OpenSSL internal buffer has been
transfered to PHP stream buffer before a select()
emulation operation is performed

Addresses bug #65137
https://bugs.php.net/bug.php?id=65137

Conflicts:
	ext/openssl/xp_ssl.c
2014-08-27 13:25:50 +01:00