stdClass Object has strange quirk on live site but not local machine [closed]

♀尐吖头ヾ 提交于 2020-01-04 04:44:06

问题


I created a set of helper functions to make my life easier when doing database operations in php. Essentially I pass the functions an stdClass Object that they then use to either perform an operation (delete, add, etc) or retrieve information. They seem to work as intended except for the helper function that is meant to delete database entries. What is frustrating to me is that works perfectly fine on my local machine running WAMP, but when I put it live it refuses to delete the database entries.

I think I've narrowed down the issue to a strange quirk I can't explain between the output of the stdClass Object between WAMP and my live site.

PHP:

<?php   
        session_start();
        require_once('dbconnect.php');
        require_once('dbhelpers.php');

        $cat = $_GET['cat'];
        $id = $_GET['id'];

        //remove row from table
        $a_remove = (object) array(
            "table" => "{$cat}",
            "columns" => (object) array(
                "`id`"
            ),
            "results" => (object) array(
                    "{$id}"
            ),
            "type" => (object) array(
                "i"
            )
        );
        removeRow($a_remove);
    ?>

Here is the output from the response on WAMP when I run a print_r on the $a_remove object:

stdClass Object
(
    [table] => subjects
    [columns] => stdClass Object
        (
            [0] => `id`
        )

    [results] => stdClass Object
        (
            [0] => 36
        )

    [type] => stdClass Object
        (
            [0] => i
        )
)

However when I do print_r on $a_remove on my live site, I get the following:

stdClass Object
(
[table] => subjects
[columns] => stdClass Object
    (
        [0] => `id`
    )

[results] => stdClass Object
    (
        [0] => 36
        [0] =>
    )

[type] => stdClass Object
    (
        [0] => i
    )
)

There is that strange additional index in the response for "result". Any ideas on what might be causing this?

来源:https://stackoverflow.com/questions/53974972/stdclass-object-has-strange-quirk-on-live-site-but-not-local-machine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!