Skip to content

Commit e1410da

Browse files
committed
On PHP8.1 a missing lock file causes flock to crash with a type error. Then you can't load the initial configuration page..
1 parent d026a84 commit e1410da

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CRM/Civioffice/DocumentRendererType/LocalUnoconv.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ protected function lock()
601601
$lock_file_path = $this->unoconv_lock_file_path;
602602
if ($lock_file_path) {
603603
$this->unoconv_lock_file = fopen($lock_file_path, "w+");
604-
if (!flock($this->unoconv_lock_file, LOCK_EX)) {
604+
if (!$this->unoconv_lock_file || !flock($this->unoconv_lock_file, LOCK_EX)) {
605605
throw new Exception(E::ts("CiviOffice: Could not acquire unoconv lock."));
606606
}
607607
}
@@ -613,7 +613,7 @@ protected function lock()
613613
protected function unlock()
614614
{
615615
if ($this->unoconv_lock_file) {
616-
if (!flock($this->unoconv_lock_file, LOCK_UN)) {
616+
if (!$this->unoconv_lock_file || !flock($this->unoconv_lock_file, LOCK_UN)) {
617617
Civi::log()->debug("CiviOffice: Could not release unoconv lock.");
618618
}
619619
fclose($this->unoconv_lock_file);

0 commit comments

Comments
 (0)