Commit Graph

201 Commits

Author SHA1 Message Date
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
Tim Düsterhus
29f98e7485
Replace @deprecated by #[\Deprecated] for internal functions / class constants (#14750)
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-07-10 16:47:31 +02:00
Niels Dossche
d883996326
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14537: shmop Windows 11 crashes the process
2024-06-28 20:14:26 +02:00
Niels Dossche
c19affc567
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-14537: shmop Windows 11 crashes the process
2024-06-28 20:14:20 +02:00
Niels Dossche
39a3266576
Fix GH-14537: shmop Windows 11 crashes the process
The error handling code isn't entirely right in two places.
One of the code blocks is dead because of an always-false condition, and
another code block is missing the assignment of a NULL pointer.

Getting the exact same behaviour is not entirely possible because you
can't extend the size of a shared memory region after it was made with
the Windows APIs we use, unless we destroy the region and recreate it,
but that has other consequences.
However, it certainly shouldn't crash.

Closes GH-14707.
2024-06-28 20:13:47 +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
Gina Peter Banyard
fd2d869642
Clean-up some more headers (#14416)
Remove unused headers (such as php_ini.h for extensions that don't define INI settings)
Use more specific headers when possible
2024-06-08 17:15:36 +01:00
Máté Kocsis
f2e199e878
Implement "support doc comments for internal classes and functions" (#13266)
Fixes #13130
2024-02-25 08:41:31 +01:00
Máté Kocsis
10957e498c
Do not generate frameless info items when func info generation is disabled
While here, I fixed newlines around arginfo and function entry generation. Previously, newlines were repeated.
2024-02-18 11:39:00 +01:00
Christoph M. Becker
c8955c078a
Revert GH-10220
Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491.
This reverts commit 588a07f737.
This reverts commit f377e15751.
This reverts commit b4ba16fe18.
This reverts commit 694ec1deea.
This reverts commit 6b34de8eba.
This reverts commit aa1cd02a43.
This reverts commit 308fd311ea.
This reverts commit 16203b53e1.
This reverts commit 738fb5ca54.
This reverts commit 9fdbefacd3.
This reverts commit cd4a7c1d90.
This reverts commit 928685eba2.
This reverts commit 01e5ffc85c.
2023-01-16 12:27:33 +01:00
Max Kellermann
308fd311ea ext/{standard,json,random,...}: add missing includes 2023-01-10 14:19:03 +00:00
Bob Weinand
a01dd9feda Revert "Port all internally used classes to use default_object_handlers"
This reverts commit 94ee4f9834.

The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
Bob Weinand
94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Christoph M. Becker
cb5a4ed920
Use --EXTENSIONS-- section for new test 2021-09-02 23:49:05 +02:00
Christoph M. Becker
404bed1a69
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81407: shmop_open won't attach and causes php to crash
2021-09-02 23:21:22 +02:00
Christoph M. Becker
58ad403cec
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81407: shmop_open won't attach and causes php to crash
2021-09-02 23:18:53 +02:00
Christoph M. Becker
f3d24af74f
Fix #81407: shmop_open won't attach and causes php to crash
We need to allocate buffers for the file mapping names which are large
enough for all potential keys (`key_t` is defined as `int` on Windows).

Regarding the test: it's probably never a good idea to use hard-coded
keys (should always use `ftok()` instead), but to reliably reproduce
this Windows specific issue we need to, and it shouldn't be an issue on
that OS.

Closes GH-7448.
2021-09-02 23:16:48 +02:00
Christoph M. Becker
f5ee3429db
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #81283: shmop can't read beyond 2147483647 bytes
2021-07-23 17:51:15 +02:00
Christoph M. Becker
71879d385e
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81283: shmop can't read beyond 2147483647 bytes
2021-07-23 17:49:56 +02:00
Christoph M. Becker
387c0de983
Fix #81283: shmop can't read beyond 2147483647 bytes
`start`, `count` and `shmop->size` are `zend_long`, so we must not
restrict to `INT_MAX`.

Closes GH-7301.
2021-07-23 17:46:42 +02:00
Joe Watkins
570d9b63e9
Not serializable flag permeation 2021-07-20 12:28:35 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Nikita Popov
5f090e06b4 Don't strictly check shmop size in test
On FreeBSD, this gets rounded up the page size.
2021-05-18 19:32:36 +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
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
Nikita Popov
ce0bc58c22 Merge branch 'PHP-8.0'
* PHP-8.0:
  Mark resource-like objects as non-comparable
2021-02-16 14:22:03 +01:00
Nikita Popov
b63ea1047a Mark resource-like objects as non-comparable
As these hold on to some internal resource, there can't be two
"equal" objects with different identity. Make sure the lack of
public properties doesn't result in these being treated as always
equal.
2021-02-16 14:20:45 +01:00
Máté Kocsis
bf0f6aaf18
Improve class entry generation
Related to GH-6701
2021-02-16 13:09:56 +01:00
Máté Kocsis
5b5bfd6be4
Generate class entries from stubs for phar, posix, pspell, readline, reflection, session, shmop
Closes GH-6692
2021-02-15 00:11:22 +01:00
Nikita Popov
b10416a652 Deprecate passing null to non-nullable arg of internal function
This deprecates passing null to non-nullable scale arguments of
internal functions, with the eventual goal of making the behavior
consistent with userland functions, where null is never accepted
for non-nullable arguments.

This change is expected to cause quite a lot of fallout. In most
cases, calling code should be adjusted to avoid passing null. In
some cases, PHP should be adjusted to make some function arguments
nullable. I have already fixed a number of functions before landing
this, but feel free to file a bug if you encounter a function that
doesn't accept null, but probably should. (The rule of thumb for
this to be applicable is that the function must have special behavior
for 0 or "", which is distinct from the natural behavior of the
parameter.)

RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

Closes GH-6475.
2021-02-11 21:46:13 +01:00
Máté Kocsis
01b239b602
Review parameter names in ext/shmop
Closes GH-6238
2020-09-30 21:07:25 +02:00
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Máté Kocsis
d54bc29540
Promote warnings to exceptions in ext/shmop
Closes GH-5986
2020-08-25 13:09:23 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov
4730b06f1d Make SimpleXMLElement a RecursiveIterator
Context: https://externals.io/message/108789

This essentially moves the functionality of SimpleXMLIterator into
SimpleXMLElement, and makes SimpleXMLIterator a no-op extension.

Ideally SimpleXMLElement would be an IteratorAggregate, whose
getIterator() method returns SimpleXMLIterator. However, because
SimpleXMLIterator extends SimpleXMLElement (and code depends on
this in non-trivial ways), this is not possible.

The only way to not keep SimpleXMLElement as a magic Traversable
(that implements neither Iterator nor IteratorAggregate) is to
move the SimpleXMLIterator functionality into it.

Closes GH-5234.
2020-06-24 15:09:21 +02:00
Máté Kocsis
bcb9658b87
Add the ZEND_ACC_NO_DYNAMIC_PROPERTIES flag to Shmop 2020-06-24 14:56:06 +02:00
Christoph M. Becker
18f58080dc Convert shmop resources to opaque objects
We make `shmop_close()` a NOP, and deprecate the function right away;
detaching from SHM now happens when the wrapper object is freed.
2020-06-24 13:59:29 +02:00
Nikita Popov
c9b9f525a9 Include stub hash in generated arginfo files
The hash is used to check whether the arginfo file needs to be
regenerated. PHP-Parser will only be downloaded if this is actually
necessary.

This ensures that release artifacts will never try to regenerate
stubs and thus fetch PHP-Parser, as long as you do not modify any
files.

Closes GH-5739.
2020-06-24 09:55:19 +02:00
George Peter Banyard
f23b3026bc Fix [-Wundef] warning in SHMOP extension 2020-05-20 14:01:10 +02:00
Christoph M. Becker
69d46c3433 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix brittle shmop test
2020-05-13 23:31:09 +02:00
Christoph M. Becker
1892e3abaa Fix brittle shmop test
To solve bug #70886, the test uses random keys to prevent collisions;
however, this is not guaranteed, and as such it may even collide with
other tests in the shmop test suite.  The proper solution would be to
use a single key (which could be randomly generated), but to actually
`shmop_close()` after each `shmop_delete()`.  This would, however, not
work on Windows due to bug #65987.  Therefore we use three different
keys for now.
2020-05-13 23:25:28 +02:00
Christoph M. Becker
1a95ed0b33 Enable test on Windows 2020-05-07 09:20:15 +02:00
Christoph M. Becker
e749db4047 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79566: Private SHM is not private on Windows
2020-05-05 11:41:31 +02:00
Christoph M. Becker
80b5006196 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79566: Private SHM is not private on Windows
2020-05-05 11:41:04 +02:00
Christoph M. Becker
f33cf52faf Fix #79566: Private SHM is not private on Windows
We map the POSIX semantics of `IPC_PRIVATE` by creating unnamed file
mapping objects on Windows.  While that is not particularly useful for
ext/shmop, which is the only bundled extension which uses `shmget()`,
it may be useful for external extensions.
2020-05-05 11:38:29 +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
Christoph M. Becker
2a1d7bd802 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79427: Integer Overflow in shmop_open()
2020-03-30 08:58:45 +02:00
Christoph M. Becker
6f8045c47f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79427: Integer Overflow in shmop_open()
2020-03-30 08:57:49 +02:00
Christoph M. Becker
a681b12820 Fix #79427: Integer Overflow in shmop_open()
If `shm.shm_segsz > ZEND_LONG_MAX` the assignment to `shmop->size` a
few lines below would overflow, so we catch that early and bail out if
necessary.
2020-03-30 08:56:49 +02:00