Log message #4102982

# At Username Text
# Dec 12th 2017, 16:34 hmic flavius: makes sense, as this is what gets set to intl.default_locale, which php internally uses to determine the timezone to use on outputting date/time related data
# Dec 12th 2017, 16:34 dereuromark but if you are a beginner maybe stick to easier things here
# Dec 12th 2017, 16:34 V99 is not my code hmic im trying to solve two bugs, the person that developed this code nowadays is not working on the factory
# Dec 12th 2017, 16:34 dereuromark V99: I usually recommend the Passwordable behavior as it is exactly doing what you want. It also keeps things DRY and out of the model itself etc.
# Dec 12th 2017, 16:33 hmic additionally you *cannot* use the authcomponent from within the model scope, but the password hasher directly!
# Dec 12th 2017, 16:33 flavius switching from `'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_US'),` to my locale outputs 2017 correctly in both web and CLI
# Dec 12th 2017, 16:32 hmic the beforeSave is the wrong place to hash the password, it should be in the entity class instead
# Dec 12th 2017, 16:32 hmic btw. your code fragment it is wrong and bad practice on multiple levels!
# Dec 12th 2017, 16:32 hmic this is what i am talking about all the time.
# Dec 12th 2017, 16:32 hmic once you are to the file, you are done.
# Dec 12th 2017, 16:31 hmic you will find it instantiates a password hasher class as per the appcomponent config
# Dec 12th 2017, 16:31 hmic so now you check what that function deos next
# Dec 12th 2017, 16:31 V99 I'm sorry hmic, my English is not good and I can not explain myself well, I'm looking for what password hashing system i use first and i find a file called User.php that have the next function: https://pastebin.com/TX0ka0gW
# Dec 12th 2017, 16:26 neon1024 Perhaps try the Cakebox VM?
# Dec 12th 2017, 16:26 hmic i'd rather be interested in fixing my (dev)environment instead :P
# Dec 12th 2017, 16:26 flavius ill just use `format()` instead
# Dec 12th 2017, 16:26 flavius you know what? i give up :)
# Dec 12th 2017, 16:25 neothermic sweet
# Dec 12th 2017, 16:25 flavius this is nucking futz
# Dec 12th 2017, 16:25 flavius File uploaded https://cakesf.slack.com/files/U75U0UMR9/F8DD4P11R/image.png / https://slack-files.com/T053DPNCM-F8DD4P11R-cf11268370
# Dec 12th 2017, 16:24 GuillaumeP -> when using PHP 7.x ?
# Dec 12th 2017, 16:24 GuillaumeP are you aware of a type error in ErrorHandlerMiddleware.php on line 167 ??
# Dec 12th 2017, 16:19 hmic but you can have a look at the password hasher class used
# Dec 12th 2017, 16:19 hmic so no.
# Dec 12th 2017, 16:19 hmic v99: you want to reimplement using VB as far as i understand
# Dec 12th 2017, 16:19 V99 hmic: maybe i can use AuthComponent::password?
# Dec 12th 2017, 16:18 neothermic possibly also `dump(date_default_timezone_get());` as well
# Dec 12th 2017, 16:17 flavius okay
# Dec 12th 2017, 16:17 neothermic @flavius add: `dump($time->i18nFormat(\IntlDateFormatter::FULL)); as the last line in that set, re-run? :slightly_smiling_face:
# Dec 12th 2017, 16:17 flavius date_default_timezone_set is already in php.ini which both the web server and CLI already loaded
# Dec 12th 2017, 16:15 flavius checking CLI with `php --ini` ... it runs through the same php.ini file
# Dec 12th 2017, 16:15 hmic right before your code?
# Dec 12th 2017, 16:15 hmic flavius: did you set the timezone using date_default_timezone_set in the webserver example
# Dec 12th 2017, 16:14 flavius left is through web server, right is CLI
# Dec 12th 2017, 16:14 flavius File uploaded https://cakesf.slack.com/files/U75U0UMR9/F8EH650DD/image.png / https://slack-files.com/T053DPNCM-F8EH650DD-7d9507e45a
# Dec 12th 2017, 16:14 flavius output
# Dec 12th 2017, 16:14 flavius ``` $time = new \Cake\I18n\Time('last day of this year'); dump($time); dump($time->i18nFormat()); dump($time->i18nFormat('YYYY'));```
# Dec 12th 2017, 16:14 flavius ```
# Dec 12th 2017, 16:14 flavius code
# Dec 12th 2017, 16:13 neothermic (i.e. use `i18nFormat(\IntlDateFormatter::FULL);`)
# Dec 12th 2017, 16:11 neothermic @flavius for giggles, output the whole timestamp as per what i18nformat thinks it is. I suspect what's happening is you're passing in a timestamp in UTC, but your local timezone in PHP is forward of UTC, so it's correctly outputting 2018.