Solved Bugs, bugs again, everywhere...

NikitOS

Registered
Registered
Upgrade Coupons
Credit System
Joined
May 15, 2020
Messages
23
Reaction score
7
Hello

Many bugs again.

#1: Invalid payment provider class specified during installation.
\XenSoluce\CreditSystem\Setup :: installStep2:
PHP:
public function installStep2(array $stepParams = [])
{
    $db = $this->db();
    $db->query('INSERT INTO `xf_payment_provider`(`provider_id`, `provider_class`, `addon_id`) VALUES (\'XenSoluce_credit\',\'XenSoluce\CreditSystem:Credits\',\'XenSoluce/CreditSystem\')');
}
Since the backslash is not escaped, a "XenSoluceCreditSystem:Credits" is inserted into the table instead of "XenSoluce\CreditSystem:Credits"
It should look like this:
PHP:
public function installStep2(array $stepParams = [])
{
    $db = $this->db();
    $db->query('INSERT INTO `xf_payment_provider`(`provider_id`, `provider_class`, `addon_id`) VALUES (\'XenSoluce_credit\',\'XenSoluce\\CreditSystem:Credits\',\'XenSoluce/CreditSystem\')');
}


#2: «Trying to get property 'title' of non-object» when reply to the thread and clicking on the "like" button.
One error for both actions.
ErrorException: [E_NOTICE] Trying to get property 'title' of non-object - src/addons/XenSoluce/CreditSystem/Entity/CreditsTransaction.php:193
[/PLAIN]
#0 src/addons/XenSoluce/CreditSystem/Entity/CreditsTransaction.php(193): XF::handlePhpError(8, '[E_NOTICE] Tryi...', '/sites/mvdev.ml...', 193, Array)
#1 src/addons/XenSoluce/CreditSystem/Service/Notifier.php(72): XenSoluce\CreditSystem\Entity\CreditsTransaction->getTitleNotifier()
#2 src/addons/XenSoluce/CreditSystem/Service/Notifier.php(54): XenSoluce\CreditSystem\Service\Notifier->_sendNotifications('reaction', Object(MMO\Hide\XF\Entity\User), 10, 1)
#3 src/addons/XenSoluce/CreditSystem/Entity/CreditsTransaction.php(155): XenSoluce\CreditSystem\Service\Notifier->send('reaction', Object(MMO\Hide\XF\Entity\User), 10, 1)
#4 src/XF/Mvc/Entity/Entity.php(1219): XenSoluce\CreditSystem\Entity\CreditsTransaction->_postSave()
#5 src/addons/XenSoluce/CreditSystem/Repository/Credit.php(844): XF\Mvc\Entity\Entity->save(true, false)
#6 src/addons/XenSoluce/CreditSystem/Repository/Credit.php(706): XenSoluce\CreditSystem\Repository\Credit->SaveAllProcess(Object(XenSoluce\CreditSystem\Entity\CreditEvents), Object(MMO\Hide\XF\Entity\User), 18, 1, 'Noct', Array, true, true)
#7 src/addons/XenSoluce/CreditSystem/XF/Pub/Controller/Post.php(55): XenSoluce\CreditSystem\Repository\Credit->getReactionForCredit(Object(XenSoluce\CreditSystem\XF\Entity\Thread), Object(XenSoluce\CreditSystem\XF\Entity\Post), Object(MMO\Hide\XF\Entity\User), Object(MMO\Hide\XF\Entity\User), true, Object(XF\Entity\ReactionContent))
#8 src/XF/Mvc/Dispatcher.php(350): XenSoluce\CreditSystem\XF\Pub\Controller\Post->actionReact(Object(XF\Mvc\ParameterBag))
#9 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Post', 'React', Object(XF\Mvc\RouteMatch), Object(XenSoluce\CreditSystem\XF\Pub\Controller\Post), NULL)
#10 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XenSoluce\CreditSystem\XF\Pub\Controller\Post), NULL)
#11 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#12 src/XF/App.php(2184): XF\Mvc\Dispatcher->run()
#13 src/XF.php(391): XF\App->run()
#14 index.php(20): XF::runApp('XF\\Pub\\App')
#15 {main}
[/PLAIN]

#3: «Cannot use object as array» when changing the reaction to the message.
Error: Cannot use object as array - src/addons/XenSoluce/CreditSystem/Entity/CreditsTransaction.php:167

#0 src/XF/Mvc/Entity/Entity.php(1595): XenSoluce\CreditSystem\Entity\CreditsTransaction->_postDelete()
#1 src/addons/XenSoluce/CreditSystem/Repository/Credit.php(717): XF\Mvc\Entity\Entity->delete()
#2 src/addons/XenSoluce/CreditSystem/XF/Pub/Controller/Post.php(55): XenSoluce\CreditSystem\Repository\Credit->getReactionForCredit(Object(XenSoluce\CreditSystem\XF\Entity\Thread), Object(XenSoluce\CreditSystem\XF\Entity\Post), Object(MMO\Hide\XF\Entity\User), Object(MMO\Hide\XF\Entity\User), true, Object(XF\Entity\ReactionContent))
#3 src/XF/Mvc/Dispatcher.php(350): XenSoluce\CreditSystem\XF\Pub\Controller\Post->actionReact(Object(XF\Mvc\ParameterBag))
#4 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Post', 'React', Object(XF\Mvc\RouteMatch), Object(XenSoluce\CreditSystem\XF\Pub\Controller\Post), NULL)
#5 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XenSoluce\CreditSystem\XF\Pub\Controller\Post), NULL)
#6 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#7 src/XF/App.php(2184): XF\Mvc\Dispatcher->run()
#8 src/XF.php(391): XF\App->run()
#9 index.php(20): XF::runApp('XF\\Pub\\App')
#10 {main}

#4: Missing error phrase about insufficient credits for purchase.
1597530782947.png

#5: Alerts?
In the event settings, you can enable alerts:
1597531767694.png
But where are they? I don't get them for three out of four events (although, given the errors above, I shouldn't be surprised).
The only alert I received was about credits for creating a topic, but the amount was displayed incorrectly (event cost = 10 credits):
1597531741170.png

#6: User upgrade page.

This is not so much information about the bug as a suggestion...

Can this be done in the form of a table? It looks very ugly.
1597530861385.png

And why are the edit button red and the delete button green? This is not logical.
1597531103645.png

#7: XenForo Resource Standards?
This also does not apply to the bug reporting, but still, I found it when I looked for the reasons for the bugs described above:
\XenSoluce\CreditSystem\Repository\Credit :: PostThreadDeleted — line 42:
PHP:
$postIds =  $db->fetchAllColumn("SELECT post_id FROM xf_post WHERE thread_id = ? ORDER BY post_id", $id );
This is inconsistent with Clause 6 of the XenForo Resource Standards. You can use this:
PHP:
$postIds = $this->finder('XF:Post')->where('thread_id', $id)->order('post_id')->pluckFrom('post_id')->fetch();


To be continued... I hope no...


Regards
 
Hello,

#1: Invalid payment provider class specified during installation.
\XenSoluce\CreditSystem\Setup :: installStep2:
PHP:
public function installStep2(array $stepParams = [])
{
$db = $this->db();
$db->query('INSERT INTO `xf_payment_provider`(`provider_id`, `provider_class`, `addon_id`) VALUES (\'XenSoluce_credit\',\'XenSoluce\CreditSystem:Credits\',\'XenSoluce/CreditSystem\')');
}
Since the backslash is not escaped, a "XenSoluceCreditSystem:Credits" is inserted into the table instead of "XenSoluce\CreditSystem:Credits"
It should look like this:
PHP:
public function installStep2(array $stepParams = [])
{
$db = $this->db();
$db->query('INSERT INTO `xf_payment_provider`(`provider_id`, `provider_class`, `addon_id`) VALUES (\'XenSoluce_credit\',\'XenSoluce\\CreditSystem:Credits\',\'XenSoluce/CreditSystem\')');
}
Indeed, this solves many problems:


#2: «Trying to get property 'title' of non-object» when reply to the thread and clicking on the "like" button.
One error for both actions.
ErrorException: [E_NOTICE] Trying to get property 'title' of non-object - src/addons/XenSoluce/CreditSystem/Entity/CreditsTransaction.php:193
I don't have that mistake, but I probably solved the problem because there was something a little weird about it.
#3: «Cannot use object as array» when changing the reaction to the message.
Error: Cannot use object as array - src/addons/XenSoluce/CreditSystem/Entity/CreditsTransaction.php:167
Likewise, I don't have this error, but I've surely fixed the problem (I'm really not sure about this one, I based myself on the error).
#4: Missing error phrase about insufficient credits for purchase.
1597530782947.png
Oops :(

#5: Alerts?
In the event settings, you can enable alerts:
1597531767694.png

But where are they? I don't get them for three out of four events (although, given the errors above, I shouldn't be surprised).
The only alert I received was about credits for creating a topic, but the amount was displayed incorrectly (event cost = 10 credits):
1597531741170.png
but for me it all works:
#6: User upgrade page.
This is not so much information about the bug as a suggestion...

Can this be done in the form of a table? It looks very ugly.
Since I'm not at home I can't see, but it's true that it's ugly :(

And why are the edit button red and the delete button green? This is not logical.
yes !
#7: XenForo Resource Standards?
This also does not apply to the bug reporting, but still, I found it when I looked for the reasons for the bugs described above:
\XenSoluce\CreditSystem\Repository\Credit :: PostThreadDeleted — line 42:
PHP:
$postIds = $db->fetchAllColumn("SELECT post_id FROM xf_post WHERE thread_id = ? ORDER BY post_id", $id );
This is inconsistent with Clause 6 of the XenForo Resource Standards. You can use this:
PHP:
$postIds = $this->finder('XF:Post')->where('thread_id', $id)->order('post_id')->pluckFrom('post_id')->fetch();
I'm using this because I just want a list of id's, that's right I could have done like this:
PHP:
$postIds = $this->finder('XF:Post')->where('thread_id', $id)->order('post_id')->pluckFrom('post_id')->fetch();
but since it's for a cron stain I don't see the point of doing that :)

Regards, CRUEL-MODZ
 
Hello,

This should be fixed in the next update : 2.0.9 Fix 1 ! (y)
And hopefully this solves the whole list of bugs !

Regards, CRUEL-MODZ
 
Yes, this fixes all the bugs I described above, but there is a bug when updating:
XF\Db\Exception: MySQL statement prepare error [1054]: Unknown column 'XenSoluce_credit' in 'where clause' - src/XF/Db/AbstractStatement.php:228
UPDATE xf_payment_provider SET provider_class = 'XenSoluce\\CreditSystem:Credits' WHERE provider_id = XenSoluce_credit
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL statement...', 1054, '42S22')
#1 src/XF/Db/Mysqli/Statement.php(39): XF\Db\Mysqli\Statement->getException('MySQL statement...', 1054, '42S22')
#2 src/XF/Db/Mysqli/Statement.php(54): XF\Db\Mysqli\Statement->prepare()
#3 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#4 src/addons/XenSoluce/CreditSystem/Setup.php(250): XF\Db\AbstractAdapter->query('UPDATE xf_payme...')
#5 src/XF/AddOn/StepRunnerUpgradeTrait.php(122): XenSoluce\CreditSystem\Setup->upgrade2000910Step1(Array)
#6 src/XF/AddOn/StepRunnerUpgradeTrait.php(71): XenSoluce\CreditSystem\Setup->upgradeStepRunner(2000910, 1, Array, NULL)
#7 src/XF/Admin/Controller/AddOn.php(576): XenSoluce\CreditSystem\Setup->upgrade(Array)
#8 src/XF/Mvc/Dispatcher.php(350): XF\Admin\Controller\AddOn->actionUpgrade(Object(XF\Mvc\ParameterBag))
#9 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:AddOn', 'Upgrade', Object(XF\Mvc\RouteMatch), Object(TG\ClearAddOnFile\XF\Admin\Controller\AddOn), NULL)
#10 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(TG\ClearAddOnFile\XF\Admin\Controller\AddOn), NULL)
#11 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#12 src/XF/App.php(2184): XF\Mvc\Dispatcher->run()
#13 src/XF.php(391): XF\App->run()
#14 admin.php(13): XF::runApp('XF\\Admin\\App')
#15 {main}

\XenSoluce\CreditSystem\Setup :: upgrade2000910Step1:
PHP:
$db->query('UPDATE xf_payment_provider SET provider_class = \'XenSoluce\\\\CreditSystem:Credits\' WHERE provider_id = XenSoluce_credit');
The quotes are missing. It should be like this:
PHP:
$db->query('UPDATE xf_payment_provider SET provider_class = \'XenSoluce\\\\CreditSystem:Credits\' WHERE provider_id = \'XenSoluce_credit\'');

I also found a small error: during the transfer to another user, the amount is more than there is, the number of credits that the user wants to transfer is not substituted in the error phrase:
1597614461452.png
 
Hello,

Indeed, I'm going to update quickly for it's 2 bugs !

Regards, CRUEL-MODZ
 
Back
Top Bottom