Commit Graph

529 Commits

Author SHA1 Message Date
Niels Dossche
301418284d Fix GH-10521: ftp_get/ftp_nb_get resumepos offset is maximum 10GB
The char arrays were too small for a long on 64-bit systems, which
resulted in cutting off the string at the end with a NUL byte. Use a
size of MAX_LENGTH_OF_LONG to fix this issue instead of a fixed size
of 11 chars.

Closes GH-10525.
2023-03-20 23:20:21 +01:00
David Carlier
574a7e7ef8 ext/ftp fix ftp_nb_get signature (for failure).
ref: https://github.com/php/doc-en/pull/2331#issuecomment-1448984096

Closes GH-10760.
2023-03-03 21:08:16 +00:00
nielsdos
abc6fe8f2e
Propagate success status of ftp_close() to userland
The docs say that this function returns true on success, and false on
error. This function always returns true in the current implementation
because the success return value from ftp_close() is never propagated to
userland. This affects one test: since the test server exits after an
invalid login, the ftp close correctly fails (because the server has
gone away).
2023-03-03 15:26:11 +01:00
Máté Kocsis
20fb26e55c
Add more specific array return type hints for various extensions - part 2
ext/ftp, ext/gmp, ext/intl

Closes GH-7433
2021-11-17 10:56:27 +01:00
Máté Kocsis
a55c6384dc
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix the return type of ftp_raw()
2021-09-06 10:29:24 +02:00
Máté Kocsis
4b3206d6c1
Fix the return type of ftp_raw() (#7466) 2021-09-06 10:26:01 +02:00
Joe Watkins
570d9b63e9
Not serializable flag permeation 2021-07-20 12:28:35 +02:00
Máté Kocsis
b382883696
Indent stubs inside global namespace blocks (#7261) 2021-07-20 10:23:58 +02:00
Nikita Popov
efbb2198d4 Return value from ZEND_ATOL
Instead of assigning it as part of the macro itself, which makes
usage quite awkward.
2021-07-12 16:51:24 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Benjamin Eberlei
0ca5ab4fa5
Add host for php_network_getaddresses getaddrinfo failed error message. (#7181) 2021-06-22 17:18:09 +02:00
Nikita Popov
d982f4eb28 Use free_obj handler in FTPConnection 2021-06-09 12:13:15 +02:00
Nikita Popov
ea256a218b Add %0 format to run-tests.php
This format matches against null bytes, and prevents the test
expectation from being interpreted as binary data.

bless_tests.php will automatically replace \0 with %0 as well.
2021-05-29 11:33:13 +02:00
Michael Voříšek
3ccc0409ce Remove no longer used "log_errors_max_len" ini directive (#6838)
This is a re-application of the original match against master.
The patch was originally applied to master, then reverted from
there, incorrectly applied to PHP-8.0, reverted from there due
to ABI break, and now lands on master again. We can only hope
that it does not get reverted again ;)
2021-05-10 19:26:33 +02:00
Nikita Popov
090627048c Revert "Remove no longer used "log_errors_max_len" ini directive (#6838)"
This reverts commit d2d227e547.

This is an ABI break.
2021-05-08 20:54:53 +02:00
Ben Ramsey
b5d5d06ff3
Revert "Remove no longer used "log_errors_max_len" ini directive (#6838)"
This reverts commit cc2c810dcf.
2021-05-08 13:23:58 -05:00
Michael Voříšek
d2d227e547
Remove no longer used "log_errors_max_len" ini directive (#6838) 2021-05-08 13:05:13 -05:00
Ayesh Karunaratne
68224f2a41 Move FTP extension class FTPConnection to FTP\Connection
With the [namespaces in bundled extensions RFC](https://wiki.php.net/rfc/namespaces_in_bundled_extensions) passed, renaming the new `\FTPConnection` class to `\FTP\Connection`.
This also adds an entry to `./UPGRADING` file.

Related: #6925, #5945
2021-05-08 16:40:10 +02:00
Michael Voříšek
cc2c810dcf
Remove no longer used "log_errors_max_len" ini directive (#6838) 2021-05-07 19:07:35 -05: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
31c74aaeeb Use EXTENSIONS instead of SKIPIF section 2021-05-03 18:37:42 +02:00
Christoph M. Becker
895185e5ea
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #79100: Wrong FTP error messages
2021-05-03 15:25:17 +02:00
Christoph M. Becker
c2a06f5d9a
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #79100: Wrong FTP error messages
2021-05-03 15:24:17 +02:00
Christoph M. Becker
42c72ef463
Fix #79100: Wrong FTP error messages
First we need to properly clear the `inbuf`, what is an amendment to
commit d2881adcbc[1].

Then we need to report `php_pollfd_for_ms()` failures right away; just
setting `errno` does not really help, since at least in some cases it
would have been overwritten before we actually could check it.  We use
`php_socket_strerror()` to get a proper error message, and define
`ETIMEDOUT` to the proper value on Windows; otherwise we catch the
definition in errno.h, which is not compatible with WinSock.  The
proper solution for this issue would likely be to include something
like ext/sockets/windows_common.h.

Finally, we ensure that we only report warnings using `inbuf`, if it is
not empty.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=d2881adcbc9be60de7e7d45a3316b0e11b7eb1e8>.

Closes GH-6718.
2021-05-03 15:19:57 +02:00
Christoph M. Becker
50f5877769
Fix new test wrt. removed skipif.inc 2021-04-26 16:29:43 +02:00
Christoph M. Becker
c0ae3a7fb7
Fix #80901: Info leak in ftp extension
We ensure that inbuf is NUL terminated on `ftp_readline()` failure.

Closes GH-6894.
2021-04-26 15:07:08 +02:00
Christoph M. Becker
5d7219dce6
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80901: Info leak in ftp extension
2021-04-26 14:46:43 +02:00
Christoph M. Becker
33d49551d1
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80901: Info leak in ftp extension
2021-04-26 14:45:55 +02:00
Christoph M. Becker
09696eee9d
Fix #80901: Info leak in ftp extension
We ensure that inbuf is NUL terminated on `ftp_readline()` failure.

Closes GH-6894.
2021-04-26 14:23:04 +02:00
Christoph M. Becker
67e545f1bb
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80880: SSL_read on shutdown, ftp/proc_open
2021-04-06 14:08:54 +02:00
Christoph M. Becker
de9734a5bb
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80880: SSL_read on shutdown, ftp/proc_open
2021-04-06 14:07:25 +02:00
Christoph M. Becker
9688071679
Fix #80880: SSL_read on shutdown, ftp/proc_open
When `SSL_read()` after `SSL_shutdown()` fails with `SSL_ERROR_SYSCALL`,
we should not warn about this, because it is likely caused by the peer
having closed the connection without having sent a close_notify
shutdown alert.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-6803.
2021-04-06 14:03:19 +02:00
Max Semenik
e9f783fcdd Migrate skip checks to --EXTENSIONS--, p3
For rationale, see #6787

Extensions migrated in part 3:
* ftp
* gmp
* iconv
* opcache
* shmop
2021-04-03 15:23:25 +02:00
Máté Kocsis
bf0f6aaf18
Improve class entry generation
Related to GH-6701
2021-02-16 13:09:56 +01:00
Máté Kocsis
99b08ac281
Implicitly enable function entry generation when class entry generation is enabled
Closes GH-6675
2021-02-09 13:37:24 +01:00
Máté Kocsis
98fb565c74
Generate class entries from stubs for another batch of extensions
Closes GH-6669
2021-02-08 19:53:55 +01:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Ayesh Karunaratne
012439b78e FTP: Disallow direct FTPConnection construction
Similar to other resource to object migrations, `FTPConnection` class is not allowed to be constructed with `new FTPConnection`.
Related to b4503fbf88.

Closes GH-6533.
2020-12-23 09:54:38 +01:00
Nikita Popov
ac1ccce264 waitpid in ftp server tests
This is not relevant right now, but ensures consistent order if
the tests are repeated.
2020-10-23 16:56:23 +02:00
Nikita Popov
3859e74347 Fix pasv_port determination
Apparently the ftp server is also used by ext/standard/tests/streams,
and only that part actually uses pasv.
2020-10-23 11:46:54 +02:00
Nikita Popov
08eb917fd5 Use ephemeral port in ftp tests
And enable them to run in parallel.
2020-10-23 10:48:21 +02:00
Nikita Popov
22bf92564c Remove unused pasv_listen() function 2020-10-22 14:23:07 +02:00
Sara Golemon
b4503fbf88 Convert FTP resource to object 2020-10-21 22:29:23 +00:00
Máté Kocsis
c9c7820f74
Review parameter names in ext/ftp
Closes GH-6254
2020-10-02 14:26:39 +02:00
Máté Kocsis
e950ca13ea
Consolidate the usage of "either" and "one of" in error messages
Closes GH-6173
2020-09-20 19:41:47 +02:00
Nikita Popov
d1ac7e3ab1 Remove some unnecessary HAVE_EXTNAME guards
A recurring pattern in old extension: Putting the whole source
code behind HAVE_EXTNAME. This is pointless, as the code is only
compiled if the extension is enabled.

This removes a couple of them, but not all.
2020-09-07 11:05:07 +02:00
Máté Kocsis
1410cd6b08
Promote warnings to exceptions in ext/ftp
Closes GH-6054
2020-08-31 12:49:17 +02:00
George Peter Banyard
fa8d9b1183 Improve type declarations for Zend APIs
Voidification of Zend API which always succeeded
Use bool argument types instead of int for boolean arguments
Use bool return type for functions which return true/false (1/0)
Use zend_result return type for functions which return SUCCESS/FAILURE as they don't follow normal boolean semantics

Closes GH-6002
2020-08-28 15:41:27 +02:00
Máté Kocsis
79981a394e
Add a bunch of missing argument types to stubs 2020-08-03 00:45:51 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00