givanz / VvvebJs

Drag and drop page builder library written in vanilla javascript without dependencies or build tools.
https://www.vvveb.com/vvvebjs/editor.html
Apache License 2.0
6.86k stars 1.58k forks source link

Error on creation New Page and save Page #352

Open TavakoliAli opened 1 month ago

TavakoliAli commented 1 month ago

Hello

I cloned the repository and checkouted on 2.0.0 then installed PHP core and the xammp and copy content of repository to htdocs of xammp. When I click on "Create page" button following error occur:

errorr

and for save Page button, the 500 error will return with following header:

     XHRPOST
    http://localhost:85/save.php
    [HTTP/1.1 500 Internal Server Error 

    POST
    http://localhost:85/save.php
    Status
    500
    Internal Server Error
    VersionHTTP/1.1
    Transferred394 B (130 B size)
    Referrer Policystrict-origin-when-cross-origin
    Request PriorityHighest
    DNS ResolutionSystem

    HTTP/1.1 500 Internal Server Error

    Date: Wed, 22 May 2024 14:13:33 GMT

    Server: Apache/2.4.56 (Unix) OpenSSL/1.1.1t PHP/8.2.4 mod_perl/2.0.12 Perl/v5.34.1

    X-Powered-By: PHP/8.2.4

    Content-Length: 130

    Connection: close

    Content-Type: text/html; charset=UTF-8

    Accept
        */*
    Accept-Encoding
        gzip, deflate, br, zstd
    Accept-Language
        en-US,en;q=0.7,fa-IR;q=0.3
    Connection
        keep-alive
    Content-Length
        177053
    Content-Type
        application/x-www-form-urlencoded; charset=UTF-8
    Host
        localhost:85
    Origin
        http://localhost:85
    Priority
        u=1
    Referer
        http://localhost:85/editor.html
    Sec-Fetch-Dest
        empty
    Sec-Fetch-Mode
        cors
    Sec-Fetch-Site
        same-origin
    User-Agent
        Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0

I tested it on Linux with Firefox 126.0

givanz commented 1 month ago

Thanks for the bug report.

I was able to reproduce the bug by generating a 500 internal server error in save.php and fixed the javascript code in https://github.com/givanz/VvvebJs/commit/16bde5681b983cf2333784ff4b5485aa6d15e667#diff-79039f951efdff70e6cf3d4ed97ca425ed0d872fe0d0fc7d84b62ef97522c43eL2497-R2505

For the 500 internal server error from php please check your php and apache error logs to see what is causing the error.

Some common causes are big page/html that will exceed apache LimitRequestBody or missing write permission for html pages.