[wp-trac] [WordPress Trac] #34708: Empty DB_CHARSET leads to error in strip_invalid_text
WordPress Trac
noreply at wordpress.org
Tue Nov 17 05:50:56 UTC 2015
#34708: Empty DB_CHARSET leads to error in strip_invalid_text
--------------------------+-----------------
Reporter: rmccue | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.4
Component: Database | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------
Found this while running unit tests without `DB_CHARSET` defined.
`wpdb::strip_invalid_text` assumes `$wpdb->charset` is set and uses it in
a query.
For the unit tests, this causes
`test_strip_invalid_text_from_query_cp1251_is_safe` to fail:
{{{
WordPress database error You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax
to use near ') AS x_0' at line 1 for query SELECT CONVERT( CONVERT(
'INSERT INTO test_cp1251_query_d9187( `a` ) VALUES( \'safe data\' )' USING
cp1251 ) USING ) AS x_0 made by PHPUnit_TextUI_Command::main,
PHPUnit_TextUI_Command->run, PHPUnit_TextUI_TestRunner->doRun,
PHPUnit_Framework_TestSuite->run, PHPUnit_Framework_TestSuite->run,
PHPUnit_Framework_TestCase->run, PHPUnit_Framework_TestResult->run,
PHPUnit_Framework_TestCase->runBare, PHPUnit_Framework_TestCase->runTest,
ReflectionMethod->invokeArgs,
Tests_DB_Charset->test_strip_invalid_text_from_query_cp1251_is_safe,
wpdb_exposed_methods_for_testing->strip_invalid_text_from_query,
wpdb_exposed_methods_for_testing->__call, call_user_func_array
}}}
Since at least [33310].
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34708>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list