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

Unable to save custom css in admin panel (beta11) #1946

Closed
phenomlab opened this issue Nov 29, 2019 · 7 comments
Closed

Unable to save custom css in admin panel (beta11) #1946

phenomlab opened this issue Nov 29, 2019 · 7 comments

Comments

@phenomlab
Copy link

@phenomlab phenomlab commented Nov 29, 2019

Bug Report

Current Behavior
Unable to save custom css in admin panel. See below for errors reported in console

Chrome js console error:

onloadwff.js:71 Assertion failed: Input argument is not an HTMLInputElement
getFormProfile @ onloadwff.js:71
onloadwff.js:71 Uncaught TypeError: Cannot read property 'type' of undefined
at setFieldValue (onloadwff.js:71)
at HTMLFormElement.formKeydownListener (onloadwff.js:71)
5Error: <svg> attribute width: Expected length, "NaN".
25Error: <line> attribute x2: Expected length, "NaN".
35Error: <g> attribute transform: Expected number, "translate(NaN, 0)".
10Error: <path> attribute d: Expected number, "MNaN,170LNaN,170L…".
onloadwff.js:71 Assertion failed: Input argument is not an HTMLInputElement
getFormProfile @ onloadwff.js:71
setFieldValue @ onloadwff.js:71
formKeydownListener @ onloadwff.js:71
onloadwff.js:71 Uncaught TypeError: Cannot read property 'type' of undefined
at setFieldValue (onloadwff.js:71)
at HTMLFormElement.formKeydownListener (onloadwff.js:71)

Firefox console error:

assertion failed: Input argument is not an HTMLInputElement onloadwff.js:71:840494
Unexpected value NaN parsing width attribute. frappe-charts.esm.js:461
Unexpected value NaN parsing x2 attribute. 6 frappe-charts.esm.js:461
Unexpected value translate(NaN, 0) parsing transform attribute.

Expected Behavior
Should save with no issues. Custom CSS validates when checking against another source

Environment

  • Flarum version: Beta11
  • Website URL: https://forum.phenomlab.com
  • Webserver: [apache and nginx]
  • Hosting environment: [vps]
  • PHP version: 7.3.11
  • Browser: [e.g. chrome]
Output of "php flarum info", run this in terminal in your Flarum directory.

Flarum core 0.1.0-beta.11
PHP version: 7.2.24-0ubuntu0.18.04.1
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, pcntl, Reflection, SPL, sodium, session, standard, mysqlnd, PDO, xml, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, i360, iconv, igbinary, imap, json, exif, mysqli, pdo_mysql, pdo_sqlite, Phar, posix, readline, redis, shmop, SimpleXML, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, Zend OPcache
+---------------------------------+-----------------+--------+
| Flarum Extensions               |                 |        |
+---------------------------------+-----------------+--------+
| ID                              | Version         | Commit |
+---------------------------------+-----------------+--------+
| flarum-bbcode                   | v0.1.0-beta.8   |        |
| flarum-emoji                    | v0.1.0-beta.10  |        |
| flarum-lang-english             | v0.1.0-beta.11  |        |
| flarum-flags                    | v0.1.0-beta.10  |        |
| flarum-lock                     | v0.1.0-beta.9   |        |
| flarum-mentions                 | v0.1.0-beta.10  |        |
| flarum-statistics               | v0.1.0-beta.9   |        |
| flarum-sticky                   | v0.1.0-beta.9   |        |
| flarum-subscriptions            | v0.1.0-beta.9   |        |
| flarum-suspend                  | v0.1.0-beta.10  |        |
| flarum-tags                     | v0.1.0-beta.11  |        |
| michaelbelgium-discussion-views | v0.1.0-beta.8.3 |        |
| fof-byobu                       | 0.3.4           |        |
| fof-follow-tags                 | 0.3.4           |        |
| fof-share-social                | 0.1.1           |        |
| fof-polls                       | 0.1.1           |        |
| fof-merge-discussions           | 0.3.3           |        |
| fof-ignore-users                | 0.1.4           |        |
| fof-formatting                  | 0.1.2           |        |
| fof-split                       | 0.4.3           |        |
| fof-user-bio                    | 0.1.3           |        |
| fof-user-directory              | 0.3.3           |        |
| amaurycarrade-syndication       | v0.3.1          |        |
| fof-links                       | 0.2.1           |        |
| fof-subscribed                  | 0.2.3           |        |
| jordanjay29-summaries           | 0.3.1           |        |
| v17development-seo              | 1.0.2           |        |
| nomiscz-auth-linkedin           | v0.1.0-beta.8.0 |        |
| flarum-auth-twitter             | v0.1.0-beta.9   |        |
| fof-gamification                | 0.1.6           |        |
| flagrow-upload                  | 0.7.1           |        |
| reflar-pwned-passwords          | 0.2.0           |        |
| fof-pages                       | 0.2.7           |        |
| fof-reactions                   | 0.1.0           |        |
| fof-drafts                      | 0.1.4           |        |
| fof-socialprofile               | 0.1.1           |        |
| fof-recaptcha                   | 0.1.1           |        |
| flarum-approval                 | v0.1.0-beta.8   |        |
| fof-spamblock                   | 0.2.1           |        |
| antoinefr-online                | 0.4.0           |        |
| flagrow-direct-links            | 0.2.0           |        |
| flarum-markdown                 | v0.1.0-beta.10  |        |
| fof-linguist                    | 0.4.1           |        |
| fof-nightmode                   | 0.3.0           |        |
| fof-prevent-necrobumping        | 0.2.0           |        |
| clarkwinkelmann-author-change   | 0.1.4           |        |
| dem13n-nickname-changer         | 0.1.6           |        |
| flagrow-impersonate             | 0.2.0           |        |
| fof-disposable-emails           | 0.1.0           |        |
| noriods-auto-more               | 0.3.0           |        |
| flarum-embed                    | v0.1.0-beta.10  |        |
| fof-ban-ips                     | 0.1.5           |        |
| flarum-pusher                   | v0.1.0-beta.9   |        |
| fof-pretty-mail                 | 0.1.6           |        |
| reflar-cookie-consent           | 0.2.0           |        |
| fof-terms                       | 0.4.0           |        |
| fof-best-answer                 | 0.1.3           |        |
| tank-perspective                | 0.1.4           |        |
| fof-stopforumspam               | 0.2.0           |        |
| flagrow-sitemap                 | 0.2.0           |        |
| reflar-level-ranks              | 1.2.1           |        |
| fof-default-group               | 0.1.0           |        |
| franzl-open-links-in-new-tab    | v0.1.0          |        |
+---------------------------------+-----------------+--------+
Base URL: https://forum.phenomlab.com
Installation path: /var/www/vhosts/phenomlab.com/forum.phenomlab.com
Debug mode: off
@datitisev

This comment has been minimized.

Copy link
Member

@datitisev datitisev commented Nov 29, 2019

I can't reproduce these JS errors, however, saving the CSS produces a 500 error when posting to /api/settings... and I cannot find an error message or stacktrace anywhere.

@flarumtr

This comment has been minimized.

Copy link

@flarumtr flarumtr commented Nov 29, 2019

@zerosonesfun

This comment has been minimized.

Copy link

@zerosonesfun zerosonesfun commented Nov 30, 2019

I can't reproduce these JS errors, however, saving the CSS produces a 500 error when posting to /api/settings... and I cannot find an error message or stacktrace anywhere.

I can verify that there are no JS errors. For me, the JS errors are due to the Statistics extension. I disabled it and now I have zero browser console errors, but unfortunately, still cannot save custom CSS.

The error is:

PHP Fatal error: Declaration of Flarum\Settings\OverrideSettingsRepository::all() must be compatible with Flarum\Settings\SettingsRepositoryInterface::all(): array in /vendor/flarum/core/src/Settings/OverrideSettingsRepository.php on line 38

Line 38 is:

public function all()
    {
        return array_merge($this->inner->all(), $this->overrides);
    }
@datitisev

This comment has been minimized.

Copy link
Member

@datitisev datitisev commented Nov 30, 2019

Thanks @zerosonesfun for the error. Looks like a typed return type was added to the all() function in SettingsRepositoryInterface but not to OverrideSettingsRepository or UninstalledSettingsRepository

@tankerkiller125

This comment has been minimized.

Copy link
Contributor

@tankerkiller125 tankerkiller125 commented Dec 1, 2019

@datitisev It appears that https://github.com/flarum/core/blob/master/src/Settings/SettingsRepositoryInterface.php#L14 added a : array; which appears to have broken anything that extensions the interface. In PHPStorm deleting that extra bit of code seems to fix the issue. But I'm not sure if that's the wanted solution.

Edit: Tested the proposed solution of removing : array; in a local dev environment and discovered that it completely solved the issue. But again not sure if this is the wanted solution.

@datitisev

This comment has been minimized.

Copy link
Member

@datitisev datitisev commented Dec 1, 2019

@tankerkiller125 The problem was that the classes implementing that interface didn't match the type notation, i.e. did not specify their return value as array. This has been fixed with ff38456.

@phenomlab Looks like this issue got a bit off-topic from your actual bug - however, no one else is able to reproduce them. Those JS issues were most likely caused by another extension, the SVG errors most l likely from an invalid extension icon image.

@luceos

This comment has been minimized.

Copy link
Member

@luceos luceos commented Dec 2, 2019

This was fixed in ff38456 and will be released as patch beta 11.1

@luceos luceos closed this Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.