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

293 Commits

Author SHA1 Message Date
Max Semenik 2b5de6f839 Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov 15846ff115 Add ZVAL_OBJ_COPY macro
For the common ZVAL_OBJ + GC_ADDREF pattern.
This mirrors the existing ZVAL_STR_COPY API.
2020-06-17 16:36:56 +02:00
Nikita Popov 94df2f697f Fix bug #65006
The "callable name" may be the same for multiple distinct callables.
The code already worked around this for the case of instance methods,
but there are other cases in which callable names clash, such as
the use of self:: reported in the referenced bug.

Rather than trying to generate a unique name for callables, compare
the content of the alfi structures. This is less efficient if there
are many autoload functions, but autoload *registration* does not
need to be particularly efficient.

As a side-effect, this no longer permits unregistering non-callables.
2020-06-10 11:30:32 +02:00
Nikita Popov 034741f6c7 Simplify spl_autoload_perform() implementation
And convert alfi.obj from zval to zend_object*.
2020-06-10 10:33:54 +02:00
Nikita Popov 097043db2a Fix called scope assignment in autoloader
We should use the scope specified in the spl_autoload_register()
call, not whatever LSB scope just so happens to be active at the
time of the autoloader call.
2020-06-10 09:55:50 +02:00
Nikita Popov e0e4a61847 Remove autoload_running flag
This was only used to decide between a hash clean and a hash
destroyed in spl_autoload_remove(). But now that
spl_autoload_functions() no longer distinguishes between NULL and
an empty array here, there's really no need to try and destroy
the hashtable here.
2020-06-10 09:41:58 +02:00
Nikita Popov 5b59d4915c Cleanup SPL autoload implementation
Replace EG(autoload_func) with a C level zend_autoload hook.
This avoids having to do one indirection through PHP function
calls. The need for EG(autoload_func) was a leftover from the
__autoload() implementation.

Additionally, drop special-casing of spl_autoload(), and instead
register it just like any other autoloading function. This fixes
bug #71236 as a side-effect.

Finally, change spl_autoload_functions() to always return an array.
The distinction between false and an empty array no longer makes
sense here.

Closes GH-5696.
2020-06-10 09:38:47 +02:00
Nikita Popov 3b8d26accf Remove obsolete __lambda_func handling
This is a leftover from create_function() support.
2020-06-09 16:47:40 +02:00
George Peter Banyard 2302b14aab Use ZPP callable check for spl_autoload_register.
This makes it always throw a TypeError, moreover this makes the
error message consistent.

Added a warning mentioning that the second parameter is now ignored
when passed false.

Closes GH-5301
2020-05-30 13:59:06 +02:00
Máté Kocsis 650da66e2d Fix UNKNOWN default values in ext/spl 2020-05-06 19:15:39 +02:00
Nikita Popov 16e9d74f07 Fixed bug #79432 2020-04-27 16:22:32 +02:00
Máté Kocsis d7f7080bb5 Generate methods entries from stubs for ext/spl
Closes GH-5458
2020-04-25 23:54:56 +02:00
Máté Kocsis 01b266aac4 Improve error messages of various extensions
Closes GH-5278
2020-03-23 18:59:04 +01:00
Máté Kocsis d1764ca330 Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Máté Kocsis 9099dbd961 Use RETURN_THROWS() after zend_type_error() 2020-01-01 14:23:21 +01:00
Máté Kocsis 817605917b Use RETURN_THROWS() during ZPP in the remaining extensions
In reflection, sodium, and SPL
2019-12-31 16:33:02 +01:00
Tyson Andre 1695d3ed07 Add funcinfo for spl global functions
This assumes that `iterator_*` will now always throw or abort on failure.

Also, move #include _arginfo.h directive to the top of the file - virtually all
other files put it there, and developers may base code on basic_functions.c.

Closes GH-4968
2019-12-11 18:17:04 -05:00
George Peter Banyard a90abe2064 Convert warnings to TypeError in php_spl.c
Closes GH-4991
2019-12-11 13:49:16 +01:00
Nikita Popov 05e6a11b5b Remove ZEND_PARSE_PARAMS_QUIET from spl_autoload_register() 2019-12-11 11:15:02 +01:00
Máté Kocsis 9493893412 Cleanup return values when parameter parsing is unsuccessful 2019-10-30 16:05:20 +01: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 53fdcd718b Merge branch 'PHP-7.4' 2019-09-03 09:50:23 +02:00
Nikita Popov c0e9b1532e Add zpp check to spl_classes() 2019-09-03 09:50:08 +02:00
Nikita Popov 2bfbb16ff2 Merge branch 'PHP-7.4' 2019-09-03 09:44:09 +02:00
Nikita Popov 5acedabfc0 Clarify failure behavior of spl_iterator_apply()
It only fails if it throws, in which case it is meaningless to
set a return value.
2019-09-03 09:43:22 +02:00
Peter Kokot 623911f993 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove local variables
2019-02-03 21:23:18 +01:00
Peter Kokot 92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Nikita Popov 0dfd918ee7 Remove support for __autoload()
There are probably some improvements we can do to the SPL
implementation now that __autoload() is gone. In particular having
EG(autoload_func) as a property zend function, rather than a simple
callback probably doesn't make sense.
2019-01-30 14:00:16 +01:00
Zeev Suraski 0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Zeev Suraski 38c337f22e Remove year range from copyright notice 2019-01-30 11:00:23 +02:00
Nikita Popov 6c73b50cf6 Remove static calls to non-static methods 2019-01-30 09:19:02 +01:00
Nikita Popov cd7601ebfc Merge branch 'PHP-7.3' 2018-12-27 15:34:22 +01:00
Lauri Kenttä 16c62a8179 Fix #77360: class_uses causes segfault 2018-12-27 15:34:02 +01:00
Nikita Popov 6a06190850 Merge branch 'PHP-7.3' 2018-12-27 15:29:51 +01:00
Lauri Kenttä 89bf3df67d Fix #77359: spl_autoload causes segfault
Use the correct function to free the string.
2018-12-27 15:28:25 +01:00
Dmitry Stogov cec091176c Replace zend_hash_apply... with ZEND_HASH_FOREACH... 2018-12-19 02:49:56 +03:00
Gabriel Caruso 84b195d9fc Fix some misspellings 2018-08-12 16:15:45 +02:00
Peter Kokot 8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Dmitry Stogov b6fb584505 Replace zval_dtor() with specialized destructors 2018-07-05 13:32:39 +03:00
Dmitry Stogov 3c600e2d61 retval shouldn't be NULL 2018-06-22 14:28:29 +03:00
Dmitry Stogov 9b2d708f21 Reduce spl_autoload() overhead 2018-06-22 13:19:53 +03:00
Dmitry Stogov 5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Dmitry Stogov eafa92ba9d zend_fcall_info_cache.calling_scope is not used by zend_call_function() and doesn't have to be initialized.
It's used only as a result of zend_is_callable() in forward_static_call and spl_autoload.
2018-05-03 19:27:04 +03:00
Gabriel Caruso affc20f891 Use bool instead of boolean in proto 2018-02-04 17:00:24 +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
Dmitry Stogov 9e709e2fa0 Move constants into read-only data segment 2017-12-14 18:43:44 +03:00
Nikita Popov 9cdd547eca Fixed bug #74372 2017-12-06 23:36:09 +01: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
Xinchen Hui e7dd9c781b Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS
  Fixed bug #75049 (spl_autoload_unregister can't handle spl_autoload_functions results)
2017-08-09 11:29:46 +08:00