pradosoft / prado

Prado - Component Framework for PHP
Other
187 stars 70 forks source link

[Unknown Error] base64_decode(): Passing null to parameter #1 ($string) of type string is deprecated #995

Closed RobCrack2023 closed 4 months ago

RobCrack2023 commented 4 months ago

Hello guys, I have a site that I am making and I found in the Prado examples how to have more than one layout, so I created the config.xml file that contains

<?xml version="1.0" encoding="utf-8"?>
<configuration>
   <pages MasterClass="Application.Layouts.menu"/>
</configuration>

All this is placed in the admin folder, now there is a page within this folder called main that contains a repeat where there are also buttons that allow you to go to another detail.page. and that is where the problem occurs when you click on the links header.

I would greatly appreciate your help

ctrlaltca commented 4 months ago

Please set your applicatin in Debug mode. In protected/application.xml:

<application id="XXX" mode="Debug">

You should get a full backtrace of the error. Please post the backtrace here inside backticks ``` otherway the content can't be seen inside your comment.

RobCrack2023 commented 4 months ago
Prado\Exceptions\TPhpErrorException
Description

[Unknown Error] base64_decode(): Passing null to parameter #1 ($string) of type string is deprecated (@line 68 in file C:\wamp64\www\appNodos\protected\vendor\pradosoft\prado\framework\Web\UI\[TPageStateFormatter](http://pradosoft.github.io/docs/manual/class-Prado.Web.UI.TPageStateFormatter.html).php). (Error Code: 0)
Source File

${PradoFramework}\Web\UI\TPageStateFormatter.php (68)

0057:         return base64_encode($str);
0058:     }
0059: 
0060:     /**
0061:      * @param TPage $page
0062:      * @param string $data serialized data
0063:      * @return mixed unserialized state data, null if data is corrupted
0064:      */
0065:     public static function unserialize($page, $data)
0066:     {
0067:         
0068:         $str = base64_decode($data);
0069:         if ($str === '') {
0070:             return null;
0071:         }
0072:         if ($str !== false) {
0073:             $sm = $page->getApplication()->getSecurityManager();
0074:             if ($page->getEnableStateEncryption()) {
0075:                 $str = $sm->decrypt($str);
0076:             }
0077:             if ($page->getEnableStateCompression() && extension_loaded('zlib')) {
0078:                 $str = @gzuncompress($str);
0079:             }
0080: 

Stack Trace

#0 [internal function]: Prado\Prado::phpErrorHandler(8192, 'base64_decode()...', 'C:\\wamp64\\www\\a...', 68)
#1 ${PradoFramework}\Web\UI\TPageStateFormatter.php(68): base64_decode(NULL)
#2 ${PradoFramework}\Web\UI\TPageStatePersister.php(64): Prado\Web\UI\TPageStateFormatter::unserialize(Object(Detalle), NULL)
#3 ${PradoFramework}\Web\UI\TPage.php(801): Prado\Web\UI\TPageStatePersister->load()
#4 ${PradoFramework}\Web\UI\TPage.php(274): Prado\Web\UI\TPage->loadPageState()
#5 ${PradoFramework}\Web\UI\TPage.php(218): Prado\Web\UI\TPage->processPostBackRequest(Object(Prado\Web\UI\THtmlWriter))
#6 ${PradoFramework}\Web\Services\TPageService.php(535): Prado\Web\UI\TPage->run(Object(Prado\Web\UI\THtmlWriter))
#7 ${PradoFramework}\Web\Services\TPageService.php(453): Prado\Web\Services\TPageService->runPage(Object(Detalle), Array)
#8 ${PradoFramework}\TApplication.php(1328): Prado\Web\Services\TPageService->run()
#9 ${PradoFramework}\TApplication.php(409): Prado\TApplication->runService()
#10 ${DocumentRoot}\appNodos\index.php(24): Prado\TApplication->run()
#11 {main}

2024-02-26 18:28 Apache/2.4.51 (Win64) PHP/8.1.0 [PRADO](https://github.com/pradosoft/prado)/4.3.0
ctrlaltca commented 4 months ago

There's something strange going on here. It looks like the request that is being handled doesn't contain a PRADO_PAGESTATE field, so the related method returns null causing the error. In your site you should see an hidden input in the page:

<input type="text" style="display:none" autocomplete="off" name="PRADO_PAGESTATE" id="PRADO_PAGESTATE" value="..." />

When you make a request (eg. click a button) you should see that field being sent to the server, eg. this is from the heloworld demo:

immagine

Can you check if the field exists and gets correctly sent to the server?

RobCrack2023 commented 4 months ago

Hello, thank you very much for your prompt response.

I attach two images, one called "paginaprincipal" which is where you press the edit button and it redirects you to the "paginadetalle" which is where the error occurs when pressing a link in the top bar, in both you can see the hidden variable that you mention PaginaDetalle paginaprincipal

ctrlaltca commented 4 months ago

In the first image (Modificacion de parametros) the <input> is outside the <form> tag, so it won't be sent alongside the subsequent page requests. You should have a <com:TForm> tag inside your page or layout. I guess some tag inside the form is not closed correctly and this is causing the <input> tag to be rendered outside the <form> tag.

RobCrack2023 commented 4 months ago

I actually had

tags that were left there when I copied the html template, I greatly appreciate your help, greetings

PaginaDetalle2

drigolin commented 4 months ago
is an html tag. You need to put to use prado components. Il giorno mar 27 feb 2024 alle ore 15:32 Roberto Rojas < ***@***.***> ha scritto: > I actually had > tags that were left there when I copied the html template, I greatly > appreciate your help, greetings > > PaginaDetalle2.png (view on web) > > > — > Reply to this email directly, view it on GitHub > , > or unsubscribe > > . > You are receiving this because you are subscribed to this thread.Message > ID: ***@***.***> >
RobCrack2023 commented 4 months ago
is an html tag. You need to put to use prado components. Il giorno mar 27 feb 2024 alle ore 15:32 Roberto Rojas < ***@***.***> ha scritto: […](#) I actually had tags that were left there when I copied the html template, I greatly appreciate your help, greetings PaginaDetalle2.png (view on web) — Reply to this email directly, view it on GitHub <[#995 (comment)](https://github.com/pradosoft/prado/issues/995#issuecomment-1966683807)>, or unsubscribe . You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>

Thank you very much for your help to remove the tags, it was solved, thank you