Blog demo does not work

Framework: svn (r1077)

Application: Blog demo from above svn

OS: Linux 2.6.23.17-88.fc7

When I try to post a new post, I find this error.

Error message:

Quote

CDbException

Description

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1 near ")": syntax error

Source File

/var/www/html/yii/yii-svn/framework/db/CDbCommand.php(211)

Stack Trace

#0 /var/www/html/yii/yii-svn/framework/db/ar/CActiveRecord.php(838): CDbCommand->execute()

#1 /var/www/html/yii/yii-svn/framework/db/ar/CActiveRecord.php(649): CActiveRecord->insert(NULL)

#2 /var/www/html/yii/yii-svn/demos/blog/protected/models/Post.php(115): CActiveRecord->save()

#3 /var/www/html/yii/yii-svn/framework/db/ar/CActiveRecord.php(857): Post->afterSave()

#4 /var/www/html/yii/yii-svn/framework/db/ar/CActiveRecord.php(649): CActiveRecord->insert(NULL)

#5 /var/www/html/yii/yii-svn/demos/blog/protected/controllers/PostController.php(102): CActiveRecord->save()

#6 /var/www/html/yii/yii-svn/framework/web/actions/CInlineAction.php(32): PostController->actionCreate()

#7 /var/www/html/yii/yii-svn/framework/web/CController.php(300): CInlineAction->run()

#8 /var/www/html/yii/yii-svn/framework/web/filters/CFilterChain.php(129): CController->runAction(Object(CInlineAction))

#9 /var/www/html/yii/yii-svn/framework/web/filters/CFilter.php(41): CFilterChain->run()

#10 /var/www/html/yii/yii-svn/framework/web/CController.php(949): CFilter->filter(Object(CFilterChain))

#11 /var/www/html/yii/yii-svn/framework/web/filters/CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain))

#12 /var/www/html/yii/yii-svn/framework/web/filters/CFilterChain.php(126): CInlineFilter->filter(Object(CFilterChain))

#13 /var/www/html/yii/yii-svn/framework/web/CController.php(283): CFilterChain->run()

#14 /var/www/html/yii/yii-svn/framework/web/CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)

#15 /var/www/html/yii/yii-svn/framework/web/CWebApplication.php(332): CController->run('create')

#16 /var/www/html/yii/yii-svn/framework/web/CWebApplication.php(120): CWebApplication->runController('post/create')

#17 /var/www/html/yii/yii-svn/framework/base/CApplication.php(133): CWebApplication->processRequest()

#18 /var/www/html/yii/yii-svn/demos/blog/index.php(11): CApplication->run()

#19 {main}

Did you make any change to the demo? What did you enter to reproduce the issue? I couldn't reproduce it. Are you using trunk or 1.0 branch?

Quote

Did you make any change to the demo?

Of course, not.

Quote

What did you enter to reproduce the issue?

What I have done is very simple.

  1. $ cd /webroot/

  2. $ ls .

CHANGELOG LICENSE (snip) demos framework (snip)

  1. $ svn checkout http://yii.googlecode.com/svn/trunk/ yii-read-only

  2. $ cd yii-read-only/demos

  3. $ chmod -R 777 */assets

  4. $ chmod -R 777 */protected/runtime

  5. $ chmod 777 */protected/data

  6. $ chmod 666 /protected/data/.db

  7. Access to http://localhost/yii…only/demos/blog

  8. Showing a post is OK.

  9. Creating a post makes such a error.

Quote

Are you using trunk or 1.0 branch?

I am using trunk as the 3rd step shows.

hmm…I still could reproduce the issue (tried on both windows and linux).

Did you enter specific content in the form to get this issue?

Quote

Did you enter specific content in the form to get this issue?

I found that when the tag is blank, the error does not occur. When I enter a word to the tag field, the error always occurs. Then I redraw the top page, the post was inserted successfully (in terms of title and content) without any tags.

I still couldn't reproduce the issue. What tag did you enter? Do you have a log of the SQL statement that is causing the error?

Here is the log when I enterd 'cc' in the tag.

Quote

2009/06/03 11:05:01 [trace] [system.web.CModule] Loading "log" application component

2009/06/03 11:05:01 [trace] [system.web.CModule] Loading "request" application component

2009/06/03 11:05:01 [trace] [system.web.CModule] Loading "urlManager" application component

2009/06/03 11:05:01 [trace] [system.web.filters.CFilterChain] Running filter PostController.filteraccessControl()

2009/06/03 11:05:01 [trace] [system.web.CModule] Loading "user" application component

2009/06/03 11:05:01 [trace] [system.web.CModule] Loading "session" application component

2009/06/03 11:05:01 [trace] [system.web.CModule] Loading "db" application component

2009/06/03 11:05:01 [trace] [system.db.CDbConnection] Opening DB connection

2009/06/03 11:05:01 [trace] [system.db.CDbCommand] Querying SQL: PRAGMA table_info('Post')

2009/06/03 11:05:01 [trace] [system.db.CDbCommand] Querying SQL: PRAGMA foreign_key_list('Post')

2009/06/03 11:05:01 [trace] [system.db.ar.CActiveRecord] Post.insert()

2009/06/03 11:05:01 [trace] [system.db.CDbCommand] Executing SQL: INSERT INTO 'Post' ("commentCount", "title", "content", "tags", "status", "contentDisplay", "updateTime", "createTime", "authorId") VALUES (:_p0, :_p1, :_p2, :_p3, :_p4, :_p5, :_p6, :_p7, :_p8)

2009/06/03 11:05:01 [trace] [system.db.CDbCommand] Querying SQL: PRAGMA table_info('Tag')

2009/06/03 11:05:01 [trace] [system.db.CDbCommand] Querying SQL: PRAGMA foreign_key_list('Tag')

2009/06/03 11:05:01 [trace] [system.db.ar.CActiveRecord] Tag.findByAttributes()

2009/06/03 11:05:01 [trace] [system.db.CDbCommand] Querying SQL: SELECT * FROM 'Tag' WHERE 'Tag'."name"=:_p0 LIMIT 1

2009/06/03 11:05:01 [trace] [system.db.ar.CActiveRecord] Tag.insert()

2009/06/03 11:05:01 [trace] [system.db.CDbCommand] Executing SQL: INSERT INTO 'Tag' () VALUES ()

2009/06/03 11:05:01 [error] [system.db.CDbCommand] Error in executing SQL: INSERT INTO 'Tag' () VALUES ()

2009/06/03 11:05:01 [trace] [system.web.CModule] Loading "coreMessages" application component

2009/06/03 11:05:01 [error] [exception.CDbException] exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1 near ")": syntax error' in /var/www/html/yii/yii-read-only/framework/db/CDbCommand.php:211

Thanks! Found and fixed the bug.

Quote

Thanks! Found and fixed the bug.

You are welcome, Qiang. :)

P.S. I have confirmed that it is working now (r1085).