Giter Site home page Giter Site logo

php / php-src Goto Github PK

View Code? Open in Web Editor NEW
37.3K 1.4K 7.7K 536.05 MB

The PHP Interpreter

Home Page: https://www.php.net

License: Other

JavaScript 0.20% C 67.38% Makefile 0.03% Shell 0.32% PHP 30.22% DTrace 0.01% C++ 0.60% Awk 0.01% HTML 0.01% GAP 0.02% XSLT 0.01% Batchfile 0.01% Yacc 0.09% M4 0.41% GDB 0.01% Lua 0.29% Lex 0.10% Roff 0.03% Assembly 0.25% Python 0.01%

php-src's Introduction

The PHP Interpreter

PHP is a popular general-purpose scripting language that is especially suited to web development. Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world. PHP is distributed under the PHP License v3.01.

Push Build status Fuzzing Status

Documentation

The PHP manual is available at php.net/docs.

Installation

Prebuilt packages and binaries

Prebuilt packages and binaries can be used to get up and running fast with PHP.

For Windows, the PHP binaries can be obtained from windows.php.net. After extracting the archive the *.exe files are ready to use.

For other systems, see the installation chapter.

Building PHP source code

For Windows, see Build your own PHP on Windows.

For a minimal PHP build from Git, you will need autoconf, bison, and re2c. For a default build, you will additionally need libxml2 and libsqlite3.

On Ubuntu, you can install these using:

sudo apt install -y pkg-config build-essential autoconf bison re2c \
                    libxml2-dev libsqlite3-dev

On Fedora, you can install these using:

sudo dnf install re2c bison autoconf make libtool ccache libxml2-devel sqlite-devel

Generate configure:

./buildconf

Configure your build. --enable-debug is recommended for development, see ./configure --help for a full list of options.

# For development
./configure --enable-debug
# For production
./configure

Build PHP. To speed up the build, specify the maximum number of jobs using -j:

make -j4

The number of jobs should usually match the number of available cores, which can be determined using nproc.

Testing PHP source code

PHP ships with an extensive test suite, the command make test is used after successful compilation of the sources to run this test suite.

It is possible to run tests using multiple cores by setting -jN in TEST_PHP_ARGS:

make TEST_PHP_ARGS=-j4 test

Shall run make test with a maximum of 4 concurrent jobs: Generally the maximum number of jobs should not exceed the number of cores available.

The qa.php.net site provides more detailed info about testing and quality assurance.

Installing PHP built from source

After a successful build (and test), PHP may be installed with:

make install

Depending on your permissions and prefix, make install may need super user permissions.

PHP extensions

Extensions provide additional functionality on top of PHP. PHP consists of many essential bundled extensions. Additional extensions can be found in the PHP Extension Community Library - PECL.

Contributing

The PHP source code is located in the Git repository at github.com/php/php-src. Contributions are most welcome by forking the repository and sending a pull request.

Discussions are done on GitHub, but depending on the topic can also be relayed to the official PHP developer mailing list [email protected].

New features require an RFC and must be accepted by the developers. See Request for comments - RFC and Voting on PHP features for more information on the process.

Bug fixes don't require an RFC. If the bug has a GitHub issue, reference it in the commit message using GH-NNNNNN. Use #NNNNNN for tickets in the old bugs.php.net bug tracker.

Fix GH-7815: php_uname doesn't recognise latest Windows versions
Fix #55371: get_magic_quotes_gpc() throws deprecation warning

See Git workflow for details on how pull requests are merged.

Guidelines for contributors

See further documents in the repository for more information on how to contribute:

Credits

For the list of people who've put work into PHP, please see the PHP credits page.

php-src's People

Contributors

bjori avatar bukka avatar bwoebi avatar cjbj avatar cmb69 avatar derickr avatar dstogov avatar faizshukri avatar felipensp avatar girgias avatar helly25 avatar iluuu1994 avatar johannes avatar kallez avatar kocsismate avatar krakjoe avatar laruence avatar nielsdos avatar nikic avatar petk avatar pierrejoye avatar remicollet avatar rlerdorf avatar sgolemon avatar smalyshev avatar stigsb avatar tony2001 avatar weltling avatar wez avatar zsuraski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-src's Issues

showing warning oci8 install through pecl

installing oci8 extension through pecl
sudo pecl -d php_suffix=8.1 install oci8

In function โ€˜php_oci_column_to_zvalโ€™:
/tmp/pear/temp/oci8/oci8.c:1708:72: warning: format โ€˜%dโ€™ expects argument of type โ€˜intโ€™, but argument 4 has type โ€˜zend_longโ€™ {aka โ€˜long intโ€™} [-Wformat=]
1708 | php_error_docref(NULL, E_WARNING, "Unable to find LOB descriptor #%d", column->descid->handle);

Datetime created from negative float timestamp is not monotonic (fraction part is added instead of substracted)

Description

The following code:

foreach ([0.4, 0, -0.4, -1, -1.4] as $ts) {
    $date = new DateTime('@' . $ts);
    print_r($date);
}

https://3v4l.org/EWpSj

Diff of current output vs expected:

 DateTime Object
 (
     [date] => 1970-01-01 00:00:00.400000
     [timezone_type] => 1
     [timezone] => +00:00
 )
 DateTime Object
 (
     [date] => 1970-01-01 00:00:00.000000
     [timezone_type] => 1
     [timezone] => +00:00
 )
 DateTime Object
 (
-    [date] => 1970-01-01 00:00:00.400000
+    [date] => 1969-12-31 23:59:59.600000
     [timezone_type] => 1
     [timezone] => +00:00
 )
 DateTime Object
 (
     [date] => 1969-12-31 23:59:59.000000
     [timezone_type] => 1
     [timezone] => +00:00
 )
 DateTime Object
 (
-    [date] => 1969-12-31 23:59:59.400000
+    [date] => 1969-12-31 23:59:58.600000
     [timezone_type] => 1
     [timezone] => +00:00
 )

PHP Version

present since PHP 8.0, should be fixed starting this version

it seems the issue is present only when TS is parsed, getTimestamp / format('u') seems correct across all PHP versions - https://3v4l.org/CjJLf

PHP 8.2: unexpected deprecation for dynamic property set via magic method

Description

The following code:

<?php
class Foo {
    public function __set( $name, $value ) {
        $this->$name = $value;
    }
}

$obj = new Foo();
$obj->test = 'test';

Resulted in this output:

Deprecated: Creation of dynamic property Foo::$test is deprecated in /in/Ds0gN on line 5

https://3v4l.org/Ds0gN/rfc#vgit.master

But I expected this output instead:

No error

I realize that this is an "unconventional" interpretation of how magic methods should be implemented, but at the same time, the RFC explicitly excluded dynamic properties being set via magic methods from the deprecation, so I'd really like to invite some discussion on this.

PHP Version

8.2/nightly

Operating System

No response

mcrypt extension not installable on php 8.1

Description

It looks like the mcrypt extension is not available (yet?) on php 8.1. I couldn't find anything about whether or not there's already efforts underway to change that, hence this issue.

Dockerfile to reproduce:

FROM php:8.1-fpm-buster
RUN pecl install mcrypt-1.0.4

Results in:

pecl/mcrypt is not compatible with PHP version 8.1.0
No valid packages found
install failed

Not sure if this is the right place to report this, the bugtracker for the mcrypt page from pecl told me to open an issue here.

README.md steps for reporting bugs should be updated to mention github issues instead of bugs.php.net

Description

The README currently says:

Bug fixes do not require an RFC but require a bug tracker ticket. Open a
ticket at bugs.php.net and reference the bug id using
#NNNNNN.

Fix #55371: get_magic_quotes_gpc() throws deprecation warning

After removing magic quotes, the get_magic_quotes_gpc function caused a
deprecated warning. get_magic_quotes_gpc can be used to detect the
magic_quotes behavior and therefore should not raise a warning at any time.
The patch removes this warning.

https://wiki.php.net/rfc/github_issues#proposal changed this:

Bug reports and feature requests are filed on GitHub with custom issue forms. Security issues point to bugs.php.net instead, because GitHub currently does not support private issue reports.

It may be useful to also update the README in older minor versions of php that still get released?

https://bugs.php.net/report.php mentions the new steps.


Should creating an issue be optional if there's a GitHub PR fixing the bug?

PHP Version

N/A

Operating System

N/A

Match allow Lambda Functions

Description

Currently match() not allow use lambda functions.

If you try

$test = 'test'; $a = match($test) { 'test' => function($test) { print_r($test); } };

  • Return
    -- Today: Nothing is returned.
    -- New implementation: "test"

htmlspecialchars converts ' to #039 on PHP 8.1

Description

The following code:

<?php
echo htmlspecialchars("'");

Resulted in this output on PHP 8.1:

#039

But I expected this output instead (like it works on PHP 7.4 or PHP 8):

'

htmlspecialchars("'", ENT_SUBSTITUTE) makes it work on all PHP versions.

PHP Version

PHP 8.1

Operating System

No response

When a zip file is left empty, a warning is triggered when script end

Description

The following code:

<?php
$zip = new ZipArchive();
$out = "test.zip";
$zip->open($out, ZipArchive::CREATE | ZipArchive::OVERWRITE);
?>

Resulted in this warning:

PHP Warning:  Unknown: Cannot destroy the zip context: Can't remove file: No such file or directory in Unknown on line 0

But I expected no warnings. This does not happen if flag ZipArchive::OVERWRITE is not specified.

I guess ZipArchive has a registered shutdown function to clear temp zip file when script ends, but that file is created when the first file is added.

PHP Version

PHP 7.x

Operating System

Linux Ubuntu 16.04

Add nullsafe call and index access

Description

Proposal

// Nullsafe call
$res = $optionalClosure?->(1, 2, 3);
$res = ($obj->optionalClosure)?->(1, 2, 3);
// or even?
$res = $obj->optionalClosure?->(1, 2, 3);

// Nullsafe index access
$res = $optionalArray?->[42];
$res = $obj->optionalArray?->[42];

Backward Incompatible Changes

No.

Motivation

  1. Nullsafe access operator ?-> already exists and whole expression consists of existing tokens only;
  2. Syntax like $fn?() and $arr?[42] is not possible since it's a part of already valid syntax ?: ;
  3. Syntax like $fn?โ€—() and $arr?โ€—[42] (where โ€— is anything else) most probably will never be added because โ€— is literally something else and leads to inconsistency with $obj?->member.

Open Issues

  • Must $obj->optionalClosure require parentheses ($obj->optionalClosure)?->() like ($obj->closure)() does?

Future Scope

Probably it may be a small step forward to $array->methods() like [1,2,3]->map(fn ($x) => $x * 10) which itself may be a step to more features like (-42)->abs(), $str->trim()->replace(...)->replace(...).

Can't use inherited constant value via 'self' in enum case value

Description

The following code:

<?php

interface I {
    public const DEFAULT_VALUE = 'gambrinus';
}

enum Beer: string implements I {
    // case GAMBRINUS = I::DEFAULT_VALUE;
     case GAMBRINUS = self::DEFAULT_VALUE;
}
var_dump(Beer::GAMBRINUS);

Resulted in this output:

Fatal error: Enum case value must be compile-time evaluatable in /in/Oqm7f on line 9

But I expected this output instead:
No errors, because commented case GAMBRINUS = I::DEFAULT_VALUE produces no error

PHP Version

8.1.1

Operating System

No response

libphp.so: oci8.php_oci_cleanup_global_handles segfaults at second call

Description

When httpd is terminating, function oci8.php_oci_cleanup_global_handles is sometimes called twice. It symbol ZTS is defined, the second call fails, as the thread specific data-area has already been freed by that time.

Suggested change for php_oci8_int.h
before:

542 #ifdef ZTS
543 #define OCI_G(v) TSRMG(oci_globals_id, zend_oci_globals *, v)
544 #else
545 #define OCI_G(v) (oci_globals.v)
546 #endif

after:

542 #ifdef ZTS
543 # define OCI_GLOBALS TSRMG_BULK(oci_globals_id, zend_oci_globals *)
544 #else
545 # define OCI_GLOBALS (&oci_globals)
546 #endif
547 #define OCI_G(v) (OCI_GLOBALS->v)

Suggested change for oci8.c

before:

246 static void php_oci_cleanup_global_handles(void)
247 {
248     if (OCI_G(err)) {
249         PHP_OCI_CALL(OCIHandleFree, ((dvoid *) OCI_G(err), OCI_HTYPE_ERROR));
250         OCI_G(err) = NULL;
251     }
252
253     if (OCI_G(env)) {
254         PHP_OCI_CALL(OCIHandleFree, ((dvoid *) OCI_G(env), OCI_HTYPE_ENV));
255         OCI_G(env) = NULL;
256     }
257 }

after:

246 static void php_oci_cleanup_global_handles(void)
247 {
248     if (OCI_GLOBALS && OCI_G(err)) {
249         PHP_OCI_CALL(OCIHandleFree, ((dvoid *) OCI_G(err), OCI_HTYPE_ERROR));
250         OCI_G(err) = NULL;
251     }
252
253     if (OCI_GLOBALS && OCI_G(env)) {
254         PHP_OCI_CALL(OCIHandleFree, ((dvoid *) OCI_G(env), OCI_HTYPE_ENV));
255         OCI_G(env) = NULL;
256     }
257 }

or perhaps:

246 static void php_oci_cleanup_global_handles(void)
247 {
248     zend_oci_globals *og= OCI_GLOBALS;
249     if (og) {
250         if (og->err) {
251             PHP_OCI_CALL(OCIHandleFree, ((dvoid *) og->err, OCI_HTYPE_ERROR));
252             og->err = NULL;
253         }
254
255         if (og->env) {
256             PHP_OCI_CALL(OCIHandleFree, ((dvoid *) og->env, OCI_HTYPE_ENV));
257             og->env = NULL;
258         }
259     }
260 }

PHP Version

all with ZTS defined

Operating System

All having pthread

openssl_seal()/_open() is not able to handle gcm cipers, e.g. aes-256-gcm

Description

The following code:

<?php

const NUM_KEYS = 2;

for ($i = 0; $i < NUM_KEYS; $i++) {
  $keys[] = $key = openssl_pkey_new();
  $details = openssl_pkey_get_details($key);
  $pubKeys[] = $details['key'];
  $privKeys[] = openssl_pkey_get_private($key);
}

$data = 'Test Data String';

$ciphers = [
  'aes-256-ctr',
  'aes-256-gcm',
];

foreach ($ciphers as $cipherAlgo) {

  echo "*** TESTING $cipherAlgo ***" . PHP_EOL . PHP_EOL;
  $iv = \random_bytes(openssl_cipher_iv_length($cipherAlgo));
  $result = openssl_seal($data, $sealedData, $sealedKeys, $pubKeys, $cipherAlgo, $iv);

  echo "DATA  :   " . strlen($data) . ' ' . $data . PHP_EOL;
  echo "IV-LEN:   " . openssl_cipher_iv_length($cipherAlgo) . PHP_EOL;
  echo "IV    :   " . bin2hex($iv) . PHP_EOL;
  echo "ENC DATA: " . strlen($sealedData) . ' ' . bin2hex($sealedData) . PHP_EOL;
  echo "RESULT:   " . ($result ? 'true' : 'false') . PHP_EOL;
  echo PHP_EOL;

  // Try decrypt
  foreach ($keys as $i => $key) {
    $decrypted = null; // ;)
    $result = openssl_open($sealedData, $decrypted, $sealedKeys[$i], $key, $cipherAlgo, $iv);
    echo "OPEN:    " . $decrypted . PHP_EOL;
    echo "RESULT:  " . ($result ? 'true' : 'false') . PHP_EOL;

    $result = openssl_private_decrypt($sealedKeys[$i], $unsealedKey, $key);
    echo "UNSEAL:  " . bin2hex($unsealedKey) . PHP_EOL;
    echo "RESULT:  " . ($result ? 'true' : 'false') . PHP_EOL;
    echo "DECRYPT: " . openssl_decrypt($sealedData, $cipherAlgo, $unsealedKey, OPENSSL_RAW_DATA, $iv) . PHP_EOL;
  }

  echo PHP_EOL;
}

Resulted in this output:

$ ./openssl-seal-test.php
*** TESTING aes-256-ctr ***

DATA  :   16 Test Data String
IV-LEN:   16
IV    :   37ff67041864b987b8ec2dcd0879f55e
ENC DATA: 16 2a748aa6ae176caf59cf22868304d65a
RESULT:   true

OPEN:    Test Data String
RESULT:  true
UNSEAL:  8745e00bdf3d88bd1caa8ec0150a9b369eade92e57fc2d26ae283f224c66af14
RESULT:  true
DECRYPT: Test Data String
OPEN:    Test Data String
RESULT:  true
UNSEAL:  8745e00bdf3d88bd1caa8ec0150a9b369eade92e57fc2d26ae283f224c66af14
RESULT:  true
DECRYPT: Test Data String

*** TESTING aes-256-gcm ***

DATA  :   16 Test Data String
IV-LEN:   12
IV    :   033b1589f62bebbfffa3adda
ENC DATA: 16 a531f88fc51e373235c928cae1eb7c29
RESULT:   true

OPEN:    
RESULT:  false
UNSEAL:  600cf6e76cf4ae9d48a881e0649af4682aa9065e63bec515a6b8c9678e398d36
RESULT:  true
DECRYPT: 
OPEN:    
RESULT:  false
UNSEAL:  600cf6e76cf4ae9d48a881e0649af4682aa9065e63bec515a6b8c9678e398d36
RESULT:  true
DECRYPT: 

But I expected this output instead:

[...]
*** TESTING aes-256-gcm ***

DATA  :   16 Test Data String
IV-LEN:   12
IV    :   033b1589f62bebbfffa3adda
ENC DATA: 16 a531f88fc51e373235c928cae1eb7c29
RESULT:   true

OPEN:    Test Data String
RESULT:  true
UNSEAL:  600cf6e76cf4ae9d48a881e0649af4682aa9065e63bec515a6b8c9678e398d36
RESULT:  false
DECRYPT: 
OPEN:    Test Data String
RESULT:  true
UNSEAL:  600cf6e76cf4ae9d48a881e0649af4682aa9065e63bec515a6b8c9678e398d36
RESULT:  false
DECRYPT: 

The point is that the gcm-cipher need the authentication tag for decrypting the data. This however does not seem to be saved by the openssl_seal() function. I have also placed a question in the OpenSSL issue tracker: openssl/openssl#17235

PHP Version

PHP 8.0.13 (cli) (built: Nov 27 2021 17:17:19) ( ZTS )

Operating System

Gentoo Linux 5.15.6, but should not matter

Incorrect file/line blamed for errors caused by `new SomeClass`

Description

https://3v4l.org/UtjRl

This code should blame line 4, not line 7, since that's where the bogus constant is actually declared.


An example of where this is more problematic:

SomeClass.php

<?php

class SomeClass{
	public const INGOT = IDontExist::INGOT;
}

test.php

<?php

require 'SomeClass.php';

new SomeClass();

Resulted in this output:

Fatal error: Uncaught Error: Class "IDontExist" not found in C:\stable\test4.php:5

But I expected this output instead:

Fatal error: Uncaught Error: Class "IDontExist" not found in C:\stable\SomeClass.php:4

This frequently causes issues with my telemetry because incorrect subsystems are getting blamed for errors when third-party plugin code comes into play.

PHP Version

8.0.13

Operating System

Windows (doubtful if relevant)

RecursiveRegexIterator

Description

For example, __DIR__ contain symfony/console.

<?php
$iterator = new RecursiveRegexIterator(
    new RecursiveDirectoryIterator( __DIR__, RecursiveDirectoryIterator::UNIX_PATHS),
    '/((?:[A-Z][a-zA-Z\d]+\/)*[A-Z][a-zA-Z\d]+)\.php$/',
    RegexIterator::GET_MATCH,
    RegexIterator::USE_KEY
);

Resulted in this output :
Matches all class files only in root directory

But I expected this output instead:
Matches all class files in directory and sub-directories

PHP Version

tested only in PHP 7.3

Operating System

No response

gethostbyaddr still not working in 8.1.1

Description

The following code:

D:\>php -v
PHP 8.1.1 (cli) (built: Dec 15 2021 10:31:43) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.1, Copyright (c) Zend Technologies

D:\>php
<?php
$ip = '192.88.99.1';
var_dump( gethostbyaddr($ip) );
^Z
string(6) "p๏ฟฝ(๏ฟฝ"

gethostbyaddr still not working for me - I expect not a binary string (I expect empty string '')

PHP Version

PHP 8.1.1

Operating System

Windows 10

Zip::extractTo return false on actual zip file

Description

The following code:

<?php
$zip = new \ZipArchive();
$zip->open('subtitle.zip');

$zip->extractTo('.'); // false

The following file is real zip archive because the open method return true, But the extractTo for some reason return false.

subtitle.zip

Is is possible to find the cause ?

PHP Version

PHP 8.0.0

Operating System

Windows 10

variable losing reference after being set in function

Description

I ran into the below scenario, which might be correct, but it wasn't something I expected, and I wanted to make sure it's the correct behavior.

In the below scenario, why do $a and $b lose their references, but $c retains the reference? I was expecting $a and $b to keep their references like $c does. It's almost like they are being passed by value since they revert to their original value even though they are passed by reference.

Is this correct behavior?

https://3v4l.org/uHaGq

Thanks for your help.

The following code:

<?php
$a = null;
$b = 'test';
$c = null;

$test1 = function() use (&$a, &$b, &$c)
{
	$value = 1;

	$a = &$value;

	$b = &$value;

	$c = array(
		'c' => &$value,
	);
};

$test1();

echo 'a: ';
var_dump($a);
echo 'b: ';
var_dump($b);
echo 'c: ';
var_dump($c);
exit;

Resulted in this output:

a: NULL
b: string(4) "test"
c: array(1) {
  ["c"]=>
  int(1)
}

But I expected this output instead:

a: int(1)
b: int(1)
c: array(1) {
  ["c"]=>
  int(1)
}

PHP Version

PHP 7.4.26

Operating System

No response

Enum could not be converted to string with \array_intersect

Description

The following code:

<?php
class EnumTest extends Unit
{
    public function testArrayIntersect(): void
    {
        $array1 = [TestEnum::TEST];
        $array2 = [TestEnum::TEST];

        $actual = \array_intersect($array1, $array2);
        self::assertCount(1, $actual);
    }
}

enum TestEnum {
    case TEST;
}

Resulted in this output:

Object of class TestEnum could not be converted to string

But I expected the test to pass and internally \array_intersect to be able to work with enums.
The same goes for \array_diff as well, so most probably other array functions, too

PHP Version

PHP 8.1.0

Operating System

php:8.1-fpm-buster

Provide more information if writing session with custom save handler fails

Description

The following code:

<?php
class MySessionHandler implements SessionHandlerInterface, SessionUpdateTimestampHandlerInterface {
    public function write($sessID, $sessData, $lock = false): bool {
        if(...){
            return false;
        }

        if(...){
            return false;
        }
        return true;
    }

    public function updateTimestamp($sessID, $val){
        return false;
    }
}

$handler = new MySessionHandler();
session_set_save_handler($handler, true);
session_start();

Resulted in this output:

session_write_close(): Failed to write session data using user defined save handler. (session.save_path: /var/lib/php)

But I expected this output instead:
Having this "fake" session handler, it is impossible to say where session write failed and find the cause. An installed error handler just reports
errorHandler::errorHandler called at [:]

PHP Version

php 8.0.14

Operating System

Mageia 8

add creating object constructor from Jason

Description

add this signature and syntax to PHP core to enjoy developer from fast developing

class MyObject{

__json_constructor( {"AdditionAmount": 0 // default value,
                "CashRegisterDeviceRef": null,
                "CustomerAddressRef": null,
                "DeliveryDesc": "",
                "Description": null,
                "DeviceReceiptCode": null,
                "DocumentRef": 0,
                "EffectiveNetPrice": 11678899,
                "ExcludedPolicies": "",
                "Fee": 11678899.000000,
                "FreeProductBusinessPolicyConditionRowRef": null,
                "FreeProductBusinessPolicyRef": null,
                "HasReservation": false,
              
            })


}

//create new that instance :
$obj= new MyObject({"AdditionAmount": 0,
                "CashRegisterDeviceRef": null,
                "CustomerAddressRef": null,
                "DeliveryDesc": "",
                "Description": null,
                "DeviceReceiptCode": null,
                "DocumentRef": 0,
                "EffectiveNetPrice": 11678899,
                "ExcludedPolicies": "",
                "Fee": 11678899.000000,
                "FreeProductBusinessPolicyConditionRowRef": null,
                "FreeProductBusinessPolicyRef": null,
                "HasReservation": false,
              
            })


Access behavior of SimpleXMLElement changes when element has sibling

Description

This was a hard bug to name, and hence it was hard to search for. I couldn't find a similar report, but if this was already reported, my apologies.

The behavior when accessing a property in a SimpleXMLElement object seems to be influenced by the element having 'siblings' or not. This behavior can be observed with xdebug, as well as using print_r or var_dump.

In the example, when accessing $xml_correct->bar the result is as expected.
However, adding a sibling 'fiz' to element 'bar' in $xml_bug will change the result when accessing $xml_bug->bar. Suddenly, $xml_bug->bar becomes an array. It only does this when $xml_bug->bar is accessed directly. When accessing $xml_bug (or viewing it in the debugger), the 'bar' property appears as expected.

I have tested this in php 7.2, 7.3, 7.4 and 8.0, all show the same result. 3v4l.org shows the same output: https://3v4l.org/0EGhe

This might be a bug in libxml, or php, I'm not sure.

<?php

/**
 * This demos a (possible) bug in PHP, which is observed in PHP 7.2, 7.3, 7.4 and 8.0 (not yet tested on 8.1).
 *
 * Access behaviour of a SimpleXMLElement changes if that node has a sibling.
 *
 * In this example, adding 'fiz' to 'foo' (which is the outer node) will change behaviour when accessing 'bar' (an inner node).
 */
$xml_correct = new SimpleXMLElement('<foo><bar><baz/></bar></foo>');

print_r($xml_correct);        // As expected
print_r($xml_correct->bar);   // As expected, $bar contains property $baz, which is an empty SimpleXMLElement

$xml_bug = new SimpleXMLElement('<foo><bar><baz/></bar><fiz/></foo>');

print_r($xml_bug);        // As expected, property $bar is equal to that observed in print_r($xml_correct)
print_r($xml_bug->bar);   // UNEXPECTED: property $bar is an array, containing one SimpleXMLElement with property $baz which is an empty SimpleXMLElement

Resulted in this output:

// output of print_r($xml_bug->bar):

SimpleXMLElement Object
(
    [0] => SimpleXMLElement Object
        (
            [baz] => SimpleXMLElement Object
                (
                )
        )
)

But I expected this output instead:

// output of print_r($xml_correct->bar):

SimpleXMLElement Object
(
    [baz] => SimpleXMLElement Object
        (
        )

)

PHP Version

7.4 8.0

Operating System

Linux

JIT segmentation fault in PHP 8.1

Description

PHP 8.1.0 + 8.1.1 produces segfault, randomly. Downgrading to 8.0 solves the issue.

--core dump---

BFD: Warning: coredump-php-fpm.30267 is truncated: expected core file size >= 5413076992, found: 35983360.
[New LWP 30267]
[New LWP 1887]
[New LWP 1886]
[New LWP 1888]
Cannot access memory at address 0x7f277dbb3128
Cannot access memory at address 0x7f277dbb3120
Failed to read a valid object file image from memory.
Core was generated by `php-fpm: pool xxxxxx '.

Program terminated with signal 11, Segmentation fault.
#0 0x000055bbf04c0f25 in ZEND_NEW_SPEC_CONST_UNUSED_HANDLER () at /usr/src/debug/php-8.1.1/Zend/zend_vm_execute.h:10137
10137 ce = CACHED_PTR(opline->op2.num);
(gdb) bt
Python Exception <class 'gdb.MemoryError'> Cannot access memory at address 0x7ffdc940e3a8:
(gdb) bt
#0 0x000055bbf04c0f25 in ZEND_NEW_SPEC_CONST_UNUSED_HANDLER () at /usr/src/debug/php-8.1.1/Zend/zend_vm_execute.h:10137
Cannot access memory at address 0x7ffdc940e3a8
(gdb) frame 0
#0 0x000055bbf04c0f25 in ZEND_NEW_SPEC_CONST_UNUSED_HANDLER () at /usr/src/debug/php-8.1.1/Zend/zend_vm_execute.h:10137
10137 ce = CACHED_PTR(opline->op2.num);
(gdb) info frame
Stack level 0, frame at 0x7ffdc940e3b0:
rip = 0x55bbf04c0f25 in ZEND_NEW_SPEC_CONST_UNUSED_HANDLER (/usr/src/debug/php-8.1.1/Zend/zend_vm_execute.h:10137); saved rip Cannot access memory at address 0x7ffdc940e3a8

this is the only available info in the core dump.

PHP Version

PHP 8.1.0 + 8.1.1

Operating System

CentOS 7

gethostbyaddr outputs binary string

Description

PHP 8.1.0
The following code:

<?php
var_dump(gethostbyaddr('89.222.225.0'));
var_dump(gethostbyaddr('192.88.99.1'));

Resulted in this output:
Snap1

But I expected this output instead:

string(12) "89.222.225.0" (which is still shown when I use PHP 8.0.3)
string(12) "192.88.99.1"

PHP Version

PHP 8.1.0

Operating System

Windows 10 (x64)

Built-in web server prints HTML tags in terminal when address is wrong

Description

I tried to start the built-in web server, but I mistyped the address and then the PHP cli printed HTML tags in the terminal.

- php -S 0.0.0.0:8080
+ php -S 0.0..0:8080

Resulted in this output:

$ php -S 0.0..0:8080
[Wed Dec 15 11:54:39 2021] PHP Warning:  Unknown: php_network_getaddresses: getaddrinfo for 0.0..0 failed: Name or service not known in Unknown on line 0
<br />
<b>Warning</b>:  Unknown: php_network_getaddresses: getaddrinfo for 0.0..0 failed: Name or service not known in <b>Unknown</b> on line <b>0</b><br />
[Wed Dec 15 11:54:39 2021] Failed to listen on 0.0..0:8080 (reason: php_network_getaddresses: getaddrinfo for 0.0..0 failed: Name or service not known)

But I expected this output instead:

$ php -S 0.0..0:8080
[Wed Dec 15 12:01:43 2021] PHP Warning:  Unknown: php_network_getaddresses: getaddrinfo for 0.0..0 failed: Name or service not known in Unknown on line 0
[Wed Dec 15 12:01:43 2021] Failed to listen on 0.0..0:8080 (reason: php_network_getaddresses: getaddrinfo for 0.0..0 failed: Name or service not known)

PHP version:

PHP 8.1.0 (cli) (built: Nov 25 2021 20:48:52) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.0, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.0, Copyright (c), by Zend Technologies
    with Xdebug v3.1.1, Copyright (c) 2002-2021, by Derick Rethans
    with blackfire v1.72.0~linux-x64-non_zts81, https://blackfire.io, by Blackfire

PHP Version

8.1.0

Operating System

Debian Bookworm

Cloning a faked SplFileInfo object may segfault

Description

We have some code that worked without any issues on PHP 8.0, but it's failing with a segmentation fault on 8.1.
I'm not sure whether it's a PHPUnit or PHP issue... So please see the code. Mock creation triggers the problem.

Test repo: b1rdex/php-8.1-segfault

I've opened sebastianbergmann/phpunit#4844 for PHPUnit, but the issue was closed with a piece of advice to report it to PHP. So please see the test repo for the details about the issue.

PHP Version

8.1.1

Operating System

Docker official image

SSL context options for in memory cert and pk

Description

It is dangerous to store certificates and privateKeys (without a password) on the disk. Unfortunately, this is needed to load the * .p12 file into stream_context_create.

Please, add the option to set certificates and privateKeys from string content or at least from Data URLs, instead the file path only.

// Using string content
// --------------------

openssl_pkcs12_read(file_get_contents('cert.p12'),$certificates,'pass');

$stream_context = stream_context_create(
[ 'ssl' => [ 'local_cert' => $certificates['cert'],
             'local_pk'   => $certificates['pkey']
           ]
]);
// Using Data URLs
// ---------------

openssl_pkcs12_read(file_get_contents('cert.p12'),$certificates,'pass');

$stream_context = stream_context_create(
[ 'ssl' => [ 'local_cert' => 'data:,'.$certificates['cert'],
             'local_pk'   => 'data:,'.$certificates['pkey']
           ]
]);
// Hack: temp files
// ----------------

openssl_pkcs12_read(file_get_contents('cert.p12'),$certificates,'pass');

file_put_contents('cert.temp',$certificates['cert']);
file_put_contents('pkey.temp',$certificates['pkey']);

$stream_context = stream_context_create(
[ 'ssl' => [ 'local_cert' => 'cert.temp',
             'local_pk'   => 'pkey.temp'
           ]
]);

Expected result: Reading certificates and privateKeys without temp files.
Actual result: Reading certificates and privateKeys only with temp files.

PHP Version

PHP 8.1.1

Operating System

All

Extends PDO, sqliteCreateFunction() and magic method __call()

Description

The following code:

<?php
declare(strict_types=1);

class DBStatement extends PDOStatement
{
    protected $db;

    protected function __construct(PDO $db)
    {
        $this->db = $db;
    }
}
class db extends PDO {
    public function __construct(string $dsn, string $username = null, string $password = null, array $options = [])
    {
        $options += [
            self::ATTR_DEFAULT_FETCH_MODE => self::FETCH_ASSOC,
            self::ATTR_EMULATE_PREPARES   => false,
            self::ATTR_STRINGIFY_FETCHES  => false,
            self::ATTR_ERRMODE            => self::ERRMODE_EXCEPTION,
            self::ATTR_STATEMENT_CLASS    => [DBStatement::class, [$this]],
        ];
        parent::__construct($dsn, $username, $password, $options);
        $this->sqliteCreateFunction('CONCAT', function (...$args) {return \implode('', $args);});
    }

    public function __call(string $name, array $args) /* : mixed */
    {
        // Here is the loading of a class with rarely used methods that are different in implementation for different databases.
        // In a real project, an exception is displayed: 
        // PHP OTHER_ERROR: Method 'sqliteCreateFunction' not found in DB driver. in ...\app\Core\DB\Sqlite.php:[70]
    }
}

$db = new db('sqlite:datadb', '', '', []);
var_dump($db->query('SELECT CONCAT(\'123\', \'456\', \'789\')')->fetch());
exit;

Resulted in this output:

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1 no such function: CONCAT in C:\laragon\www\1.php:33 Stack trace: #0 C:\laragon\www\1.php(33): PDO->query('SELECT CONCAT('...') #1 {main} thrown in C:\laragon\www\1.php on line 33

But I expected this output instead:

array(1) { ["CONCAT('123', '456', '789')"]=> string(9) "123456789" } 

It turns out that the call to the sqliteCreateFunction() method is intercepted by __call()?

P.S. In my project, I extended PDO, extended PDOStatement and use _call () to call rare methods to change the structure of the database. Now I got such an incident when using SQLite.

PHP Version

PHP 8.1.1-Win32-vs16-x64, 8.1.0, 8.0.8, 7.4.5, 7.3.33

Operating System

Windows 7 x64

Intl Extension: MessageFormatter prepends date with space

Description

The following code:

<?php

$formatter = new \MessageFormatter('en_US', '{0, date, YYYY-ww}');
var_dump($formatter->format([new \DateTimeImmutable]));

$formatter = new \MessageFormatter('en_US', '{0}');
var_dump($formatter->format(['test']));

Resulted in this output:

string(8) " 2021-51"
string(4) "test"

But I expected this output instead:

string(8) "2021-51"
string(4) "test"

See this 3v4l online page. This applies to all messages using date.

PHP Version

7.3.13 - 7.3.33, 7.4.0 - 7.4.27, 8.0.0 - 8.0.13, 8.1.0

Operating System

Any

php_uname doesn't recognise Windows 11 and Windows Server 2019/2022

Description

The following code:

<?php
echo php_uname();
?>

Resulted in this output:

Windows NT HOMEPC 10.0 build 22000 (Windows 10) AMD64

But I expected this output instead:

Windows NT HOMEPC 10.0 build 22000 (Windows 11) AMD64

PHP Version

8.1.1

Operating System

Windows 11

Cli-server mode cannot send Access-Control-Allow-Origin header

Description

The following code:

<?php

header('Access-Control-Allow-Origin: *');
header("Access-Control-Expose-Headers: Content-Disposition");
header('Access-Control-Origin: xxx.hoo.com');
die('header test');

Resulted in this output:

I used the curl -I command to test, but did not output the first header.

But I expected this output instead:

PHP Version

PHP 7.4.3

Operating System

kde neon / Ubuntu 20.04.3 LTS

openssl_x509_checkpurpose_basic.phpt fails, because san-cert.pem expired on 2021-12-11

Description

Unit test ext/openssl/tests/openssl_x509_checkpurpose_basic.phpt fails. Diff file is:

--
int(-1)
int(-1)
int(-1)
036- bool(true)
037- bool(true)
038- bool(true)
039- bool(true)
040- bool(true)
041- bool(true)
042- bool(true)
036+ bool(false)
037+ bool(false)
038+ bool(false)
039+ bool(false)
040+ bool(false)
041+ bool(false)
042+ bool(false)
bool(false)
bool(false)
bool(false)

 int(-1)
 int(-1)
 int(-1)

057+ bool(false)
058+ bool(false)
059+ bool(false)
060+ bool(false)
061+ bool(false)
062+ bool(false)
063+ bool(false)
057- bool(true)
058- bool(true)
059- bool(true)
060- bool(true)
061- bool(true)
062- bool(true)
063- bool(true)

The failing tests are all for the certificate

...
$sert = "file://" . DIR . "/san-cert.pem";
...

and "openssl x509 -text" for this cert reveals:

$ openssl x509 -in /path/to/ext/openssl/tests/san-cert.pem -text
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
86:aa:c6:d6:39:77:08:ed
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=US, ST=MN, L=Minneapolis, OU=Domain Control Validated
Validity
Not Before: Sep 24 08:05:51 2013 GMT
Not After : Dec 11 08:05:51 2021 GMT
...

So this test cert expired a few days ago.

PHP Version

PHP 8.1.1, 8.0.14, 7.4.27

Operating System

Linux (several variants), Solaris Sparc

DateTimeZone::getTransitions() returns insufficient data

Description

The following code:

var_dump(
    (new \DateTime('2203-10-05 15:05:37.180157', new \DateTimeZone('America/Los_Angeles')))
    ->getTimestamp()
);

https://3v4l.org/HpVAr

produces different result on PHP 8.1 vs PHP 7.4/8.0

it is from our failing unit test, what result is correct and any plain to bugfix in either PHP 8.1 or the PHP 8.0 and lower?

PHP Version

PHP 8.1.0

Operating System

linux

string '0.0' evaluates to true

Description

Surely this is not a mistake, but I do not understand why it is so.

Consider the following code:

   if (0) echo "int 0 is true" . "\n";
   if ('0') echo "string '0' is true" . "\n";
   if (0.0) echo "float 0.0 is true" . "\n";
   if ('0.0') echo "string '0.0' is true" . "\n";

Why does the string '0.0' evaluate to true, when its logical value would be false? The string '0' evaluates to false. Why is the same not true for '0.0'?

https://3v4l.org/ZNhbM

PHP Version

PHP 7.X, 8.X

Operating System

All

enums

Description

Hello!

There seems to be no way to get the string representation of an instance of an enum, except with var_export()

enum Foo: string {
   case Bar = 'bar';
   case Baz = 'baz';
}

$bar = Foo::Bar;
$bar_string = var_export($bar, true);

Also, what if I want to find out the backing value of an enum variable?

$backing_value = (new \ReflectionEnumBackedCase($bar, ???))->getBackingValue();

Any ideas?

mysqli_sql_exception->getSqlState()

Description

Hello,

About mysqli_sql_exception:
https://www.php.net/manual/en/class.mysqli-sql-exception.php

What's the point of:

protected string $sqlstate;

if we cannot access it?

I was also trying:

class mysqli_sql_exception_x extends \mysqli_sql_exception {
	public function getSqlState() : string {
		return $this->sqlstate;
	}
}

But then I get:

Class mysqli_sql_exception_x may not inherit from final class (mysqli_sql_exception)

Why doesn't \mysqli_sql_exception contain a getSqlState() method?

I see some workarounds with using Reflection, etc, but that's obviously not ideal.
At least we can still use mysqli_sqlstate, but still...

Thank you very much.

Segfault when recursive call is made

Description

While working on a Symfony project, I made a small mistake in the code's design which lead to segfaults when running the testing suite. After debugging, I managed to narrow the issue, which was awkward. I know this kind of code shouldn't happen, but it's a simple and clear example of mistake that a newcomer might do in php. Just because it "shouldn't" doesn't mean it "doesn't".

Additional context:

  • scripts were executed from CLI, where the execution time is unlimited
  • usually, one would get a fatal error because of memory allocation exhaustion.
  • our CLI config has a memory_limit of 128M.. it's weird why we don't get memory allocation exhaustion
  • defined classes are in fact Doctrine entities
  • doctrine / phpunit doesn't have any impact. running the bare minimum code should do it.
  • executing the code in 3v4l does NOT trigger segfault.

The following code (in a Symfony 5.4 app):

<?php

error_reporting(E_ALL);
ini_set('display_errors', 'on');

class Product {
    public function __construct(
        private array $groups = [],
    ) {
    }

    public function addGroup(Group $group): void {
        $group->addProduct($this);
        $this->groups[] = $group;
    }
}

class Group {
    public function __construct(
        private array $products = [],
    ) {
    }

    public function addProduct(Product $product): void {
        $product->addGroup($this);
        $this->products[] = $product;
    }
}

$product = new Product();
$group = new Group();

$product->addGroup($group);

Resulted in this output:

$ php test.php; echo $?
139

(139 = exit code for segmentation fault)

But I expected this output instead:

Fatal error: ...something suggestive about recursion...
php -i output
phpinfo()
PHP Version => 8.0.13

System => Linux 4dbfa07182d9 5.15.6-200.fc35.x86_64 #1 SMP Wed Dec 1 13:41:10 UTC 2021 x86_64
Build Date => Dec  2 2021 13:36:12
Build System => Linux 2b51f0c4f4d4 4.19.0-14-cloud-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux
Configure Command =>  './configure'  '--build=x86_64-linux-gnu' '--with-config-file-path=/usr/local/etc/php' '--with-config-file-scan-dir=/usr/local/etc/php/conf.d' '--enable-option-checking=fatal' '--with-mhash' '--with-pic' '--enable-ftp' '--enable-mbstring' '--enable-mysqlnd' '--with-password-argon2' '--with-sodium=shared' '--with-pdo-sqlite=/usr' '--with-sqlite3=/usr' '--with-curl' '--with-openssl' '--with-readline' '--with-zlib' '--with-pear' '--with-libdir=lib/x86_64-linux-gnu' '--disable-cgi' '--enable-fpm' '--with-fpm-user=www-data' '--with-fpm-group=www-data' 'build_alias=x86_64-linux-gnu'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/etc/php
Loaded Configuration File => /usr/local/etc/php/php.ini
Scan this dir for additional .ini files => /usr/local/etc/php/conf.d
Additional .ini files parsed => /usr/local/etc/php/conf.d/blackfire.ini,
/usr/local/etc/php/conf.d/gd.ini,
/usr/local/etc/php/conf.d/imagick.ini,
/usr/local/etc/php/conf.d/intl.ini,
/usr/local/etc/php/conf.d/opcache.ini,
/usr/local/etc/php/conf.d/pdo_mysql.ini,
/usr/local/etc/php/conf.d/sodium.ini,
/usr/local/etc/php/conf.d/uuid.ini,
/usr/local/etc/php/conf.d/xdebug.ini,
/usr/local/etc/php/conf.d/zip.ini

PHP API => 20200930
PHP Extension => 20200930
Zend Extension => 420200930
Zend Extension Build => API420200930,NTS
PHP Extension Build => API20200930,NTS
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => enabled
Zend Memory Manager => enabled
Zend Multibyte Support => provided by mbstring
IPv6 Support => enabled
DTrace Support => disabled

Registered PHP Streams => https, ftps, compress.zlib, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2, tlsv1.3
Registered Stream Filters => zlib.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, convert.*, consumed, dechunk

This program makes use of the Zend Scripting Language Engine:
Zend Engine v4.0.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.13, Copyright (c), by Zend Technologies
    with blackfire v1.71.0~linux-x64-non_zts80, https://blackfire.io, by Blackfire


 _______________________________________________________________________


Configuration

blackfire

Blackfire => enabled
Blackfire => 1.71.0~linux-x64-non_zts80
Timing measurement => cgt
Sessions support => enabled
Num of CPU => 12
Profiling heap memory => 0 Kb
Main instance trigger mode => CLI autotriggered
Main instance => disabled

                   Blackfire runtime active environment                   
BLACKFIRE_AGENT_SOCKET => tcp://blackfire:8707
BLACKFIRE_LOG_LEVEL => 1
                        Blackfire runtime headers                        
                           No headers detected                           

Directive => Local Value => Master Value
blackfire.agent_socket => tcp://blackfire:8707 => unix:///var/run/blackfire/agent.sock
blackfire.apm_browser_key => no value => no value
blackfire.apm_connect_at_startup => 0 => 0
blackfire.apm_enable_automatic_browser_probe => 1 => 1
blackfire.apm_enabled => 1 => 1
blackfire.apm_lock_duration => 300 => 300
blackfire.disable_features => no value => no value
blackfire.env_id => no value => no value
blackfire.env_token => no value => no value
blackfire.hostname => no value => no value
blackfire.log_file => no value => no value
blackfire.log_level => 1 => 1
blackfire.server_id => no value => no value
blackfire.server_token => no value => no value


Blackfire developed by Blackfire

INI settings 'blackfire.server_id' and 'blackfire.server_token' should not be configured manually unless you are using a cloud provider with a shared agent

Core

PHP Version => 8.0.13

Directive => Local Value => Master Value
allow_url_fopen => On => On
allow_url_include => Off => Off
arg_separator.input => & => &
arg_separator.output => & => &
auto_append_file => no value => no value
auto_globals_jit => On => On
auto_prepend_file => no value => no value
browscap => no value => no value
default_charset => UTF-8 => UTF-8
default_mimetype => text/html => text/html
disable_classes => no value => no value
disable_functions => no value => no value
display_errors => Off => Off
display_startup_errors => Off => Off
doc_root => no value => no value
docref_ext => no value => no value
docref_root => no value => no value
enable_dl => Off => Off
enable_post_data_reading => On => On
error_append_string => no value => no value
error_log => /proc/1/fd/2 => /proc/1/fd/2
error_prepend_string => no value => no value
error_reporting => 32767 => 32767
expose_php => Off => Off
extension_dir => /usr/local/lib/php/extensions/no-debug-non-zts-20200930 => /usr/local/lib/php/extensions/no-debug-non-zts-20200930
file_uploads => On => On
hard_timeout => 2 => 2
highlight.comment => <font style="color: #FF8000">#FF8000</font> => <font style="color: #FF8000">#FF8000</font>
highlight.default => <font style="color: #0000BB">#0000BB</font> => <font style="color: #0000BB">#0000BB</font>
highlight.html => <font style="color: #000000">#000000</font> => <font style="color: #000000">#000000</font>
highlight.keyword => <font style="color: #007700">#007700</font> => <font style="color: #007700">#007700</font>
highlight.string => <font style="color: #DD0000">#DD0000</font> => <font style="color: #DD0000">#DD0000</font>
html_errors => Off => Off
ignore_repeated_errors => Off => Off
ignore_repeated_source => Off => Off
ignore_user_abort => Off => Off
implicit_flush => On => On
include_path => .:/usr/local/lib/php => .:/usr/local/lib/php
input_encoding => no value => no value
internal_encoding => no value => no value
log_errors => On => On
log_errors_max_len => 0 => 0
mail.add_x_header => Off => Off
mail.force_extra_parameters => no value => no value
mail.log => no value => no value
max_execution_time => 0 => 0
max_file_uploads => 20 => 20
max_input_nesting_level => 64 => 64
max_input_time => -1 => -1
max_input_vars => 1000 => 1000
memory_limit => 128M => 128M
open_basedir => no value => no value
output_buffering => 0 => 0
output_encoding => no value => no value
output_handler => no value => no value
post_max_size => 8M => 8M
precision => 14 => 14
realpath_cache_size => 4096k => 4096k
realpath_cache_ttl => 120 => 120
register_argc_argv => On => On
report_memleaks => On => On
report_zend_debug => Off => Off
request_order => GP => GP
sendmail_from => no value => no value
sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i
serialize_precision => -1 => -1
short_open_tag => Off => Off
SMTP => localhost => localhost
smtp_port => 25 => 25
sys_temp_dir => no value => no value
syslog.facility => LOG_USER => LOG_USER
syslog.filter => no-ctrl => no-ctrl
syslog.ident => php => php
unserialize_callback_func => no value => no value
upload_max_filesize => 2M => 2M
upload_tmp_dir => no value => no value
user_dir => no value => no value
user_ini.cache_ttl => 300 => 300
user_ini.filename => .user.ini => .user.ini
variables_order => GPCS => GPCS
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
zend.assertions => -1 => -1
zend.detect_unicode => On => On
zend.enable_gc => On => On
zend.exception_ignore_args => On => On
zend.exception_string_param_max_len => 0 => 0
zend.multibyte => Off => Off
zend.script_encoding => no value => no value
zend.signal_check => Off => Off

ctype

ctype functions => enabled

curl

cURL support => enabled
cURL Information => 7.74.0
Age => 7
Features
AsynchDNS => Yes
CharConv => No
Debug => No
GSS-Negotiate => No
IDN => Yes
IPv6 => Yes
krb4 => No
Largefile => Yes
libz => Yes
NTLM => Yes
NTLMWB => Yes
SPNEGO => Yes
SSL => Yes
SSPI => No
TLS-SRP => Yes
HTTP2 => Yes
GSSAPI => Yes
KERBEROS5 => Yes
UNIX_SOCKETS => Yes
PSL => Yes
HTTPS_PROXY => Yes
MULTI_SSL => No
BROTLI => Yes
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, mqtt, pop3, pop3s, rtmp, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
Host => x86_64-pc-linux-gnu
SSL Version => OpenSSL/1.1.1k
ZLib Version => 1.2.11
libSSH Version => libssh2/1.9.0

Directive => Local Value => Master Value
curl.cainfo => no value => no value

date

date/time support => enabled
timelib version => 2020.03
"Olson" Timezone Database Version => 2021.3
Timezone Database => internal
Default timezone => Europe/Bucharest

Directive => Local Value => Master Value
date.default_latitude => 31.7667 => 31.7667
date.default_longitude => 35.2333 => 35.2333
date.sunrise_zenith => 90.833333 => 90.833333
date.sunset_zenith => 90.833333 => 90.833333
date.timezone => Europe/Bucharest => Europe/Bucharest

dom

DOM/XML => enabled
DOM/XML API Version => 20031129
libxml Version => 2.9.10
HTML Support => enabled
XPath Support => enabled
XPointer Support => enabled
Schema Support => enabled
RelaxNG Support => enabled

fileinfo

fileinfo support => enabled
libmagic => 539

filter

Input Validation and Filtering => enabled

Directive => Local Value => Master Value
filter.default => unsafe_raw => unsafe_raw
filter.default_flags => no value => no value

ftp

FTP support => enabled
FTPS support => enabled

gd

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.10.4
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
libJPEG Version => 6b
PNG Support => enabled
libPNG Version => 1.6.37
WBMP Support => enabled
XPM Support => enabled
libXpm Version => 30411
XBM Support => enabled
WebP Support => enabled
BMP Support => enabled
TGA Read Support => enabled

Directive => Local Value => Master Value
gd.jpeg_ignore_warning => 1 => 1

hash

hash support => enabled
Hashing Engines => md2 md4 md5 sha1 sha224 sha256 sha384 sha512/224 sha512/256 sha512 sha3-224 sha3-256 sha3-384 sha3-512 ripemd128 ripemd160 ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160,4 tiger192,4 snefru snefru256 gost gost-crypto adler32 crc32 crc32b crc32c fnv132 fnv1a32 fnv164 fnv1a64 joaat haval128,3 haval160,3 haval192,3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4 haval128,5 haval160,5 haval192,5 haval224,5 haval256,5 

MHASH support => Enabled
MHASH API Version => Emulated Support

iconv

iconv support => enabled
iconv implementation => glibc
iconv library version => 2.31

Directive => Local Value => Master Value
iconv.input_encoding => no value => no value
iconv.internal_encoding => no value => no value
iconv.output_encoding => no value => no value

imagick

imagick module => enabled
imagick module version => 3.6.0
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version => ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
Imagick using ImageMagick library version => ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
ImageMagick copyright => (C) 1999-2021 ImageMagick Studio LLC
ImageMagick release date => 2021-01-25
ImageMagick number of supported formats:  => 247
ImageMagick supported formats => 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, AVI, AVIF, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, H, HALD, HDR, HEIC, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIDEO, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV

Directive => Local Value => Master Value
imagick.allow_zero_dimension_images => 0 => 0
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0
imagick.set_single_thread => 1 => 1
imagick.shutdown_sleep_count => 10 => 10
imagick.skip_version_check => 0 => 0

intl

Internationalization support => enabled
ICU version => 67.1
ICU Data version => 67.1
ICU Unicode version => 13.0

Directive => Local Value => Master Value
intl.default_locale => no value => no value
intl.error_level => 0 => 0
intl.use_exceptions => Off => Off

json

json support => enabled

libxml

libXML support => active
libXML Compiled Version => 2.9.10
libXML Loaded Version => 20910
libXML streams => enabled

mbstring

Multibyte Support => enabled
Multibyte string engine => libmbfl
HTTP input encoding translation => disabled
libmbfl version => 1.3.2

mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.

Multibyte (japanese) regex support => enabled
Multibyte regex (oniguruma) version => 6.9.6

Directive => Local Value => Master Value
mbstring.detect_order => no value => no value
mbstring.encoding_translation => Off => Off
mbstring.http_input => no value => no value
mbstring.http_output => no value => no value
mbstring.http_output_conv_mimetypes => ^(text/|application/xhtml\+xml) => ^(text/|application/xhtml\+xml)
mbstring.internal_encoding => no value => no value
mbstring.language => neutral => neutral
mbstring.regex_retry_limit => 1000000 => 1000000
mbstring.regex_stack_limit => 100000 => 100000
mbstring.strict_detection => Off => Off
mbstring.substitute_character => no value => no value

mysqlnd

mysqlnd => enabled
Version => mysqlnd 8.0.13
Compression => supported
core SSL => supported
extended SSL => supported
Command buffer size => 4096
Read buffer size => 32768
Read timeout => 86400
Collecting statistics => Yes
Collecting memory statistics => No
Tracing => n/a
Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password,auth_plugin_caching_sha2_password,auth_plugin_sha256_password
API Extensions => pdo_mysql

openssl

OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.1.1k  25 Mar 2021
OpenSSL Header Version => OpenSSL 1.1.1k  25 Mar 2021
Openssl default config => /usr/lib/ssl/openssl.cnf

Directive => Local Value => Master Value
openssl.cafile => no value => no value
openssl.capath => no value => no value

pcre

PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 10.35 2020-05-09
PCRE Unicode Version => 13.0.0
PCRE JIT Support => enabled
PCRE JIT Target => x86 64bit (little endian + unaligned)

Directive => Local Value => Master Value
pcre.backtrack_limit => 1000000 => 1000000
pcre.jit => 1 => 1
pcre.recursion_limit => 100000 => 100000

PDO

PDO support => enabled
PDO drivers => sqlite, mysql

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => mysqlnd 8.0.13

Directive => Local Value => Master Value
pdo_mysql.default_socket => no value => no value

pdo_sqlite

PDO Driver for SQLite 3.x => enabled
SQLite Library => 3.34.1

Phar

Phar: PHP Archive support => enabled
Phar API version => 1.1.1
Phar-based phar archives => enabled
Tar-based phar archives => enabled
ZIP-based phar archives => enabled
gzip compression => enabled
bzip2 compression => disabled (install ext/bz2)
Native OpenSSL support => enabled


Phar based on pear/PHP_Archive, original concept by Davey Shafik.
Phar fully realized by Gregory Beaver and Marcus Boerger.
Portions of tar implementation Copyright (c) 2003-2009 Tim Kientzle.
Directive => Local Value => Master Value
phar.cache_list => no value => no value
phar.readonly => On => On
phar.require_hash => On => On

posix

POSIX support => enabled

readline

Readline Support => enabled
Readline library => 8.1

Directive => Local Value => Master Value
cli.pager => no value => no value
cli.prompt => \b \>  => \b \> 

Reflection

Reflection => enabled

session

Session Support => enabled
Registered save handlers => files user 
Registered serializer handlers => php_serialize php php_binary 

Directive => Local Value => Master Value
session.auto_start => Off => Off
session.cache_expire => 180 => 180
session.cache_limiter => nocache => nocache
session.cookie_domain => no value => no value
session.cookie_httponly => no value => no value
session.cookie_lifetime => 0 => 0
session.cookie_path => / => /
session.cookie_samesite => no value => no value
session.cookie_secure => 0 => 0
session.gc_divisor => 1000 => 1000
session.gc_maxlifetime => 1440 => 1440
session.gc_probability => 1 => 1
session.lazy_write => On => On
session.name => PHPSESSID => PHPSESSID
session.referer_check => no value => no value
session.save_handler => files => files
session.save_path => no value => no value
session.serialize_handler => php => php
session.sid_bits_per_character => 5 => 5
session.sid_length => 26 => 26
session.upload_progress.cleanup => On => On
session.upload_progress.enabled => On => On
session.upload_progress.freq => 1% => 1%
session.upload_progress.min_freq => 1 => 1
session.upload_progress.name => PHP_SESSION_UPLOAD_PROGRESS => PHP_SESSION_UPLOAD_PROGRESS
session.upload_progress.prefix => upload_progress_ => upload_progress_
session.use_cookies => 1 => 1
session.use_only_cookies => 1 => 1
session.use_strict_mode => 0 => 0
session.use_trans_sid => 0 => 0

SimpleXML

SimpleXML support => enabled
Schema support => enabled

sodium

sodium support => enabled
libsodium headers version => 1.0.18
libsodium library version => 1.0.18

SPL

SPL support => enabled
Interfaces => OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject
Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, CallbackFilterIterator, DirectoryIterator, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveCallbackFilterIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeException, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHeap, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStack, SplTempFileObject, UnderflowException, UnexpectedValueException

sqlite3

SQLite3 support => enabled
SQLite Library => 3.34.1

Directive => Local Value => Master Value
sqlite3.defensive => On => On
sqlite3.extension_dir => no value => no value

standard

Dynamic Library Support => enabled
Path to sendmail => /usr/sbin/sendmail -t -i

Directive => Local Value => Master Value
assert.active => On => On
assert.bail => Off => Off
assert.callback => no value => no value
assert.exception => On => On
assert.warning => On => On
auto_detect_line_endings => Off => Off
default_socket_timeout => 60 => 60
from => no value => no value
session.trans_sid_hosts => no value => no value
session.trans_sid_tags => a=href,area=href,frame=src,form= => a=href,area=href,frame=src,form=
unserialize_max_depth => 4096 => 4096
url_rewriter.hosts => no value => no value
url_rewriter.tags => form= => form=
user_agent => no value => no value

tokenizer

Tokenizer Support => enabled

uuid

UUID extension => enabled
Version => 1.2.0 (stable)
Released => 2020-10-06
Authors => Hartmut Holzgraefe, Remi Collet

xml

XML Support => active
XML Namespace Support => active
libxml2 Version => 2.9.10

xmlreader

XMLReader => enabled

xmlwriter

XMLWriter => enabled

Zend OPcache

Opcode Caching => Disabled
Optimization => Disabled
SHM Cache => Enabled
File Cache => Disabled
JIT => On
Startup Failed => Opcode Caching is disabled for CLI

Directive => Local Value => Master Value
opcache.blacklist_filename => no value => no value
opcache.consistency_checks => 0 => 0
opcache.dups_fix => Off => Off
opcache.enable => On => On
opcache.enable_cli => Off => Off
opcache.enable_file_override => Off => Off
opcache.error_log => no value => no value
opcache.file_cache => no value => no value
opcache.file_cache_consistency_checks => On => On
opcache.file_cache_only => Off => Off
opcache.file_update_protection => 2 => 2
opcache.force_restart_timeout => 180 => 180
opcache.huge_code_pages => Off => Off
opcache.interned_strings_buffer => 16 => 16
opcache.jit => tracing => tracing
opcache.jit_bisect_limit => 0 => 0
opcache.jit_blacklist_root_trace => 16 => 16
opcache.jit_blacklist_side_trace => 8 => 8
opcache.jit_buffer_size => 0 => 0
opcache.jit_debug => 0 => 0
opcache.jit_hot_func => 127 => 127
opcache.jit_hot_loop => 64 => 64
opcache.jit_hot_return => 8 => 8
opcache.jit_hot_side_exit => 8 => 8
opcache.jit_max_exit_counters => 8192 => 8192
opcache.jit_max_loop_unrolls => 8 => 8
opcache.jit_max_polymorphic_calls => 2 => 2
opcache.jit_max_recursive_calls => 2 => 2
opcache.jit_max_recursive_returns => 2 => 2
opcache.jit_max_root_traces => 1024 => 1024
opcache.jit_max_side_traces => 128 => 128
opcache.jit_prof_threshold => 0.005 => 0.005
opcache.lockfile_path => /tmp => /tmp
opcache.log_verbosity_level => 1 => 1
opcache.max_accelerated_files => 20000 => 20000
opcache.max_file_size => 0 => 0
opcache.max_wasted_percentage => 5 => 5
opcache.memory_consumption => 256 => 256
opcache.opt_debug_level => 0 => 0
opcache.optimization_level => 0x7FFEBFFF => 0x7FFEBFFF
opcache.preferred_memory_model => no value => no value
opcache.preload => no value => no value
opcache.preload_user => no value => no value
opcache.protect_memory => Off => Off
opcache.record_warnings => Off => Off
opcache.restrict_api => no value => no value
opcache.revalidate_freq => 2 => 2
opcache.revalidate_path => Off => Off
opcache.save_comments => On => On
opcache.use_cwd => On => On
opcache.validate_permission => Off => Off
opcache.validate_root => Off => Off
opcache.validate_timestamps => On => On

zip

Zip => enabled
Zip version => 1.19.5
Libzip version => 1.7.3
BZIP2 compression => Yes
XZ compression => No
ZSTD compression => No
AES-128 encryption => Yes
AES-192 encryption => Yes
AES-256 encryption => Yes

zlib

ZLib Support => enabled
Stream Wrapper => compress.zlib://
Stream Filter => zlib.inflate, zlib.deflate
Compiled Version => 1.2.11
Linked Version => 1.2.11

Directive => Local Value => Master Value
zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value

Additional Modules

Module Name

Environment

Variable => Value
PATH => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME => 4dbfa07182d9
TERM => xterm
PHP_FPM_WORKERS => 5
XDEBUG_CLIENT_HOST => host.docker.internal
BLACKFIRE_LOG_LEVEL => 1
BLACKFIRE_AGENT_SOCKET => tcp://blackfire:8707
BLACKFIRE_CLIENT_ID =>  
BLACKFIRE_CLIENT_TOKEN =>  
PHPIZE_DEPS => autoconf 		dpkg-dev 		file 		g++ 		gcc 		libc-dev 		make 		pkg-config 		re2c
PHP_INI_DIR => /usr/local/etc/php
PHP_CFLAGS => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
PHP_CPPFLAGS => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
PHP_LDFLAGS => -Wl,-O1 -pie
GPG_KEYS => 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F
PHP_VERSION => 8.0.13
PHP_URL => https://www.php.net/distributions/php-8.0.13.tar.xz
PHP_ASC_URL => https://www.php.net/distributions/php-8.0.13.tar.xz.asc
PHP_SHA256 => cd976805ec2e9198417651027dfe16854ba2c2c388151ab9d4d268513d52ed52
PHP_SOCKET_TIMEOUT => 60
APP_VERSION => dev
HOME => /var/www

PHP Variables

Variable => Value
$_SERVER['PATH'] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
$_SERVER['HOSTNAME'] => 4dbfa07182d9
$_SERVER['TERM'] => xterm
$_SERVER['PHP_FPM_WORKERS'] => 5
$_SERVER['XDEBUG_CLIENT_HOST'] => host.docker.internal
$_SERVER['BLACKFIRE_LOG_LEVEL'] => 1
$_SERVER['BLACKFIRE_AGENT_SOCKET'] => tcp://blackfire:8707
$_SERVER['BLACKFIRE_CLIENT_ID'] => 
$_SERVER['BLACKFIRE_CLIENT_TOKEN'] => 
$_SERVER['PHPIZE_DEPS'] => autoconf 		dpkg-dev 		file 		g++ 		gcc 		libc-dev 		make 		pkg-config 		re2c
$_SERVER['PHP_INI_DIR'] => /usr/local/etc/php
$_SERVER['PHP_CFLAGS'] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
$_SERVER['PHP_CPPFLAGS'] => -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
$_SERVER['PHP_LDFLAGS'] => -Wl,-O1 -pie
$_SERVER['GPG_KEYS'] => 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F
$_SERVER['PHP_VERSION'] => 8.0.13
$_SERVER['PHP_URL'] => https://www.php.net/distributions/php-8.0.13.tar.xz
$_SERVER['PHP_ASC_URL'] => https://www.php.net/distributions/php-8.0.13.tar.xz.asc
$_SERVER['PHP_SHA256'] => cd976805ec2e9198417651027dfe16854ba2c2c388151ab9d4d268513d52ed52
$_SERVER['PHP_SOCKET_TIMEOUT'] => 60
$_SERVER['APP_VERSION'] => dev
$_SERVER['HOME'] => /var/www
$_SERVER['PHP_SELF'] => 
$_SERVER['SCRIPT_NAME'] => 
$_SERVER['SCRIPT_FILENAME'] => 
$_SERVER['PATH_TRANSLATED'] => 
$_SERVER['DOCUMENT_ROOT'] => 
$_SERVER['REQUEST_TIME_FLOAT'] => 1639151277.635
$_SERVER['REQUEST_TIME'] => 1639151277
$_SERVER['argv'] => Array
(
)

$_SERVER['argc'] => 0

PHP License
This program is free software; you can redistribute it and/or modify
it under the terms of the PHP License as published by the PHP Group
and included in the distribution in the file:  LICENSE

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact [email protected].

PHP Version

8.0.13

Operating System

Debian Bullseye (Docker container)

Inherited final constant causes fatal error (if the same interface is inherited multiple times)

Description

The following code:

<?php

interface EntityInterface {
    final public const TEST = 'this';
}

interface KeyInterface extends EntityInterface {
}

interface StringableInterface extends EntityInterface {
}

class SomeTestClass implements KeyInterface, StringableInterface {
}

Resulted in this output:

Fatal error: EntityInterface::TEST cannot override final constant EntityInterface::TEST in /in/UiiTf on line 13

Process exited with code 255.

But I expected this output instead:

No error

PHP Version

PHP 8.1.0

Operating System

Ubuntu 20.04

Problem with mysqli_options and persistent connections in mysqli.

Description

According to the documentation https://www.php.net/manual/en/mysqli.options.php
mysqli_options() should be called after mysqli_init() and before mysqli_real_connect().

But, when using persistent connections and the connection in the pool is broken,
when creating a new connection, the MYSQLI_OPT_INT_AND_FLOAT_NATIVE option is lost.

Setting the option AFTER calling real_connect solves the problem

The following code:

<?php
\mysqli_report(MYSQLI_REPORT_ERROR);
function connect(): mysqli {
	$mysqli = mysqli_init();
	$mysqli->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1);
	$mysqli->real_connect('p:127.0.0.1', 'user', 'password');

	return $mysqli;
}

$mysqli1 = connect();
var_dump($mysqli1->query("SELECT 1")->fetch_row()[0]); // int
@$mysqli1->query("KILL {$mysqli1->thread_id}");
unset($mysqli1);

$mysqli2 = connect();
var_dump($mysqli2->query("SELECT 2")->fetch_row()[0]); // string, but int is expected

// next ok
$mysqli2->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1);
var_dump($mysqli2->query("SELECT 3")->fetch_row()[0]); // int

Resulted in this output:

int(1)
string(1) "2"
int(3)

But I expected this output instead:

int(1)
int(2)
int(3)

PHP Version

PHP 8.0.14, 8.1.1

Operating System

Debian 9.13, Ubuntu 21.10

Wrong error message if Enum doesn't correctly implement an interface

Description

The following code:

<?php
interface A {
    public function a(): void;
}

enum B implements A {
}

Resulted in this output:

PHP Fatal error:  Class E contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (I::a) in Command line code on line 1

But I expected this output instead:

PHP Fatal error:  Enum E contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (I::a) in Command line code on line 1

Patch:

diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 3ef291c315..04d5728ef1 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -4789,6 +4789,8 @@ ZEND_API ZEND_COLD const char *zend_get_object_type(const zend_class_entry *ce)
                return "trait";
        } else if (ce->ce_flags & ZEND_ACC_INTERFACE) {
                return "interface";
+       } else if (ce->ce_flags & ZEND_ACC_ENUM) {
+               return "enum";
        } else {
                return "class";
        }
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 82af3d8afa..002da24383 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -2324,9 +2324,13 @@ void zend_verify_abstract_class(zend_class_entry *ce) /* {{{ */
        } ZEND_HASH_FOREACH_END();

        if (ai.cnt) {
+               char* kind = strdup(zend_get_object_type(ce));
+               kind[0] = toupper(kind[0]);
+
                zend_error_noreturn(E_ERROR, !is_explicit_abstract
-                       ? "Class %s contains %d abstract method%s and must therefore be declared abstract or implement the remaining methods (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")"
-                       : "Class %s must implement %d abstract private method%s (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")",
+                       ? "%s %s contains %d abstract method%s and must therefore be declared abstract or implement the remaining methods (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")"
+                       : "%s %s must implement %d abstract private method%s (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")",
+                       kind,
                        ZSTR_VAL(ce->name), ai.cnt,
                        ai.cnt > 1 ? "s" : "",
                        DISPLAY_ABSTRACT_FN(0),

PHP Version

8.1.*

Operating System

Irrelevant

Add mysqli_rollback_to

Description

In PHP 5.5 mysqli::savepoint and mysqli::release_savepoint were added, but not rollback_to. Maybe there is some database engine where savepoints have multiple purposes, but in mariadb the only use of savepoints is to call query ROLLBACK TO name manually.

For completion: existing rollback with $name is doing nothing (only adding comment) at least in mariadb/mysql.

Method signature

class mysqli { /* ... */
  public function rollback_to(string $name) : bool;
}

Sample test sequence

mysqli_query($link, 'DROP TABLE IF EXISTS test');
mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB');

mysqli_begin_transaction($link);
mysqli_query($link, 'INSERT INTO test(id) VALUES (1)');
mysqli_savepoint($link, 'foo');
mysqli_query($link, 'INSERT INTO test(id) VALUES (2)');
mysqli_rollback_to($link, 'foo');
mysqli_commit($link);
$res = mysqli_query($link, "SELECT * FROM test");
var_dump($res->num_rows); // int(1)

move reference to pcre.h out of spl_iterators.h

Description

Currently spl_iterators.h includes php_pcre.h so that it can be reference in the spl_dual_it_object struct but only as a pointer to a .

This makes a dependency on the pcre2.h file for extensions that include the spl_iterators.h. Apparently this causes problems for people installing extensions that include spl_iteterators header, presumably due to the common swapping out of PCRE bundled vs system?

Would it be possible to make the header not depend on the php_pcre.h file, either through moving the relevant parts to a spl-private file or using an void pointer?

btw feel free to close if this is non-trivial. I'd missed the fact that as the countable_ce was moved from spl to zend, I no longer need to include the spl header anyway....

Incorrect return types for hash() and hash_hmac()

Description

I believe the stub file entries for hash() and hash_hmac() to be incorrect. Their return types are both specified as string|false, but starting with PHP 8.0 they in fact never return false, they throw a fatal error where they returned false before PHP 8.0. In the case of hash() the only two RETURN_FALSE statements (1, 2) are within if (isfilename)blocks, e.g. the code path used exclusively by hash_file(). It's similar for hash_hmac().

Does that make sense or did I miss something?

PHP Version

PHP >= 8.0

Operating System

All OSes

DOMNode Reflection does not return properties

Description

The following code:

<?php

$c = new ReflectionClass("DOMNode");
$ps = $c->getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED);

var_dump(count($ps));

foreach($ps as $p) {

    var_dump($p->name);
    var_dump($p->getType());
}

Resulted in this output:

int(0)

But I expected this output instead:
a list of all properties, as documented in https://www.php.net/manual/en/class.domnode.php

see https://sandbox.onlinephpfunctions.com/

PHP Version

PHP 8.0.12

Operating System

macos

Allow CData to be passed as valid argument to primitive ffi functions

Description

Currently one can only pass a float (C) from the PHP's float, which is a double.

When using a lot of floats with C libraries, this means that float's are constantly converted from float's to double' and double's to floats.

I hereby would like to request the option to send the CData class to FFI bound functions, to bypass this type juggling

I guess this would also mean that there should be an option to get the return as the "raw" CData value, which I have no idea how to fully implement from a user standpoint ($ffi->atan->raw(0.5) or something?)

A simple code example (that has no bearing on reality) that displays the "issue" would be the following:

<?php

$c = FFI::cdef('float atanf (float x);', 'libm.so.6');
$x = $c->atanf(0.4);
$z = FFI::new('float');
$z->cdata = $x;
$y = $c->atanf($z);
echo $y.$x."\n";

php will now simply throw a warning "PHP Warning: Object of class FFI\CData could not be converted to float", and use 1.0 instead

enums: is_case() function

Description

There is currently no way to determine if an expression or variable is of type "enum" (or I don't know how).

Since "enum" is a new data type, it would be desirable for there to be a function to know if an expression or variable is a case of an enumeration.

Such a function could be:

is_case()
is_enum()
is_enum_case()
is_enumcase()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.