Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Columns named with a number result in fatal error #1060

Open
Riyuri opened this issue Sep 3, 2022 · 1 comment
Open

Columns named with a number result in fatal error #1060

Riyuri opened this issue Sep 3, 2022 · 1 comment

Comments

@Riyuri
Copy link

Riyuri commented Sep 3, 2022

Information

  • Version of Medoo: 2.1.7
  • Version of PHP: 7.3.5
  • Type of Database (MySQL, MSSQL, SQLite...): MySQL
  • System (Linux|Windows|Mac): Windows

Describe the Problem
Selecting columns which contain only numbers throw a fatal error. It didn't do that in Medoo Version 1.7.10.

Notice: Undefined index: column in C:\xampp\htdocs\folder\Medoo.php on line 816

Fatal error: Uncaught TypeError: Argument 1 passed to Medoo\Medoo::columnQuote() must be of the type string, null given, called in C:\xampp\htdocs\folder\Medoo.php on line 816 and defined in C:\xampp\htdocs\folder\Medoo.php:726 Stack trace: #0 C:\xampp\htdocs\folder\Medoo.php(816): Medoo\Medoo->columnQuote(NULL) #1 C:\xampp\htdocs\folder\Medoo.php(1226): Medoo\Medoo->columnPush(Array, Array, true, false) #2 C:\xampp\htdocs\folder\Medoo.php(1908): Medoo\Medoo->selectContext('"table"', Array, '1', Array, Array) #3 C:\xampp\htdocs\folder\subfolder\profil.php(220): Medoo\Medoo->get('table', '1', Array) #4 {main} thrown in C:\xampp\htdocs\folder\Medoo.php on line 726

Detail Code

$variable = $database->get("table", "1", ["id" => $user_id]);

//These produce similar results:
$variable = $database->get("table", ["1", "2", "3"], ["id" => $user_id]);
$variable = $database->select("table", "2");
if ($database->has("table", ["3[!]" => 0])) { }

//This one works though:
$variable = $database->get("table", "*", ["id" => $user_id]);
@Nachtgesicht
Copy link

I have the same problem. My colum name (1_fahren) has an number in the beginning:
"mod_fcgid: stderr: PHP Fatal error: Uncaught InvalidArgumentException: Incorrect column name: 1_fahren"

Version of Medoo: 2.1.10
Version of PHP: 8.0.30

Can you fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants