1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

621 Commits

Author SHA1 Message Date
Arshid
c524773a4f ext/ftp: Remove unreachable break (#21481) 2026-03-21 11:24:04 +00:00
Arshid
c995a6cb4b ext/ftp: Returning a boolean value using RETURN_BOOL (#21187) 2026-02-10 12:26:18 +00:00
Arshid
9580d47898 ext/ftp: Use STANDARD_MODULE_HEADER instead of STANDARD_MODULE_HEADER_EX (#21088) 2026-01-30 09:05:43 +00:00
Arnaud Le Blanc
65b4073922 Include the actual stub name in generated arginfo headers (#20993) 2026-01-21 20:57:00 +01:00
David Carlier
50abef95bd Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20603 issue on windows 32 bits.
2025-12-03 20:23:01 +00:00
David Carlier
f90d1f7aa6 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20603 issue on windows 32 bits.
2025-12-03 20:22:50 +00:00
David Carlier
51f4450b47 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20603 issue on windows 32 bits.
2025-12-03 20:22:38 +00:00
David Carlier
ff51ac161d Fix GH-20603 issue on windows 32 bits.
the timeout needed to be unsigned.

close GH-20634
2025-12-03 20:22:14 +00:00
David Carlier
71d11bdb16 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20601: ftp_connect() timeout argument overflow.
2025-11-29 23:06:41 +00:00
David Carlier
227541cb96 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20601: ftp_connect() timeout argument overflow.
2025-11-29 23:06:15 +00:00
David Carlier
1701589884 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20601: ftp_connect() timeout argument overflow.
2025-11-29 23:05:37 +00:00
David Carlier
4312a446d0 Fix GH-20601: ftp_connect() timeout argument overflow.
close GH-20603
2025-11-29 23:05:14 +00:00
Niels Dossche
64b30cee76 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20240: FTP with SSL: ftp_fput(): Connection timed out on successful writes
2025-10-26 23:40:01 +01:00
Niels Dossche
6bcc4e2c09 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20240: FTP with SSL: ftp_fput(): Connection timed out on successful writes
2025-10-26 23:39:56 +01:00
Niels Dossche
6dab33a438 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20240: FTP with SSL: ftp_fput(): Connection timed out on successful writes
2025-10-26 23:39:02 +01:00
Niels Dossche
8761c4e507 Fix GH-20240: FTP with SSL: ftp_fput(): Connection timed out on successful writes
Looking at the strace, the timeout is only 1s which may be too low
anyway for checking for a response, but some servers also don't end up
replying finally anyway and close the connection already.

`data_available` was originally used for non-blocking downloads/uploads
and then reused for the shutdown sequence, but its error handling was
never adjusted to be silent.

Closes GH-20294.
2025-10-26 23:38:09 +01:00
Niels Dossche
23674d9482 Merge branch 'PHP-8.5'
* PHP-8.5:
  ftp: Fix weird typo (#20295)
2025-10-26 08:57:26 +01:00
Niels Dossche
393302bc62 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ftp: Fix weird typo (#20295)
2025-10-26 08:57:21 +01:00
Niels Dossche
d4030362cf Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ftp: Fix weird typo (#20295)
2025-10-26 08:57:14 +01:00
Niels Dossche
61b0d589d6 ftp: Fix weird typo (#20295)
* ftp: Fix weird typo

In 8827f8eca9 the async functions were
renamed to nb functions. So this was just a find+replace of async to nb.
The diff shows that "no asyncronous transfer to continue" was replaced
with "no nbronous transfer to continue". Makes no sense.

* Update ext/ftp/php_ftp.c

Co-authored-by: Jakub Zelenka <bukka@php.net>

---------

Co-authored-by: Jakub Zelenka <bukka@php.net>
2025-10-26 08:56:56 +01:00
Tim Düsterhus
aa90372428 ftp: Use return true / return false for functions returning bool
Changes done with Coccinelle:

    @r1@
    identifier fn;
    typedef bool;
    symbol false;
    symbol true;
    @@

    bool fn ( ... )
    {
    <...
    return
    (
    - 0
    + false
    |
    - 1
    + true
    )
    ;
    ...>
    }

Coccinelle patch sourced from
torvalds/linux@46b5c9b856.
2025-09-24 18:51:40 +02:00
Tim Düsterhus
9a36e513a6 ftp: Use true / false instead of 1 / 0 when assigning to bool
Changes done with Coccinelle:

    @@
    bool b;
    @@

    - b = 0
    + b = false

    @@
    bool b;
    @@

    - b = 1
    + b = true
2025-09-24 18:51:40 +02:00
Niels Dossche
93b9808004 Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for hrtime in FTP and standard
  Handle broken hrtime in ftp
  Fix arginfo/zpp violation if zend_hrtime is not available
2025-07-25 12:05:17 +02:00
Niels Dossche
802e348b49 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS for hrtime in FTP and standard
  Handle broken hrtime in ftp
  Fix arginfo/zpp violation if zend_hrtime is not available
2025-07-25 12:05:12 +02:00
Niels Dossche
beeeee2978 Handle broken hrtime in ftp
Part of GH-19210.

Closes GH-19219.
2025-07-25 11:56:30 +02:00
Gina Peter Banyard
8033b058a9 ext/ftp: Remove output field of ftpbuf_t struct
It was only used once, and removing it reduces the size of a userland FTP object by 4096 bytes
2025-04-03 22:47:13 +01:00
Gina Peter Banyard
1dd788acdc ext/ftp: Change return type of ftp_set_option() to true
It either returns true or throws an Error
2025-04-03 22:47:13 +01:00
Gina Peter Banyard
c8559648fa [skip ci] ext/ftp: Fix typos 2025-04-03 22:47:13 +01:00
Gina Peter Banyard
96cf1b5a9f ext/ftp: Use size_t type instead of int type 2025-04-03 22:47:13 +01:00
Gina Peter Banyard
7fcdf1cfa2 ext/ftp: Use zend_result type instead of int type 2025-04-03 22:47:13 +01:00
Gina Peter Banyard
169573bcb5 ext/ftp: Use bool type instead of int type 2025-04-03 22:47:13 +01:00
Gina Peter Banyard
114a8ffb9d ext/ftp: Mark static functions as such
Removing missleading comment
2025-04-03 22:47:13 +01:00
Gina Peter Banyard
51fa97fb44 ext/ftp: Normalize coding style 2025-04-03 22:47:13 +01:00
Gina Peter Banyard
7fb8db014e ext/ftp: Voidify ftp_close() 2025-04-03 22:47:13 +01:00
Gina Peter Banyard
c9d23c96d6 ext/ftp: Use new php_streams fast ZPP specifier 2025-03-03 18:08:23 +00:00
Niels Dossche
2dfe92767d Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16800: ftp functions can abort with EINTR
2025-01-03 12:31:13 +01:00
Niels Dossche
e90243a640 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16800: ftp functions can abort with EINTR
2025-01-03 12:31:08 +01:00
Niels Dossche
412a6b2e08 Fix GH-16800: ftp functions can abort with EINTR
This adds wrappers around recv(), send(), and php_pollfd_for_ms() to
handle EINTR.

This is a bit hard to test on its own, but it is testable manually using
the following script:
```php
pcntl_signal(SIGUSR1, function() {
    var_dump(func_get_args());
}, false);

var_dump(getmypid());
sleep(10);

$ftp = ftp_connect('127.0.0.1');
ftp_login($ftp, 'user', 'pass');
ftp_put($ftp, 'testfile', 'testfile');
```

in combination with an infinite while loop that sends SIGUSR1 to the
process.

Closes GH-17327.
2025-01-03 12:30:43 +01:00
DanielEScherzer
aeb2d5cfa6 ext/[ef]*: fix a bunch of typos (GH-16621) 2024-10-28 11:28:32 +01:00
DanielEScherzer
53cb89670c Generated arginfo header files: remove empty zend_function_entry arrays (#15705)
When a class (or enum) has no methods, rather than using an array that only
contains `ZEND_FE_END`, use `NULL` for the functions. The implementation of
class registration for internal classes, `do_register_internal_class()` in
zend_API.c, already skips classes where the functions are `NULL`. By removing
these unneeded arrays, we can reduce the size of the header files, while also
removing an unneeded call to zend_register_functions() for each internal class
with no extra methods.
2024-09-03 23:19:53 +02:00
Máté Kocsis
8d12f666ae Fix registration of internal readonly child classes (#15459)
Currently, internal classes are registered with the following code:

INIT_CLASS_ENTRY(ce, "InternalClass", class_InternalClass_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ...;

This has worked well so far, except if InternalClass is readonly. It is because some inheritance checks are run by zend_register_internal_class_ex before ZEND_ACC_READONLY_CLASS is added to ce_flags.

The issue is fixed by adding a zend_register_internal_class_with_flags() zend API function that stubs can use from now on. This function makes sure to add the flags before running any checks. Since the new API is not available in lower PHP versions, gen_stub.php has to keep support for the existing API for PHP 8.3 and below.
2024-08-24 12:36:54 +02:00
Peter Kokot
cf6bbdfb0c Autotools: Improve ftp and mysqlnd SSL configure options (#15164)
This makes the configure log messages and help text more intuitive what
is being enabled and when.
2024-08-03 22:13:36 +02:00
Peter Kokot
f66feaec0f Sync HAVE_<extension> help texts (#15167)
This syncs all help texts of extension preprocessor macros to the same
style "Define to 1 if the PHP extension '<ext>' is available.".
[skip ci]
2024-08-02 01:41:47 +02:00
Peter Kokot
1ceadaed52 Autotools: Normalize and quote all PHP_NEW_EXTENSION arguments (#15144)
This adds Autoconf quote characters to all PHP_NEW_EXTENSION arguments
and syncs the CS across the php-src Autotools build system.
2024-07-29 00:14:59 +02:00
Peter Kokot
a1b45bb87a Autotools: Sync PHP_SETUP_* M4 macros (#15117)
- arguments quoted
- MYSQLND_HAVE_SSL help text synced
2024-07-27 11:20:07 +02:00
Christoph M. Becker
f590b34530 Drop support for OpenSSL < 1.1.0 on Windows
PR #13498 bumped the required OpenSSL version to 1.1.1, but apparently
only for non Windows system.  We catch up somewhat by dropping support
for OpenSSL < 1.1.0 on Windows; besides completely removing detection
of old OpenSSL versions in `SETUP_OPENSSL`, we also ensure that all
bundled extension using this function do no longer accept OpenSSL <
1.1.0, to avoid to still be able to build these extensions with older
`phpize` scripts.

We do not cater to `--phar-native-ssl` yet; that might better be
addressed by #14578.

Closes GH-14973.
2024-07-17 12:22:59 +02:00
Peter Kokot
bee84c0468 Autotools: Quote PHP_SUBST arguments in extensions (#14748) 2024-07-02 06:56:18 +02:00
Peter Kokot
c44834d8ad Trim trailing whitespace (#14721) 2024-06-29 18:41:45 +02:00
Arnaud Le Blanc
11accb5cdf Preferably include from build dir (#13516)
* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
2024-06-26 00:26:43 +02:00
Peter Kokot
44ed17cab5 Replace configure option --with-openssl-dir (#14028)
This is a leftover from the refactoring of the --with-openssl-dir option
that once accepted the path to OpenSSL but wasn't renamed back then.

Instead of --with-openssl-dir, SSL support in ext/ftp and ext/mysqlnd
can be enabled implicitly when building with ext/openssl enabled
(--with-openssl) or explicitly by using new separate configure options
--with-ftp-ssl and --with-mysqlnd-ssl.
2024-05-13 22:54:54 +02:00