kktsvetkov / krumo Goto Github PK
View Code? Open in Web Editor NEWKrumo: Structured information display solution for PHP
Home Page: http://krumo.kaloyan.info
License: GNU Lesser General Public License v2.1
Krumo: Structured information display solution for PHP
Home Page: http://krumo.kaloyan.info
License: GNU Lesser General Public License v2.1
I'm getting the following error in PHP 7.2:
Warning: count(): Parameter must be an array or an object that implements Countable in krumo::_object() (line 1156 of backdrop/modules/contrib/devel/lib/krumo/class.krumo.php).
The problem is this bit of code, as it assumes $data
is either an array or Countable:
<div class="krumo-element<?php echo count($data) > 0 ? ' krumo-expand' : '';?>">
I struggled with the idea of adding this feature when initially working on Krumo, and I decided not to include it:
I am not sure why would you need such thing... What's the benefit of doing this ? The "krumo dump" is a bunch of HTML code, so I don't see what help it would it be if ti is saved to a var - it is meant to be seen, to visualize the data you ra dumping.
Over the years I've seen more than enough places where this feature was requested, and usually this is the advice I would give:
Anyway, try output buffering - start it before calling Krumo and close it afterwards - and you will have the "krumo dump" in the buffer. Please note that the first dump also prints the references to the CSS skin, and it printes the JS code used to expand/collapse the dump nodes.
Adding such a feature is really easy with output buffering, and I am going to add it as part of the krumo
class -- to make it easy for all people that need that to do it out-of-the-box instead of doing the output-buffering themselves.
This is from a request on SourceForge.net:
Right now, if you do krumo($_SESSION, $_GET, $_POST); you will get 3 listings but all will be displayed as "...(Array, x elements)". Instead of those ... I think it would be much more useful to have the name of the array.
Right now, it is very confusing trying to make out which is which.
Thank you!
https://sourceforge.net/p/krumo/discussion/686810/thread/48d07929/
I just found this repo via Google. I've been maintaining Krumo here:
https://github.com/mmucklo/krumo/releases
For quite some time now. We should team up and combine our efforts.
It's been a valid complain that if Krumo is called in the middle of some opened HTML tag, that will break the output of both that tag and Krumo itself. This is from SourceForge.net comments:
For example when you are generating an image and need to evaluate something, you can't simply output it to the screen.
https://sourceforge.net/p/krumo/discussion/686810/thread/74217e3b/
One solution (that I already use in Wano) is to use register_shutdown_function()
to dump the krumo output at the end of the output.
I'm getting this error on a new install of PHP 7.2. I'm getting it in phpmyadmin as well just fyi:
Warning: count(): Parameter must be an array or an object that implements Countable in var/www/html/iconcierge/shared/krumo/class.krumo.php on line 1132
Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/iconcierge/shared/krumo/class.krumo.php on line 1133
Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/iconcierge/shared/krumo/class.krumo.php on line 1146
it is coming from this block of code:
/**
* Render a dump for an object
*
* @param mixed $data
* @param string $name
*/
private static function _object(&$data, $name)
{
?>
<li class="krumo-child">
<div <?php if (count($data) > 0) {?> onClick="krumo.toggle(this);"<?php } ?>
class="krumo-element<?php echo count($data) > 0 ? ' krumo-expand' : '';?>" >
<a class="krumo-name"><?php echo $name;?></a>
(<em class="krumo-type">Object</em>)
<strong class="krumo-class"><?php echo get_class($data);?></strong>
<?php
if( get_class( $data ) == 'Image' ){
echo '<img class=img-thumbnail src="' . $data->urlSecure . '" />';
}
?>
</div>
<?php if (count($data))
{
self::_vars($data);
} ?>
</li>
<?php
}
Namely the two calls to count($data)
.
Casting $data
to an array causes more bugs. Ideas?
This has been a requested featured from the start: the ability to expand and collapse all the nodes in a Krumo report.
The krumo.ini configuration is a remnant from the PHP4 days. It was created as a configuration solution that will operate the selection of the CSS skin and the URL used for the images in the stylesheets.
As of ed1a544 the external images for the stylesheets have been converted into "data-URI" statements. This made the %url%
stylesheet hack useless, as well as the "[css] url=..." section of krumo.ini
Now what is left in krumo.ini is only the "[skin] selected=..." which points to what the selected skin is. This can be easily set by a static class property, e.g. krumo::$skin = 'blue';
, and with that having krumo.ini is pointless.
Dropping krumo.ini will reduce the configuration hassle and the footprint of the library.
`<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Login extends MY_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('login_m');
$this->load->library('template_login');
}
public function index()
{
$this->template_login->display('admin/login_v');
}
public function validasi()
{
$this->form_validation->set_rules('username', 'Username', 'trim|required');
$this->form_validation->set_rules('password', 'Password', 'trim|required');
if ($this->form_validation->run() == false) {
$this->template_login->display('admin/login_v');
} else {
$username = stripHTMLtags(trim($this->input->post('username', 'true')));
$password = stripHTMLtags(trim($this->input->post('password', 'true')));
$temp_user = $this->login_m->get_user($username)->row();
$num_user = count($temp_user);
if ($num_user == 0) {
$this->session->set_flashdata('notification', '<b>Username Anda Tidak Terdaftar.</b>');
redirect(site_url('login'));
} elseif ($num_user > 0) {
$temp_account = $this->login_m->check_user_account($username, sha1($password))->row();
$num_account = count($temp_account);
if ($num_account > 0) {
$array_item = array(
'username' => trim($temp_account->user_username),
'pass' => $temp_account->user_password,
'nama' => strtoupper(trim($temp_account->user_name)),
'avatar' => $temp_account->user_avatar,
'level' => $temp_account->user_level,
'logged_in_resto' => true,
);
$this->session->set_userdata($array_item);
if ($this->session->userdata('level') == 'Admin') {
redirect(site_url('admin/home'));
} elseif($this->session->userdata('level') == 'Kasir') {
redirect(site_url('operator/home'));
}
elseif($this->session->userdata('level') == 'Pelanggan') {
redirect(site_url('front/'));
}
} else {
$this->session->set_flashdata('notification', '<b>Username atau Password Anda Salah.</b>');
redirect(site_url('login'));
}
}
}
}
public function logout()
{
$this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . 'GMT');
$this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
$this->output->set_header('Pragma: no-chace');
$this->session->sess_destroy();
redirect(base_url());
}
}
/* Location: ./application/controller/Login.php */
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.