Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHP 8.4 support in a PHP >= 5.1 compatible way #900

Open
wants to merge 3 commits into
base: 1.7.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Parsedown.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ function setSafeMode($safeMode)

protected function lines(array $lines)
{
$CurrentBlock = null;
$CurrentBlock = array();

foreach ($lines as $line)
{
if (chop($line) === '')
{
if (isset($CurrentBlock))
if (!empty($CurrentBlock))
{
$CurrentBlock['interrupted'] = true;
}
Expand Down Expand Up @@ -255,7 +255,7 @@ protected function lines(array $lines)

# ~

if (isset($CurrentBlock) and ! isset($CurrentBlock['type']) and ! isset($CurrentBlock['interrupted']))
if (!empty($CurrentBlock) and ! isset($CurrentBlock['type']) and ! isset($CurrentBlock['interrupted']))
{
$CurrentBlock['element']['text'] .= "\n".$text;
}
Expand Down Expand Up @@ -317,9 +317,9 @@ protected function isBlockCompletable($Type)
#
# Code

protected function blockCode($Line, $Block = null)
protected function blockCode($Line, $Block = array())
{
if (isset($Block) and ! isset($Block['type']) and ! isset($Block['interrupted']))
if (!empty($Block) and ! isset($Block['type']) and ! isset($Block['interrupted']))
{
return;
}
Expand Down Expand Up @@ -712,9 +712,9 @@ protected function blockRule($Line)
#
# Setext

protected function blockSetextHeader($Line, array $Block = null)
protected function blockSetextHeader($Line, array $Block = array())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a BC break as the method can now longer be called with null as the second argument anymore.

{
if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted']))
if (empty($Block) or isset($Block['type']) or isset($Block['interrupted']))
{
return;
}
Expand Down Expand Up @@ -850,9 +850,9 @@ protected function blockReference($Line)
#
# Table

protected function blockTable($Line, array $Block = null)
protected function blockTable($Line, array $Block = array())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

{
if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted']))
if (empty($Block) or isset($Block['type']) or isset($Block['interrupted']))
{
return;
}
Expand Down