Commit Graph

389 Commits

Author SHA1 Message Date
Máté Kocsis
3709e74b5e
Store default parameter values of internal functions in arg info
Closes GH-5353. From now on, PHP will have reflection information
about default values of parameters of internal functions.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-04-08 18:37:51 +02:00
Remi Collet
e11d3b1690 Move gen_stub.php to build directory and install it so phpize can take care of it, and thus extension can use it as it is already in Makefile 2020-04-03 10:48:20 +02:00
Nikita Popov
50d07ff28c mb_detect_encoding(): Use proper array|string parameter
Needed to add support for nullabiltiy in some places.
2020-03-30 16:15:12 +02:00
Nikita Popov
d2cb200e10 Enable formatting of phpt files in tidy.php 2020-02-03 22:52:04 +01:00
Nikita Popov
169805777c Merge branch 'PHP-7.4'
* PHP-7.4:
  Apply tidy formatting
2020-02-03 13:42:08 +01:00
Nikita Popov
58b17906f5 Apply tidy formatting
Mostly reindent PHP scripts to spaces.
2020-02-03 13:41:31 +01:00
Nikita Popov
6b38251820 Add bundled jit libraries to exclude list 2020-02-03 13:41:09 +01:00
Nikita Popov
fc2663abef Merge branch 'PHP-7.4'
* PHP-7.4:
  Add tidy.php to enforce formatting
2020-02-03 13:35:49 +01:00
Nikita Popov
4fd6318580 Add tidy.php to enforce formatting
Many parts are disabled for the PHP-7.4 branch. We only strip
trailing whitespace in C files and reindent .php files to spaces.
2020-02-03 13:34:42 +01:00
Nikita Popov
292a1aeb59 Support union types for args in gen stubs
Using this requires care! The zpp implementation for this union
must be consistent with the arginfo implementation!

Apart from array|object, this is probably only the case for
int|float right now.
2019-11-15 17:33:37 +01:00
Nikita Popov
0cec268d15 Support single class unions in gen stubs 2019-11-15 17:19:26 +01:00
Máté Kocsis
27e83d0fb8
Add union return types for function stubs 2019-11-11 14:54:55 +01:00
Nikita Popov
9bbbc9e7e9 Add support for union types in stubs
This is the MVP for supporting union types in PHP stubs. Return
types with only builtin types work, which is the part we mainly
need.

Closes GH-4895.
2019-11-08 17:32:18 +01:00
Nikita Popov
5ca46572e6 Allow generating stubs for directory 2019-11-01 16:54:20 +01:00
Nikita Popov
82f74ce3f2 Improve bless tests script to minimize diffs
Compute the diff between the old EXPECTF and the new output and
don't touch lines that still match the old EXPECTF. This reduces
the amount of manual fixup necessary after running bless_tests.php.
2019-10-01 15:00:22 +02:00
Nikita Popov
34e7c2daf0 Merge branch 'PHP-7.4' 2019-09-27 10:49:25 +02:00
Nikita Popov
a6c9c7c2b8 Handle resources used as array keys consistently
Resources used as array keys are generally handled by throwing a
notice and converting the resource to the resource handle. The only
exception is the [$resource => null] syntax, where this was treated
as an illegal offset type instead. However, this also only happened
for VM evaluations, the AST evaluator did handle resources correctly.
2019-09-27 10:40:41 +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
Nikita Popov
a98307df87 Make arginfo printing of prefer-ref arguments nicer 2019-08-26 15:39:39 +02:00
Nikita Popov
0c2d4d698c Make sure that params with null default are marked nullable 2019-08-26 14:34:28 +02:00
Theodore Brown
d5f42d68c8 Convert remaining array function arginfo to PHP stubs 2019-08-26 12:53:00 +02:00
Tyson Andre
0c09089caf Fix escapes for namespaced classes in gen_stub.php
Fix the string generated when the `ns\class` is passed to a macro

    #define ESCAPE(x) #x
    // puts(ESCAPE(ns\class));  // warning: unknown escape sequence: \c
    puts(ESCAPE(ns\\class));  // Properly prints ns\class to stdout.
2019-08-23 12:29:55 +02:00
Nikita Popov
37a8408e83 Support typed variadic args in gen_stubs 2019-08-15 22:07:49 +02:00
Craig Duncan
288442716e Add a prefix to differeniate between class methods and functions
Closes GH-4528
2019-08-12 20:57:18 +01:00
Nikita Popov
7c49951769 Support regenerating all stubs 2019-08-12 10:27:22 +02:00
Stephen Reay
44de46ab69 Add support for callable to the stub generator [ci skip] 2019-08-11 18:37:35 +02:00
Nikita Popov
ae721c488d Handle preprocessor conditions inside classes
Also remove the dead parseClass() function.
2019-08-10 16:29:45 +02:00
Stephen Reay
9c02c58481 Fallback to curl in gen_stub if wget fails
Closes GH-4502.
2019-08-10 16:21:03 +02:00
Nikita Popov
17987da884 Expand preprocessor support in gen_stubs
Support #ifdef, #ifndef, #else and nested #if's.
2019-08-10 15:07:54 +02:00
Nikita Popov
3b2f2ce474 Make uninitialized DateTime an Error
This avoids many spurious false return values.
2019-08-09 14:51:25 +02:00
Nikita Popov
33886f710c Generate arginfo from PHP stub files
Signature stubs for internal functions are specified in xyz.stub.php,
from which we generate actual arginfo structures in xyz_arginfo.h.
This file then needs to be included in the implementation appropriately.

Arginfo from stubs can be regenerated using scripts/dev/gen_stub.php.
However, this should also automatically happen when the stub file is
modified.
2019-08-09 14:51:25 +02:00
Nikita Popov
1cbcf0f4f1 Throw notice for plain wrapper fread/fwrite errors
Similar to what is done for socket read/write errors.
2019-07-25 10:42:10 +02:00
Nikita Popov
0146bab449 Merge branch 'PHP-7.4' 2019-07-12 12:55:21 +02:00
Nikita Popov
9a274de4f4 Improve bless_tests
If a string var_dump contains a wildcard, also make the length a
wildcard.
2019-07-12 12:54:01 +02:00
Peter Kokot
1a935e2662 Merge branch 'PHP-7.4'
* PHP-7.4:
  Refactor undefining PACKAGE_* symbols
2019-07-11 02:02:01 +02:00
Peter Kokot
a6daded1a4 Refactor undefining PACKAGE_* symbols
Instead of patching configuration headers template generated by
the given tools - autoheader, this moves patching these symbols to
the configure step before creating and invoking the config.status
and before the configuration header file is generated from the
patched template.

Closes GH-4374
2019-07-11 02:00:51 +02:00
Peter Kokot
c752b74665 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove some unused variables
2019-07-08 10:20:14 +02:00
Peter Kokot
5ba69ab3ad Remove some unused variables
- Variables php_abs_top_srcdir php_abs_top_builddir are no longer used.
- ZEND_EXT_TYPE is always zend_extension and variable is no longer used.

Closes GH-4378
2019-07-08 10:18:17 +02:00
Joe Watkins
5f25cd6ed7
Merge branch 'PHP-7.4'
* PHP-7.4:
  add ini config details to php-config
2019-06-29 05:26:38 +02:00
Joe Watkins
2d5f277a2d
add ini config details to php-config 2019-06-29 05:26:21 +02:00
Peter Kokot
7239925213 Merge branch 'PHP-7.4'
* PHP-7.4:
  Set Computer English language for credits sorting
2019-06-26 22:38:35 +02:00
Peter Kokot
537844cb1d Set Computer English language for credits sorting
This makes the script a bit more portable when used on systems with
different LC_ALL and LANG settings.
2019-06-26 22:35:55 +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
Peter Kokot
29bff939c7 Enhance makedist script
This enhances the makidst script:
- integrate both snapshot and makedist scripts together
- add help and options
- generated files are created in the php-src repository directly
- other minor enhancemenets such as CS fixes
- functionality moved from the Makefile to only shell script
- Add missed patching of the Zend Parsers to the main build step
- Add all *.tmp files to gitignore
2019-05-18 02:05:59 +02:00
Peter Kokot
75fb74860d Normalize comments in *nix build system m4 files
Normalization include:
- Use dnl for everything that can be ommitted when configure is built in
  favor of the shell comment character # which is visible in the output.
- Line length normalized to 80 columns
- Dots for most of the one line sentences
- Macro definitions include similar pattern header comments now
2019-05-12 18:43:03 +02:00
Peter Kokot
4eb67310a0 Remove vcsclean script
The vcsclean script is really only a wrapper for a git clean command.
Developers should use the more proper and clear native Git command
directly instead:
`git clean -Xfd`
2019-05-08 21:51:01 +02:00
Peter Kokot
e58fddf7a3 Remove phpextdist
This script hasn't been used since using PEAR as a package manager for
PHP extensions since it is using Makefile.in as an indicator if the
current directory is extension. Instead of this script extensions can
be packaged differently and more properly with either current PEAR
or with some other manual method.
2019-05-06 00:15:20 +02:00
Hugh McMaster
c9ee822bb6 Always use pkg-config from the host architecture 2019-04-29 14:16:16 +02:00
Peter Kokot
c79eb107a0 Simplify checking of *nix build tools
The buildmk.stamp file has been created by the *nix build checking step
to run the check step only once. Instead of poluting the project root
directory, the stamp file can be also omitted. Performance difference is
very minimal to not justify having the stamp check at all today anymore.

This patch integrates the buildcheck.sh to buildconf script directly.
2019-04-29 01:30:27 +02:00
Peter Kokot
f9db357623 Automatically remove aclocal.m4 if present
Commit 4e7064d173 removed the usage of
`aclocal.m4`. When using Git repositories, many times cleaning of the
generated files is not done prior to running phpize or buildconf. For
example:

  git clone git://github.com/php/php-src
  cd php-src
  git checkout PHP-7.3
  ./buildconf
  ./configure
  git checkout PHP-7.4
  ./buildconf # -> warnings
  ./configure # -> errors

To not accidentally include `aclocal.m4` file in the generated configure
this enhances build system experience a bit more by removing aclocal.m4
file prior to start building configure file using phpize or buildconf.
2019-04-28 21:05:34 +02:00