Skip to content

Commit

Permalink
fixes: mostly php 8.3 fixes to prepare for next release (openemr#6935)
Browse files Browse the repository at this point in the history
* variable with 2 $ fix

* php 8.3 fix

* interim php 8.3 fixes

* interim

* done
  • Loading branch information
bradymiller authored Oct 29, 2023
1 parent c2671d3 commit 221034a
Show file tree
Hide file tree
Showing 905 changed files with 930 additions and 932 deletions.
2 changes: 1 addition & 1 deletion interface/forms/procedure_order/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function getListOptions($list_id, $fieldnames = array('option_id', 'title', 'seq
if (!CsrfUtils::verifyCsrfToken($_POST["csrf_token_form"])) {
CsrfUtils::csrfNotVerified();
}
$ppid = (int)$_POST['form_lab_id'];
$ppid = (int)($_POST['form_lab_id'] ?? null);
if (get_lab_name($ppid) === 'labcorp') {
if (!empty($_POST['form_account_facility'])) {
$location = sqlQueryNoLog("SELECT f.id, f.facility_code, f.name FROM facility as f " .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ function initSearchForm() {
</div>
<?php die();
} ?>
<form method="post" id="qa_form" name="qa_form" onsubmit="return saveQR()" action="<?php echo $rootdir; ?>/forms/questionnaire_assessments/save.php?form_id=<?php echo attr_url($formid); ?><?php echo ($isPortal) ? '&isPortal=1' : ''; ?><?php echo ($patientPortalOther) ? '&formOrigin=' . attr_url($_GET['formOrigin']) : '' ?><?php echo '&mode=' . attr_url($mode ?? ''); ?>">
<form method="post" id="qa_form" name="qa_form" onsubmit="return saveQR()" action="<?php echo $rootdir; ?>/forms/questionnaire_assessments/save.php?form_id=<?php echo attr_url($formid ?? ''); ?><?php echo ($isPortal) ? '&isPortal=1' : ''; ?><?php echo ($patientPortalOther) ? '&formOrigin=' . attr_url($_GET['formOrigin']) : '' ?><?php echo '&mode=' . attr_url($mode ?? ''); ?>">
<input type="hidden" name="csrf_token_form" value="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
<input type="hidden" id="lform" name="lform" value="<?php echo attr($form['lform'] ?? ''); ?>" />
<input type="hidden" id="lform_response" name="lform_response" value="<?php echo attr($form['lform_response'] ?? ''); ?>" />
Expand All @@ -388,21 +388,23 @@ function initSearchForm() {
<select class="select-dropdown my-2" type="text" id="select_item" name="select_item" autocomplete="off" role="combobox" aria-expanded="false">
<option value=""></option>
<?php
foreach ($q_list as $item) {
$id = attr($item['id']);
if ($id == $repository_item) {
echo "<option selected value='$id'>" . text($item['name']) . "</option>";
continue;
if (!empty($q_list)) {
foreach ($q_list as $item) {
$id = attr($item['id']);
if ($id == $repository_item) {
echo "<option selected value='$id'>" . text($item['name']) . "</option>";
continue;
}
echo "<option value='$id'>" . text($item['name']) . "</option>";
}
echo "<option value='$id'>" . text($item['name']) . "</option>";
}
?>
</select>
</div>
<div class="input-group isNew d-none">
<hr />
<label class="font-weight-bold my-2" for="form_name"><?php echo xlt("Form Name") . ':'; ?></label>
<input required type="text" class="form-control skip-template-editor ml-1" id="form_name" name="form_name" title="<?php echo xla('You may edit name to shorten to be more understandable.'); ?>" placeholder="<?php echo xla('Name of new Encounter form. You may change or leave as displayed.'); ?>" value="<?php echo attr($form['form_name'] ?: $form_name); ?>" />
<input required type="text" class="form-control skip-template-editor ml-1" id="form_name" name="form_name" title="<?php echo xla('You may edit name to shorten to be more understandable.'); ?>" placeholder="<?php echo xla('Name of new Encounter form. You may change or leave as displayed.'); ?>" value="<?php echo attr((($form['form_name'] ?? null) ?: $form_name) ?? ''); ?>" />
</div>
</div>
<hr />
Expand Down
1 change: 1 addition & 0 deletions interface/forms/ros/FormROS.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class FormROS extends ORDataObject

var $id;
var $date;
var $date_of_onset;
var $pid;
var $weight_change = "N/A";
var $weakness = "N/A";
Expand Down
8 changes: 4 additions & 4 deletions interface/logview/logview.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,12 @@ function setpatient(pid, lname, fname, dob) {
<tr>
<td><?php echo text(oeFormatDateTime($iter["date"])); ?></td>
<td><?php echo xlt($iter["event"]); ?></td>
<td><?php echo xlt($iter["category"]); ?></td>
<td><?php echo xlt($iter["category"] ?? ''); ?></td>
<td><?php echo text($iter["user"]); ?></td>
<td><?php echo text($iter["crt_user"]); ?></td>
<td><?php echo text($iter["groupname"]); ?></td>
<td><?php echo text($iter["crt_user"] ?? ''); ?></td>
<td><?php echo text($iter["groupname"] ?? ''); ?></td>
<td><?php echo text($iter["patient_id"]); ?></td>
<td><?php echo text($iter["success"]); ?></td>
<td><?php echo text($iter["success"] ?? ''); ?></td>
<td> </td>
<td><?php echo text($comments); ?></td>
</tr>
Expand Down
12 changes: 6 additions & 6 deletions interface/main/calendar/modules/PostCalendar/common.api.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,12 @@ function &postcalendar_userapi_getCategories()
$categories[$i]['active'] = $active;
$categories[$i]['sequence'] = $seq;
$categories[$i]['event_repeat'] = $rtype;
$rspecs = unserialize($rspec, ['allowed_classes' => false]);
$categories[$i]['event_repeat_freq'] = $rspecs['event_repeat_freq'];
$categories[$i]['event_repeat_freq_type'] = $rspecs['event_repeat_freq_type'];
$categories[$i]['event_repeat_on_num'] = $rspecs['event_repeat_on_num'];
$categories[$i]['event_repeat_on_day'] = $rspecs['event_repeat_on_day'];
$categories[$i]['event_repeat_on_freq'] = $rspecs['event_repeat_on_freq'];
$rspecs = unserialize($rspec ?? '', ['allowed_classes' => false]);
$categories[$i]['event_repeat_freq'] = $rspecs['event_repeat_freq'] ?? null;
$categories[$i]['event_repeat_freq_type'] = $rspecs['event_repeat_freq_type'] ?? null;
$categories[$i]['event_repeat_on_num'] = $rspecs['event_repeat_on_num'] ?? null;
$categories[$i]['event_repeat_on_day'] = $rspecs['event_repeat_on_day'] ?? null;
$categories[$i]['event_repeat_on_freq'] = $rspecs['event_repeat_on_freq'] ?? null;
$categories[$i]['event_recurrspec'] = $rspecs;
$categories[$i]['event_duration'] = $duration;
$categories[$i]['event_durationh'] = (int)($duration / (60 * 60)); //seconds divided by 60 seconds * 60 minutes;
Expand Down
15 changes: 8 additions & 7 deletions interface/patient_file/summary/stats_full.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ function newEncounter() {

<?php
// display issues
$encount = 0;
while ($row = sqlFetchArray($pres)) :
$rowid = $row['id'];

Expand Down Expand Up @@ -309,12 +310,12 @@ function newEncounter() {
$click_class = '';
}

$shortBegDate = trim(oeFormatShortDate($row['begdate']));
$shortEndDate = trim(oeFormatShortDate($row['enddate']));
$fullBegDate = trim(oeFormatDateTime($row['begdate']));
$fullEndDate = trim(oeFormatDateTime($row['enddate']));
$shortModDate = trim(oeFormatShortDate($row['modifydate']));
$fullModDate = trim(oeFormatDateTime($row['modifydate']));
$shortBegDate = trim(oeFormatShortDate($row['begdate']) ?? '');
$shortEndDate = trim(oeFormatShortDate($row['enddate']) ?? '');
$fullBegDate = trim(oeFormatDateTime($row['begdate']) ?? '');
$fullEndDate = trim(oeFormatDateTime($row['enddate']) ?? '');
$shortModDate = trim(oeFormatShortDate($row['modifydate']) ?? '');
$fullModDate = trim(oeFormatDateTime($row['modifydate']) ?? '');

$outcome = ($row['outcome']) ? generate_display_field(['data_type' => 1, 'list_id' => 'outcome'], $row['outcome']) : false;
?>
Expand All @@ -328,7 +329,7 @@ function newEncounter() {
<button type="button" class="btn btn-outline-text btn-sm collapsed" data-toggle="collapse" data-target="#details_<?php echo attr($row['id']); ?>" aria-expanded="false" aria-controls="details_<?php echo attr($row['id']); ?>"><span aria-hidden="true" class="fa fa-fw fa-chevron-right"></span></button>
<button type="button" class="btn btn-outline-text btn-sm editenc" data-issue-id="<?php echo attr($row['id']); ?>"><span aria-hidden="true" class="fa fa-fw fa-link"></span></button>
</div>
<a href="#" data-issue-id="<?php echo attr($row['id']); ?>" class="font-weight-bold issue_title" data-toggle="tooltip" data-placement="right" title="<?php echo text($diag . ": " . $codedesc); ?>">
<a href="#" data-issue-id="<?php echo attr($row['id']); ?>" class="font-weight-bold issue_title" data-toggle="tooltip" data-placement="right" title="<?php echo text(($diag ?? '') . ": " . ($codedesc ?? '')); ?>">
<?php echo text($disptitle); ?>
</a>&nbsp;(<?php echo $statusCompute; ?><?php echo (!$resolved && $outcome) ? ", $outcome" : ""; ?>)
<?php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ public function getActionData(): array
* which is a value of any type other than a resource.
* @since 5.4.0
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
public function jsonSerialize(): mixed
{
return $this->getActionData();
}
Expand Down
4 changes: 2 additions & 2 deletions library/options.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function generate_select_list(

$selectEmptyName = xlt($empty_name);
if ($empty_name) {
preg_match_all('/select2/m', $class, $matches, PREG_SET_ORDER, 0);
preg_match_all('/select2/m', ($class ?? ''), $matches, PREG_SET_ORDER, 0);
if (array_key_exists('placeholder', $attributes) && count($matches) > 0) {
// We have a placeholder attribute as well as a select2 class indicating there
// should be provide a truley empty option.
Expand Down Expand Up @@ -2486,7 +2486,7 @@ function generate_display_field($frow, $currvalue)
$s = htmlspecialchars(xl_list_label($lrow['title'] ?? ''), ENT_NOQUOTES);
//if there is no matching value in the corresponding lists check backup list
// only supported in data types 1,26,43,46
if ($lrow == 0 && !empty($backup_list) && ($data_type == 1 || $data_type == 26 || $$data_type == 43 || $data_type == 46)) {
if ($lrow == 0 && !empty($backup_list) && ($data_type == 1 || $data_type == 26 || $data_type == 43 || $data_type == 46)) {
$lrow = sqlQuery("SELECT title FROM list_options " .
"WHERE list_id = ? AND option_id = ? AND activity = 1", array($backup_list,$currvalue));
$s = htmlspecialchars(xl_list_label($lrow['title']), ENT_NOQUOTES);
Expand Down
3 changes: 1 addition & 2 deletions src/Billing/BillingProcessor/BillingClaim.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ public function setIsLast($is_last): void
$this->is_last = $is_last;
}

#[\ReturnTypeWillChange]
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$vars = get_object_vars($this);
return $vars;
Expand Down
3 changes: 1 addition & 2 deletions src/Common/ORDataObject/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ public function set_district(string $district): Address
* which is a value of any type other than a resource.
* @since 5.4.0
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
public function jsonSerialize(): mixed
{
return [
"id" => $this->get_id(),
Expand Down
3 changes: 1 addition & 2 deletions src/Common/ORDataObject/ContactAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,7 @@ public function toArray()
* which is a value of any type other than a resource.
* @since 5.4.0
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$result = [
"id" => $this->get_id(),
Expand Down
3 changes: 1 addition & 2 deletions src/Cqm/Qdm/BaseTypes/AbstractType.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public function __construct(array $properties = [])
}
}

#[\ReturnTypeWillChange]
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$vars = get_object_vars($this);
return $vars;
Expand Down
3 changes: 1 addition & 2 deletions src/Cqm/Qdm/BaseTypes/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class DateTime extends AbstractType implements \JsonSerializable
{
public $date;

#[\ReturnTypeWillChange]
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$formatted = DateHelper::format_datetime_cqm($this->date);
return $formatted;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRActivityDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRAdverseEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRAllergyIntolerance.php
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRAppointment.php
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRAppointmentResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRAuditEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRBodyStructure.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRCapabilityStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRCarePlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRCareTeam.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRCatalogEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRChargeItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRClaim.php
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRClaimResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRClinicalImpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRCodeSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
2 changes: 1 addition & 1 deletion src/FHIR/R4/FHIRDomainResource/FHIRCommunication.php
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ public function __toString()
/**
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
$json = parent::jsonSerialize();
$json['resourceType'] = $this->_fhirElementName;
Expand Down
Loading

0 comments on commit 221034a

Please sign in to comment.