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

Publish article date error: Data Missing #334

Closed
l3utterfly opened this issue Aug 18, 2017 · 38 comments
Closed

Publish article date error: Data Missing #334

l3utterfly opened this issue Aug 18, 2017 · 38 comments
Labels
Status: Completed Fix is completed and merged into the dev branch; remaining open until it has been merged into master Type: Bug Report that has been identified / verified as an issue requiring resolution

Comments

@l3utterfly
Copy link

Whenever I publish an article setting "published = true", and setting a published date/time, I get this error:

image

I then have to go into the database directly and set the published_at field. Any help on why this is happening?

I am using the latest OctoberCMS + latest plugin. I am using SQL Server with October CMS.

Any help would be appreciated.

@LukeTowers
Copy link
Contributor

Check your error logs and see if you can get a stack trace.

@jan-vince
Copy link
Contributor

Or maybe try to use a different SQL engine (SQLite) to test where the problem is.

@l3utterfly
Copy link
Author

Where do I find the error logs?

@jan-vince
Copy link
Contributor

In backend administration in Settings > Event log.

Or in file system: /storage/logs/system.log.

@LukeTowers
Copy link
Contributor

Closing as it has been over a month since any activity on this occurred.

@LukeTowers LukeTowers added Status: Abandoned Has not seen any activity in at least a month, used to prompt stakeholders to action Type: Unconfirmed Bug Report that hasn't been verified / reproduced by a maintainer or trusted community member yet labels Oct 26, 2017
@chrisvidal
Copy link
Contributor

chrisvidal commented Jul 3, 2020

this issue is surfacing on Windows 2019 server:

timezone: Asia/Singapore
Windows Region date format has been updated to M/d/yyyy

here is the trace:

InvalidArgumentException: Data missing in C:\STTC\vendor\nesbot\carbon\src\Carbon\Carbon.php:917
Stack trace:
#0 C:\STTC\vendor\jenssegers\date\src\Date.php(100): Carbon\Carbon::createFromFormat()
#1 C:\STTC\vendor\october\rain\src\Database\Model.php(562): Jenssegers\Date\Date::createFromFormat()
#2 C:\STTC\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasAttributes.php(738): October\Rain\Database\Model->asDateTime()
#3 C:\STTC\vendor\october\rain\src\Database\Model.php(579): Illuminate\Database\Eloquent\Model->fromDateTime()
#4 C:\STTC\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasAttributes.php(532): October\Rain\Database\Model->fromDateTime()
#5 C:\STTC\vendor\october\rain\src\Database\Model.php(1214): Illuminate\Database\Eloquent\Model->setAttribute()
#6 C:\STTC\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1394): October\Rain\Database\Model->setAttribute()
#7 C:\STTC\vendor\october\rain\src\Extension\ExtendableTrait.php(387): Illuminate\Database\Eloquent\Model->__set()
#8 C:\STTC\vendor\october\rain\src\Database\Model.php(635): October\Rain\Database\Model->extendableSet()
#9 C:\STTC\modules\backend\traits\FormModelSaver.php(81): October\Rain\Database\Model->__set()
#10 C:\STTC\modules\backend\traits\FormModelSaver.php(40): Backend\Behaviors\FormController->setModelAttributes()
#11 C:\STTC\modules\backend\behaviors\FormController.php(317): Backend\Behaviors\FormController->prepareModelsToSave()
#12 [internal function]: Backend\Behaviors\FormController->update_onSave()
#13 C:\STTC\vendor\october\rain\src\Extension\ExtendableTrait.php(411): call_user_func_array()
#14 C:\STTC\modules\backend\classes\Controller.php(184): Backend\Classes\Controller->extendableCall()
#15 [internal function]: Backend\Classes\Controller->__call()
#16 C:\STTC\modules\backend\classes\Controller.php(620): call_user_func_array()
#17 C:\STTC\modules\backend\classes\Controller.php(478): Backend\Classes\Controller->runAjaxHandler()
#18 C:\STTC\modules\backend\classes\Controller.php(277): Backend\Classes\Controller->execAjaxHandlers()
#19 C:\STTC\modules\backend\classes\BackendController.php(165): Backend\Classes\Controller->run()
#20 [internal function]: Backend\Classes\BackendController->run()

@bennothommo
Copy link
Contributor

@chrisvidal What is your app.timezone config in config/app.php?

@chrisvidal
Copy link
Contributor

chrisvidal commented Jul 3, 2020

@chrisvidal What is your app.timezone config in config/app.php?

Asia/Singapore

in config/cms.php as well

@bennothommo
Copy link
Contributor

@chrisvidal app.timezone should generally be kept as UTC. cms.backendTimezone can be changed to Asia/Singapore. Try changing it back to that and see if that works.

@chrisvidal
Copy link
Contributor

we tried that to leave it on UTC but the exception is still there.

I also tried unsuccessfully to use ignoreTimezone: true in the .yaml, still the exception shows up

@LukeTowers
Copy link
Contributor

@chrisvidal can you modify vendor/october/rain/src/database/model.php asDateTime()

return Argon::createFromFormat(
            str_replace('.v', '.u', $this->getDateFormat()),
            $value
        );

to dd($this->getDateFormat(), $value) and then post the results?

Also what DB driver are you using?

@LukeTowers LukeTowers added Status: Response Needed Requires / is waiting on a response from at least one of the participants and removed Status: Abandoned Has not seen any activity in at least a month, used to prompt stakeholders to action labels Jul 4, 2020
@LukeTowers LukeTowers reopened this Jul 4, 2020
@chrisvidal
Copy link
Contributor

alright thanks @LukeTowers
I will do so next week, after the client give me remote access to their server hopefully.

@chrisvidal
Copy link
Contributor

result is 2020-07-10 06:30:00 for the 10th of July

@LukeTowers
Copy link
Contributor

@chrisvidal I need to see both variables, what is the output of $this->getDateFormat()?

@chrisvidal
Copy link
Contributor

damnit I didn't get it, as it showed up in a long dialog box, sorry

@LukeTowers
Copy link
Contributor

I'll need to see it in order to help further.

@chrisvidal
Copy link
Contributor

I understand, but we are going to have to wait - I do not have any more access to the client server as we are biding for their project, testing OC installation on their Windows env.
I will be able to know more if we win the project in the next few days/weeks.

@LukeTowers
Copy link
Contributor

Sounds good, looking forward to an update.

@chrisvidal
Copy link
Contributor

alright, I am facing the problem now, since I am doing the installation on this Winder Server.
same error

@chrisvidal
Copy link
Contributor

chrisvidal commented Oct 12, 2020

so the results from dd($this->getDateFormat(), $value) is

"Y-m-d H:i:s.v"

"2020-10-12 02:49:40.673"

settings are as such app.timezone kept as UTC.
cms.backendTimezone can be changed to Asia/Singapore

@chrisvidal
Copy link
Contributor

results coming upon saving a new article in the blog plugin:

"Y-m-d H:i:s.v"
"2020-10-12 03:32:38.420"

@chrisvidal
Copy link
Contributor

chrisvidal commented Oct 12, 2020

after some digging, the blog post published date returns the value 2020-10-29 11:20:00 and the expected format is Y-m-d H:i:s.v. So apparently there is missing this .v expected from the format here.

meaning that the datetime picker widget does not provide the expected format?

@LukeTowers
Copy link
Contributor

@chrisvidal I can tell you that the JS based datetime picker does not include microseconds in it's format. Why on earth is the .v in your expected datetime format?

@chrisvidal
Copy link
Contributor

chrisvidal commented Oct 13, 2020

Where does this expected date format come from?
We are on Windows Server 2019 though, SQL Server, PHP 7.4.
What could we explore to fix this?

Mmm not sure if related but looks like it laravel/framework#27200 and here laravel/framework#22407

@LukeTowers
Copy link
Contributor

@chrisvidal what version of the Laravel Framework are you using specifically?

@chrisvidal
Copy link
Contributor

chrisvidal commented Oct 13, 2020

I just installed the last OC version with the wizard installer. Not sure which Laravel Framework version it is.

LukeTowers added a commit to octobercms/library that referenced this issue Oct 13, 2020
@LukeTowers
Copy link
Contributor

@chrisvidal
Copy link
Contributor

chrisvidal commented Oct 13, 2020

here is the october/rain composer.json file on the Microsoft / SQL Server machine, which I am surprised to see a completely different the one I have on my local machine

{
    "name": "october/rain",
    "description": "October Rain Library",
    "homepage": "http://octobercms.com",
    "keywords": ["october", "cms", "rain"],
    "license": "MIT",
    "authors": [
        {
            "name": "Alexey Bobkov",
            "email": "[email protected]"
        },
        {
            "name": "Samuel Georges",
            "email": "[email protected]"
        }
    ],
    "require": {
        "php": ">=7.0",
        "doctrine/dbal": "2.5.*",
        "erusev/parsedown-extra": "~0.7",
        "kriswallsmith/assetic": "~1.3",
        "linkorb/jsmin-php": "~1.0",
        "leafo/scssphp": "~0.6",
        "symfony/yaml": "~3.2",
        "twig/twig": "~2.0",
        "league/csv": "~8.0",
        "jenssegers/date": "~3.0",
        "laravel/tinker": "~1.0"
    },
    "require-dev": {
        "phpunit/phpunit": "~5.7",
        "illuminate/database": "5.5.*",
        "illuminate/filesystem": "5.5.*",
        "illuminate/encryption": "5.5.*",
        "illuminate/queue": "5.5.*",
        "illuminate/support": "5.5.*",
        "illuminate/log": "5.5.*",
        "illuminate/mail": "5.5.*",
        "illuminate/events": "5.5.*",
        "illuminate/pagination": "5.5.*",
        "illuminate/routing": "5.5.*",
        "illuminate/validation": "5.5.*",
        "illuminate/view": "5.5.*",
        "illuminate/cache": "5.5.*",
        "symfony/dom-crawler": "~3.1",
        "symfony/css-selector": "~3.1",
        "meyfa/phpunit-assert-gd": "1.1.0",
        "squizlabs/php_codesniffer": "3.*",
        "php-parallel-lint/php-parallel-lint": "^1.0"
    },
    "replace": {
        "october/auth": "self.version",
        "october/config": "self.version",
        "october/database": "self.version",
        "october/extension": "self.version",
        "october/filesystem": "self.version",
        "october/halcyon": "self.version",
        "october/html": "self.version",
        "october/mail": "self.version",
        "october/network": "self.version",
        "october/parse": "self.version",
        "october/router": "self.version",
        "october/support": "self.version",
        "october/translation": "self.version"
    },
    "autoload": {
        "files": [
            "src/Support/helpers.php",
            "src/Html/helpers.php",
            "src/Parse/Assetic/Less/lessc.inc.php"
        ],
        "psr-4": {
            "October\\Rain\\": "src/"
        },
        "psr-0": {
            "Less": "src/Parse/Assetic/Less/lib/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ],
        "psr-4": {
            "October\\Rain\\Tests\\": "tests/"
        }
    },
    "extra": {
        "branch-alias": {
            "dev-master": "1.0-dev"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

@LukeTowers
Copy link
Contributor

@chrisvidal were you able to apply https://github.com/octobercms/library/pull/528/files to see if that resolved your issue?

@chrisvidal
Copy link
Contributor

having a remote call with my client in 2 hours to check this out. will post results here.

@chrisvidal
Copy link
Contributor

ok it seems to be working, thanks so much @LukeTowers

However, I am facing multiple issues from SQL Server with "simple" Eloquent query from the component Posts for example the ORDER BY clause is invalid in views..., when a category of post is queried with an order by published_at. From the listForFrontEnd method in post.php model. Any experience with that by any chance?

@LukeTowers
Copy link
Contributor

@chrisvidal can you post the full error message you get for that / the full SQL statement it tries to run?

@chrisvidal
Copy link
Contributor

chrisvidal commented Oct 15, 2020

SQL Server]The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries

select * from [rainlab_blog_posts] where exists (select * from [rainlab_blog_categories] inner join [rainlab_blog_posts_categories] on [rainlab_blog_categories].[id] = [rainlab_blog_posts_categories].[category_id] where [rainlab_blog_posts].[id] = [rainlab_blog_posts_categories].[post_id] and [id] in (?) order by [nest_left] asc) order by [published_at] desc

@LukeTowers
Copy link
Contributor

@bennothommo can you take a look at the above?

@LukeTowers LukeTowers added Status: Completed Fix is completed and merged into the dev branch; remaining open until it has been merged into master Type: Bug Report that has been identified / verified as an issue requiring resolution and removed Status: Response Needed Requires / is waiting on a response from at least one of the participants Type: Unconfirmed Bug Report that hasn't been verified / reproduced by a maintainer or trusted community member yet labels Oct 15, 2020
@chrisvidal
Copy link
Contributor

Maybe it is better that I create a new thread for this?
(I am waiting to gain access to the client remote server through another remote pc to post the complete exception trace)

@bennothommo
Copy link
Contributor

Continuing thread in #525.

@chrisvidal
Copy link
Contributor

Since the last OC 471 update, my client is facing again the date error issue when creating new post.

OC #471
rainlab blog 1.4.3

here are the errors:

"Data missing" on line 917 of D:\STTC\vendor\nesbot\carbon\src\Carbon\Carbon.php

and

InvalidArgumentException: Data missing in D:\STTC\vendor\nesbot\carbon\src\Carbon\Carbon.php:917
Stack trace:
#0 D:\STTC\vendor\jenssegers\date\src\Date.php(100): Carbon\Carbon::createFromFormat()
#1 D:\STTC\vendor\october\rain\src\Database\Model.php(561): Jenssegers\Date\Date::createFromFormat()
#2 D:\STTC\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasAttributes.php(738): October\Rain\Database\Model->asDateTime()
#3 D:\STTC\vendor\october\rain\src\Database\Model.php(578): Illuminate\Database\Eloquent\Model->fromDateTime()
#4 D:\STTC\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasAttributes.php(532): October\Rain\Database\Model->fromDateTime()
#5 D:\STTC\vendor\october\rain\src\Database\Model.php(1213): Illuminate\Database\Eloquent\Model->setAttribute()
#6 D:\STTC\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1394): October\Rain\Database\Model->setAttribute()
#7 D:\STTC\vendor\october\rain\src\Extension\ExtendableTrait.php(390): Illuminate\Database\Eloquent\Model->__set()
#8 D:\STTC\vendor\october\rain\src\Database\Model.php(634): October\Rain\Database\Model->extendableSet()
#9 D:\STTC\modules\backend\traits\FormModelSaver.php(81): October\Rain\Database\Model->__set()
#10 D:\STTC\modules\backend\traits\FormModelSaver.php(40): Backend\Behaviors\FormController->setModelAttributes()
#11 D:\STTC\modules\backend\behaviors\FormController.php(249): Backend\Behaviors\FormController->prepareModelsToSave()
#12 [internal function]: Backend\Behaviors\FormController->create_onSave()
#13 D:\STTC\vendor\october\rain\src\Extension\ExtendableTrait.php(414): call_user_func_array()
#14 D:\STTC\modules\backend\classes\Controller.php(184): Backend\Classes\Controller->extendableCall()
#15 [internal function]: Backend\Classes\Controller->__call()
#16 D:\STTC\modules\backend\classes\Controller.php(620): call_user_func_array()
#17 D:\STTC\modules\backend\classes\Controller.php(478): Backend\Classes\Controller->runAjaxHandler()
#18 D:\STTC\modules\backend\classes\Controller.php(277): Backend\Classes\Controller->execAjaxHandlers()
#19 D:\STTC\modules\backend\classes\BackendController.php(165): Backend\Classes\Controller->run()
#20 [internal function]: Backend\Classes\BackendController->run()
#21 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Controller.php(54): call_user_func_array()
#22 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction()
#23 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Route.php(212): Illuminate\Routing\ControllerDispatcher->dispatch()
#24 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Route.php(169): Illuminate\Routing\Route->runController()
#25 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Router.php(658): Illuminate\Routing\Route->run()
#26 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#27 D:\STTC\modules\backend\classes\BackendController.php(68): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#28 D:\STTC\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(131): Backend\Classes\BackendController->Backend\Classes\{closure}()
#29 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#30 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#31 D:\STTC\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\Routing\Middleware\SubstituteBindings->handle()
#32 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#33 D:\STTC\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#34 D:\STTC\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\View\Middleware\ShareErrorsFromSession->handle()
#35 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#36 D:\STTC\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php(63): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#37 D:\STTC\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\Session\Middleware\StartSession->handle()
#38 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#39 D:\STTC\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#40 D:\STTC\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()
#41 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#42 D:\STTC\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php(68): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#43 D:\STTC\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\Cookie\Middleware\EncryptCookies->handle()
#44 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#45 D:\STTC\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#46 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Router.php(660): Illuminate\Pipeline\Pipeline->then()
#47 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Router.php(635): Illuminate\Routing\Router->runRouteWithinStack()
#48 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Router.php(601): Illuminate\Routing\Router->runRoute()
#49 D:\STTC\vendor\october\rain\src\Router\CoreRouter.php(20): Illuminate\Routing\Router->dispatchToRoute()
#50 D:\STTC\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(176): October\Rain\Router\CoreRouter->dispatch()
#51 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
#52 D:\STTC\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#53 D:\STTC\vendor\october\rain\src\Foundation\Http\Middleware\CheckForMaintenanceMode.php(25): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle()
#54 D:\STTC\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): October\Rain\Foundation\Http\Middleware\CheckForMaintenanceMode->handle()
#55 D:\STTC\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#56 D:\STTC\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#57 D:\STTC\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(151): Illuminate\Pipeline\Pipeline->then()
#58 D:\STTC\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#59 D:\STTC\index.php(43): Illuminate\Foundation\Http\Kernel->handle()

@chrisvidal
Copy link
Contributor

Apparently, the vendor/october/rain/src/database/Model.php is still causing the same issue in this OC #471

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Completed Fix is completed and merged into the dev branch; remaining open until it has been merged into master Type: Bug Report that has been identified / verified as an issue requiring resolution
Projects
None yet
Development

No branches or pull requests

5 participants