PDA

View Full Version : Strict Standards --- Need help, pre launch!


Missy Master
01-29-2015, 01:43 PM
Hey guys!

Okay Canidae is about to launch and I need ONE thing! :) to get this dreadful thing gone:


Strict Standards: Declaration of AdminSidebar

And all the Strict Standards stuff to stop showing. It's way more than just this one message. I just don't want this showing for members at ALL.


I saw a thread about this and still don't have a way to stop it that's working for me. The site's fine except for this jazz popping up in too many places to even name. As I understand it's a simple thing to turn this off .. I even tried adding something to the .htaccess file but that just made the whole site not work.


Help! :)

Hall of Famer
01-29-2015, 02:41 PM
Well you can just manually edit the AdminSidebar class method setDivision() to match its parent class'. So instead of setDivision($components), change it to setDivision(GUIComponent $component). This should do the trick for you.

Missy Master
01-29-2015, 02:42 PM
Ah fantastic, let me go try that, thanks HOF!! :)

Kyttias
01-29-2015, 03:50 PM
I managed to fix all my strict standard errors except for this one, so if you list some of the others off on the front end I can help -- but I never managed to fix the adminCP one on my site at webfreehosting (http://webfreehosting.net/). Out of curiosity, what's your host?

Missy Master
01-29-2015, 03:57 PM
Seemed to fix it most places --- now getting this Strict Standards error for the Breeding page:


: Declaration of DropdownList::add() should be compatible with GUIContainer::add(GUIComponent $component, $index = -1) in /home/petsim/public_html/Canidae/classes/class_dropdownlist.php



Oh hey thanks! I'm on SkyeNetHosting.


And now I get this too in ACP:



Parse error: syntax error, unexpected '$component' (T_VARIABLE) in /home/petsim/public_html/Canidae/classes/class_adminsidebar.php on line 37

Kyttias
01-29-2015, 04:05 PM
Alright, well what did you change in the adminsidebar class to get it to work? I changed $components to $component in the parameters, then where it was used, and then everywhere on the page and none of it worked. The error changed to -

Catchable fatal error: Argument 1 passed to AdminSidebar::setDivision() must be an instance of GUIComponent, instance of Resource\Collection\ArrayList given, called in /srv/disk3/1793798/www/novul/classes/class_adminsidebar.php on line 187 and defined in /srv/disk3/1793798/www/novul/classes/class_adminsidebar.php on line 36

As for your error, in classes/class_dropdownlist.php, around line 105 (by the way, it'll help if you give the full error with line numbers, if possible, so I don't have to compare entire files), change this:
public function add($option, $index = -1){
if(!($option instanceof Option) and !($option instanceof OptGroup)) throw new GUIException("Cannot add a non-option type component to dropdown list.");
parent::add($option, $index);
}
into this:
public function add(GUIComponent $option, $index = -1){
if(!($option instanceof Option) and !($option instanceof OptGroup)) throw new GUIException("Cannot add a non-option type component to dropdown list.");
parent::add($option, $index);
}

Missy Master
01-29-2015, 04:06 PM
I made the change HOF advised up above, and it seemed to work well --- okay thanks I'll try this now! :)

Kyttias
01-29-2015, 04:13 PM
></ Darn, could you give me a copy of your adminsidebar class file then, the whole thing? I want to see what I'm doing wrong.

Kyttias
01-29-2015, 04:17 PM
Oh, also, on your site, go in and try to change profile settings/anywhere with a radio button. I think you'll get an error there, too?

Missy Master
01-29-2015, 04:21 PM
I attached the file here!


Sorry it was on line 189.

I tried the fix and it gave this:


Fatal error: Cannot redeclare DropdownList::add() in /home/petsim/public_html/Canidae/classes/class_dropdownlist.php on line 112


Ugh now the ACP doesnt work at all .. what is this horrible Strict Standards thing, can't it just be turned off?

Kyttias
01-29-2015, 04:28 PM
Yes, it can be, if you have access to your php.ini file. Most hosts don't allow that, they control the entire server's php.ini file. I think you can also put error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE); at the top of each page the error reports, but I haven't fully tried it yet -- because doing that on the adminCP gave me an error, too. Maybe if I'd done that to begin with everywhere, things would be fine, so I might go and try that. =|

(And err, your file just gave me:

Parse error: syntax error, unexpected '$component' (T_VARIABLE) in /srv/disk3/1793798/www/novul/classes/class_adminsidebar.php on line 37)

Missy Master
01-29-2015, 04:42 PM
Yep, that was with the addition that HOF had suggested I am guessing .. the site itself will come up, ACP wont .... the change had gotten rid of most of the SS errors, but breeding still had it come up ---and then I checked ACP and -- no go !


http://pet-sim.com/Canidae/


if you want to see what's happening there ? Thanks for trying to help guys!

Kyttias
01-29-2015, 04:53 PM
Well, another one to fix would be around line 43 in classes/class_radiolist.php, changing this:
public function add(RadioButton $radio, $index = -1){
if($radio->getName() != $this->name) throw new GUIException("Cannot add unrelated radiobuttons to a RadioList.");
parent::add($radio, $index);
}
to:
public function add(GUIComponent $radio, $index = -1){
if($radio->getName() != $this->name) throw new GUIException("Cannot add unrelated radiobuttons to a RadioList.");
parent::add($radio, $index);
}

And that would fix stuff in the profile settings.

But I digress - I could fix all the errors on the front end, but never the AdminCP one. Not without getting a new error to take its place. And I really feel this comes down on the hosting provider, because I couldn't get inline modifications of the error_reporting to work either. Not in the file, not in the htaccess, and I don't have control over my php.ini. *sigh*

Missy Master
01-29-2015, 04:57 PM
well rats .. so to get rid of all the SS errors showing, we sacrifice our ACP? :(



I cant get into mine at all now ...

Kyttias
01-29-2015, 05:01 PM
Yes, and I never could -- but! We got a different error after making changes there, so many HOF can still help!

I made this change in the AdminCP -
protected function setDivision(GUIComponent $component){
$this->division = new Division($component);
$this->division->setClass("sidebar");
}

and now have:
Catchable fatal error: Argument 1 passed to AdminSidebar::setDivision() must be an instance of GUIComponent, instance of Resource\Collection\ArrayList given, called in /srv/disk3/1793798/www/novul/classes/class_adminsidebar.php on line 187 and defined in /srv/disk3/1793798/www/novul/classes/class_adminsidebar.php on line 36

So if we can just get that figured out, we should be good, right?

Missy Master
01-29-2015, 05:03 PM
I think we desperately need help! :)


I really cant launch and have members see all those errors pop up, and I need access to the ACP, that's too important ..

Missy Master
01-29-2015, 05:09 PM
Parse error: syntax error, unexpected '$component' (T_VARIABLE) in /home/petsim/public_html/Canidae/classes/class_adminsidebar.php on line 37


This is my current error, for trying to access ACP .. I'm using the fix from HOF for the coding.




Also, getting this for Breeding:


Strict Standards : Declaration of DropdownList::add() should be compatible with GUIContainer::add(GUIComponent $component /home/petsim/public_html/Canidae/classes/class_dropdownlist.php</b> $index = -1) in on line 189

Kyttias
01-29-2015, 05:21 PM
Try what I did, not what you did (in the AdminCP).
This:
$this->division = new Division($component);
Not:
$this->division = new Division(GUIComponent $component);

It doesn't need to be declared there. Above that it does, but not in the function itself.

And here is my entire class_dropdownlist.php:
<?php
use Resource\Native\String;
use Resource\Collection\Collective;
use Resource\Collection\LinkedList;
use Resource\Collection\LinkedHashMap;

/**
* The DropdownList Class, extends from abstract GUIContainer class.
* It specifies a standard single-item dropdown list.
* @category Resource
* @package GUI
* @author Hall of Famer
* @copyright Mysidia Adoptables Script
* @link http://www.mysidiaadoptables.com
* @since 1.3.3
* @todo Not much at this point.
*
*/

class DropdownList extends GUIContainer{

/**
* The autofocus property, checks if the input component is autofocused.
* @access protected
* @var Boolean
*/
protected $autofocus = FALSE;

/**
* The disabled property, checks if the input component is disabled.
* @access protected
* @var Boolean
*/
protected $disabled = FALSE;

/**
* Constructor of SelectList Class, which assigns basic property to this list
* @param String $name
* @param ArrayList $components
* @param String $identity
* @param Event $event
* @access public
* @return Void
*/
public function __construct($name = "", $components = "", $identity = "", $event = ""){
if(!empty($name)){
$this->setName($name);
$this->setID($name);
}
if(!empty($identity)) $this->select($identity);
if(!empty($event)) $this->setEvent($event);

parent::__construct($components);
$this->renderer = new ListRenderer($this);
}

/**
* The isAutofocus method, getter method for property $autofocus.
* @access public
* @return Boolean
*/
public function isAutofocus(){
return $this->autofocus;
}

/**
* The setAutofocus method, setter method for property $autofocus.
* @param Boolean $autofocus
* @access public
* @return Void
*/
public function setAutofocus($autofocus = TRUE){
$this->autofocus = $autofocus;
$this->setAttributes("Autofocus");
}

/**
* The isDisabled method, getter method for property $disabled.
* @access public
* @return Boolean
*/
public function isDisabled(){
return $this->disabled;
}

/**
* The setDisabled method, setter method for property $disabled.
* @param Boolean $disabled
* @access public
* @return Void
*/
public function setDisabled($disabled = TRUE){
$this->disabled = $disabled;
$this->setAttributes("Disabled");
}

/**
* The add method, sets an Option Object to a specific index.
* @param Option|OptGroup $option
* @param int $index
* @access public
* @return Void
*/
public function add(GUIComponent $option, $index = -1){
if(!($option instanceof Option) and !($option instanceof OptGroup)) throw new GUIException("Cannot add a non-option type component to dropdown list.");
parent::add($option, $index);
}

/**
* The select method, determines which option in this list should be set selected.
* @param String $identity
* @access public
* @return Void
*/
public function select($identity){
foreach($this->components as $components){
if($components->getValue() == $identity) $components->setSelected(TRUE);
}
}

/**
* The fill method, fill in this dropdownlist with options from database starting at a given index.
* To use it, you need PDO or MySQLi to fetch all rows with one or two properties to serve as collection list or map.
* @param Collective $collection
* @param String $identity
* @param Int $index
* @access public
* @return Void
*/
public function fill(Collective $collection, $identity = "", $index = -1){
if($index != -1) $this->currentIndex = $index;
if($collection instanceof LinkedList) $this->fillList($collection, $identity, $index);
elseif($collection instanceof LinkedHashMap) $this->fillMap($collection, $identity, $index);
else throw new GUIException("Cannot fill option objects inside this dropdownlist");
}

/**
* The fillList method, fill in this dropdownlist with elements from a LinkedList.
* @param LinkedList $list
* @param String $identity
* @param Int $index
* @access protected
* @return Void
*/
protected function fillList(LinkedList $list, $identity = "", $index = -1){
$iterator = $list->iterator();
while($iterator->hasNext()){
$field = (string)$iterator->next();
$option = new Option($field, $field);
if($option->getValue() == $identity) $option->setSelected(TRUE);
$this->add($option, $index);
if($index != -1) $index++;
}
}

/**
* The fillList method, fill in this dropdownlist with entries from a LinkedHashMap.
* @param LinkedHashMap $map
* @param String $identity
* @param Int $index
* @access protected
* @return Void
*/
protected function fillMap(LinkedHashMap $map, $identity = "", $index = -1){
$iterator = $map->iterator();
while($iterator->hasNext()){
$field = $iterator->next();
$option = new Option((string)$field->getKey(), (string)$field->getValue());
if($option->getValue() == $identity) $option->setSelected(TRUE);
$this->add($option, $index);
if($index != -1) $index++;
}
}

/**
* Magic method __toString for DropdownList class, it reveals that the object is a dropdown list.
* @access public
* @return String
*/
public function __toString(){
return new String("This is an instance of Mysidia DropDownList class.");
}
}
?>

Let me know how that goes.

Missy Master
01-29-2015, 05:25 PM
Okay I now have this:


protected function setDivision(GUIComponent $component){
$this->division = new Division($component);
$this->division->setClass("sidebar");
}


and I get this in ACP:


Catchable fatal error: Argument 1 passed to AdminSidebar::setDivision() must be an instance of GUIComponent, instance of Resource\Collection\ArrayList given, called in /home/petsim/public_html/Canidae/classes/class_adminsidebar.php on line 195 and defined in /home/petsim/public_html/Canidae/classes/class_adminsidebar.php on line 36

Kyttias
01-29-2015, 05:30 PM
Yup, this is what I have, too. From what I can tell it's not sure what to do with the ArrayList and the addClass function at the bottom of that file - I already pinged HoF over aim, so hopefully he'll return to the thread tonight. ovo

Missy Master
01-29-2015, 05:57 PM
I hope so too!

I really want to launch this site with this great script! :)

Hall of Famer
01-29-2015, 07:58 PM
Sorry, it seems that the original fix was not correct. The setDivision() method in AdminSidebar should be just a different method than the original SetDivision() from Sidebar and Widget class. I rename it to setDivisions, and it should work now. Download the attachment from below and lemme know if you encounter further issues.

Missy Master
01-29-2015, 08:22 PM
I think that's got it!! *hugs* HOF you totally rock as usual!!





As far as I can tell all is okay, if not I will report here but it's looking GOOD!!

Missy Master
01-29-2015, 08:29 PM
its still doing the drop down list error, but the ACP is working now, and the massive amounts of Strict Standards errors aren't happening---



seems to be in Items and Breeding --- actually shop and breeding, yeaaaah -

Kyttias
01-29-2015, 08:39 PM
I get Fatal error: Uncaught exception 'Exception' with message 'Fatal Error: Class AdmincpView either does not exist, or has its include path misconfigured!' in /srv/disk3/1793798/www/novul/classes/class_loader.php:83
Stack trace:
#0 [internal function]: Loader->load('AdmincpView')
#1 /srv/disk3/1793798/www/novul/classes/class_controller.php(135): spl_autoload_call('AdmincpView')
#2 /srv/disk3/1793798/www/novul/classes/class_frontcontroller.php(72): Controller->loadView(Object(Resource\Native\String))
#3 /srv/disk3/1793798/www/novul/index.php(73): FrontController->getView()
#4 /srv/disk3/1793798/www/novul/index.php(78): IndexController::main()
#5 {main} thrown in /srv/disk3/1793798/www/novul/classes/class_loader.php on line 83
Now when trying to visit my AdminCP.

Missy Master
01-29-2015, 08:51 PM
There you go!


No idea why that's still glitching but I can live with it if I have to .. I dont get why you can't access your ACP now ...




<?php

use Resource\Native\String;
use Resource\Collection\Collective;
use Resource\Collection\LinkedList;
use Resource\Collection\LinkedHashMap;

/**
* The DropdownList Class, extends from abstract GUIContainer class.
* It specifies a standard single-item dropdown list.
* @category Resource
* @package GUI
* @author Hall of Famer
* @copyright Mysidia Adoptables Script
* @link http://www.mysidiaadoptables.com
* @since 1.3.3
* @todo Not much at this point.
*
*/

class DropdownList extends GUIContainer{

/**
* The autofocus property, checks if the input component is autofocused.
* @access protected
* @var Boolean
*/
protected $autofocus = FALSE;

/**
* The disabled property, checks if the input component is disabled.
* @access protected
* @var Boolean
*/
protected $disabled = FALSE;

/**
* Constructor of SelectList Class, which assigns basic property to this list
* @param String $name
* @param ArrayList $components
* @param String $identity
* @param Event $event
* @access public
* @return Void
*/
public function __construct($name = "", $components = "", $identity = "", $event = ""){
if(!empty($name)){
$this->setName($name);
$this->setID($name);
}
if(!empty($identity)) $this->select($identity);
if(!empty($event)) $this->setEvent($event);

parent::__construct($components);
$this->renderer = new ListRenderer($this);
}

/**
* The isAutofocus method, getter method for property $autofocus.
* @access public
* @return Boolean
*/
public function isAutofocus(){
return $this->autofocus;
}

/**
* The setAutofocus method, setter method for property $autofocus.
* @param Boolean $autofocus
* @access public
* @return Void
*/
public function setAutofocus($autofocus = TRUE){
$this->autofocus = $autofocus;
$this->setAttributes("Autofocus");
}

/**
* The isDisabled method, getter method for property $disabled.
* @access public
* @return Boolean
*/
public function isDisabled(){
return $this->disabled;
}

/**
* The setDisabled method, setter method for property $disabled.
* @param Boolean $disabled
* @access public
* @return Void
*/
public function setDisabled($disabled = TRUE){
$this->disabled = $disabled;
$this->setAttributes("Disabled");
}

/**
* The add method, sets an Option Object to a specific index.
* @param Option|OptGroup $option
* @param int $index
* @access public
* @return Void
*/


public function add($option, $index = -1){
if(!($option instanceof Option) and !($option instanceof OptGroup)) throw new GUIException("Cannot add a non-option type component to dropdown list.");
parent::add($option, $index);
}




/**
* The select method, determines which option in this list should be set selected.
* @param String $identity
* @access public
* @return Void
*/
public function select($identity){
foreach($this->components as $components){
if($components->getValue() == $identity) $components->setSelected(TRUE);
}
}

/**
* The fill method, fill in this dropdownlist with options from database starting at a given index.
* To use it, you need PDO or MySQLi to fetch all rows with one or two properties to serve as collection list or map.
* @param Collective $collection
* @param String $identity
* @param Int $index
* @access public
* @return Void
*/
public function fill(Collective $collection, $identity = "", $index = -1){
if($index != -1) $this->currentIndex = $index;
if($collection instanceof LinkedList) $this->fillList($collection, $identity, $index);
elseif($collection instanceof LinkedHashMap) $this->fillMap($collection, $identity, $index);
else throw new GUIException("Cannot fill option objects inside this dropdownlist");
}

/**
* The fillList method, fill in this dropdownlist with elements from a LinkedList.
* @param LinkedList $list
* @param String $identity
* @param Int $index
* @access protected
* @return Void
*/
protected function fillList(LinkedList $list, $identity = "", $index = -1){
$iterator = $list->iterator();
while($iterator->hasNext()){
$field = (string)$iterator->next();
$option = new Option($field, $field);
if($option->getValue() == $identity) $option->setSelected(TRUE);
$this->add($option, $index);
if($index != -1) $index++;
}
}

/**
* The fillList method, fill in this dropdownlist with entries from a LinkedHashMap.
* @param LinkedHashMap $map
* @param String $identity
* @param Int $index
* @access protected
* @return Void
*/
protected function fillMap(LinkedHashMap $map, $identity = "", $index = -1){
$iterator = $map->iterator();
while($iterator->hasNext()){
$field = $iterator->next();
$option = new Option((string)$field->getKey(), (string)$field->getValue());
if($option->getValue() == $identity) $option->setSelected(TRUE);
$this->add($option, $index);
if($index != -1) $index++;
}
}

/**
* Magic method __toString for DropdownList class, it reveals that the object is a dropdown list.
* @access public
* @return String
*/
public function __toString(){
return new String("This is an instance of Mysidia DropDownList class.");
}
}
?>

Kyttias
01-29-2015, 08:54 PM
Yes, again, you haven't replaced

public function add($option, $index = -1){
if(!($option instanceof Option) and !($option instanceof OptGroup)) throw new GUIException("Cannot add a non-option type component to dropdown list.");
parent::add($option, $index);
}

with

public function add(GUIComponent $option, $index = -1){
if(!($option instanceof Option) and !($option instanceof OptGroup)) throw new GUIException("Cannot add a non-option type component to dropdown list.");
parent::add($option, $index);
}

Or, here's the full file:

<?php
use Resource\Native\String;
use Resource\Collection\Collective;
use Resource\Collection\LinkedList;
use Resource\Collection\LinkedHashMap;

/**
* The DropdownList Class, extends from abstract GUIContainer class.
* It specifies a standard single-item dropdown list.
* @category Resource
* @package GUI
* @author Hall of Famer
* @copyright Mysidia Adoptables Script
* @link http://www.mysidiaadoptables.com
* @since 1.3.3
* @todo Not much at this point.
*
*/

class DropdownList extends GUIContainer{

/**
* The autofocus property, checks if the input component is autofocused.
* @access protected
* @var Boolean
*/
protected $autofocus = FALSE;

/**
* The disabled property, checks if the input component is disabled.
* @access protected
* @var Boolean
*/
protected $disabled = FALSE;

/**
* Constructor of SelectList Class, which assigns basic property to this list
* @param String $name
* @param ArrayList $components
* @param String $identity
* @param Event $event
* @access public
* @return Void
*/
public function __construct($name = "", $components = "", $identity = "", $event = ""){
if(!empty($name)){
$this->setName($name);
$this->setID($name);
}
if(!empty($identity)) $this->select($identity);
if(!empty($event)) $this->setEvent($event);

parent::__construct($components);
$this->renderer = new ListRenderer($this);
}

/**
* The isAutofocus method, getter method for property $autofocus.
* @access public
* @return Boolean
*/
public function isAutofocus(){
return $this->autofocus;
}

/**
* The setAutofocus method, setter method for property $autofocus.
* @param Boolean $autofocus
* @access public
* @return Void
*/
public function setAutofocus($autofocus = TRUE){
$this->autofocus = $autofocus;
$this->setAttributes("Autofocus");
}

/**
* The isDisabled method, getter method for property $disabled.
* @access public
* @return Boolean
*/
public function isDisabled(){
return $this->disabled;
}

/**
* The setDisabled method, setter method for property $disabled.
* @param Boolean $disabled
* @access public
* @return Void
*/
public function setDisabled($disabled = TRUE){
$this->disabled = $disabled;
$this->setAttributes("Disabled");
}

/**
* The add method, sets an Option Object to a specific index.
* @param Option|OptGroup $option
* @param int $index
* @access public
* @return Void
*/
public function add(GUIComponent $option, $index = -1){
if(!($option instanceof Option) and !($option instanceof OptGroup)) throw new GUIException("Cannot add a non-option type component to dropdown list.");
parent::add($option, $index);
}

/**
* The select method, determines which option in this list should be set selected.
* @param String $identity
* @access public
* @return Void
*/
public function select($identity){
foreach($this->components as $components){
if($components->getValue() == $identity) $components->setSelected(TRUE);
}
}

/**
* The fill method, fill in this dropdownlist with options from database starting at a given index.
* To use it, you need PDO or MySQLi to fetch all rows with one or two properties to serve as collection list or map.
* @param Collective $collection
* @param String $identity
* @param Int $index
* @access public
* @return Void
*/
public function fill(Collective $collection, $identity = "", $index = -1){
if($index != -1) $this->currentIndex = $index;
if($collection instanceof LinkedList) $this->fillList($collection, $identity, $index);
elseif($collection instanceof LinkedHashMap) $this->fillMap($collection, $identity, $index);
else throw new GUIException("Cannot fill option objects inside this dropdownlist");
}

/**
* The fillList method, fill in this dropdownlist with elements from a LinkedList.
* @param LinkedList $list
* @param String $identity
* @param Int $index
* @access protected
* @return Void
*/
protected function fillList(LinkedList $list, $identity = "", $index = -1){
$iterator = $list->iterator();
while($iterator->hasNext()){
$field = (string)$iterator->next();
$option = new Option($field, $field);
if($option->getValue() == $identity) $option->setSelected(TRUE);
$this->add($option, $index);
if($index != -1) $index++;
}
}

/**
* The fillList method, fill in this dropdownlist with entries from a LinkedHashMap.
* @param LinkedHashMap $map
* @param String $identity
* @param Int $index
* @access protected
* @return Void
*/
protected function fillMap(LinkedHashMap $map, $identity = "", $index = -1){
$iterator = $map->iterator();
while($iterator->hasNext()){
$field = $iterator->next();
$option = new Option((string)$field->getKey(), (string)$field->getValue());
if($option->getValue() == $identity) $option->setSelected(TRUE);
$this->add($option, $index);
if($index != -1) $index++;
}
}

/**
* Magic method __toString for DropdownList class, it reveals that the object is a dropdown list.
* @access public
* @return String
*/
public function __toString(){
return new String("This is an instance of Mysidia DropDownList class.");
}
}
?>

Missy Master
01-29-2015, 08:57 PM
Ah let me try that now, now that the basics are working! Glad you caught that!

Missy Master
01-29-2015, 08:59 PM
BINGO!! Solved!! Thank you so much!!!!


Now hopefully your ACP will give you access !!

Hall of Famer
01-30-2015, 08:04 AM
It seems that your site will work now. ^^ Got any other issues, please let me or other users on the forum know. Also you can message me on Skype directly, since you have my contact.