Commit Graph

901 Commits

Author SHA1 Message Date
Dmitry Stogov
9d139b16c2
Test ReflectionZendExtension class 2018-03-09 12:07:52 +01:00
Anatol Belski
70a1b23c2c Remove unused assignment 2018-03-07 18:09:58 +01:00
Gabriel Caruso
0c0a5df111 Test ReflectionClass::getReflectionConstant method 2018-02-22 13:18:52 +01:00
Gabriel Caruso
b895690dfa
remove support for string|unicode in tests 2018-02-22 08:11:30 +01:00
Gabriel Caruso
ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00
Gabriel Caruso
0f2be28b43
Fix typo 2018-02-13 08:05:05 +01:00
Gabriel Caruso
21e3b0c70c Remove trailing whitespace in inc files 2018-02-10 19:20:23 +01:00
Nikita Popov
b4dff68379 Remove no longer necessary type-name special cases
zend_get_type_by_name() now produces the correct value by itself,
so we no longer need these workarounds.
2018-02-04 23:20:44 +01:00
Gabriel Caruso
fef879a2d6 Use bool instead of boolean while throwing a type error
PHP requires boolean typehints to be written "bool" and disallows
"boolean" as an alias. This changes the error messages to match
the actual type name and avoids confusing messages like "must be
of type boolean, boolean given".

This a followup to ce1d69a1f6, which
implements the same change for integer->int.
2018-02-04 23:09:40 +01:00
Gabriel Caruso
ce1d69a1f6 Use int instead of integer in type errors
PHP requires integer typehints to be written "int" and does not
allow "integer" as an alias. This changes type error messages to
match the actual type name and avoids confusing messages like
"must be of the type integer, integer given".
2018-02-04 19:08:23 +01:00
Gabriel Caruso
a920db8f13 Remove superfluous SKIPIF sections in Reflection tests 2018-02-03 14:10:51 +01:00
Dmitry Stogov
12c386f5b9 Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse. (reapply 781e1573af, now it should be OK). 2018-01-11 22:15:45 +03:00
Dmitry Stogov
6ba10a03e7 Revert "Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse." (this patch is incomplete or wrong)
This reverts commit 781e1573af.
2018-01-11 17:27:26 +03:00
Dmitry Stogov
781e1573af Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse. 2018-01-11 16:25:28 +03:00
Gabriel Caruso
6400264856 Trailing whitespaces
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-03 14:38:00 +01:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Dmitry Stogov
d9f5ea691f zend_fcall_info_cache.initialized is removed (zend_fcall_info_cache is initialized if zend_fcall_info_cache.function_handler is set). 2017-12-27 15:15:03 +03:00
Xinchen Hui
4dfbfe93aa Use cheaper API 2017-12-18 11:55:14 +08:00
Dmitry Stogov
9e709e2fa0 Move constants into read-only data segment 2017-12-14 18:43:44 +03:00
Dmitry Stogov
084c17fe0b Use zend_string_tolower() where it's possible (to avoid reallocations).
Allow zend_string_tolower_ex() to create parsistent strings
2017-11-30 01:13:39 +03:00
Nikita Popov
b72b1a4e4d Add zend_object_alloc() API
Using ecalloc() to create objects is expensive, because the
dynamic-size memset() is unreasonably slow. Make sure we only
zero the main object structure with known size, as the properties
are intialized separately anyway.

Technically we do not need to zero the embedded zend_object
structure either, but as long as the memset argument is constant,
a couple more bytes don't really matter.
2017-11-25 17:12:37 +01:00
Dmitry Stogov
ccc12b82da Avoid unnecessary reference-counting on strings. 2017-11-16 17:09:32 +03:00
Sara Golemon
c33008339e Merge branch 'PHP-7.2'
* PHP-7.2:
  Revert BC break caused by fixing bug #74035
2017-11-06 17:52:35 -05:00
Michael Moravec
f70ca770b6 Revert BC break caused by fixing bug #74035
This reverts commit 9ffc6ca62f.
2017-11-06 17:52:17 -05:00
Xinchen Hui
a8a17a72b0 RC manipulation cleanup 2017-11-01 10:25:10 +08:00
Dmitry Stogov
fcb13fab6e Avoid reference counting (the value may be a persistent string) 2017-11-01 01:31:47 +03:00
Nikita Popov
5b044aacbe Use known strings for reflection properties 2017-10-31 15:46:55 +01:00
Nikita Popov
7b16205f8b Remove some unnecessary duplications 2017-10-30 22:48:20 +01:00
Dmitry Stogov
fcc08ce19f Prevent reference-counting on persistent zvals (internal constants, default properties and constants of internal classes).
New macro ZVAL_COPY_OR_DUP() is used perform duplication, if necessary.
This should eliminate related race-coditions in ZTS build and prevent reference-counting bugs after unclean shutdown.
2017-10-30 23:13:10 +03:00
Dmitry Stogov
49ea143bbd Encapsulate reference-counting primitives.
Prohibit direct update of GC_REFCOUNT(), GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF() shoukf be instead.
Added mactros to validate reference-counting (disabled for now).
These macros are going to be used to eliminate race-condintions during reference-counting on data shared between threads.
2017-10-27 01:28:58 +03:00
Dmitry Stogov
9cf87aa196 Avoid HashTable allocations for empty arrays (using zend_empty_array). 2017-10-24 17:27:31 +03:00
Dmitry Stogov
ef5ea48741 Always use IS_CONSTANT_AST (IS_CONSTANT is removed). 2017-10-10 10:11:05 +03:00
Dmitry Stogov
e70618aff6 Changed the way VM accesses constant operands in 64-bit builds. 2017-10-04 16:53:01 +03:00
Sammy Kaye Powers
c900764e64
Fix type-o in ext/reflection comment 💬 2017-09-13 14:11:57 -05:00
Derick Rethans
21493e0824 Merge branch 'PHP-7.1' into PHP-7.2 2017-08-16 11:14:53 +01:00
Derick Rethans
9a72a7c58f Merge branch 'PHP-7.0' into PHP-7.1 2017-08-16 11:14:47 +01:00
Derick Rethans
5d2c303438 Fixed stupid test 2017-08-16 11:14:41 +01:00
Xinchen Hui
262aeb8ae1 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed test
2017-07-27 12:50:41 +08:00
Xinchen Hui
0ddda0dcb7 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed test
2017-07-27 12:50:28 +08:00
Xinchen Hui
9fcfe52d03 Fixed test 2017-07-27 12:50:17 +08:00
Xinchen Hui
afc2be8fc8 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS
  Fixed bug #74949 (null pointer dereference in _function_string)
2017-07-27 11:24:53 +08:00
Xinchen Hui
84a18c4782 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #74949 (null pointer dereference in _function_string)
2017-07-27 11:23:27 +08:00
Xinchen Hui
e36c04ef48 Fixed bug #74949 (null pointer dereference in _function_string) 2017-07-27 11:23:06 +08:00
Tom Van Looy
04fb3f28ff Remove superfluous semicolons 2017-06-26 00:23:25 +02:00
Michał Brzuchalski
8e10c9d373 Implement object type annotation
RFC: https://wiki.php.net/rfc/object-typehint
2017-06-25 21:49:41 +02:00
Remi Collet
fdfc5c1b3d code de-duplication in ReflectionType::__toString and ReflectionNamedType::getName
This code duplication introduce an inconsistency in displayed type name
- bool (reflection) vs boolean
- int (reflection) vs integer

And reflection already use zend_get_type_by_const in other methods...

Inconsistenty is kept for BC reason.
Could be fixed in 8.0
2017-06-15 15:38:03 +02:00
Sara Golemon
d1cfd87fbe Allow ReflectionClass::isIterable() to return true for Traversables
Current behavior is essentially "Is an INTERNAL iterable class".
This change allows isIterable() to return true for userspace classes as well.
2017-05-31 14:23:57 -07:00
Sara Golemon
c1500f8519 Rename ReflectionClass::isIterateable() to isIterable()
Iterateable is not a word.
Add the correct spelling, but keep the original one around
for BC purposes.

Perhaps we can add ZEND_ACC_DEPRECATED at some later date
and even remove it from PHP 8.
2017-05-31 12:08:07 -07:00
Xinchen Hui
bfd35512bb Merge branch 'PHP-7.1'
* PHP-7.1:
  Update NEWS
  Fixed bug #74673 (Segfault when cast Reflection object to string with undefined constant)

Conflicts:
	ext/reflection/php_reflection.c
2017-05-31 13:12:24 +08:00
Xinchen Hui
9064dca58b Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #74673 (Segfault when cast Reflection object to string with undefined constant)

Conflicts:
	ext/reflection/php_reflection.c
2017-05-31 13:08:26 +08:00