Commit graph

215 commits

Author SHA1 Message Date
Peter Kokot
ff2b50889c
Refactor checks for fpathconf and pathconf
These two might not be available everywhere so we check them in
config.m4 when doing the configure step. Check is skipped for musl libc
due to limited implementation.

Constants that are defined into main/php_config.h:
HAVE_FPATHCONF
HAVE_PATHCONF

Implemented via GH-10238
Related to GH-10350
Fixes GH-12725
2023-11-20 13:39:21 +00:00
Ilija Tovilo
66e2aa7255
Fix use-of-uninitialized-value when calling php_posix_stream_get_fd (#11694)
Passing a double pointer to php_stream_cast means the caller of
php_posix_stream_get_fd will never receive the actual value. Moreover,
php_posix_stream_get_fd may only write the low sizeof(php_socket_t) bytes of fd,
so we need to initialize the upper bytes to 0 to avoid partial
use-of-uninitialized-value.
2023-07-13 15:21:36 +02:00
George Peter Banyard
59f6d08f83
ext/posix: posix_isatty() fix use-of-uninitialized-value (#11676)
When the value passed is not representable as an int then it is not a TTY and thus should return false immediately.

This was reported by MSAN.
2023-07-11 23:55:18 +01:00
George Peter Banyard
39ef5ca31c
Add tests for uncastable streams and dataloss streams (#10173)
And suppress the nonsensical warnings by passing the PHP_STREAM_CAST_INTERNAL flag.
2023-07-10 13:24:23 +01:00
David CARLIER
717f460fa4
ext/posix: posix_eaccess little update and forgotten UPGRADING entry. (#10965) 2023-03-29 20:08:42 +01:00
David CARLIER
2b354318d9 ext/posix: proposing posix_eaccess. unlike access, it is not standard but available in enough platforms ; on linux it's euidaccess in reality eaccess being 'just' an alias. key difference is eaccess checks the effective user id instead.
Close GH-10917
2023-03-27 22:32:16 +01:00
Cristian Rodríguez
ab3f871846 posix: fix misuse of bool (invalid code in c23)
a bool pointer argument cannot take true or false but either &boolval
or NULL

Closes GH-10577.
2023-02-13 19:40:03 +00:00
David Carlier
dee39518a0 posix detects posix_pathconf api.
alpine linux throws undefined reference at build time, thus
 not assuming it s necessarily available.

Closes GH-10350.
2023-01-23 17:49:34 +00:00
Máté Kocsis
7936c8085e
Fix GH-8329 Print true/false instead of bool in error and debug messages (#8385) 2023-01-23 10:52:14 +01:00
David Carlier
55d19eee49 posix adding posix_fpathconf.
follow-up on GH-10238 but with the file descriptor flavor.

Close GH-10253
2023-01-12 22:15:31 +00:00
David Carlier
61cf7d49ab posix_pathconf throwing ValueError on empty path 2023-01-10 15:03:11 +00:00
David CARLIER
84af629e7e
follow-up on GH-10238. (#10243)
fixes based on feedback.
2023-01-06 18:03:59 +00:00
David Carlier
69d49e4dd7 posix adding posix_pathconf.
to get configuration variables from a directory/file.
Closes GH-10238.
2023-01-06 14:59:02 +00:00
George Peter Banyard
31e7d6ef05 Check that int file descriptor is valid for posix_(isatty|ttyname) 2023-01-04 19:55:36 +00:00
George Peter Banyard
54767b1047 Manually handle int ZPP for posix_isatty()/posix_ttyname() 2023-01-04 19:55:36 +00:00
George Peter Banyard
11f6022365 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-10187: Segfault in stripslashes() with arm64
  Fix memory leak in posix_ttyname()
2022-12-30 16:43:05 +00:00
George Peter Banyard
e6c9b176d4 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10187: Segfault in stripslashes() with arm64
  Fix memory leak in posix_ttyname()
2022-12-30 16:42:45 +00:00
George Peter Banyard
c2b0be5570 Fix memory leak in posix_ttyname()
Closes GH-10190
2022-12-30 16:24:28 +00:00
Ilija Tovilo
d10a04b391
Allow specifying resource in posix_getrlimit() for single result
Closes GH-9790
2022-10-27 10:46:09 +02:00
David Carlier
a5a8b5ff7e posix add sysconf call.
providing handful of common and most used constants.

Closes GH-9481.
2022-09-04 17:11:25 +01:00
Máté Kocsis
17f3631d95
Declare ext/posix constants in stubs (#9095) 2022-07-22 13:08:58 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Nikita Popov
2973a71a91 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix gidlist allocation leak on error
2021-04-11 10:38:16 +02:00
Nikita Popov
26d417d758 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix gidlist allocation leak on error
2021-04-11 10:38:07 +02:00
Nikita Popov
454d297564 Fix gidlist allocation leak on error 2021-04-11 10:37:40 +02:00
Nikita Popov
7f4513f1cb Merge branch 'PHP-8.0'
* PHP-8.0:
  Support more than NGROUPS_MAX groups on macos
2021-04-08 12:25:26 +02:00
Nikita Popov
032905b5a0 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Support more than NGROUPS_MAX groups on macos
2021-04-08 12:25:16 +02:00
Nikita Popov
eebcfeb68e Support more than NGROUPS_MAX groups on macos
I suspect this is the cause for our recent CI failures. Apparently,
on macos it is possible for getgroups() to return more than
NGROUPS_MAX groups. We avoid an EINVAL in that case by fetching
the exact number of groups in advance. This should work on both
macos and posix systems.
2021-04-08 12:23:39 +02:00
David Carlier
ebca8deaaf posix: adding freebsd specific rlimit constants
Respectively number of kqueues, pty limits per user.

Closes GH-6608.
2021-01-18 10:44:21 +01:00
Máté Kocsis
ffff237497
Promote warning to exception in ext/posix
Closes GH-6009
2020-08-24 17:34:33 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov
aa2e68cf6e Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79570
2020-06-19 17:32:34 +02:00
Nikita Popov
525d8a8bfa Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79570
2020-06-19 17:32:21 +02:00
Böszörményi Zoltán
6aff9a50ca Fixed bug #79570
Use the same logic for getgrgid_r, getpwnam_r and getpwuid_r
as for getgrnam_r in #75696

Closes GH-5740.
2020-06-19 17:31:28 +02:00
George Peter Banyard
e6930bcfba More [-Wundef] warnings fixed in POSIX extension
Forgot to squash this into the other commit
2020-05-20 18:22:10 +02:00
George Peter Banyard
f677251ceb Fix [-Wundef] warning in POSIX extension 2020-05-20 14:01:11 +02:00
Máté Kocsis
21cfa03f17
Generate function entries for another batch of extensions
Closes GH-5352
2020-04-05 21:15:30 +02:00
Máté Kocsis
d1764ca330
Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Máté Kocsis
8f4f1dea34
Convert zend_parse_parameters_none() to fast ZPP
I've done the conversion in those extensions where fast ZPP is predominant.
2020-01-03 13:23:37 +01:00
Máté Kocsis
345703724c
Use RETURN_THROWS() during ZPP in most of the extensions
Except for some bigger ones: reflection, sodium, spl
2019-12-31 11:46:11 +01:00
Nikita Popov
647b1c7fcf Remove most uses of ZEND_PARSE_PARAMETERS_END_EX()
As ZPP now throws, it makes no sense to specify an explicit return
value.
2019-10-07 10:02:18 +02:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Stephen Reay
f40cc41465 Added arginfo stub for posix extension 2019-08-14 14:40:37 +02:00
Nikita Popov
0d31a8e4e1 Merge branch 'PHP-7.4' 2019-06-20 17:24:43 +02:00
Nikita Popov
d80f0ff6c0 Handle gr_mem misalignment on macos 2019-06-20 17:24:06 +02:00
Nikita Popov
1df8175b61 Convert fetch_resource warnings into TypeErrors
More type checks that are not part of zpp and should generate a
TypeError in PHP 8.
2019-06-03 09:17:12 +02:00
Dmitry Stogov
f1b306fe11 Switch to use ZTS cache 2019-03-12 14:15:47 +03: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