PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » MDB2 » Bug #5294

column names specified in "alais" should be backticked

Details

Submitted2005-09-05 00:25 UTC
Fromtommythekid at gmail dot com
Assignedlsmith
StatusClosed
PackageMDB2
PHP Version5.0.4
OSMacOS
Roadmaps(Not assigned)

Comments

[2005-09-05 00:25 UTC] tommythekid at gmail dot com

Description:
------------
if I specify that I want the "passwd" column to be named "password" (to be compliant with another application that will use this table as well).. I get a horrible crashdump. I believe this could be fixed by enclosing whatever the user specifies in "alias" with backticks so that, just incase it would conflict with a keyword like "password" it would still work.

Test script:
---------------
'alias' => array(
'users' => 'wq_users',
'auth_user_id' => 'user_id',
'handle' => 'username',
'passwd' => 'password',
),

Expected result:
----------------
it should work and name the password column `password`

Actual result:
--------------
it barfs all over the place (probably a result of the error handler)

Fudge:~/tmp tommy$ php install.php
<pre>int(1)
object(MDB2_Error)#9 (8) {
["error_message_prefix"]=>
string(0) ""
["mode"]=>
int(1)
["level"]=>
int(1024)
["code"]=>
int(-33)
["message"]=>
string(38) "MDB2 Error: manager schema parse error"
["userinfo"]=>
string(90) "Parser error: fieldname "password" not allowed - No error - Byte: 591; Line: 35; Col: 275
"
["backtrace"]=>
array(12) {
[0]=>
array(6) {
["file"]=>
string(21) "/usr/lib/php/MDB2.php"
["line"]=>
int(846)
["function"]=>
string(10) "PEAR_Error"
["class"]=>
string(10) "MDB2_Error"
["type"]=>
string(2) "->"
["args"]=>
array(5) {
[0]=>
string(38) "MDB2 Error: manager schema parse error"
[1]=>
int(-33)
[2]=>
int(1)
[3]=>
int(1024)
[4]=>
string(90) "Parser error: fieldname "password" not allowed - No error - Byte: 591; Line: 35; Col: 275
"
}
}
[1]=>
array(6) {
["file"]=>
string(21) "/usr/lib/php/PEAR.php"
["line"]=>
int(540)
["function"]=>
string(10) "MDB2_Error"
["class"]=>
string(10) "MDB2_Error"
["type"]=>
string(2) "->"
["args"]=>
array(4) {
[0]=>
int(-33)
[1]=>
int(1)
[2]=>
int(1024)
[3]=>
string(90) "Parser error: fieldname "password" not allowed - No error - Byte: 591; Line: 35; Col: 275
"
}
}
[2]=>
array(6) {
["file"]=>
string(21) "/usr/lib/php/MDB2.php"
["line"]=>
int(486)
["function"]=>
string(10) "raiseError"
["class"]=>
string(18) "MDB2_Schema_Parser"
["type"]=>
string(2) "->"
["args"]=>
array(7) {
[0]=>
NULL
[1]=>
int(-33)
[2]=>
NULL
[3]=>
NULL
[4]=>
string(90) "Parser error: fieldname "password" not allowed - No error - Byte: 591; Line: 35; Col: 275
"
[5]=>
string(10) "MDB2_Error"
[6]=>
bool(true)
}
}
[3]=>
array(6) {
["file"]=>
string(35) "/usr/lib/php/MDB2/Schema/Parser.php"
["line"]=>
int(460)
["function"]=>
string(10) "raiseError"
["class"]=>
string(18) "MDB2_Schema_Parser"
["type"]=>
string(2) "->"
["args"]=>
array(4) {
[0]=>
int(-33)
[1]=>
NULL
[2]=>
NULL
[3]=>
string(90) "Parser error: fieldname "password" not allowed - No error - Byte: 591; Line: 35; Col: 275
"
}
}
[4]=>
array(6) {
["file"]=>
string(35) "/usr/lib/php/MDB2/Schema/Parser.php"
["line"]=>
int(217)
["function"]=>
string(10) "raiseError"
["class"]=>
string(18) "MDB2_Schema_Parser"
["type"]=>
string(2) "->"
["args"]=>
array(3) {
[0]=>
string(32) "fieldname "password" not allowed"
[1]=>
NULL
[2]=>
resource(28) of type (xml)
}
}
[5]=>
array(6) {
["file"]=>
string(27) "/usr/lib/php/XML/Parser.php"
["line"]=>
int(500)
["function"]=>
string(10) "endHandler"
["class"]=>
string(18) "MDB2_Schema_Parser"
["type"]=>
string(2) "->"
["args"]=>
array(2) {
[0]=>
resource(28) of type (xml)
[1]=>
string(5) "FIELD"
}
}
[6]=>
array(4) {
["file"]=>
string(27) "/usr/lib/php/XML/Parser.php"
["line"]=>
int(500)
["function"]=>
string(9) "xml_parse"
["args"]=>
array(3) {
[0]=>
resource(28) of type (xml)
[1]=>
string(1465) "<?xml version="1.0" encoding="ISO-8859-1" ?>
<database>

<name><variable>database</variable></name>
<create><variable>create</variable></create>

<table>

<name>wq_users</name>

<declaration>

<field>
<name>user_id</name>
<type>text</type>
<length>32</length>
<notnull>1</notnull>
<default></default>
</field>

<field>
<name>username</name>
<type>text</type>
<length>32</length>
<notnull>1</notnull>
<default></default>
</field>

<field>
<name>password</name>
<type>text</type>
<length>32</length>
<notnull>1</notnull>
<default></default>
</field>

<field>
<name>lastLogin</name>
<type>timestamp</type>
<notnull>1</notnull>
<default></default>
</field>

<field>
<name>isActive</name>
<type>boolean</type>
<notnull>1</notnull>
<default></default>
</field>

<field>
<name>owner_user_id</name>
<type>integer</type>
</field>

<field>
<name>owner_group_id</name>
<type>integer</type>
</field>

<index>
<name>users_user_id</name>
<unique>1</unique>
<field>
<name>user_id</name>
</field>
</index>

<index>
<name>users_unique_i</name>
<unique>1</unique>
<field>
<name>username</name>
</field>
</index>

</declaration>

</table>

<sequence>
<name>wq_users</name>
<on>
<table>wq_users</table>
<field>user_id</field>
</on>
</sequence>

</database>
"
[2]=>
int(1)
}
}
[7]=>
array(6) {
["file"]=>
string(27) "/usr/lib/php/XML/Parser.php"
["line"]=>
int(470)
["function"]=>
string(12) "_parseString"
["class"]=>
string(18) "MDB2_Schema_Parser"
["type"]=>
string(2) "->"
["args"]=>
array(2) {
[0]=>
string(1465) "<?xml version="1.0" encoding="ISO-8859-1" ?>
<database>

<name><variable>database</variable></name>
<create><variable>create</variable></create>

<table>

<name>wq_users</name>

<declaration>

<field>
<name>user_id</name>
<type>text</type>
<length>32</length>
<notnull>1</notnull>
<default></default>
</field>

<field>
<name>username</name>
<type>text</type>
<length>32</length>
<notnull>1</notnull>
<default></default>
</field>

<field>
<name>password</name>
<type>text</type>
<length>32</length>
<notnull>1</notnull>
<default></default>
</field>

<field>
<name>lastLogin</name>
<type>timestamp</type>
<notnull>1</notnull>
<default></default>
</field>

<field>
<name>isActive</name>
<type>boolean</type>
<notnull>1</notnull>
<default></default>
</field>

<field>
<name>owner_user_id</name>
<type>integer</type>
</field>

<field>
<name>owner_group_id</name>
<type>integer</type>
</field>

<index>
<name>users_user_id</name>
<unique>1</unique>
<field>
<name>user_id</name>
</field>
</index>

<index>
<name>users_unique_i</name>
<unique>1</unique>
<field>
<name>username</name>
</field>
</index>

</declaration>

</table>

<sequence>
<name>wq_users</name>
<on>
<table>wq_users</table>
<field>user_id</field>
</on>
</sequence>

</database>
"
[big snip]