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

Check is_countable() before count() #151

Merged
merged 1 commit into from
Jan 1, 2023
Merged

Conversation

erAck
Copy link
Contributor

@erAck erAck commented Jan 1, 2023

is_countable() would demand PHP >= 7.3.0 as of which it is available.
See https://www.php.net/manual/en/function.is-countable.php
Use a polyfill for PHP < 7.3.0

Loading serendipity_admin.php with $serendipity['production'] = false
yielded a red alert box:

The Serendipity JavaScript-library could not be loaded. This can happen
due to PHP or Plugin errors, or even a malformed browser cache. To check
the exact error please open
https://.../index.php?/plugin/admin/serendipity_editor.js manually in
your browser and check for error messages.

Where at the end of that file could be found:

== ERROR-REPORT (BETA/ALPHA-BUILDS) ==

Warning: count(): Parameter must be an array or an object that implements Countable in plugins/serendipity_event_linktrimmer/serendipity_event_linktrimmer.php on line 323.

is_countable() would demand PHP >= 7.3.0 as of which it is available.
See https://www.php.net/manual/en/function.is-countable.php
Use a polyfill for PHP < 7.3.0

Loading serendipity_admin.php with $serendipity['production'] = false
yielded a red alert box:

The Serendipity JavaScript-library could not be loaded. This can happen
due to PHP or Plugin errors, or even a malformed browser cache. To check
the exact error please open
https://.../index.php?/plugin/admin/serendipity_editor.js manually in
your browser and check for error messages.

Where at the end of that file could be found:

== ERROR-REPORT (BETA/ALPHA-BUILDS) ==
<p><b>Warning:</b> count(): Parameter must be an array or an object that
implements Countable in
plugins/serendipity_event_linktrimmer/serendipity_event_linktrimmer.php
on line 323.</p>
@onli
Copy link
Member

onli commented Jan 1, 2023

Let's keep this solution also in mind for the core, no? Could be useful there as well.

@onli onli merged commit 3b3dc99 into s9y:master Jan 1, 2023
@erAck erAck deleted the linktrimmer-countable branch January 1, 2023 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants