Bug #79398 [NEW]: Different behavior of flock and include on PHP 7.3 and PHP 7.4

From: Date: Fri, 20 Mar 2020 13:59:06 +0000
Subject: Bug #79398 [NEW]: Different behavior of flock and include on PHP 7.3 and PHP 7.4
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226188@lists.php.net to get a copy of this message
From:             praszywka dot adam at gmail dot com
Operating system: Windows 10 1909
PHP version:      7.4.4
Package:          *General Issues
Bug Type:         Bug
Bug description:Different behavior of flock and include on PHP 7.3 and PHP 7.4

Description:
------------
PHP 7.3 allows to include previously locked file. PHP 7.4 throws Notice.

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

$cachePath = 'file.php';

$lock = fopen($cachePath, 'w');
chmod($cachePath, 0666 & ~umask());

$res = flock($lock, LOCK_EX | LOCK_NB, $wouldBlock);

include $cachePath;

echo 'OK';


Expected result:
----------------
$ C:/Program\ Files/php-7.3.5-nts-Win32-VC15-x64/php.exe test2.php
OK


Actual result:
--------------
$ C:/Program\ Files/php-7.4.4-nts-Win32-VC15-x64/php.exe test2.php
PHP Notice:  include(): read of 4096 bytes failed with errno=13
Permission denied in C:\Users\praszywa\Downloads\test\test2.php on line
10
PHP Stack trace:
PHP   1. {main}() C:\Users\praszywa\Downloads\test\test2.php:0

Notice: include(): read of 4096 bytes failed with errno=13 Permission
denied in C:\Users\praszywa\Downloads\test\test2.php on line 10

Call Stack:
    0.0002     393720   1. {main}()
C:\Users\praszywa\Downloads\test\test2.php:0

PHP Warning:  include(): Failed opening 'file.php' for inclusion
(include_path='.;C:\php\pear') in
C:\Users\praszywa\Downloads\test\test2.php on line 10
PHP Stack trace:
PHP   1. {main}() C:\Users\praszywa\Downloads\test\test2.php:0

Warning: include(): Failed opening 'file.php' for inclusion
(include_path='.;C:\php\pear') in
C:\Users\praszywa\Downloads\test\test2.php on line 10

Call Stack:
    0.0002     393720   1. {main}()
C:\Users\praszywa\Downloads\test\test2.php:0

OK

-- 
Edit bug report at https://bugs.php.net/bug.php?id=79398&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=79398&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=79398&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=79398&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=79398&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=79398&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=79398&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=79398&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=79398&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=79398&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=79398&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79398&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=79398&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=79398&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=79398&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=79398&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=79398&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=79398&r=mysqlcfg


Thread (8 messages)

« previous php.bugs (#226188) next »