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 edit SEO tab #43

Open
joselaurens opened this issue Mar 7, 2023 · 3 comments
Open

Unable to edit SEO tab #43

joselaurens opened this issue Mar 7, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@joselaurens
Copy link

joselaurens commented Mar 7, 2023

I install the Bundle on Sulu 2.5, configure and can start using it. But when accessing the SEO tab, it doesn't allow me to edit any fields.
When writing in any field, I get this error that I don't understand.

error_seo_tab

Uncaught TypeError: e is undefined
    set index.js:101
    set ResourceStore.js:274
    MobX 2
    change ResourceStore.js:294
    MobX 2
    change ResourceFormStore.js:276
    handleChange Form.js:93
    handleChange Field.js:76
    handleChange Input.js:45
    React 11
    unstable_runWithPriority scheduler.production.min.js:18
    React 3
index.js:101:4

Line 101 is method

api.set = function set (obj, pointer, value) {
    var refTokens = Array.isArray(pointer) ? pointer : api.parse(pointer),
      nextTok = refTokens[0];

    if (refTokens.length === 0) {
      throw Error('Can not set the root object');
    }

    for (var i = 0; i < refTokens.length - 1; ++i) {
        var tok = refTokens[i];
        if (typeof tok !== 'string' && typeof tok !== 'number') {
          tok = String(tok)
        }
        if (tok === "__proto__" || tok === "constructor" || tok === "prototype") {
            continue
        }
        if (tok === '-' && Array.isArray(obj)) {
          tok = obj.length;
        }
        nextTok = refTokens[i + 1];

        if (!(tok in obj)) {
            if (nextTok.match(/^(\d+|-)$/)) {
                obj[tok] = [];
            } else {
                obj[tok] = {};
            }
        }
        obj = obj[tok];
    }
    if (nextTok === '-' && Array.isArray(obj)) {
      nextTok = obj.length;
    }
    obj[nextTok] = value;
    return this;
};

Composer requires are

"require": {
        "php": "^8.1",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "dantleech/phpcr-migrations-bundle": "^1.3",
        "doctrine/doctrine-bundle": "^2.5",
        "doctrine/doctrine-fixtures-bundle": "^3.4",
        "friendsofsymfony/http-cache-bundle": "^2.10.1",
        "handcraftedinthealps/zendsearch": "^2.1",
        "jackalope/jackalope-doctrine-dbal": "^1.7",
        "scheb/2fa-bundle": "^6.1",
        "scheb/2fa-email": "^6.1",
        "scheb/2fa-trusted-device": "^6.1",
        "sulu/sulu": "~2.5.7",
        "symfony/config": "^6.2",
        "symfony/dotenv": "^6.2",
        "symfony/flex": "^1.17 || ^2.0",
        "symfony/framework-bundle": "^6.2",
        "symfony/mailer": "^6.2",
        "symfony/monolog-bridge": "^6.2",
        "symfony/monolog-bundle": "^3.4",
        "symfony/runtime": "^6.2",
        "symfony/security-bundle": "^6.2",
        "symfony/twig-bundle": "^6.2",
        "thecadien/sulu-news-bundle": "^1.3"
    },
    "require-dev": {
        "friendsofphp/php-cs-fixer": "^3.9",
        "jangregor/phpstan-prophecy": "^1.0",
        "phpcr/phpcr-shell": "^1.4",
        "phpspec/prophecy-phpunit": "^2.0",
        "phpstan/extension-installer": "^1.1",
        "phpstan/phpstan": "^1.4",
        "phpstan/phpstan-doctrine": "^1.2",
        "phpstan/phpstan-phpunit": "^1.0",
        "phpstan/phpstan-symfony": "^1.1",
        "phpstan/phpstan-webmozart-assert": "^1.0",
        "phpunit/phpunit": "^9.5",
        "rector/rector": "^0.15.1",
        "sulu/sulu-rector": "^0.1.3",
        "symfony/browser-kit": "^6.2",
        "symfony/css-selector": "^6.2",
        "symfony/debug-bundle": "^6.2",
        "symfony/error-handler": "^6.2",
        "symfony/phpunit-bridge": "^6.2",
        "symfony/thanks": "^1.2",
        "symfony/web-profiler-bundle": "^6.2",
        "thecodingmachine/phpstan-strict-rules": "^1.0"
    },

This also happened to me on a Sulu 2.4 installation with SuluNewsBundle version 1.2.0.

@TheCadien TheCadien added the bug Something isn't working label Mar 7, 2023
@TheCadien TheCadien self-assigned this Mar 7, 2023
@manuxi
Copy link

manuxi commented Jul 17, 2023

Same here...

@TheCadien
Copy link
Owner

@manuxi can confirm that we had here a bug.
At the moment, however, I unfortunately lack the time to repoduce exactly why this arises.

@alexander-schranz
Copy link

I would say this is a serialization issue in the bundle. Empty array maybe converted into [] instead of into a empty object {} and so the JSON Pointer not working:

Make sure the bundle return:

{
    "ext": {
          "seo": {} // <-- if this is [] it could be the problem of the issue
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants