PHP7.4 기타 변경 사항

Performance Improvements

PHP Core

array_key_exists() 함수에 대한 특수 VM opcode가 추가되어 정적으로 해결할 수 있는 경우 이 함수의 성능이 향상됩니다. 네임스페이스 코드에서는 \array_key_exists()를 작성하거나 명시적으로 함수를 가져와야 할 수 있습니다.

Regular Expressions (Perl-Compatible)

UTF-8 모드("u" 수정자)의 preg_match()가 동일한 문자열(그러나 오프셋이 다를 수 있음)에서 반복적으로 호출되면 UTF-8 유효성에 대해 한 번만 검사됩니다.


Changes to INI File Handling

zend.exception_ignore_args는 예외에서 생성된 스택 추적에서 인수를 포함하거나 제외하기 위한 새로운 INI 지시문입니다.

opcache.preload_user는 루트로 실행되는 경우 사전 로드 코드가 실행되는 사용자 계정을 지정하기 위한 새로운 INI 지시문입니다(보안상의 이유로 허용되지 않음).


Migration to pkg-config

라이브러리 종속성 감지를 위해 pkg-config를 독점적으로 사용하도록 많은 확장이 마이그레이션되었습니다. 일반적으로 이는 --with-foo-dir=DIR 또는 이와 유사한 --with-foo를 사용하는 대신 사용됨을 의미합니다. 사용자 정의 라이브러리 경로는 PKG_CONFIG_PATH에 추가 디렉토리를 추가하거나 FOO_CFLAGS 및 FOO_LIBS를 통해 컴파일 옵션을 명시적으로 지정하여 지정할 수 있습니다.

다음 확장 및 SAPI가 영향을 받습니다.

  • CURL:
    • --with-curl no longer accepts a directory.
  • Enchant:
    • --with-enchant no longer accepts a directory.
  • FPM:
    • --with-fpm-systemd now uses only pkg-config for libsystem checks. The libsystemd minimum required version is 209.
  • GD:
    • --with-gd becomes --enable-gd (whether to enable the extension at all) and --with-external-gd (to opt into using an external libgd, rather than the bundled one).
    • --with-png-dir has been removed. libpng is required.
    • --with-zlib-dir has been removed. zlib is required.
    • --with-freetype-dir becomes --with-freetype
    • --with-jpeg-dir becomes --with-jpeg
    • --with-webp-dir becomes --with-webp
    • --with-xpm-dir becomes --with-xpm
  • IMAP:
    • --with-kerberos-systemd no longer accepts a directory.
  • Intl:
    • --with-icu-dir has been removed. If --enable-intl is passed, then libicu is always required.
  • LDAP:
    • --with-ldap-sasl no longer accepts a directory.
  • Libxml:
    • --with-libxml-dir has been removed.
    • --enable-libxml becomes --with-libxml.
    • --with-libexpat-dir has been renamed to --with-expat and no longer accepts a directory.
  • Litespeed:
    • --with-litespeed becomes --enable-litespeed.
  • Mbstring:
    • --with-onig has been removed. Unless --disable-mbregex has been passed, libonig is required.
  • ODBC:
    • --with-iodbc no longer accepts a directory.
    • --with-unixODBC without a directory now uses pkg-config (preferred). Directory is still accepted for old versions without libodbc.pc.
  • OpenSSL:
    • --with-openssl no longer accepts a directory.
  • PCRE:
    • --with-pcre-regex has been removed. Instead --with-external-pcre is provided to opt into using an external PCRE library, rather than the bundled one.
  • PDO_SQLite:
    • --with-pdo-sqlite no longer accepts a directory.
  • Readline:
    • --with-libedit no longer accepts a directory.
  • Sodium:
    • --with-sodium no longer accepts a directory.
  • SQLite3:
    • --with-sqlite3 no longer accepts a directory.
  • XSL:
    • --with-xsl no longer accepts a directory.
  • Zip:
    • --with-libzip has been removed.
    • --enable-zip becomes --with-zip.

CSV escaping

fputcsv(), fgetcsv(), SplFileObject::fputcsv(), SplFileObject::fgetcsv()SplFileObject::setCsvControl()은 이제 빈 문자열을 $escape 인수로 허용하여 독점 PHP 이스케이프 메커니즘을 비활성화합니다.

str_getcsv()의 동작이 그에 따라 조정되었습니다(이전에는 빈 문자열이 기본값을 사용하는 것과 동일했습니다).

SplFileObject::getCsvControl()은 이제 세 번째 배열 요소에 대해 빈 문자열을 반환할 수도 있습니다.


Data Filtering

필터 확장은 더 이상 Unix 빌드용 --with-pcre-dir을 노출하지 않으며 이제 ./configure를 사용할 때 공유로 안정적으로 빌드할 수 있습니다.


GD

번들 libgd의 imagecropauto() 동작이 시스템 libgd의 동작과 동기화되었습니다.

  • IMG_CROP_DEFAULT가 더 이상 IMG_CROP_SIDES로 대체되지 않습니다.
  • 임계값 자르기는 이제 시스템 libgd의 알고리즘을 사용합니다.

imagecropauto()의 기본 $mode 매개변수가 IMG_CROP_DEFAULT로 변경되었습니다. -1 전달은 이제 더 이상 사용되지 않습니다.

imagescale()은 이제 -1을 $new_width로 전달하여 고정 높이로 크기 조정을 유지하는 종횡비를 지원합니다.


HASH Message Digest Framework

해시 확장은 더 이상 비활성화할 수 없으며 날짜 확장과 마찬가지로 항상 모든 PHP 빌드의 필수적인 부분입니다.


Intl

이제 intl 확장을 사용하려면 최소 ICU 50.1이 필요합니다.

ResourceBundle은 이제 Countable을 구현합니다.


Lightweight Directory Access Protocol

nsldap 및 umich_ldap에 대한 지원이 제거되었습니다.


Libxml

모든 libxml 기반 확장에는 이제 libxml 2.7.6 이상이 필요합니다.


Multibyte String

oniguruma 라이브러리는 더 이상 PHP와 번들로 제공되지 않으며 대신 시스템에서 libonig를 사용할 수 있어야 합니다. 또는 --disable-mbregex를 사용하여 mbregex 구성 요소를 비활성화할 수 있습니다.


OPcache

--disable-opcache-file 및 --enable-opcache-file 구성 옵션은 opcache.file_cache INI 지시문을 위해 제거되었습니다.


Password Hashing

password_hash() 및 함수는 이제 $algo 인수에 대해 nullable 문자열과 int를 허용합니다.


PEAR

PEAR(PECL 포함) 설치는 더 이상 기본적으로 활성화되어 있지 않습니다. --with-pear를 사용하여 명시적으로 활성화할 수 있습니다. 이 옵션은 더 이상 사용되지 않으며 향후 제거될 수 있습니다.


Reflection

ReflectionClass, ReflectionFunction, ReflectionMethod,ReflectionObject, ReflectionPropty 클래스에 대한 수정자 상수(IS_ABSTRACT, IS_DEPRECATED, IS_EXPLICIT_ABSTRACT, IS_FINAL, IS_IMPLICIT_ABSTRACT, IS_PRIVATE, IS_PROTECTED, IS_PUBLIC 및 IS_STATIC)의 숫자 값이 변경되었습니다.


SimpleXML

SimpleXMLElement는 이제 Countable을 구현합니다.


SQLite3

번들 libsqlite가 제거되었습니다. SQLite3 확장을 빌드하려면 이제 시스템 libsqlite3 ≥ 3.7.4가 필요합니다. PDO_SQLite 확장을 빌드하려면 이제 시스템 libsqlite3 ≥ 3.5.0이 필요합니다.

SQLite3, SQLite3StmtSQLite3Result의 직렬화 및 직렬화 해제는 이제 명시적으로 금지됩니다. 이전에는 이러한 클래스의 인스턴스를 직렬화할 수 있었지만 직렬화 해제하면 사용할 수 없는 개체가 생성되었습니다.

이제 @param 표기법을 사용하여 SQL 쿼리 매개변수를 표시할 수도 있습니다.


Zip

번들 libzip 라이브러리가 제거되었습니다. zip 확장을 빌드하려면 시스템 libzip >= 0.11이 필요합니다.