1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Commit Graph

1427 Commits

Author SHA1 Message Date
istiak101
bf2867bc72 Fix FSF address & update year to 2022
FSF mailing address was changed long time ago. This patch updates that address. Also updated year from 2021 to 2022.

Closes GH-8009.
2022-03-19 18:25:29 +01:00
Ilija Tovilo
2f5295692f Optimize stripos/stristr
Closes GH-7847
Closes GH-7852

Previously stripos/stristr would lowercase both the haystack and the
needle to reuse strpos. The approach in this PR is similar to strpos.
memchr is highly optimized so we're using it to search for the first
character of the needle in the haystack. If we find it we compare the
remaining characters of the needle manually.

The new implementation seems to perform about half as well as strpos (as
two memchr calls are necessary to find the next candidate).
2022-01-31 21:44:31 +01:00
Nikita Popov
cd3fbb1b15 Fix file name clash in phar test 2021-11-09 15:52:10 +01:00
Dmitry Stogov
90b7bde615 Use more compact representation for packed arrays.
- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[i]
  instead of ht->arData[i]
- in addition to general ZEND_HASH_FOREACH_* macros, we introduced similar
  familied for packed (ZEND_HASH_PACKED_FORECH_*) and real hashes
  (ZEND_HASH_MAP_FOREACH_*)
- introduced an additional family of macros to access elements of array
  (packed or real hashes) ZEND_ARRAY_ELEMET_SIZE, ZEND_ARRAY_ELEMET_EX,
  ZEND_ARRAY_ELEMET, ZEND_ARRAY_NEXT_ELEMENT, ZEND_ARRAY_PREV_ELEMENT
- zend_hash_minmax() prototype was changed to compare only values

Because of smaller data set, this patch may show performance improvement
on some apps and benchmarks that use packed arrays. (~1% on PHP-Parser)

TODO:
    - sapi/phpdbg needs special support for packed arrays (WATCH_ON_BUCKET).
    - zend_hash_sort_ex() may require converting packed arrays to hash.
2021-11-03 15:18:26 +03:00
Kamil Tekiela
c3dda473cc Fix 'can not' in test data and in code comments 2021-10-05 09:51:58 +01:00
Nikita Popov
4087aba60d Fix file name clashes in phar buildfromiterator tests 2021-09-17 10:11:06 +02:00
George Peter Banyard
989d539528 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix param name order for Phar::copy()
2021-09-08 12:33:14 +01:00
George Peter Banyard
be2500f229 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix param name order for Phar::copy()
2021-09-08 12:32:58 +01:00
George Peter Banyard
0d0c9acafb Fix param name order for Phar::copy() 2021-09-08 12:31:09 +01:00
Nikita Popov
768265cd22 Fix some more CLEAN sections 2021-09-06 17:03:35 +02:00
Nikita Popov
98d004c9bc Fix CLEAN sections 2021-09-03 12:36:02 +02:00
Nikita Popov
7a411564f0 Fix some more CLEAN sections 2021-09-03 11:18:19 +02:00
Stanislav Malyshev
1fefd482f4 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix test
2021-08-23 23:44:06 -07:00
Stanislav Malyshev
ffcf5ba4ae Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix test
2021-08-23 23:43:58 -07:00
Stanislav Malyshev
c1f427b506 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix test
2021-08-23 23:43:51 -07:00
Stanislav Malyshev
b815645aac Fix test 2021-08-23 23:43:32 -07:00
Stanislav Malyshev
18ebe1588d Merge branch 'PHP-8.0'
* PHP-8.0:
  Update NEWS
  Fix #81211: Symlinks are followed when creating PHAR archive
2021-08-23 23:31:00 -07:00
Stanislav Malyshev
33e4174d1c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Update NEWS
  Fix #81211: Symlinks are followed when creating PHAR archive
2021-08-23 23:30:34 -07:00
Stanislav Malyshev
40db8947e2 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS
  Fix #81211: Symlinks are followed when creating PHAR archive
2021-08-23 23:29:01 -07:00
Christoph M. Becker
2ff853aa11 Fix #81211: Symlinks are followed when creating PHAR archive
It is insufficient to check whether the `base` is contained in `fname`;
we also need to ensure that `fname` is properly separated.  And of
course, `fname` has to start with `base`.
2021-08-23 23:25:16 -07:00
Nikita Popov
ddc21b0902 Fix phar test
As the REPORT_ERRORS flag is now respected, this no longer
throws a warning (in addition to the exception).
2021-08-17 14:57:17 +02:00
Remi Collet
c51af22fef implement openssl_256 and openssl_512 for phar singatures 2021-08-11 14:13:57 +02:00
Remi Collet
8bb0c74e24 switch phar to use sha256 signature by default 2021-08-11 14:13:54 +02:00
Nikita Popov
1a370d3321 Skip some tests under --preload
A genuine problem here is that we sometime get different class
casing due interaction with the ZSTR CE cache. Ignore these for
now.
2021-07-30 17:26:39 +02:00
Nikita Popov
bca1ebf529 Merge branch 'PHP-8.0'
* PHP-8.0:
  Create interned strings for internal union types
  Duplicate possibly persistent string in phar metadata clone
2021-07-20 16:24:33 +02:00
Nikita Popov
9726bc6977 Duplicate possibly persistent string in phar metadata clone 2021-07-20 16:24:00 +02:00
Máté Kocsis
75a678a7e3 Declare tentative return types for Zend (#7251)
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-07-19 13:44:20 +02:00
Nikita Popov
edb6b375dd Don't return bool from Phar::offsetUnset()
This violates the ArrayAccess interface. Use offsetExists() to
check if an entry exists.
2021-07-16 16:39:27 +02:00
Nikita Popov
4423253700 Fix deprecation warnings in phar.php 2021-07-16 14:19:01 +02:00
Máté Kocsis
c6357b804e Declare tentative return types for ext/spl - part 1 (#7115) 2021-07-13 13:04:45 +02:00
Nikita Popov
3fc3cfbad0 Fix Phar::offsetGet() return type
It's possible to change the returned type using setFileClass(),
which unfortunately only enforces that it's a subtype of
SplFileInfo, not PharFileInfo.
2021-07-13 12:02:05 +02:00
Nikita Popov
5502910ed8 Fix phar test
Make getCurrentLine() return a string rather than an array.
2021-07-06 14:53:50 +02:00
Anatol Belski
e7123ef569 phar: crc32: Extend and cleanup API for the new bulk crc32 functions
As suggested on the patch discussion, adding init/end macros. Plus,
prefixed the new functions with php_ to avoid possible symbol conflicts.

Signed-off-by: Anatol Belski <ab@php.net>
2021-07-03 21:03:47 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
jianxind
28a1a6be08 phar: use crc32 bulk method instead. (#6099)
phar: use crc32 bulk method instead.

Benefit from the hardware crc32 computing.

Signed-off-by: Frank Du <frank.du@intel.com>
2021-06-19 22:21:21 +02:00
Nikita Popov
39131219e8 Migrate more SKIPIF -> EXTENSIONS (#7139)
This is a mix of more automated and manual migration. It should remove all applicable extension_loaded() checks outside of skipif.inc files.
2021-06-11 12:58:44 +02:00
Nikita Popov
7485978339 Migrate SKIPIF -> EXTENSIONS (#7138)
This is an automated migration of most SKIPIF extension_loaded checks.
2021-06-11 11:57:42 +02:00
Máté Kocsis
83916e83b4 Declare tentative return types for ext/phar (#7052) 2021-05-28 15:07:15 +02:00
Máté Kocsis
0224cc83fc Merge branch 'PHP-8.0'
* Add a few missing RETURN_THROWS();
* Fix a few ext/phar return types
2021-05-27 16:32:16 +02:00
Máté Kocsis
9bba9f68df Fix a few ext/phar return types 2021-05-27 16:31:18 +02:00
Máté Kocsis
2d47447d66 Add a few missing RETURN_THROWS();
Only PharFileInfo::compress() really needs it though.
2021-05-27 16:31:18 +02:00
Nikita Popov
f57526a07a Store base path as zend_string in Phar::buildFrom*
This also removes the need to check for length overflow, as the
length is now size_t.
2021-05-27 10:57:51 +02:00
Nikita Popov
8c192c717c Accept regex as zend_string in Phar::buildFromDirectory()
No need to copy it...
2021-05-27 10:51:51 +02:00
twosee
9066d695e9 Remove all *_EXTERN_C() in C source files (#7054) 2021-05-27 15:52:54 +08:00
George Peter Banyard
e7135cb817 Use zend_string_equals_* API in a couple of more place
Closes GH-6979
2021-05-14 13:45:17 +01: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
Christoph M. Becker
c8a966a9ae Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80960: opendir() warning wrong info when failed on Windows
2021-04-19 16:18:03 +02:00
Christoph M. Becker
cb262cd974 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80960: opendir() warning wrong info when failed on Windows
2021-04-19 16:17:01 +02:00
Christoph M. Becker
ea3c992bff Fix #80960: opendir() warning wrong info when failed on Windows
Firstly, we must not forget to set appropriate error codes for "manual"
checks in `virtual_file_ex()`.

Secondly, we must not call `php_error_docref2()` for warnings regarding
unary functions; thus, we introduce `php_win32_docref1_from_error()`.

Closes GH-6872.
2021-04-19 16:12:22 +02:00
twosee
44a35c9219 Fix E_DEPRECATED in phar (#6824)
shell_exec() can return null both when an error occurs or the program produces no output, or return false when popen failed, and treating null/false as an empty string has no effect on the behavior of phar here.
2021-04-14 18:21:14 +08:00