1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 23:18:13 +02:00
Commit Graph

826 Commits

Author SHA1 Message Date
Nikita Popov c9d4696f76 Merge branch 'PHP-7.4' 2019-10-07 16:32:42 +02:00
Nikita Popov f085bddb51 Fix number of required arguments in arginfo
* pack() only requires one argument
* stream_context_set_option() only requires two arguments
* ReflectionMethod::getClosure() accepts no args for static methods
* DOMDocument::createProcessingInstruction() only requires one arg
* DOMImplementation::createDocument() only requires two arguments
* DOMDocument::importNode() only requires one arg
* mysql_get_client_version() doesn't accept any args,
  despite what the docs say...
2019-10-07 16:32:11 +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
Christoph M. Becker 0c7124e6be Add check_only parameter to get_closure handler
`get_closure` handlers are called to check whether an object is
callable, and to actually get the closure, respectively.  The behavior
of the handler might differ for these two cases, particularly the
handler may throw in the latter case, but should not in the former.

Therefore we add a `check_only` parameter, to be able to distinguish
the desired purpose.
2019-09-24 16:08:42 +02:00
Nikita Popov 6276dd826b Use ZEND_TYPE_IS_SET() when checking for property types
Instead of a simple if or 0 comparison. This would no longer work
if zend_type is a struct.
2019-09-23 16:53:54 +02:00
Nikita Popov 3012d006ff Don't set nullability flag for parameters without type
Use value 0 instead. To compensate we check in ReflectionParameter
allowsNull() whether the type is set at all: If it isn't, it always
allows null.

This removes a discrepancy between internal&userland functions:
For userland functions allowsNull() on untyped parameters returned
true, but for internal functions it returned false.
2019-09-23 16:39:52 +02:00
Nikita Popov 8d7911ef56 Standardize type printing in reflection
Use ?T instead of "T or NULL".
2019-09-23 15:40:03 +02:00
Nikita Popov 9e8ba7891e Change representation of zend_type from type code to MAY_BE_* mask
This switches zend_type from storing a single IS_* type code to
storing a MAY_BE_* type mask. Right now most code still assumes
that there is only a single type in the mask (or two together
with MAY_BE_NULL). But this will make it a lot simpler to introduce
union types.

An additional advantage (and why I'm doing this separately), is
that a number of special cases no longer need to be handled
separately: We can do a single mask & (1 << type) check to handle
all simple types, booleans (true|false) and null.
2019-09-23 15:31:35 +02:00
Nikita Popov 4fc4249d24 Make ReflectionType an abstract class
This is never instantiated directly, only child classes are used.
2019-09-02 15:38:56 +02:00
Nikita Popov bdf2cd7508 Move isBuiltin() method from ReflectionType to ReflectionNamedType
This method only makes sense for single types, e.g. it would be
meaningless for union types.

Note that we always return ReflectionNamedType right now, so this does
not break compatibility for code using any currently existing types.
2019-09-02 14:59:31 +02:00
Nikita Popov d0f4ec4c31 Merge branch 'PHP-7.4' 2019-08-13 20:24:39 +02:00
Nikita Popov d891b5f458 Fixed bug #78410 2019-08-13 20:23:56 +02:00
Nikita Popov 7a1540fa28 Merge branch 'PHP-7.4' 2019-07-22 17:00:17 +02:00
Nikita Popov c817b8020c Special-case rc=1 self-referential arrays in ReflectionReference
New fix for bug #78263. This is special-cased elsewhere in the engine,
so we need to mirror it here.
2019-07-22 16:59:23 +02:00
Nikita Popov 19588a8f3b Revert "Add ReflectionReference::getRefcount()"
This reverts commit 428cfdd181.
2019-07-22 16:49:08 +02:00
Nikita Popov 36db71df47 Merge branch 'PHP-7.4' 2019-07-22 12:28:40 +02:00
Nikita Popov 3121b7174f Deprecate Reflection export() methods
And remove the Reflector::export() interface method.
2019-07-22 11:39:52 +02:00
Dmitry Stogov 390810e1e6 Merge branch 'PHP-7.4'
* PHP-7.4:
  Evaluate constant in class scope
2019-07-22 11:59:49 +03:00
Dmitry Stogov 2f51764e5d Evaluate constant in class scope 2019-07-22 11:59:24 +03:00
Nikita Popov f464f8edfe Merge branch 'PHP-7.4' 2019-07-11 14:15:02 +02:00
Nikita Popov 42cac9d7d7 Don't call Reflection::export() internally
export() methods were implemented in a roundabout way, where they
would call Reflection::export(), which would then call __toString().
Cut out the middleman by directly calling __toString().
2019-07-11 14:14:55 +02:00
Nikita Popov 1fe478d30c Merge branch 'PHP-7.4' 2019-07-08 16:54:22 +02:00
Nikita Popov 428cfdd181 Add ReflectionReference::getRefcount()
And don't return null for rc=1 references. Leave it to the user
to decide whether or not they want to consider these as references
or not.

Fixes bug #78263.
2019-07-08 16:54:03 +02:00
twosee 61f78de486 Constify some char* arguments or return values of ZEND_API
Closes GH-4247.
2019-06-12 16:49:32 +02:00
twosee 63171d88f2 Add do...while(0) for RETURN_* and ZVAL_* APIs
Closes GH-4255.
2019-06-12 16:17:16 +02:00
Dmitry Stogov e029cc4dd4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Cheaper checks for exceptions thrown from __toString()
2019-06-06 02:23:17 +03:00
Dmitry Stogov 457392fa64 Cheaper checks for exceptions thrown from __toString() 2019-06-06 01:47:22 +03:00
Nikita Popov cc286e5bd5 Merge branch 'PHP-7.4' 2019-06-05 15:34:56 +02:00
Nikita Popov b964298c19 Deprecate ReflectionType::__toString()
We weren't able to do this in 7.1 because the deprecation notice
may be converted to an exception and __toString() can't throw,
which means that it ultimately become a fatal error. This issue
is resolved now, so we can mark the method as deprecated.
2019-06-05 15:33:52 +02:00
Nikita Popov 7686b0b889 Merge branch 'PHP-7.4' 2019-06-05 14:53:50 +02:00
Nikita Popov a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Dmitry Stogov b2cdde0826 Merge branch 'PHP-7.4'
* PHP-7.4:
  Replace ZVAL_COPY() and ZVAL_COPY_VALUE() for IS_OBJECT by cheaper macros
2019-05-28 20:19:15 +03:00
Dmitry Stogov 83804519df Replace ZVAL_COPY() and ZVAL_COPY_VALUE() for IS_OBJECT by cheaper macros 2019-05-28 20:10:02 +03:00
Nikita Popov 20e983d9ce Merge branch 'PHP-7.4' 2019-05-14 14:59:36 +02:00
Nikita Popov 3f19f5112a Add RETURN_EMPTY_ARRAY() / RETVAL_EMPTY_ARRAY()
The usual wrappers around ZVAL_EMPTY_ARRAY()...
2019-05-14 14:59:10 +02:00
Nikita Popov 9f87831470 Merge branch 'PHP-7.4' 2019-05-09 12:36:33 +02:00
Nikita Popov 4b40a46bf1 Merge branch 'PHP-7.3' into PHP-7.4 2019-05-09 12:36:20 +02:00
Nikita Popov 90318fbcbe Merge branch 'PHP-7.2' into PHP-7.3 2019-05-09 12:35:11 +02:00
Nikita Popov 35c80583f0 Fixed bug #75186 2019-05-09 12:33:53 +02:00
Nikita Popov 969f238808 Merge branch 'PHP-7.4' 2019-05-09 12:03:29 +02:00
Nikita Popov 54be40113d Fixed bug #77951
Treat singleton references as non-references in ReflectionReference
and return null for them.
2019-05-09 12:02:16 +02:00
Nikita Popov be31a9468d Merge branch 'PHP-7.4' 2019-05-08 17:06:34 +02:00
Nikita Popov e4e6820d10 Use fast zpp for ReflectionClass constructor
At this point zpp overhead makes up a significant part of this
function.
2019-05-08 17:06:00 +02:00
Nikita Popov 230d3089b3 Merge branch 'PHP-7.4' 2019-05-08 15:44:29 +02:00
Nikita Popov ee0fc1b5ae Optimize $name/$class property population in reflection
Instead of going through write_property, directly assign to the
respective property slot.
2019-05-08 15:43:42 +02:00
Nikita Popov 2e186aa9dc Merge branch 'PHP-7.4' 2019-04-15 10:25:27 +02:00
Nikita Popov b2ec07e64c Merge branch 'PHP-7.3' into PHP-7.4 2019-04-15 10:25:20 +02:00
Nikita Popov 14047b50b4 Merge branch 'PHP-7.2' into PHP-7.3 2019-04-15 10:25:11 +02:00
Nikita Popov e9c0367fdc Fixed bug #77882 2019-04-15 10:22:40 +02:00
Nikita Popov 787ecb6d56 Merge branch 'PHP-7.4' 2019-03-22 12:41:39 +01:00