htmlspecialchars() expects parameter 1 to be string, - joomla

I'm getting this error
htmlspecialchars() expects parameter 1 to be string, object given in /homepages/25/d695898710/htdocs/clickandbuilds/Joomla/prestigetaxisheathrow/components/com_sppagebuilder/parser/addon-parser.php on line 561
where line 561 is
$default .= ' '.$key.'="'.htmlspecialchars($val).'"';
How can i solve this error?

Related

strconv.ParseInt fails if number starts with 0

I'm currently having issues parsing some numbers starting with 0 in Go.
fmt.Println(strconv.ParseInt("0491031", 0, 64))
0 strconv.ParseInt: parsing "0491031": invalid syntax
GoPlayground: https://go.dev/play/p/TAv7IEoyI8I
I think this is due to some base conversion error, but I don't have ideas about how to fix it.
I'm getting this error parsing a 5GB+ csv file with gocsv, if you need more details.
[This error was caused by the GoCSV library that doesn't allow to specify a base for the numbers you're going to parse.]
Quoting from strconv.ParseInt()
If the base argument is 0, the true base is implied by the string's prefix following the sign (if present): 2 for "0b", 8 for "0" or "0o", 16 for "0x", and 10 otherwise. Also, for argument base 0 only, underscore characters are permitted as defined by the Go syntax for integer literals.
You are passing 0 for base, so the base to parse in will be inferred from the string value, and since it starts with a '0' followed by a non '0', your number is interpreted as an octal (8) number, and the digit 9 is invalid there.
Note that this would work:
fmt.Println(strconv.ParseInt("0431031", 0, 64))
And output (try it on the Go Playground):
143897 <nil>
(Octal 431031 equals 143897 decimal.)
If your input is in base 10, pass 10 for base:
fmt.Println(strconv.ParseInt("0491031", 10, 64))
Then output will be (try it on the Go Playground):
491031 <nil>

Why can't I call load() on a variable?

I can call load() in the REPL.
>>> load("trades.csv")
symbol timestamp price size
AAPL 2019-05-01 09:30:00.578802 210.5200 780
AAPL 2019-05-01 09:30:00.580485 210.8100 390
BAC 2019-05-01 09:30:00.629205 30.2500 510
CVX 2019-05-01 09:30:00.944122 117.8000 5860
AAPL 2019-05-01 09:30:01.002405 211.1300 320
AAPL 2019-05-01 09:30:01.066917 211.1186 310
AAPL 2019-05-01 09:30:01.118968 211.0000 730
BAC 2019-05-01 09:30:01.186416 30.2450 380
... ... ... ...
But I can't load a command-line argument in a script:
let trades = load(argv[1])
I get an error:
Error: macro parameter filename requires a comptime literal
Error: unable to determine type for trades
Empirical is statically typed. load() will infer a Dataframe's type if the file path can be determined at compile time. Variables and arbitrary expressions are permitted. For example:
let filename = "trades.csv"
let trades = load("./" + filename)
The filename above is a constant (immutable) because it was declared with let. But argv is mutable (not constant) because it is implicitly declared with var.
Empirical must know the type of the Dataframe, which we will have to pass explicitly in this case. Fortunately, we can get a hint in the REPL.
>>> columns(load("trades.csv"))
symbol: String
timestamp: Timestamp
price: Float64
size: Int64
We will also have to call csv_load() instead, since that takes a template. Here is the script as it should be:
data Trade:
symbol: String,
timestamp: Timestamp,
price: Float64,
size: Int64
end
let trades = csv_load{Trade}(argv[1])
This compiles as expected. Calling print(trades) in the script will display the Dataframe.

ErrorException in class.pdf.php line 3154

I'm new in Laravel, I use laravel 5.2 and I'm trying to generate a report using DomPdf but I'm getting error:
ErrorException in class.pdf.php line 3154
Undefined index:
in class.pdf.php line 3154
at HandleExceptions->handleError('8', 'Undefined index: ', 'C:\xampp\htdocs\balai\vendor\dompdf\dompdf\lib\class.pdf.php', '3154', array('size' => '12')) in class.pdf.php line 3154
at Cpdf->getFontHeight('12') in cpdf_adapter.cls.php line 740
at CPDF_Adapter->get_font_height('C:/xampp/htdocs/balai/vendor/dompdf/dompdf/lib/fonts/Times-Roman', '12') in font_metrics.cls.php line 122
at Font_Metrics::get_font_height('C:/xampp/htdocs/balai/vendor/dompdf/dompdf/lib/fonts/Times-Roman', '12') in text_frame_reflower.cls.php line 167
at Text_Frame_Reflower->_layout_line() in text_frame_reflower.cls.php line 332
at Text_Frame_Reflower->reflow(object(Block_Frame_Decorator)) in frame_decorator.cls.php line 711
at Frame_Decorator->reflow(object(Block_Frame_Decorator)) in block_frame_reflower.cls.php line 750
at Block_Frame_Reflower->reflow(null) in frame_decorator.cls.php line 711
at Frame_Decorator->reflow() in page_frame_reflower.cls.php line 123
at Page_Frame_Reflower->reflow(null) in frame_decorator.cls.php line 711
at Frame_Decorator->reflow() in dompdf.cls.php line 973
at DOMPDF->render() in PDF.php line 208
at PDF->render() in PDF.php line 154
at PDF->output() in PDF.php line 166
at PDF->save('documents.pdf') in LlajRambuController.php line 247
at LlajRambuController->printRambu('52', '1')
I was having this same problem, and I found a solution that makes no sense to me.
The HTML I was passing to dompdf didn't have any line breaks, like:
<html><body>content here<body></html>
Adding a break after the body tag fixed the problem.
<html><body>
content here
</body></html>
No clue what's going on, but now it works. Hope this fixes your problem too.

Shell Error: value too great for base (error token is "09") [duplicate]

This question already has answers here:
printf in bash: "09" and "08" are invalid numbers, "07" and "06" are fine
(9 answers)
Closed 7 years ago.
The Question already exists in stackoverflow, but it didn't solve my problem.
The function getDate calculate number of days based on 3 parameters.
But I always get this error: value too great for base (error token is "09") line 7 val= ..
function getDate (){
d=$1
m=$2
y=$3
m=$(((m+9) % 12))
y=$((y - m/10))
val=$((365*y + y/4 - y/100 + y/400 + (m*306 + 5)/10 + ( d - 1 )))
return $val
}
It is because because of leading 0 shell treats 09 as an octal value and obviously 09 is an invalid octal value.

Notice: Undefined offset: 0 in smarty

I got the following notices and would like to clarify:
Notice: Undefined offset: 0 in /homepages/40/d35550088/htdocs/smarty/templates_c/
ef666588706a0451c86287e631024054e2f40226.file.list.tpl.php on line 434
Notice: Undefined offset: 1 in /homepages/40/d35550088/htdocs/smarty/templates_c/
ef666588706a0451c86287e631024054e2f40226.file.list.tpl.php on line 434
Notice: Undefined offset: 2 in /homepages/40/d35550088/htdocs/smarty/templates_c/
ef666588706a0451c86287e631024054e2f40226.file.list.tpl.php on line 434
Notice: Undefined offset: 9 in /homepages/40/d35550088/htdocs/smarty/templates_c/
ef666588706a0451c86287e631024054e2f40226.file.list.tpl.php on line 434
Code lines in the compiled tpl are:
<?php if ($_smarty_tpl->tpl_vars['TablesLinked']->value[$_smarty_tpl->getVariable('smarty')->value['section']['i']['index']]){?>
This is the uncompiled line:
{if $TablesLinked[i]}
One line above starts the section:
{section name=i loop=$NumberFields}
Do I have to change the start index because offset means wrong index ?
TablesLinked does not appear in every field, because fields consist of linkedtables and normal fields, thats why I use an if-clause.
I hope you can help.
Although it is a very good practice set error_reporting to E_ALL during development phase and trying to eliminate all notices, personally I wouldn't worry about these messages. It just won't find the elements on the specified indices during the loop. In any case, if you insist on eliminating the notices, you can change
{if $TablesLinked[i]}
to
{if isset($TablesLinked[i]) && $TablesLinked[i]}

Resources