Evernote PHP API getNoteContent failes with uncaught exception - php

Here's my code:
try {
if (!isset($_SESSION['E_TOKEN'])) {
$oauth_data = $oauth_handler->authorize($key, $secret, $callback);
$token = $oauth_data['oauth_token'];
$_SESSION['E_TOKEN'] = $token;
}
else
$token = $_SESSION['E_TOKEN'];
$reason = $_GET['reason'];
$client = new \Evernote\Client(array('token' => $token, 'sandbox' => true));
$advancedClient = $client->getAdvancedClient();
switch ($reason) {
case 'update':
$noteGuid = $_GET['guid'];
$noteStore = $advancedClient->getNoteStore();
$note = $noteStore->getNoteContent(array('token' => $token), $noteGuid, true, false, false, false);
}
} catch (Evernote\Exception\AuthorizationDeniedException $e) {
//If the user decline the authorization, an exception is thrown.
echo "Declined";
}
Here's the exception:
[Sat Apr 30 10:44:55.256042 2016] [:error] [pid 27190:tid 139957362468608] [client 216.104.244.35:32700] PHP Warning: strlen() expects parameter 1 to be string, array given in /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/Thrift/StringFunc/Core.php on line 36
[Sat Apr 30 10:44:55.599976 2016] [:error] [pid 27190:tid 139957362468608] [client 216.104.244.35:32700] PHP Fatal error: Uncaught exception 'EDAM\Error\EDAMUserException' in /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php:3202\nStack trace:\n#0 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php(717): EDAM\UserStore\UserStore_getNoteStoreUrl_result->read(Object(Thrift\Protocol\TBinaryProtocol))\n#1 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php(678): EDAM\UserStore\UserStoreClient->recv_getNoteStoreUrl()\n#2 [internal function]: EDAM\UserStore\UserStoreClient->getNoteStoreUrl(Array)\n#3 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/Evernote/Store/Store.php(38): call_user_func_array(Array, Array)\n#4 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/Evernote/AdvancedClient.php(69): Evernote\Store\Store->__call('getNoteStoreUrl', Array)\n#5 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/Evernote/AdvancedClient.php(69): Evernote\S in /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php on line 3202
Note the error log entry for Core.php at line 36 expecting a string instead of an array.
Any suggestions?

Related

PHP Warning: ltrim() Problem in WordPress (formatting.php)

I am writing this in shell;
sudo tail -100 /var/log/apache2/error.log
And, I saw this;
......
[Sun Feb 14 09:42:06.873076 2021] [php7:warn] [pid 1968] [client 82.222.237.83:36955] PHP Warning: ltrim() expects parameter 1 to be string, object given in /var/www/html/wp-includes/formatting.php on line 4314
[Sun Feb 14 09:42:06.873149 2021] [php7:warn] [pid 1968] [client 82.222.237.83:36955] PHP Warning: ltrim() expects parameter 1 to be string, object given in /var/www/html/wp-includes/formatting.php on line 4314
...
I'm going to the relevant code. --> /var/www/html/wp-includes/formatting.php on line 4314
function esc_url( $url, $protocols = null, $_context = 'display' ) {
$original_url = $url;
if ( '' === $url ) {
return $url;
}
$url = str_replace( ' ', '%20', ltrim( $url ) );
$url = preg_replace( '|[^a-z0-9-~+_.?#=!&;,/:%#$\|*\'()\[\]\\x80-\\xff]|i', '', $url );
if ( '' === $url ) {
return $url;
}
if ( 0 !== stripos( $url, 'mailto:' ) ) {
$strip = array( '%0d', '%0a', '%0D', '%0A' );
$url = _deep_replace( $strip, $url );
}
$url = str_replace( ';//', '://', $url );
on line 4314;
$url = str_replace( ' ', '%20', ltrim( $url ) );
I did not understand. My error page is full of this. I could not figure out despite my research. Can you help me?
Note: Ubuntu 20.04, Wordpress
Healthy days,
Best regards.
The function esc_url() is called with a $url that is object rather a string. You can use gettype() or print_r() to confirm. debug_backtrace() might be useful to figure out where you are making those calls from.

How to make a xslt-tranformation with Saxon/C PHP-API

I have a FrontController made in PHP with XSLT 1.0, i have installed the Saxon/C PHP-API to work with the XSLT 2.0. But now is the Problem, i must write the FrontController around the Saxon syntax.
$xmlDoc = new DOMDocument();
$xslDoc = new DOMDocument();
$proc = new XSLTProcessor();
$xslDoc->load("../ressources/xslt/transform_article_partials_to_html.xslt");
$dir = __DIR__ . "/articles/" . $lang;
$filename = "{$rubrik}_{$seite}.html";
$filelist = scandir($dir, 1);
$proc->setParameter ("" , "articlePfad" , $filename);
$proc->setParameter("", "lang", $lang);
if($seite == null) {
$filename = "{$rubrik}.html";
if(in_array($filename, $filelist)) {
$xmlDoc->load($dir . "/" . $filename);
} else {
echo "404";
}
} else if(isset($seite) && isset($rubrik)){
if(in_array($filename, $filelist)) {
$xmlDoc->load($dir . "/" . $filename);
} else {
echo "404";
}
}
$proc->importStylesheet($xslDoc);
echo $proc->transformToXML($xmlDoc);
Some sample code, what i do with the XSLT 1.0.
The Apache2 Error.log:
PHP Warning: PHP Startup: Unable to load dynamic library 'xsl' (tried: /usr/lib/php/20170718/xsl (/usr/lib/php/20170718/xsl: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/xsl.so (/usr/lib/php/20170718/xsl.so: undefined symbol: dom_node_class_entry)) in Unknown on line 0
PHP Warning: Module 'Saxon/C' already loaded in Unknown on line 0
[Thu Jun 20 00:40:38.128672 2019] [mpm_prefork:notice] [pid 892] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Thu Jun 20 00:40:38.130224 2019] [core:notice] [pid 892] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jun 20 00:40:54.815341 2019] [php7:notice] [pid 2692] [client 127.0.0.1:54472] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:40:54.815512 2019] [php7:error] [pid 2692] [client 127.0.0.1:54472] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:40:55.935485 2019] [php7:notice] [pid 2691] [client 127.0.0.1:54474] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:40:55.935580 2019] [php7:error] [pid 2691] [client 127.0.0.1:54474] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:44:39.915201 2019] [php7:notice] [pid 2719] [client 127.0.0.1:54508] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5, referer: http://localhost/Comelio%20Website/
[Thu Jun 20 00:44:39.915301 2019] [php7:error] [pid 2719] [client 127.0.0.1:54508] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5, referer: http://localhost/Comelio%20Website/
[Thu Jun 20 00:44:47.966250 2019] [php7:notice] [pid 2692] [client 127.0.0.1:54510] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:44:47.966297 2019] [php7:error] [pid 2692] [client 127.0.0.1:54510] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:13.520374 2019] [php7:notice] [pid 2691] [client 127.0.0.1:54528] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:13.520447 2019] [php7:error] [pid 2691] [client 127.0.0.1:54528] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:14.887942 2019] [php7:notice] [pid 2806] [client 127.0.0.1:54530] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:14.888235 2019] [php7:error] [pid 2806] [client 127.0.0.1:54530] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:15.847351 2019] [php7:notice] [pid 2693] [client 127.0.0.1:54532] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:15.874397 2019] [php7:error] [pid 2693] [client 127.0.0.1:54532] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:16.475331 2019] [php7:notice] [pid 2690] [client 127.0.0.1:54534] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:16.475456 2019] [php7:error] [pid 2690] [client 127.0.0.1:54534] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 02:09:30.155871 2019] [php7:notice] [pid 2719] [client 127.0.0.1:54596] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 02:09:30.156196 2019] [php7:error] [pid 2719] [client 127.0.0.1:54596] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
So i changed the code and now it works!
<?php
// INITIALIZE PROCESSOR
$saxonProc = new Saxon\SaxonProcessor();
$xsltProc = $saxonProc->newXsltProcessor();
$lang = $_GET['lang'];
$rubrik = $_GET['rubrik'];
$seite = $_GET['seite'];
// LOAD XSLT SCRIPT
$xslFile = "../ressources/xslt/transform_article_partials_to_html.xslt";
$xsltProc->compileFromFile($xslFile);
// SET PARAMS
$dir = __DIR__ . "/articles/" . $lang;
$filename = "{$rubrik}_{$seite}.html";
$filelist = scandir($dir, 1);
$xdmvalue = $saxonProc->createAtomicValue($filename);
$xsltProc->setParameter("articlePfad", $xdmvalue);
$xdmvalue = $saxonProc->createAtomicValue($lang);
$xsltProc->setParameter("lang", $xdmvalue);
// LOAD SOURCE XML
if($seite == null) {
$filename = "{$rubrik}.html";
if(in_array($filename, $filelist)) {
$xmlFile = $dir . "/" . $filename;
$xsltProc->setSourceFromFile($xmlFile);
} else {
echo "404";
exit;
}
} else if(isset($seite) && isset($rubrik)){
if(in_array($filename, $filelist)) {
$xmlFile = $dir . "/" . $filename;
$xsltProc->setSourceFromFile($xmlFile);
} else {
echo "404";
}
}
// RUN TRANSFORMATION
$result = $xsltProc->transformToString();
echo $result;
// RELEASE RESOURCES
$xsltProc->clearParameters();
$xsltProc->clearProperties();
unset($xsltProc);
unset($saxonProc);
?>
Currently, you are using PHP's XSL class to supposedly run an XSLT 2.0 script. If you really do have the Saxon/C API installed, implement this in place of PHP's XSL class.
Consider the below, untested code as example using online docs:
// INITIALIZE PROCESSOR
$saxonproc = new Saxon\SaxonProcessor();
$xsltProc = $saxonProc->newXsltProcessor();
// LOAD XSLT SCRIPT
$xslFile = "../ressources/xslt/transform_article_partials_to_html.xslt";
$xsltProc->compileFromFile($xslFile);
// SET PARAMS
$dir = __DIR__ . "/articles/" . $lang;
$filename = "{$rubrik}_{$seite}.html";
$filelist = scandir($dir, 1);
$xdmvalue = $xsltProc->createAtomicValue($filename);
$xsltProc->setParameter("articlePfad", $xdmvalue);
$xdmvalue = $xsltProc->createAtomicValue($lang);
$xsltProc->setParameter("lang", $xdmvalue);
// LOAD SOURCE XML
if($seite == null) {
$filename = "{$rubrik}.html";
if(in_array($filename, $filelist)) {
$xmlFile = $dir . "/" . $filename;
} else {
echo "404";
exit;
}
} else if(isset($seite) && isset($rubrik)){
if(in_array($filename, $filelist)) {
$xmlFile = $dir . "/" . $filename;
} else {
echo "404";
}
}
$xsltProc->setSourceFromFile($xmlFile);
// RUN TRANSFORMATION
$result = $xsltProc->transformToString();
echo $result;
// RELEASE RESOURCES
$xsltProc->clearParameters();
$xsltProc->clearProperties();
unset($xsltProc);
unset($saxonproc);

PHP Form Not Submiting (Waiting for localhost...)

Looked over some answers here but nothing seems to work..
I'm new to PHP and trying to upload multiple files from a form that's inside a jquery bootbox dialog..
here's my form:
function dialogUpload() {
bootbox.confirm({
message: '<form name="uploadForm" action="Control/upload.php" method="post" enctype="multipart/form-data"> '
+ ' Nome do objeto:<br />'
+ ' <input name="objectname" type="text"><br />'
+ ' <input type="hidden" name="MAX_FILE_SIZE" value="10000000">'
+ ' Objeto 3D(Formato <b>.dae</b>):<br />'
+ ' <input name="userfile[]" type="file" /><br />'
+ ' Imagem 2D do objeto(Formato <b>.png</b> ou <b>.jpg</b>) (<i>Opcional</i>):'
+ ' <input name="userfile[]" type="file" /><br />'
+ ' Comentário:<br />'
+ ' <textarea name="comment" rows="5" cols="75"></textarea>'
+ '</form>',
buttons: {
confirm: {
label: 'Enviar Arquivo',
className: 'btn-success'
},
cancel: {
label: 'Cancelar',
className: 'btn-danger'
}
},
callback: function (result) {
if(result){
document.uploadForm.submit();
}
}
});
}
and heres my PHP, it just create a random file name and check the file extensions...than upload the file to respective folder.
Running on Windows 10, with XAMPP(don't know if it's relevant)
<?php
include '../Model/conexao.php';
include 'funcoes.php';
echo '<script>alert("Upload script started.");</script>';
$uploadIsOk = TRUE;
$imageUploaded = FALSE;
$targetObjectDirectory = "C:\xampp\htdocs\importaobjetos\uploads\objects";
$targetImageDirectory = "C:\xampp\htdocs\importaobjetos\uploads\images";
$fileName = createFileName($targetObjectDirectory);
$targetObjectFile = $targetObjectDirectory . basename($_FILES["userfile"][0]["name"]);
$targetObjectFileType = pathinfo($targetObjectFile, PATHINFO_EXTENSION);
if($_FILES["userfile"][1]["name"] != ""){
$targetImageFile = $targetObjectDirectory . basename($_FILES["userfile"][1]["name"]);
$targetImageFileType = pathinfo($targetImageFile,PATHINFO_EXTENSION);
$imageUploaded = TRUE;
}
$errorMessage = '<script>alert("';
$successMessage = '<script>alert("';
checkExtensions();
replaceOriginalFileName();
if(!$uploadIsOk){
$errorMessage = $errorMessage . 'Erros occoridos estão acima, upload não foi feito.';
$errorMessage = $errorMessage . '");</script>';
echo $errorMessage;
}
else{
//Tudo certo, fazer upload
if(move_uploaded_file($_FILES["userfile"][0]["tmp_name"], $targetObjectFile)){
$successMessage = $successMessage . 'Upload do objeto foi feito com sucesso.\n';
if($imageUploaded && move_uploaded_file($_FILES["userfile"][1]["tmp_name"], $targetImageFile))
$successMessage = $successMessage . 'Upload da imagem foi feito com sucesso.\n';
}
$successMessage = $successMessage . '");</script>';
echo $successMessage;
}
//Funcoes
function checkExtensions(){
echo '<script>alert("checkExtensions");</script>';
if($targetObjectFileType != "dae"){
$uploadIsOk = FALSE;
$errorMessage = $errorMessage . 'Formato invalido para o objeto, favor usar arquivos .dae\n';
}
if($imageUploaded){
if($targetImageFileType != "jpg" && $targetImageFileType != "jpeg" && $targetImageFileType != "png"){
$uploadIsOk = FALSE;
$errorMessage = $errorMessage . 'Formato invalido para a imagem, favor usar arquivos .jpg, .jpeg ou .png\n';
}
}
}
function createFileName($targetObjectDirectory){
$fileCreated = FALSE;
echo '<script>alert("createFileName");</script>';
while(!$fileCreated){
$fileName = "";
$size = mt_rand(5,9);
$all_str = "abcdefghijlkmnopqrstuvxyzwABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
for ($i = 0;$i <= $size;$i++){
$fileName .= $all_str[mt_rand(0,61)];
}
$filePath = $targetObjectDirectory . $fileName . '.dae';
if(checkIfExists($filePath))
$fileCreated = TRUE;
}
return $fileName;
}
function checkIfExists($filePath){
if(file_exists($filePath))
return TRUE;
else
return FALSE;
}
function replaceOriginalFileName(){
$targetObjectFile = $targetObjectDirectory . $fileName . '.' . $targetObjectFileType;
if(imageUploaded)
$targetImageFile = $targetImageDirectory . $fileName . '.' . $targetImageFileType;
else
$errorMessage = $errorMessage . 'Voce nao fez upload da imagem, será utilizada a imagem padrao.';
}
?>
things I've changed in php.ini to try to make it work...:
file_uploads = On
upload_max_filesize = 10M
max_file_uploads = 20
post_max_size = 10M
max_input_time = 360
The curious thing is that it calls the php script just after the max_input_time..then it echos the alert on the beggining of the script, and gives the error
Fatal error: Maximum execution time of 360 seconds exceeded in C:\xampp\htdocs\importaobjetos\Control\upload.php on line 113
someone can help?
EDIT:
Apache errors.log(from last trial)
[Fri Jul 14 10:34:29.219240 2017] [ssl:warn] [pid 5864:tid 664] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 14 10:34:29.275767 2017] [core:warn] [pid 5864:tid 664] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Jul 14 10:34:29.332850 2017] [ssl:warn] [pid 5864:tid 664] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 14 10:34:29.354372 2017] [mpm_winnt:notice] [pid 5864:tid 664] AH00455: Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 configured -- resuming normal operations
[Fri Jul 14 10:34:29.354372 2017] [mpm_winnt:notice] [pid 5864:tid 664] AH00456: Apache Lounge VC11 Server built: Dec 20 2016 13:02:04
[Fri Jul 14 10:34:29.354372 2017] [core:notice] [pid 5864:tid 664] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Fri Jul 14 10:34:29.355874 2017] [mpm_winnt:notice] [pid 5864:tid 664] AH00418: Parent: Created child process 4944
[Fri Jul 14 10:34:29.754780 2017] [ssl:warn] [pid 4944:tid 632] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 14 10:34:29.929697 2017] [ssl:warn] [pid 4944:tid 632] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 14 10:34:29.953227 2017] [mpm_winnt:notice] [pid 4944:tid 632] AH00354: Child: Starting 150 worker threads.
[Fri Jul 14 10:34:42.508930 2017] [:error] [pid 4944:tid 1920] [client ::1:54421] PHP Notice: Trying to get property of non-object in C:\\xampp\\htdocs\\importaobjetos\\index.php on line 152
[Fri Jul 14 10:34:42.509446 2017] [:error] [pid 4944:tid 1920] [client ::1:54421] PHP Notice: Trying to get property of non-object in C:\\xampp\\htdocs\\importaobjetos\\index.php on line 162
when i try to get php_error_log it gives me "the system cannot find the path specified"
Do the changes as per the link WAMPServer phpMyadmin Maximum execution time of 360 seconds exceeded. Did you restarted the wamp server?
Or still same error coming?
Send me the error details.

Why does the session id change on some records?

this is my config:
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 86400; //1 day
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 86400; //1 day
I don't know why my session_id changes whenn im dealing with some records.
Here's the error log of the record that the session_id doesn't change (which is correct) (AJAX post):
[Thu Mar 19 14:26:14.080447 2015] [:error] [pid 7902] [client 192.168.10.126:58565] f83e35227ac23f60d175dbbb333f9554 <----- session Id (Ajax), referer: http://192.168.10.126/consumer/ignite.php/update_listings_controller?listingId=1129
[Thu Mar 19 14:26:15.516590 2015] [:error] [pid 7902] [client 192.168.10.126:58565] f83e35227ac23f60d175dbbb333f9554 <----- session Id (Ajax), referer: http://192.168.10.126/consumer/ignite.php/update_listings_controller?listingId=1129
Here's the error log of the record that the session_id changes (which is NOT correct) (AJAX post):
[Thu Mar 19 14:25:42.260545 2015] [:error] [pid 7590] [client 192.168.10.126:58512] 3ff5478a950d3f0d5d71f3c72d1102a0 <----- session Id (Ajax), referer: http://192.168.10.126/consumer/ignite.php/update_listings_controller?listingId=28453
[Thu Mar 19 14:25:47.322896 2015] [:error] [pid 7511] [client 192.168.10.126:58521] 5a7f2424717505a2a68ffe717e56971b <----- session Id (Ajax), referer: http://192.168.10.126/consumer/ignite.php/update_listings_controller?listingId=28453
I'm using the same steps for both. I'm not sure when and why the session_id changes when I'm dealing with some records on back-end. I believe that my config is correct.
Additional info:
var opt;
function showPreviewMode(div,section,editmode){
showModalElement('pleasewait');
jQuery.ajax({
url:"update_listings_controller/get_listing_content/<?php echo $this->input->get('listingId'); ?>/"+section+"/"+editmode,
success:function(data){
jQuery(div).html(data);
hideModalElement('pleasewait');
masking();
if(section == 3){
opt = new OptionTransfer("serviceArea", "serviceAreaIds");
opt.setAutoSort(true);
opt.setDelimiter(",");
opt.saveNewRightOptions("newRight");
var dol = new DynamicOptionList("serviceAreaLeft");
opt.init(document.whoDoTheyServe);
}else if(section== 4){
disAbledFee();
disabledMeds();
privatePay();
}else if(section== 5){
checkDay();
waitList();
}
}
});
}
This is just what I did:
instead of calling $this->session->userdata('session_id'),
I'm just calling this:
session_id();
They don't have same value, session_id(); is not changing anyway.

PHP recursive call is causing an interal server error

i was programming a mail templatingsystem. The user should be able to use markers in there, they will be replaced by the actual data. The problem ist, my function to replace the markers works just fine, but i need to do a recursiv call of that function, that will only run once, and this is what i came up with:
public function replace_placeholders($content, $recipient, $settings, $interface, $recommendation, $format, $recursion = false) {
$content = $this->replace_ph('briefanrede' , $recipient['id'] , $content);
$content = $this->replace_ph('anrede' , $recipient['title'] , $content);
$content = $this->replace_ph('email' , $recipient['email'] , $content);
$content = $this->replace_ph('kundennummer' , $recipient['kdnumber'] , $content);
$content = $this->replace_ph('briefanrede' , $recipient['briefanrede'] , $content);
if($recipient['title'] == $settings['anrede_w'] || $recipient['title'] == $settings['anrede_m']) {
$content = $this->replace_ph('vorname' , $recipient['forename'] , $content);
$content = $this->replace_ph('nachname' , $recipient['surename'] , $content);
} else {
$content = $this->replace_ph('vorname' , "" , $content, true);
$content = $this->replace_ph('nachname' , "" , $content, true);
}
$content = $this->replace_salutation($recipient, $settings, $content);
//Recommendation
if($this->need_replacement($content, 'weiterempfehlung') === false && $recursion === false) {
if($recommendation['own_page'] == 1) {
$baseurl = $recommendation['location'];
} else {
$baseurl = $recommendation['link'];
}
$pattern = ($format == "html") ? '%s' : '%s';
$url = $this->replace_placeholders($baseurl, $recipient, $settings, $interface, $recommendation, true);
$content = $this->replace_ph('weiterempfehlung' , (($format == "html") ? sprintf($pattern, $url, $settings['text_weiterempfehlung']): sprinf($pattern, $url)), $content);
}
return $content;
}
The recursiv call in this line
$url = $this->replace_placeholders($baseurl, $recipient, $settings, $interface, $recommendation, true);
is causing a 500 internal server error. I dont know why, because i think that i limited the recursion to run once. Can you help me out?
Sorry for my bad english i try hard to write clear sentences.
//EDIT:
Apache log:
[Wed May 30 15:31:56 2012] [warn] [client xx.xxx.xx.xxx] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Wed May 30 15:31:56 2012] [warn] [client xx.xxx.xx.xxx] (104)Connection reset by peer: mod_fcgid: ap_pass_brigade failed in handle_request_ipc function
[Wed May 30 15:31:56 2012] [error] [client xx.xxx.xx.xxx] File does not exist: /var/www/web80/html/web80-newsletter/favicon.ico
[Wed May 30 15:31:58 2012] [error] mod_fcgid: process /var/www/php-fcgi/web80.php53/php-fcgi(21975) exit(communication error), get unexpected signal 11
the php errorlog is empty.
It would seem you miss one argument in your recursive call, making the $recursive = false continue being false all the time, which in turn makes your if statement
if($this->need_replacement($content, 'weiterempfehlung') === false && $recursion === false)
always return true.
Try adding one last variable to your recursive call instead and you should be able to properly execute your script, ie:
$url = $this->replace_placeholders($baseurl, $recipient, $settings, $interface,
$recommendation, true, true);
^ added one true
What i think you want to add instead of the first true is $format.
Signal 11 is SIGSEGV, i.e. the process crashed due to a bad memory access (such as dereferencing a NULL pointer or accessing memory it was not supposed to access).
This is nothing a PHP script should be causing, so you should first upgrade to the most recent stable PHP version and if it still happens reduce your script as much as possible (remove everything that can be removed while the crash still happens) and then report it as a PHP bug.

Categories