#6021: Wrong timestamp saving for automatic fields "created" and "modified"
-----------------------------------------+----------------------------------
    Reporter:  bugmenot                  |         Owner:           
        Type:  Test Case                 |        Status:  new      
    Priority:  Medium                    |     Milestone:  1.2.x.x  
   Component:  General                   |       Version:  1.2 Final
    Severity:  Normal                    |    Resolution:           
    Keywords:  mysql, CURRENT_TIMESTAMP  |   Php_version:  PHP 5    
Cake_version:  1.2.1.8004                |  
-----------------------------------------+----------------------------------
Comment (by bugmenot):

 I don't know how to make a test case, but you can reproduce this doing:

 1. Download CakePHP 1.2.1.8004

 2. Unpack it on someplace in ~/public_html

 3. Add this model to app/models/obj.php:
    {{{
    <?php

    class Obj extends AppModel
    {
         var $name = "Obj";
    }

    ?>
    }}}

 4. Create a MySQL database and table like this:
    {{{
    CREATE DATABASE caketest;
    USE caketest;
    CREATE TABLE objs (
        id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
        name VARCHAR(255) NOT NULL,
        created TIMESTAMP NOT NULL,
        modified TIMESTAMP NOT NULL
    );
    }}}

 5. Go bake the controller and views:
    {{{
    cake-root$ bash cake/console/cake bake controller Objs scaffold admin
    (answer with the defaults)
    cake-root$ bash cake/console/cake bake view Objs
    }}}

 6. Don't use mod_rewrite:
    {{{
    cake-root$ rm .htaccess app/.htaccess app/webroot/.htaccess
    cake-root$ edit app/config/core.php # uncomment
 Configure::write('App.baseUrl', env('SCRIPT_NAME'));
    }}}

 7. Edit `app/config/core.php` salt

 8. Configure `app/config/database.php`

 9. Give write permissions to Apache in the app/tmp directory

 10. Go to the web browser and enter cake-root/index.php/admin/objs/add

 11. Write something in the "Name" field and submit the form

 12. See how created and modified are both set to '0000-00-00 00:00:00'.

 I hope it helps.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/6021#comment:2>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to tickets-cakephp@googlegroups.com
To unsubscribe from this group, send email to 
tickets-cakephp+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to