← Back to team overview

phpdevshell team mailing list archive

[Bug 677324] [NEW] config sql query utf8 error

 

Public bug reported:

While trying to setup a query within the plugin.config.xml file for my
new plugin, I came across the following error with respect to UTF8 which
says "Input is not proper UTF-8" (see full error below).

I exported the sql query from my db using phpMyAdmin. The table in
question is InnoDB and the Collation is utf8_general_ci.

The line in question is probably the last letter of this query which is an e with two dots on top:
INSERT INTO `_db_my_setup_state_province` (`id`, `country_id`, `code`, `name`) VALUES (340, 20, 'BU', 'Bulqizë');

Here is the full error message that I copied and pasted from my screen:
-----------------------------------------------------------------------------------------
Uncaught Exception while running

This page will try to provide as much information as possible so you can track down (and hopefully fix) the problem.
The error

The message of the error is as follow:

    simplexml_load_file() [function.simplexml-load-file]:
plugins/myNEWpluginSetup/config/plugin.config.xml:344: parser error :
Input is not proper UTF-8, indicate encoding ! Bytes: 0xEB 0x27 0x29
0x3B

The error occurred in file
/home/public_html/phpds/plugins/PHPDevShell/models/plugin-admin/plugin-
activation.query.php at line 122

    116   <?php
                        } else {
    117   <?php
                            $logo_selected = false;
    118   <?php
                        }
    119   <?php
                        // Read Config Installation File.
    120   <?php
                        if (file_exists("plugins/$object/config/plugin.config.xml")) {
    121   <?php
                            $plugin_config_message = $this->template->icon('puzzle', sprintf(_('Installation file in %s found!'), $object));
    122   <?php
                            $xml = simplexml_load_file("plugins/$object/config/plugin.config.xml");
    123   <?php
                            $install_ok = true;
    124   <?php
                        } else {
    125   <?php
                            $plugin_config_message = $this->template->icon('puzzle--exclamation', sprintf(_('Installation file in %s NOT found!'), $object));
    126   <?php
                        }
    127   <?php
                        // Check if item hide is a core script.
    128   <?php
                        if ($install_ok == true) {
    129   <?php
                            // Call required database version.

The configuration
Configuration files actually used:

    * [ 0 ] => /home/public_html/phpds/config/_host.local.config.php
    * [ 1 ] => /home/public_html/phpds/config/_default.config.php
    * [ 2 ] => /home/public_html/phpds/config/_default.local.config.php
    * [ 3 ] => /home/public_html/phpds/config/_default.config.php
    * [ 4 ] => /home/public_html/phpds/config/_default.local.config.php

Configuration files which would have been used if they were present:

    * [ 0 ] => /home/public_html/phpds/config/_host.config.php
    * [ 1 ] => /home/public_html/phpds/config/www.mydomain.com.config.php
    * [ 2 ] => /home/public_html/phpds/config/www.mydomain.com.local.config.php

The Backtrace:

All relative file pathes are relative to the server root (namely
/home/public_html/ )

Click on the Book icon to access online documentation.
File path (relative) 	Line 	Call (with arguments)
...phpds/plugins/PHPDevShell/models/plugin-admin/plugin-activation.query.php	122	  <?php
simplexml_load_file(array[1])
116   <?php
                    } else {
117   <?php
                        $logo_selected = false;
118   <?php
                    }
119   <?php
                    // Read Config Installation File.
120   <?php
                    if (file_exists("plugins/$object/config/plugin.config.xml")) {
121   <?php
                        $plugin_config_message = $this->template->icon('puzzle', sprintf(_('Installation file in %s found!'), $object));
122   <?php
                        $xml = simplexml_load_file("plugins/$object/config/plugin.config.xml");
123   <?php
                        $install_ok = true;
124   <?php
                    } else {
125   <?php
                        $plugin_config_message = $this->template->icon('puzzle--exclamation', sprintf(_('Installation file in %s NOT found!'), $object));
126   <?php
                    }
127   <?php
                    // Check if item hide is a core script.
128   <?php
                    if ($install_ok == true) {
129   <?php
                        // Call required database version.
...phpds/includes/PHPDS_db.class.php	157	  <?php
PHPDS_readPluginsQuery::invoke("PHPDS_readPluginsQuery", array[1])
151   <?php
     */
152   <?php
    public function invokeQueryWith($query_name, $params)
153   <?php
    {
154   <?php
        $query = $this->makeQuery($query_name);
155   <?php
        if (!is_a($query, 'PHPDS_query'))
156   <?php
                throw new PHPDS_databaseException('Error invoking query');
157   <?php
        return $query->invoke($params);
158   <?php
    }
159   <?php

160   <?php
    /**
161   <?php
     * Locates the query class of the given name, loads it, intantiate it, and returns the query object
162   <?php
     *
163   <?php
     * @date                20100219
164   <?php
     * @version     1.1
...phpds/includes/PHPDS_db.class.php	139	  <?php
PHPDS_db::invokeQueryWith("PHPDS_readPluginsQuery", array[9])
133   <?php
     * @return array (usually), the result data of the query
134   <?php
     */
135   <?php
    public function invokeQuery($query_name) // actually more parameters can be given
136   <?php
    {
137   <?php
        $params = func_get_args();
138   <?php
        array_shift($params); // first parameter of this function is $query_name
139   <?php
        return $this->invokeQueryWith($query_name, $params);
140   <?php
    }
141   <?php

142   <?php
    /**
143   <?php
     * Locates the query class of the given name, loads it, intantiate it, send the query to the DB, and return the result
144   <?php
     *
145   <?php
     * @date 20100922 (1.0) (greg) added
146   <?php
     * @version 1.0
...phpds/plugins/PHPDevShell/controllers/plugin-admin/plugin-activation.php	100	  <?php
PHPDS_db::invokeQuery()
94   <?php
            /////////////////////////////////////////////////////////////////////
95   <?php
        }
96   <?php
        /////////////////////////////////////////////////
97   <?php
        // Call current plugins status from database. ///
98   <?php
        /////////////////////////////////////////////////
99   <?php
        // Read plugin directory.
100   <?php
        $RESULTS = $this->db->invokeQuery('PHPDS_readPluginsQuery', $this->db->invokeQuery('PHPDS_currentPluginStatusQuery'));
101   <?php

102   <?php
        // Load views.
103   <?php
        $view = $this->factory('views');
104   <?php

105   <?php
        // Set Array.
106   <?php
        $view->set('RESULTS', $RESULTS);
107   <?php

...phpds/includes/PHPDS_controller.class.php	89	<?php
PluginActivation::execute()
83   <?php
    public function run()
84   <?php
    {
85   <?php
        (is_object($this->security)) ? $this->security->securityIni() : exit('Access Denied!');
86   <?php
        if (PU_isAJAX ()) {
87   <?php
            PU_exitToAJAX($this->viaAJAX());
88   <?php
        } else {
89   <?php
            $this->execute();
90   <?php
        }
91   <?php
    }
92   <?php

93   <?php
    /**
94   <?php
     * This method is meant to be the entry point of your class. Most checks and cleanup should have been done by the time its executed
95   <?php
     *
96   <?php
     * @return whatever
...phpds/includes/PHPDS_core.class.php	516	  <?php
PHPDS_controller::run("plugins/PHPDevShell/controllers/plugin-admin/plugin-activation.php")
510   <?php
            }
511   <?php
        } else {
512   <?php
            if ($required) throw new PHPDS_exception('Trying to load a non-existant file: "'.$path.'"');
513   <?php
        }
514   <?php
        if (is_string($result) && class_exists($result)) {
515   <?php
            $result = $this->factory($result);
516   <?php
            $result->run();
517   <?php
        }
518   <?php

519   <?php
        // we don't use $debug as it can have been tampered with
520   <?php
        $this->debugInstance()->domain('core');
521   <?php

522   <?php
        return $result;
523   <?php
    }
...phpds/includes/PHPDS_template.class.php	1251	  <?php
PHPDS_core::loadFile("585886089")
1245   <?php
                if ($include_model === true) $include_model = 'query';
1246   <?php
                $core->loadFile($plugin_folder . 'models/' . preg_replace("/.php/", '.' . $include_model . '.php', $navigation[$menu_id]['menu_link']));
1247   <?php
            }
1248   <?php
            // Set active script directory.
1249   <?php
            $active_dir = $plugin_folder . '%s' . $navigation[$menu_id]['menu_link'];
1250   <?php
            // Require script.
1251   <?php
            if ($core->loadFile(sprintf($active_dir, 'controllers/'))) return true;
1252   <?php
            if ($core->loadFile(sprintf($active_dir, ''))) return true;
1253   <?php
        }
1254   <?php
        $this->stopScript = sprintf(___('The controller of menu id %d could not be found, I tried to execute filename : "%s"'), $menu_id, $active_dir);
1255   <?php
        return false;
1256   <?php
    }
1257   <?php

1258   <?php

...phpds/includes/PHPDS_template.class.php	1152	  <?php
PHPDS_template::loadControllerFile()
1146   <?php
                }
1147   <?php
            }
1148   <?php
            // Execute repeated menu cases.
1149   <?php
            switch ($menu_case) {
1150   <?php
                // Plugin Script.
1151   <?php
                case 1:
1152   <?php
                    $this->loadControllerFile($menu_id);
1153   <?php
                    break;
1154   <?php
                // Link, Jump, Placeholder.
1155   <?php
                case 2:
1156   <?php
                    
1157   <?php
                    if (empty($menu_id)) {
1158   <?php
                        // Lets take user to the front page as last option.
1159   <?php
                        // Get correct frontpage id.
...phpds/includes/PHPDS_template.class.php	148	  <?php
PHPDS_template::executeController()
142   <?php
        if (!empty($configuration['modules']) && is_array($configuration['modules'])) {
143   <?php
            $this->module = array_merge($this->module, $configuration['modules']);
144   <?php
        }
145   <?php

146   <?php
        if (empty($this->module['bc']) || ($this->module['bc'] != 2)) {
147   <?php
            // This will pre-load the controller and save it.
148   <?php
            $this->executeController();
149   <?php
        } else {
150   <?php
            $this->core->loadFile($template_dir . '/language/core.lang.php');
151   <?php
        }
152   <?php

153   <?php
        // There should be a template available here...
154   <?php
        if (! $this->core->loadFile($template_dir . '/theme.php')) {
155   <?php
            if (!$this->core->loadFile($template_dir . '/main.php')) {
...phpds/includes/PHPDS.inc.php	534	  <?php
PHPDS_template::runTemplate()
528   <?php
    {
529   <?php
        $this->stage = 2;
530   <?php
        try {
531   <?php
            //TODO: check we don't run an embebbed instance
532   <?php
            // We require templating system for final output
533   <?php
            // Run template as required.
534   <?php
            $this->PHPDS_template()->runTemplate();
535   <?php
            // Lets log access to menu item if so required.
536   <?php
            $this->PHPDS_db()->logMenuAccess();
537   <?php
            // Write collected logs to database.
538   <?php
            $this->PHPDS_db()->logThis();
539   <?php
            // Print queries used, when required.
540   <?php
            ($this->configuration['queries_count']) ? $this->template->queriesUsed($this->db->countQueries) : null;
541   <?php
        } catch (Exception $e) {
...phpds/index.php	34	  <?php
PHPDS::run()

** Affects: phpdevshell
     Importance: Undecided
         Status: New

-- 
config sql query utf8 error
https://bugs.launchpad.net/bugs/677324
You received this bug notification because you are a member of
PHPDevShell, which is subscribed to PHPDevShell.

Status in Open Source php gui type development framework.: New

Bug description:
While trying to setup a query within the plugin.config.xml file for my new plugin, I came across the following error with respect to UTF8 which says "Input is not proper UTF-8" (see full error below).

I exported the sql query from my db using phpMyAdmin. The table in question is InnoDB and the Collation is utf8_general_ci.

The line in question is probably the last letter of this query which is an e with two dots on top:
INSERT INTO `_db_my_setup_state_province` (`id`, `country_id`, `code`, `name`) VALUES (340, 20, 'BU', 'Bulqizë');

Here is the full error message that I copied and pasted from my screen:
-----------------------------------------------------------------------------------------
Uncaught Exception while running

This page will try to provide as much information as possible so you can track down (and hopefully fix) the problem.
The error

The message of the error is as follow:

    simplexml_load_file() [function.simplexml-load-file]: plugins/myNEWpluginSetup/config/plugin.config.xml:344: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xEB 0x27 0x29 0x3B

The error occurred in file /home/public_html/phpds/plugins/PHPDevShell/models/plugin-admin/plugin-activation.query.php at line 122

    116   <?php
                        } else {
    117   <?php
                            $logo_selected = false;
    118   <?php
                        }
    119   <?php
                        // Read Config Installation File.
    120   <?php
                        if (file_exists("plugins/$object/config/plugin.config.xml")) {
    121   <?php
                            $plugin_config_message = $this->template->icon('puzzle', sprintf(_('Installation file in %s found!'), $object));
    122   <?php
                            $xml = simplexml_load_file("plugins/$object/config/plugin.config.xml");
    123   <?php
                            $install_ok = true;
    124   <?php
                        } else {
    125   <?php
                            $plugin_config_message = $this->template->icon('puzzle--exclamation', sprintf(_('Installation file in %s NOT found!'), $object));
    126   <?php
                        }
    127   <?php
                        // Check if item hide is a core script.
    128   <?php
                        if ($install_ok == true) {
    129   <?php
                            // Call required database version.

The configuration
Configuration files actually used:

    * [ 0 ] => /home/public_html/phpds/config/_host.local.config.php
    * [ 1 ] => /home/public_html/phpds/config/_default.config.php
    * [ 2 ] => /home/public_html/phpds/config/_default.local.config.php
    * [ 3 ] => /home/public_html/phpds/config/_default.config.php
    * [ 4 ] => /home/public_html/phpds/config/_default.local.config.php

Configuration files which would have been used if they were present:

    * [ 0 ] => /home/public_html/phpds/config/_host.config.php
    * [ 1 ] => /home/public_html/phpds/config/www.mydomain.com.config.php
    * [ 2 ] => /home/public_html/phpds/config/www.mydomain.com.local.config.php

The Backtrace:

All relative file pathes are relative to the server root (namely /home/public_html/ )

Click on the Book icon to access online documentation.
File path (relative) 	Line 	Call (with arguments)
...phpds/plugins/PHPDevShell/models/plugin-admin/plugin-activation.query.php	122	  <?php
simplexml_load_file(array[1])
116   <?php
                    } else {
117   <?php
                        $logo_selected = false;
118   <?php
                    }
119   <?php
                    // Read Config Installation File.
120   <?php
                    if (file_exists("plugins/$object/config/plugin.config.xml")) {
121   <?php
                        $plugin_config_message = $this->template->icon('puzzle', sprintf(_('Installation file in %s found!'), $object));
122   <?php
                        $xml = simplexml_load_file("plugins/$object/config/plugin.config.xml");
123   <?php
                        $install_ok = true;
124   <?php
                    } else {
125   <?php
                        $plugin_config_message = $this->template->icon('puzzle--exclamation', sprintf(_('Installation file in %s NOT found!'), $object));
126   <?php
                    }
127   <?php
                    // Check if item hide is a core script.
128   <?php
                    if ($install_ok == true) {
129   <?php
                        // Call required database version.
...phpds/includes/PHPDS_db.class.php	157	  <?php
PHPDS_readPluginsQuery::invoke("PHPDS_readPluginsQuery", array[1])
151   <?php
     */
152   <?php
    public function invokeQueryWith($query_name, $params)
153   <?php
    {
154   <?php
        $query = $this->makeQuery($query_name);
155   <?php
        if (!is_a($query, 'PHPDS_query'))
156   <?php
                throw new PHPDS_databaseException('Error invoking query');
157   <?php
        return $query->invoke($params);
158   <?php
    }
159   <?php

160   <?php
    /**
161   <?php
     * Locates the query class of the given name, loads it, intantiate it, and returns the query object
162   <?php
     *
163   <?php
     * @date                20100219
164   <?php
     * @version     1.1
...phpds/includes/PHPDS_db.class.php	139	  <?php
PHPDS_db::invokeQueryWith("PHPDS_readPluginsQuery", array[9])
133   <?php
     * @return array (usually), the result data of the query
134   <?php
     */
135   <?php
    public function invokeQuery($query_name) // actually more parameters can be given
136   <?php
    {
137   <?php
        $params = func_get_args();
138   <?php
        array_shift($params); // first parameter of this function is $query_name
139   <?php
        return $this->invokeQueryWith($query_name, $params);
140   <?php
    }
141   <?php

142   <?php
    /**
143   <?php
     * Locates the query class of the given name, loads it, intantiate it, send the query to the DB, and return the result
144   <?php
     *
145   <?php
     * @date 20100922 (1.0) (greg) added
146   <?php
     * @version 1.0
...phpds/plugins/PHPDevShell/controllers/plugin-admin/plugin-activation.php	100	  <?php
PHPDS_db::invokeQuery()
94   <?php
            /////////////////////////////////////////////////////////////////////
95   <?php
        }
96   <?php
        /////////////////////////////////////////////////
97   <?php
        // Call current plugins status from database. ///
98   <?php
        /////////////////////////////////////////////////
99   <?php
        // Read plugin directory.
100   <?php
        $RESULTS = $this->db->invokeQuery('PHPDS_readPluginsQuery', $this->db->invokeQuery('PHPDS_currentPluginStatusQuery'));
101   <?php

102   <?php
        // Load views.
103   <?php
        $view = $this->factory('views');
104   <?php

105   <?php
        // Set Array.
106   <?php
        $view->set('RESULTS', $RESULTS);
107   <?php

...phpds/includes/PHPDS_controller.class.php	89	<?php
PluginActivation::execute()
83   <?php
    public function run()
84   <?php
    {
85   <?php
        (is_object($this->security)) ? $this->security->securityIni() : exit('Access Denied!');
86   <?php
        if (PU_isAJAX ()) {
87   <?php
            PU_exitToAJAX($this->viaAJAX());
88   <?php
        } else {
89   <?php
            $this->execute();
90   <?php
        }
91   <?php
    }
92   <?php

93   <?php
    /**
94   <?php
     * This method is meant to be the entry point of your class. Most checks and cleanup should have been done by the time its executed
95   <?php
     *
96   <?php
     * @return whatever
...phpds/includes/PHPDS_core.class.php	516	  <?php
PHPDS_controller::run("plugins/PHPDevShell/controllers/plugin-admin/plugin-activation.php")
510   <?php
            }
511   <?php
        } else {
512   <?php
            if ($required) throw new PHPDS_exception('Trying to load a non-existant file: "'.$path.'"');
513   <?php
        }
514   <?php
        if (is_string($result) && class_exists($result)) {
515   <?php
            $result = $this->factory($result);
516   <?php
            $result->run();
517   <?php
        }
518   <?php

519   <?php
        // we don't use $debug as it can have been tampered with
520   <?php
        $this->debugInstance()->domain('core');
521   <?php

522   <?php
        return $result;
523   <?php
    }
...phpds/includes/PHPDS_template.class.php	1251	  <?php
PHPDS_core::loadFile("585886089")
1245   <?php
                if ($include_model === true) $include_model = 'query';
1246   <?php
                $core->loadFile($plugin_folder . 'models/' . preg_replace("/.php/", '.' . $include_model . '.php', $navigation[$menu_id]['menu_link']));
1247   <?php
            }
1248   <?php
            // Set active script directory.
1249   <?php
            $active_dir = $plugin_folder . '%s' . $navigation[$menu_id]['menu_link'];
1250   <?php
            // Require script.
1251   <?php
            if ($core->loadFile(sprintf($active_dir, 'controllers/'))) return true;
1252   <?php
            if ($core->loadFile(sprintf($active_dir, ''))) return true;
1253   <?php
        }
1254   <?php
        $this->stopScript = sprintf(___('The controller of menu id %d could not be found, I tried to execute filename : "%s"'), $menu_id, $active_dir);
1255   <?php
        return false;
1256   <?php
    }
1257   <?php

1258   <?php

...phpds/includes/PHPDS_template.class.php	1152	  <?php
PHPDS_template::loadControllerFile()
1146   <?php
                }
1147   <?php
            }
1148   <?php
            // Execute repeated menu cases.
1149   <?php
            switch ($menu_case) {
1150   <?php
                // Plugin Script.
1151   <?php
                case 1:
1152   <?php
                    $this->loadControllerFile($menu_id);
1153   <?php
                    break;
1154   <?php
                // Link, Jump, Placeholder.
1155   <?php
                case 2:
1156   <?php
                    
1157   <?php
                    if (empty($menu_id)) {
1158   <?php
                        // Lets take user to the front page as last option.
1159   <?php
                        // Get correct frontpage id.
...phpds/includes/PHPDS_template.class.php	148	  <?php
PHPDS_template::executeController()
142   <?php
        if (!empty($configuration['modules']) && is_array($configuration['modules'])) {
143   <?php
            $this->module = array_merge($this->module, $configuration['modules']);
144   <?php
        }
145   <?php

146   <?php
        if (empty($this->module['bc']) || ($this->module['bc'] != 2)) {
147   <?php
            // This will pre-load the controller and save it.
148   <?php
            $this->executeController();
149   <?php
        } else {
150   <?php
            $this->core->loadFile($template_dir . '/language/core.lang.php');
151   <?php
        }
152   <?php

153   <?php
        // There should be a template available here...
154   <?php
        if (! $this->core->loadFile($template_dir . '/theme.php')) {
155   <?php
            if (!$this->core->loadFile($template_dir . '/main.php')) {
...phpds/includes/PHPDS.inc.php	534	  <?php
PHPDS_template::runTemplate()
528   <?php
    {
529   <?php
        $this->stage = 2;
530   <?php
        try {
531   <?php
            //TODO: check we don't run an embebbed instance
532   <?php
            // We require templating system for final output
533   <?php
            // Run template as required.
534   <?php
            $this->PHPDS_template()->runTemplate();
535   <?php
            // Lets log access to menu item if so required.
536   <?php
            $this->PHPDS_db()->logMenuAccess();
537   <?php
            // Write collected logs to database.
538   <?php
            $this->PHPDS_db()->logThis();
539   <?php
            // Print queries used, when required.
540   <?php
            ($this->configuration['queries_count']) ? $this->template->queriesUsed($this->db->countQueries) : null;
541   <?php
        } catch (Exception $e) {
...phpds/index.php	34	  <?php
PHPDS::run()





Follow ups

References