After attempting to migrate our Wordpress site to the root, the page builder theme we're using now shows the majority of the pages as blank. The page builder theme uses rows and modules with the data stored in the _postmeta table of the database. I've checked the database and the page data for the builder is still there, albeit serialized. After migrating, I did do a search and replace on the database, which I now know wasn't a good move due to the serialized data. However, I've restored the database and the site/theme files to an earlier date and the issue still persists. The site is blank! :(
I've checked the error logs for the server, and I'm noticing 3 recurring warnings starting after the migration:
Warning 1
PHP Warning: substr() expects parameter 3 to be long, string given in /hermes/waloraweb013/b1721/blu.icweb4704n/test/wp-content/themes/cutting-edge/framework/spyropress-functions.php on line 105
Line 105 reads:
$text = substr( $text, 0, $length );
Warning 2
PHP Warning: Invalid argument supplied for foreach() in /hermes/waloraweb013/b1721/blu.icweb4704n/test/wp-content/themes/cutting-edge/framework/builder/spyropress-row-functions.php on line 382
The code for line 382 is:
foreach ( $rows as $row_ID => $row ) {
Warning 3
PHP Warning: Invalid argument supplied for foreach() in /hermes/waloraweb013/b1721/blu.icweb4704n/test/wp-content/themes/cutting-edge/framework/builder/spyropress-row-functions.php on line 332
Line 332 is also:
foreach ( $rows as $row_ID => $row ) {
I need help figuring out what could've gone wrong and still be wrong after restoring the site and the database to an earlier time, and without changes in of the Lines which now have errors. Is it possible that the database is caching? I've cleared my browser cache and restarted several times to no avail.
Any help or insight is greatly appreciated - we're talking about 8 months worth of work I really can't afford to lose.
Thanks in advance!
Related
I use the Accordion plugin of Wordpress in php. But after changing the name of the site, I have errors including the script add-acc.php.
The error message is: Notice: unserialize (): Error at offset 0 of 1 bytes.
The line concerned in the file is:
$ accordion_data = unserialize (get_post_meta ($ post-> ID, 'wpsm_accordion_data', true));
I can not solve this problem. As a result, the publications do not appear anymore.
Can someone help me?
thank you in advance
Modx generate error in log. How to find original snippet in modx administation panel?
[2019-01-18 13:30:25] (ERROR #
../site/core/cache/includes/elements/modsnippet/105.include.cache.php
: 26) PHP warning: Invalid argument supplied for foreach()
modsnippet/105.include.cache.php : 26
This is the key - please open snippet with ID=105 and find row № 26
In other words you need
/manager/?a=element/snippet/update&id=105
I'm redoing a large portion of my website to use older mysql_* extensions because they execute faster. Yes I know people say its not a good idea to use older extensions, but I need to go for speed since this code is part of the back-end operations to my website and I want to serve as many people as possible.
I do have a small issue after converting things over. Sometimes when I try to close a database connection I get a PHP warning of:
PHP Warning: mysql_close(): 33 is not a valid MySQL-Link resource in /path/to/script.php on line #
and the line refers to the code below:
function DBclose($c){
if (isset($c) && !mysql_close($c)){
error_log("DB handle is invalid/null. Called from ".debug_backtrace()[2]['function'].'->'.debug_backtrace()[1]['function']);
}
}
This only happens sometimes.
What I want to do is change only this warning so that it includes the function that called it. Maybe to something more like:
PHP Warning: mysql_close(): 33 is not a valid MySQL-Link resource in /path/to/script.php on line # called from parent function <function-name>
How do I fix this and still make it so that other function calls I make that begin with # will have no errors printed on screen?
I don't think you can change the message, however, you can check if it's a resource using is_resource()
I needed to change the data_scale of a decimal field implemented by the module "computed field".
I changed the field_data_MYFIELD directly in database (from 10,2 to 10,4).
I also modified the field_revision_MYFIELD the same way.
As third step, I modified the data of the field_config by changing:
FROM
s:14:"data_precision";s:2:"10";s:10:"data_scale";s:1:"2";
TO
s:14:"data_precision";s:2:"10";s:10:"data_scale";s:1:"4";
As I'm trying to clear caches with drush cc all, I get the following error:
PHP Fatal error: Unsupported operand types in
DRUPAL_SITE/modules/field/field.info.class.inc on line 495
The line 495 is:
// Make sure all expected field settings are present.
$field['settings'] += field_info_field_settings($field['type']);
I enabled the error log in index.php and have the following errors:
unserialize(): Error at offset 330 of 1314 bytes in DRUPAL_SITE/modules/field/field.crud.inc on line 374
Notice: Undefined index: settings in DRUPAL_SITE/sites/all/modules/computed_field/computed_field.install on line 13
Undefined index: settings in DRUPAL_SITE/modules/field/field.info.class.inc on line 495
Fatal error: Unsupported operand types in DRUPAL_SITE/modules/field/field.info.class.inc on line 495
What am I doing wrong?
Never a good idea to alter settings via mysql directly, take a look here to do it from code : https://drupal.stackexchange.com/questions/79378/changing-a-field-type-from-integer-to-decimal/151367#151367
Instead, you could have use an hook_update to alter the field.
Thank you Clive. I did'nt paste the whole data ...apologize. The data_precision etc keys are indeed inside a database key within that string. I tested the data content into http://blog.tanist.co.uk/files/unserialize/ (as suggested) and the string is not valid ... you were right. I fixed it by changing different values of the S lenght in order to match the content of each S . After some tests, the problem is now resolved. It appears that editing the Blob data (for computed fields with php code inside) directly from phpmyadmin is not a good idea as far as it adds many additional char that doesn't match the lenght of the S. Thanks again for your help.
I'm currently working with PDFLib 9.0.5 with PHP and I'm truggling with the building of a table.
I've got a large table with 34 columns. The first thing I do is create the header row and i've got this error message
PDFlibException' with message 'Cell in column(s) 33 and row(s) 1: Illegal array index 32 in function pdc_bvtr_setbit
I've made a test with 32 columns and there is no problems. If the array i'm using to create the row is larger than 32 elements, i've got the error.
I thought it could be due to a lack of space whithin my pdf, so i increase the pdf's width but it didn't change anything.
Here is the code which triggered the error :
foreach($this->headerTable as $index=>$text)
{
$currentOption=$optlist;
if(is_int($index))
{
$currentColorString=(($col%2)==0)?$alternateWhiteColorString:$whiteColorString;
$currentOption.=(in_array($index,array(2,3)))?' fittextflow={orientate=west}':'';
$currentOption.=($index==5)?' fittextflow={stamp=ll2ur}':'';
$currentOption.=(in_array($index,array(0,1,4)))?' fittextflow={stamp=ll2ur}':'';
}
else
{
$currentColorString=(($col%2)==0)?$greyColorString:$greyAlternateColorString;
$text=$index.' ('.$text.')';
$currentOption.=' fittextflow={stamp=ll2ur}';
}
$textFlow=PDF_add_textflow($this->pdf,0,$text,$optionHeaderContent);
$this->table=PDF_add_table_cell($this->pdf,$this->table,$col,1,'',$currentOption.' matchbox={fillcolor={rgb '.$currentColorString.'}} textflow='.$textFlow);
++$col;
}
Answer from Rainer comment : this is bug in the current version of PDFlib 9.0.5. It should be fixed in the next release.