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

DateTime error in 3.2.0 #8132

Closed
ghost opened this issue Jan 30, 2016 · 8 comments
Closed

DateTime error in 3.2.0 #8132

ghost opened this issue Jan 30, 2016 · 8 comments

Comments

@ghost
Copy link

ghost commented Jan 30, 2016

/src/Database/Type/DateTimeType.php (line 125)
object(Cake\I18n\Time) {

    'time' => '2016-01-30T14:04:48+00:00',
    'timezone' => 'UTC',
    'fixedNowTime' => false

}
Warning (2): DateTime::modify() [datetime.modify]: Failed to parse time string (30/08/2015 13:49) at position 0 (3): Unexpected character [CORE/src/Database/Type/DateTimeType.php, line 126]
Code Context
DateTime::modify() - [internal], line ??
Cake\Database\Type\DateTimeType::toPHP() - CORE/src/Database/Type/DateTimeType.php, line 126
Cake\Database\FieldTypeConverter::__invoke() - CORE/src/Database/FieldTypeConverter.php, line 77
Cake\Database\Statement\CallbackStatement::fetch() - CORE/src/Database/Statement/CallbackStatement.php, line 58
Cake\ORM\ResultSet::_fetchResult() - CORE/src/ORM/ResultSet.php, line 455
Cake\ORM\ResultSet::valid() - CORE/src/ORM/ResultSet.php, line 268
iterator_to_array - [internal], line ??
Cake\ORM\ResultSet::toArray() - CORE/src/Collection/CollectionTrait.php, line 478
Cake\ORM\Query::toArray() - CORE/src/Datasource/QueryTrait.php, line 288
DebugKit\Panel\VariablesPanel::DebugKit\Panel\{closure}() - ROOT/vendor/cakephp/debug_kit/src/Panel/VariablesPanel.php, line 77
array_walk_recursive - [internal], line ??
DebugKit\Panel\VariablesPanel::shutdown() - ROOT/vendor/cakephp/debug_kit/src/Panel/VariablesPanel.php, line 106
Cake\Event\EventManager::_callListener() - CORE/src/Event/EventManager.php, line 385
Cake\Event\EventManager::dispatch() - CORE/src/Event/EventManager.php, line 355
Cake\Controller\Controller::dispatchEvent() - CORE/src/Event/EventDispatcherTrait.php, line 78
Cake\Controller\Controller::shutdownProcess() - CORE/src/Controller/Controller.php, line 513
Cake\Routing\Dispatcher::_invoke() - CORE/src/Routing/Dispatcher.php, line 125
@antograssiot
Copy link
Contributor

@creaweb06 could you show some code that help someone to reproduce your issue ?

@antograssiot antograssiot added this to the 3.2.1 milestone Jan 30, 2016
@markstory markstory modified the milestones: 3.2.1, 3.2.2 Jan 31, 2016
@ghost
Copy link
Author

ghost commented Jan 31, 2016

Hi,

$this->NameTables->find('all') ->where(['NameTables.user_id' => $this->Auth->user('id')]);

This work perfectly with 3.1.9 version, but in 3.2.0, i have this bug.
My request read a datetime mysql field with this value in created and modified column : 2015-08-30 13:49:48
Same defect with PHP 5.6 and 7.0

Thanks

@markstory
Copy link
Member

From looking at the exception message are your datetime values coming out of the database formatted like 30/08/2015 13:49?

@ghost
Copy link
Author

ghost commented Jan 31, 2016

No, in my database (mysql datetime), i have :

2015-08-30 13:49:48

@ghost
Copy link
Author

ghost commented Jan 31, 2016

And it work perfectly with cakephp 3.1.9 and previous.
Only cakephp 3.2 has this bug for me with the same database.

@dereuromark
Copy link
Member

Might also be related to https://github.com/cakephp/cakephp/pull/8146/files#r51362765
It would be good if Time itself checks on immutable and would not modify the object in that case until it is cloned first or sth.

@markstory
Copy link
Member

@creaweb06 Ok I am not sure how to reproduce this issue. I tried locally to load some data with datetimes in the results and didn't encounter any issues. Do you have a default locale set in PHP or a locale set in the database connection?

@ghost
Copy link
Author

ghost commented Feb 2, 2016

After a mysql restart => no bug ...
Sorry for this issue !

@ghost ghost closed this as completed Feb 2, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants