PHP reporting error on wrong line - php

I have what appears to me, to be two identical text files, I copy and paste exactly the same (intentionally erroneous) content in them, being the following:
<?
//error code
$sSQL = "SELECT error";
fakefunction();
?>
But I get this in tab #1 of my browser:
Fatal error: Call to undefined function fakefunction() in
/home/public_html/notes/textfileone.php on line 3
And I get this in tab #2 of my browser (the same browser as tab #1 is in):
Fatal error: Call to undefined function fakefunction() in
/home/public_html/notes/textfiletwo.php on line 4
Any idea why this would be happening?

Possibly one of them is being saved with a Byte Order Mark and one without? That would add one more line to the content. Your text editor might be adding it upon save, but hiding it otherwise.

Related

How can I correct a string array error message when it appears suddenly?

When accessing a page, I am now receiving the following error message:
Fatal error: Cannot use string offset as an array in
/home/content/01/5335601/html/wp-content/plugins/popup-by-supsystic/modules/popup/mod.php
on line 194
No changes were made to the page or popups. The fatal error just appeared.
Have not tried much since I have no earthly idea about code. I did follow the error message to at least locate line 194.
Line 194:
if(isset($p['params']['main']['hide_for_devices'])
Would like suggestions on how to correct this issue, especially those that I can understand enough to get the fatal error message removed and the content showing again.

PHP mysqli functions fatal ERROR when using the query function

I am programming a website and my current task is to save the text on a mysql server so I can login as admin and then edit the displayed text online.
I already got so far that everything works but I have done it using mysql functions. Now changed all those functions to mysqli ones, since I heard those are way better.
Here is my mysql_connect.php which I created so I could include this in the other scripts wherever I need to connect to the server:
mysql_connect.php
This is my block1_aboutme.php file, where I connect to the server and request all the text from it so I can display it on my "about me" page. This also works as intended and it properly displays the text on my page.
block1_aboutme.php
The problem is when I login as an admin a part of the login verification is this code below in my class.login.php script. As soon as I am logged in and go to my aboutme page an error occurs:
Fatal error: Uncaught Error: Call to a member function query() on unknown in C:\xampp\htdocs\mywebsites\LuPaw\admin\class.login.php:84 Stack trace: #0 C:\xampp\htdocs\mywebsites\LuPaw\admin\class.login.php(73): Login->verifyDatabase() #1 C:\xampp\htdocs\mywebsites\LuPaw\admin\class.login.php(36): Login->verifySession() #2 C:\xampp\htdocs\mywebsites\LuPaw\aboutme.php(42): Login->isLoggedIn() #3 {main} thrown inC:\xampp\htdocs\mywebsites\LuPaw\admin\class.login.php on line 84
This error refers to line 84 which is the $data = $db-> query("select stuff") function.
Somehow this does not work here, while the nearly exact same code line does work in the block1_aboutme script.
I would place the link of my 3rd script here but I can't since I don't have reputation pints yet to place 3 links in one post. Will post 3rd picture in the comments.
I already tried out a few things. If I for example echo out the "$path" it shows the correct path which means $db should be a viable variavble.
Does anyone see the problem here?
Try not to use include_once in your class method as the file will not be included if anywhere during the script execution has been already included: use include instead.
Anyway this is not the best solution you can achieve, I can suggest you to implement a DB class as a singleton and then retrieve the database instance in order to execute your queries.

What is this error and How to solve it Missing argument 2 for PLATFORMS::get_device_info()

I am having this error on my wp multi site ,
Warning: Missing argument 2 for PLATFORMS::get_device_info(), called in /homepages/13/d133448570/htdocs/sogolearn/prosper/tracking202/redirect/rtr.php on line 395 and defined in /homepages/13/d133448570/htdocs/sogolearn/prosper/202-config/connect2.php on line 258
Warning: Cannot modify header information - headers already sent by (output started at /homepages/13/d133448570/htdocs/sogolearn/prosper/202-config/connect2.php:258) in /homepages/13/d133448570/htdocs/sogolearn/prosper/tracking202/redirect/rtr.php on line 286
Page url = http://prosper.sogolearn.com/tracking202/redirect/rtr.php?t202id=8368&t202kw=
Rest of the functions are working properly, no errors on the main site or other domains.
I have no idea what is this error and How to fix it.
The first error is caused by only providing one argument to a function or method that requires at least two arguments. For example, if we have a function like this:
function hasTwoArguments($first, $second) {
// Do something...
}
...then the error occurs if it is called like this:
// The second argument is required, but is not provided, causing an error
hasTwoArguments('first');
The second error is most likely a side-effect of the first error. HTTP headers must be set before any output is sent to the client (the browser in this case). The first error outputs a message (describing what went wrong), which is why the second error occurred.
To fix these errors you have to make sure that the PLATFORMS::get_device_info() method gets two arguments. If you have written the code yourself then you can either provide the second argument, or you can make the second argument optional (if it indeed is optional). If you did not write the code yourself then you should contact the author(s) of the code, telling them that they may have made a mistake.

Prestashop fatal error on products list page

I suddenly had this issue on my Prestashop project. When I'm opening the products list page, I have a blank page with this message :
Fatal error: Call to undefined method Product::getProductsImgs()...product-list.tpl.php on line 76
The error line : {$more_imgs = Product::getProductsImgs($product.id_product)}
You may want to check the following:
Advanced parameters > performance > debug mode > disable all overrides
check if it is set to no.
Check The following points first..
1) Did you try to modify the controller?
2) Did you add any custom code to product-list.tpl?
if yes post it and also a few lines above and below the line mentioned..
Call to undefined method means you don't have the file with the method referenced..

receiving error undefined index on two variables

Using adLDAP.php class
receiving following error: Notice: Undefined index: memberof in /web/ee_web/include/adLDAP.php on line 762
line 762: if (is_array($groups[0]["memberof"])) {
Also receiving error: Notice: Undefined index: count in /web/ee_web/include/adLDAP.php on line 982
line 982: $entries[0]["memberof"]["count"]++;
Unsure of what I need to do to resolve these error messages, it seems that the script is working fine, but I'd like get rid of these errors.
Using: http://adldap.sourceforge.net/wiki/doku.php?id=api
You could edit the code to something along the lines of:
if(isset($groups[0]["memberof"]))
{
if (is_array($groups[0]["memberof"])){ ... }
}
And
if(isset($entries[0]["memberof"]["count"]))
{
$entries[0]["memberof"]["count"]++;
}
It will keep you from getting the errors, though it won't necessarily handle some pretty lax sanity checking by the original author of the code.
It seems like you have your error_level set to show every possible error/warning/notice, that's why you're getting it.
If the script is working fine, then it's not an error, simply a missing check the coder forgot to put in the library.
To get rid of thos messages, you have 2 options:
a) Use # before the calls you do to that library, such as
$var = #the_function(param1);
This will avoid those messages for just that line.
b) Set the error level to something like this with error_reporting():
error_reporting(E_ALL ^ E_NOTICE);
This will affect the whole script you're running.
It's up to you what to use depending on the project.

Categories