2024-03-01, 06:48 PM
(This post was last modified: 2024-03-02, 12:49 PM by Crazy Jane. Edited 6 times in total.)
I know that Wildcard discontinued support for this Plugin ages ago, and my initial course of action was to see if anyone was game for a replacement, but after nearly a week without response to the matter I've come to the conclusion that I was too hasty to abandon the notion of just fixing what's broken.
Through the power of error logging, I've figured out that the problem seems to be boolean properties that are initially set as "false" are instead fed into the database insertion query's array as Null values that are then rejected at insertion time. I also have a general window of when it happens in both major cases it's come up (making new YourCodes and porting old MyCodes on plugin install, in both cases likely prior to entry #4 of the backtrace), but thanks to my limited understanding of PHP I've hit a wall in diagnosing the actual discrepancy in the code.
For two examples of this happening, here is a quick snippet of two separate incidents from my Error Logs, with the root directory censored to "{$mybb->settings['bburl']}" to protect private information as this is a local install of myBB.
Case #1: Installing the YourCode plugin. The error occurs when the installation attempts to convert existing MyCodes to YourCodes.
Case #2: Attempting to make a YourCode. Again, the makings of the error seem to lie within the same apparent FALSE to NULL problem.
Strangely, this doesn't seem to happen with booleans set to "true". Could someone a little better versed in PHP tell me where the problem is and possibly offer a solution?
Through the power of error logging, I've figured out that the problem seems to be boolean properties that are initially set as "false" are instead fed into the database insertion query's array as Null values that are then rejected at insertion time. I also have a general window of when it happens in both major cases it's come up (making new YourCodes and porting old MyCodes on plugin install, in both cases likely prior to entry #4 of the backtrace), but thanks to my limited understanding of PHP I've hit a wall in diagnosing the actual discrepancy in the code.
For two examples of this happening, here is a quick snippet of two separate incidents from my Error Logs, with the root directory censored to "{$mybb->settings['bburl']}" to protect private information as this is a local install of myBB.
Case #1: Installing the YourCode plugin. The error occurs when the installation attempts to convert existing MyCodes to YourCodes.
<error>
<dateline>1709168682</dateline>
<script></script>
<line>0</line>
<type>20</type>
<friendly_type>MyBB SQL Error</friendly_type>
<message>SQL Error: 1366 - Incorrect integer value: '' for column 'nestable' at row 1
Query:
INSERT
INTO mybb_yourcode (`title`,`description`,`parse_order`,`nestable`,`active`,`case_sensitive`,`single_line`,`multi_line`,`eval`,`callback`,`regex`,`replacement`,`alt_replacement`,`can_use`,`can_view`,`default_id`,`dateline`)
VALUES ('Format - Bold','MyBB Default Bold MyCode',10,'','1','','1','','','','\\[b\\](.*?)\\[/b\\]','<span style=\"font-weight: bold;\" class=\"mycode_b\">$1</span>','','','',1,1709168682)
</message>
<back_trace>#0 errorHandler->error() called at [{$mybb->settings['bburl']}\inc\db_mysqli.php:609]
#1 DB_MySQLi->error() called at [{$mybb->settings['bburl']}\inc\db_mysqli.php:345]
#2 DB_MySQLi->query() called at [{$mybb->settings['bburl']}\inc\db_mysqli.php:378]
#3 DB_MySQLi->write_query() called at [{$mybb->settings['bburl']}\inc\db_mysqli.php:843]
#4 DB_MySQLi->insert_query() called at [{$mybb->settings['bburl']}\inc\plugins\yourcode\classes\StorableObject010000.php:136]
#5 StorableObject010000->save() called at [{$mybb->settings['bburl']}\inc\plugins\yourcode\install.php:297]
#6 yourcode_port_old_mycode() called at [{$mybb->settings['bburl']}\inc\plugins\yourcode\install.php:134]
#7 yourcode_install() called at [[PHP]: ]
#8 call_user_func() called at [{$mybb->settings['bburl']}\admin\modules\config\plugins.php:432]
#9 require() called at [{$mybb->settings['bburl']}\admin\index.php:830]
</back_trace>
</error>
Case #2: Attempting to make a YourCode. Again, the makings of the error seem to lie within the same apparent FALSE to NULL problem.
<error>
<dateline>1709169542</dateline>
<script></script>
<line>0</line>
<type>20</type>
<friendly_type>MyBB SQL Error</friendly_type>
<message>SQL Error: 1366 - Incorrect integer value: '' for column 'default_id' at row 1
Query:
INSERT
INTO mybb_yourcode (`title`,`description`,`parse_order`,`nestable`,`active`,`case_sensitive`,`single_line`,`multi_line`,`eval`,`callback`,`regex`,`replacement`,`alt_replacement`,`can_use`,`can_view`,`default_id`,`dateline`)
VALUES ('Ipsum','A test of the YourCode module.','10','0','1','0','0','1','0','0','IPSUM','DOLOR','','','','',1709169542)
</message>
<back_trace>#0 errorHandler->error() called at [{$mybb->settings['bburl']}\inc\db_mysqli.php:609]
#1 DB_MySQLi->error() called at [{$mybb->settings['bburl']}\inc\db_mysqli.php:345]
#2 DB_MySQLi->query() called at [{$mybb->settings['bburl']}\inc\db_mysqli.php:378]
#3 DB_MySQLi->write_query() called at [{$mybb->settings['bburl']}\inc\db_mysqli.php:843]
#4 DB_MySQLi->insert_query() called at [{$mybb->settings['bburl']}\inc\plugins\yourcode\classes\StorableObject010000.php:136]
#5 StorableObject010000->save() called at [{$mybb->settings['bburl']}\inc\plugins\yourcode\acp.php:364]
#6 yourcode_admin_edit() called at [{$mybb->settings['bburl']}\inc\plugins\yourcode\acp.php:62]
#7 yourcode_admin() called at [{$mybb->settings['bburl']}\inc\class_plugins.php:142]
#8 pluginSystem->run_hooks() called at [{$mybb->settings['bburl']}\admin\index.php:828]
</back_trace>
</error>
Strangely, this doesn't seem to happen with booleans set to "true". Could someone a little better versed in PHP tell me where the problem is and possibly offer a solution?