php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80745 JIT produces Assert failure and UNKNOWN:0 var_dumps in code involving bitshifts
Submitted: 2021-02-13 16:16 UTC Modified: 2021-02-16 11:08 UTC
Votes:4
Avg. Score:4.2 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:2 (66.7%)
From: dktapps at pmmp dot io Assigned: dmitry (profile)
Status: Closed Package: JIT
PHP Version: 8.0.2 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dktapps at pmmp dot io
New email:
PHP Version: OS:

 

 [2021-02-13 16:16 UTC] dktapps at pmmp dot io
Description:
------------
The following code crashes with PHP 8.0.2 ZTS DEBUG when opcache is enabled using opcache.jit=1205.

This happens on both Windows and Linux.

Test script:
---------------
<?php

final class Message
{
    public $qr = false;

    public $opcode = 0;

    public $aa = false;
}

echo "Starting...\n";

function headerToBinary(Message $message)
{
	$flags = 0;
	$flags = ($flags << 1) | ($message->qr ? 1 : 0);
	$flags = ($flags << 4) | $message->opcode;
	var_dump($flags);
	$flags = ($flags << 1) | ($message->aa ? 1 : 0);
}

headerToBinary(new Message());

echo "PROBLEM NOT REPRODUCED !\n";

Expected result:
----------------
Starting...
int(0)
PROBLEM NOT REPRODUCED !

Actual result:
--------------
In release mode
---------------
Starting...
UNKNOWN:0
PHP Fatal error:  Uncaught TypeError: Unsupported operand types: null << int in /home/runner/work/php-8-jit-bug-1/php-8-jit-bug-1/reproduce.php:20
Stack trace:
#0 /home/runner/work/php-8-jit-bug-1/php-8-jit-bug-1/reproduce.php(23): headerToBinary()
#1 {main}
  thrown in /home/runner/work/php-8-jit-bug-1/php-8-jit-bug-1/reproduce.php on line 20

In debug mode
-------------
Starting...
UNKNOWN:0
php: /tmp/php-build/source/8.0.2/Zend/zend_operators.c:345: zendi_try_get_long: Assertion `0' failed.
Aborted (core dumped)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-13 17:39 UTC] JaxkDev at gmail dot com
Reproduced on windows 10 (10.0.19042.804), PHP 8.0.2 ZTS (opcache.jit=1205)
 [2021-02-16 11:08 UTC] nikic@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: dmitry
 [2021-02-17 08:51 UTC] dmitry@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7f68a7afe625ffdc485a05d417197bc30cbb1513
Log: Fixed bug #80745 (JIT produces Assert failure and UNKNOWN:0 var_dumps in code involving bitshifts)
 [2021-02-17 08:51 UTC] dmitry@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 02:01:29 2024 UTC