tcpdf date error Message: Undefined offset: 2 - date

i have a date (datepicker jquery) $fecha_constancia:
public function generarReporte(){
$data_b = array();
$container = $this->input->get_post('opc_report', TRUE);
$paciente = $this->input->get_post('paciente', TRUE);
$odontologo = $this->input->get_post('odontologo', TRUE);
$fecha_constancia = $this->input->get_post('fecha_constancia', TRUE);
$diagnostico = $this->input->get_post('diagnostico', TRUE);
$reposo= $this->input->get_post('reposo', TRUE);
$reposo = $reposo*7;
list($day,$mon,$year) = explode('/',$fecha_constancia);
$nueva_fecha = date('d/m/Y',mktime(0,0,0,$mon,$day+$reposo,$year));
$data_a = array(
'fecha_constancia' => $fecha_constancia,
'diagnostico' => $diagnostico,
'fecha_reposo' => $nueva_fecha,
'dias_reposo' => $reposo
but when I'm going to spend the time to the Make pdf throws me the following result:
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 2
Filename: controllers/constancia.php
Line Number: 38
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 1
Filename: controllers/constancia.php
Line Number: 38
is that the problem is in the date but not how to fix it

Check that the value of $fecha_constancia is an actual date in the format of Day/Month/Year.
This is line 38, correct?:
list($day,$mon,$year) = explode('/',$fecha_constancia);
Based on the error message, there's no slashes in $fecha_constancia. It can't assign anything to $mon and $year because explode is returning an array with a single element.

Related

A PHP Error was encountered Severity: Notice Message: Trying to access array offset on value of type null

A PHP Error was encountered
Severity: Notice
Message: Trying to access array offset on value of type null
Filename: datauser/editsuperadmin.php
Line Number: 20
Backtrace:
File: C:\xampp\htdocs\mcicampus2\application\views\Superadmin\datauser\editsuperadmin.php
Line: 20
Function: _error_handler
File: C:\xampp\htdocs\mcicampus2\application\controllers\Superadmin.php
Line: 107
Function: view
File: C:\xampp\htdocs\mcicampus2\index.php
Line: 315
Function: require_once
This error means the index doesn't exist in array. You should use isset before printing or using the value of the array.
To check whether the index exists or not you can use isset():
isset($abc_array['xyz_data']) {
echo $abc_array['xyz_data'];
}

Dart Mockito - UnimplementedError, Fake.noSuchMethod

I've got this test:
test(
'Form is Edit, and value is different to form value, sets form type to Add, and sets hasFormTypeChanged to true',
() async {
manageVgnItmStore = MockManageVgnItmStore();
final formVm = MockManageVgnItmsFormStore();
when(formVm.hasFormTypeChanged).thenReturn(false);
when(manageVgnItmStore?.lastSelectedVgnItm).thenReturn(
const VgnItm.groceryItm(companyName: 'Cadbury', name: 'Chocolate'));
when(manageVgnItmStore?.stateNotifiersVm)
.thenReturn(ManageVgnItmsStateNotifiersStore(manageVgnItmStore!));
when(manageVgnItmStore?.formVm).thenReturn(formVm);
when(manageVgnItmStore?.formVm.hasFormTypeChanged).thenReturn(false);
when(manageVgnItmStore?.formType).thenReturn(const Edit(name: 'Edit'));
underTest = VgnItmFormEvents(manageVgnItmStore!);
underTest?.onNameChanged('fasdfsdfsdf', form!);
verify(underTest?.manageVgnItmStore.formType = const Add(name: 'Add'));
verify(underTest?.manageVgnItmStore.formVm.hasFormTypeChanged = true);
});
The last verify call produces the error:
UnimplementedError: hasFormTypeChanged
package:test_api
Fake.noSuchMethod
package:vepo/src/presentation/stores/manage_vegan_items/form_store.dart
19:8 _FakeManageVgnItmsFormStore_0.hasFormTypeChanged
As you can see I have set it multiple times:
when(formVm.hasFormTypeChanged).thenReturn(false);
when(manageVgnItmStore?.formVm.hasFormTypeChanged).thenReturn(false);
Why is this error occurring?

How to use DataHandler in Symfony command controller in TYPO3

class RemoveHiddenPages extends Symfony\Component\Console\Command\Command
{
protected function execute(InputInterface $input, OutputInterface $output)
{
Bootstrap::initializeBackendAuthentication();
$uid = someuid;
$cmd['pages'][$uid]['delete'] = 1;
$dataHandler = GeneralUtility::makeInstance(DataHandler::class);
$dataHandler->start([], $cmd);
$dataHandler->process_cmdmap();
// ....
I try to run the command from the command line. This results in an exception:
Tue, 17 Mar 2020 10:14:15 +0100 [CRITICAL] request="684c29a15bc6b" component="TYPO3.CMS.Core.Error.DebugExceptionHandler":
Core: Exception handler (CLI): Uncaught TYPO3 Exception: Argument 1 passed to
TYPO3\CMS\Core\Session\Backend\DatabaseSessionBackend::update() must be of the type string, null given,
called in /site/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php on line 1311
| TypeError thrown in file /site/typo3/sysext/core/Classes/Session/Backend/DatabaseSessionBackend.php in line 159
- {"exception":{"xdebug_message":"\nTypeError: Argument 1 passed to
TYPO3\\CMS\\Core\\Session\\Backend\\DatabaseSessionBackend::update()
must be of the type string, null given, called in ....
In DataHandler::deletePages() a flash message is sent. This seems to cause the problem, as the session is not initialized. Is it possible to use the DataHandler in command controllers?
The example is based on:
https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/CommandControllers/Index.html
https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Typo3CoreEngine/UsingDataHandler/Index.html
I am using TYPO3 9.5.14
You can have a look into in2code/migration. There is a DataHandler call to move pages via symfony command: https://github.com/einpraegsam/migration/blob/master/Classes/Command/DataHandlerCommand.php
protected function execute(InputInterface $input, OutputInterface $output): int
{
$command = [];
$command['pages'][(int)$input->getArgument('startPid')][$input->getArgument('action')]
= (int)$input->getArgument('targetPid');
/** #var DataHandler $dataHandler */
$dataHandler = GeneralUtility::makeInstance(DataHandler::class);
$dataHandler->BE_USER = $GLOBALS['BE_USER'];
$dataHandler->BE_USER->user['admin'] = 1;
$dataHandler->userid = $GLOBALS['BE_USER']->user['uid'];
$dataHandler->admin = true;
$dataHandler->bypassAccessCheckForRecords = true;
$dataHandler->copyTree = $input->getArgument('recursion');
$dataHandler->deleteTree = true;
$dataHandler->neverHideAtCopy = true;
$dataHandler->start([], $command);
$dataHandler->process_cmdmap();
$output->writeln($this->getMessage($dataHandler));
return 0;
}

The SOAP function called with localhost, works, when I call with external IP and port, returns Forbidden error

Function called:
public function getAcces($plngVersiune, $pstrNumeFirma, $pstrUtilizator, $pstrParolaSecurizata, $wsdl)
{
$this->plngVersiune = $plngVersiune;
$this->pstrNumeFirma = $pstrNumeFirma;
$this->pstrUtilizator = $pstrUtilizator;
$this->pstrParolaSecurizata = $pstrParolaSecurizata;
$this->wsdl = $wsdl;
$xml_array = array();
$xml_array['plngVersiune'] = $this->plngVersiune;
$xml_array['pstrNumeFirma'] = $this->pstrNumeFirma;
$xml_array['pstrUtilizator'] = $this->pstrUtilizator;
$xml_array['pstrParolaSecurizata'] = $this->pstrParolaSecurizata;
$client = new SoapClient($wsdl); // , array('trace' => $trace, 'exceptions' => $exceptions)
var_dump($client);
$clientToken = $client->LogIn($xml_array)->LogInResult;
var_dump($clientToken);
//unset($xml_array);
return $clientToken;
}
Line called:
$acces = $gru->getAcces(1,"ALM","Administrator","d41d8cd98f00b204e9800998ecf8427e", "http://82.108.151.XXX:8080/InterfacesWS/IInterfacesBO3.asmx?WSDL");
Returns Errors:
Fatal error: Uncaught SoapFault exception: [HTTP] Forbidden in C:\Program Files (x86)\Ampps\www\soap\class_01.php
SoapFault: Forbidden in C:\Program Files (x86)\Ampps\www\soap\class_01.php
Instead, if I call the same function with "http: //localhost/InterfacesWS/IInterfacesBO3.asmx? WSDL" I have no error. It works correctly.
How do I eliminate the SoapFault: Forbidden error?

ORA-06550: PLS-00103: Encountered the symbol "" with mybatis TypeHandler

I am using Typehandler to map a List<Dep> to oracle array of ... here is the setPArameter method in the handler :
public void setParameter(PreparedStatement ps, int i, List<Dep> parameter, JdbcType jdbcType)
throws SQLException {
Connection connection = ps.getConnection();
// StructDescriptor structDescriptor = StructDescriptor.createDescriptor("MEMS_ARR", connection);
Struct[] structs = null;
if(parameter != null && parameter.size() >0) {
structs = new Struct[parameter.size()];
for (int index = 0; index < parameter.size(); index++)
{
Dep dep = parameter.get(index);
Object[] params = new Object[7];
params[0] = dep.getOrder();
params[1] = dep.getIdTp;
params[2] = dep.getId();
params[3] = " ";
params[4] = " ";
params[5] = " ";
params[6] = " ";
// STRUCT struct = new STRUCT(structDescriptor, ps.getConnection(), params);
structs[index] = connection.createStruct("MEMS", params);
}
// ArrayDescriptor desc = ArrayDescriptor.createDescriptor("MEMS_ARR", ps.getConnection());
// ARRAY oracleArray = new ARRAY(desc, ps.getConnection(), structs);
}else {
parameter = new ArrayList<DependentDTO>();
structs= new Struct[0];
}
this.parameter = parameter;
Array oracleArray = ((OracleConnection) connection).createOracleArray("MEMS_ARR", structs);
ps.setArray(i, oracleArray);
}
and here is the MEMS type :
create or replace TYPE MEMS AS OBJECT
( MEM1 NUMBER(2,0),
MEM2 VARCHAR2(1),
MEM3 VARCHAR2(15),
MEM4 VARCHAR2(60),
MEM5 VARCHAR2(1),
MEM6 VARCHAR2(40),
MEM7 VARCHAR2(10)
);
and here is the portion of the xml mapping file that uses the Typehandler :
#{nat,javaType=String,jdbcType=VARCHAR,mode=IN}, --nat
**#{deps,javaType=List,jdbcType=ARRAY,mode=IN,jdbcTypeName=MEMS_ARR,typeHandler=com.my.package.MyHandler}, --mems**
#{res,javaType=String,jdbcType=VARCHAR,mode=OUT} --res
the error log is as follows :
Error querying database. Cause: java.sql.SQLException: ORA-06550: line 31, column 5: PLS-00103: Encountered the symbol "" when expecting one of the following: . ( ) , * # % & = - + < / > at in is mod remainder not rem => <an exponent (**)> <> or != or ~= >= <= <> and or like like2 like4 likec between || indicator multiset member submultiset The symbol "(" was substituted for "" to continue. ORA-06550: line 44, column 4: PLS-00103: Encountered the symbol ";" when expecting one of the following: . ( ) , * % & = - + < / > at in is mod remainder not rem => <an exponent (**)> <> or != or ~= >= <= <> and or like like2 like4 likec between || multiset ### The error may exist in file [E:\path\to\mapper\ADao.xml] ### The error may involve my.package.ADao.mthodToCall -Inline ### The error occurred while setting parameters ### SQL: {call MY_PROC( ... , --nat?, **--mems? --res**)}
As you can see in the logs, the mems is replaced by empty string or is merged with the next arg res ... the comma is not there
Also kindly note that I already debugged inside the mybatis code and realized that the mapping setParameter method is called and the input List is mapped correctly to the oracle array ... the issue happens at the time of real calling
The issue actually was that I simply missed one comma between two previous parameters ... but the error pointed to the wrong parameter to look at