PHP: weird usort bug - php

Everything works fine on my local machine. But when uploading this piece of code to my live server I'm getting a weird warning ...
usort($modules, array('util_SortItem', 'ByOrder'));
Causes this warning:
Warning: include_once(sc3lycp6hmyab.php) [function.include-once]: failed to open stream: No such file or directory in /opt/www/xxx/web/private/Zend/Loader.php on line 146
Warning: include_once() [function.include]: Failed opening 'sc3lycp6hmyab.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /opt/www/xxx/web/private/Zend/Loader.php on line 146
When I remove the usort from my code the warnings disapear.
Any ideas on how I can get rid of this warning?

This has nothing to do with the usort, but with the ByOrder method of the Util_SortItem class that you are telling usort() to call.
You should take a look into the file where that class is defined to see what it does to trigger the error.
One possibility is that it tries to include a class that doesn't exist, which triggers Zend's Autoloader; the other that Zend is trying to create some sort of cache file.

To me it looks like those spammer names. I'd guess it's not related whatsoever. I think you might have something unescaped in your application and it results in someone trying to exploit it ;)

I haven't been able to sort out the isue but I got rid of it by merging two queries and sorting on my SQL server.

Related

CakePHP showing include_once warnings

Suddenly, this website stop working and this errors appeared:
Warning: include_once(///controllers/site/default.php) [function.include-once]: failed to open stream: No such file or directory in /var/www/html/sitename.com/web/index.php on line 54
Warning: include_once() [function.include]: Failed opening '///controllers/site/default.php' for inclusion (include_path='.:/usr/share/pear') in /var/www/html/sitename.com/web/index.php on line 54
I don't know how CakePHP works, this is why I need help to figure out what happened (without anyone messing the code). The indicated files, that says that they're not there (No such file or directory), are exactly where the path describes.
I appreciate any help!
Error from line 54 in index.php:
include_once sprintf('%s/%s%s/%s.php', ROOT_PROJECT, CONTROLLERS_DIR, $url->tipo, 'default');
I believe the problem lies in the variables inserted through sprintf.
There are some empty ones causing a lot of backslashes to be added to the string;
Basically it says
include('///controllers/site/default.php');
(This is also visible in the generated php warning)
Try catching empty variables or parsing the resulting string (making sure only 1 backslash exists between every parameter).
If I'm right the next php command should work:
include('/controllers/site/default.php');
Hope this helps.

require_once is unable to find the file

Hello i have a stupid question i search in stackflow there was lots of answeserd but i couldnt find solution for my problem i want to call a file in php receiving error actually the code is correct but i am receiving a problem error which is:
Warning: require_once(1) [function.require-once]: failed to open stream:
No such file or directory in C:\xampp\htdocs\Upload images\upload.php on line 2
Fatal error: require_once() [function.require]: Failed opening required '1'(include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\Upload
images\upload.php on line 2
I am using dreamweaver. i deleted the path with directory and recreated with different name but not solved still prob exist. also i did google there also i didn't find solution ??????? any one please my head is exploding....??????????????????????????????
A quick test on my system reveals that require_once("file") or error_function(); fails with that exact message; require_once("file"); does not.
This is possibly because require_once is a statement rather than a function, and might have different parsing rules, causing your statement to actually be require_once('db.php' or mysql_error());. The PHP or operator with those arguments will return TRUE without calling mysql_error, causing the statement to be require_once(1) (1 == TRUE) - which would generate those messages. This is just my speculation.
tl;dr
Try removing the or mysql_error() from your code. require_once will generate a fatal error anyway. (Warning: Works On My Machineā„¢.)
Try write complete path in require_once(path)

Doctrine - PHP Warning: include_once(): Failed opening Table for inclusion

I'm using Doctrine 1.2.
The code is trying to include some entities (in the example, AdvertiserUsers) by adding the suffix "Table" at the end. I print a trace at the end of this message.
The thing is, my app does not use these files! I have my models called AdvertiserUsers on the style, with no need for an AdvertiserUsersTable file. Actually, I have my models called "AdvertiserUsers" only, and my app works OK without it (ugly warnings aside - which I want to get rid of).
I don't know why it tries to include these files that are not needed. This is the actual issue.
As a side note, my application has been doing this after I integrated an external module (from a freelance) that used a direct connection - no Doctrine - and happens on this module, when having to integrate both and using separate connections for different data.
Trace:
[26-Jul-2011 22:59:06] PHP Warning: include_once(AdvertiserUsersTable.php): failed to open stream: No such file or directory in /usr/local/zend/share/ZendFramework/library/Zend/Loader.php on line 146
[26-Jul-2011 22:59:06] PHP Warning: include_once(): Failed opening 'AdvertiserUsersTable.php' for inclusion (include_path='/usr/local/zend/apache2/htdocs/stats-from-zero/application/../library:/usr/local/zend/apache2/htdocs/stats-from-zero/library:/usr/local/zend/apache2/htdocs/stats-from-zero/library/doctrine::/usr/local/zend/apache2/htdocs/stats-from-zero/library/recaptcha-php-1.10:/usr/local/zend/apache2/htdocs/stats-from-zero/public/php-form-builder-class:.:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/share/pear:/usr/local/zend/apache2/htdocs/stats-from-zero/application/modules/stats/models:/usr/local/zend/apache2/htdocs/stats-from-zero/application/modules/stats/forms') in /usr/local/zend/share/ZendFramework/library/Zend/Loader.php on line 146
AdvertiserUsersTable.php does not exist. Check name of that file & specific directory. It should be there

Two Errors trying to include .php file: Warning: require(...) AND Fatal error: require() ... (include_path='.;C:\php\pear')

Here is the first error:
Warning: require(/hb/includes/constants.php) [function.require]: failed to open stream: No such file or directory in C:\wamp2\www\hb\includes\connection.php on line 2
And the second error that immediately follows:
Fatal error: require() [function.require]: Failed opening required '/hb/includes/constants.php' (include_path='.;C:\php\pear') in C:\wamp2\www\hb\includes\connection.php on line 2
Here is the line that it doesn't like:
require("/hb/includes/constants.php");
I did install a new version of WAMP, but I know the directories/files are fine and the code worked previously and on another server. It seems like none of my require()'s are working anymore. I tried looking around and some suggested to others that they edit their php.ini, but I don't know what directory I would point to - if you can't tell I'm pretty noobish regarding all things server related.
Any help is appreciated.
First of all, are your really -- really ! -- sure that the file /hb/includes/constants.php, that your are trying to include, exists ?
Considering that the path you requested begins with a /, it looks like you're using an absolute path... that looks like an UNIX path, but you are on a Windows server...
If it exists, and PHP still cannot include it, check :
that it is readable by your webserver (including the directories) -- I'm thinking about UNIX permissions
that there is no open_basedir restriction that would prevent PHP from accessing those files.
BTW, having a warning and a fatal error is the behavior that's to be expected when using require : the warning is normal (it comes from include) ; and the fatal error is the difference between include and require.

Troubleshooting PHP Login connection

I have encountered a problem that I have not come accross yet when setting up a log in page using php.
The page has a error message that relates to line 1 ( require_once('../Connections/Login.php)
that states
[function.require-once]: failed to open stream: No such file or directory
Fatal Error: require_once() [function.require]: failed opening required ... (include_path='.:/usr/share/pear-php5')
I know it is probably really simple and stupid, but I'm really struggling to self-troubleshoot and would really value some help please?
This is where I have been so confused. I also thought the same, that it just couldn't find the file; however the structure is just as you have said:
htdocs/comparison.php (the log in page)
htdocs/Connections/connComparisonLogin.php
Sorry this is going to confuse you, I simplified the actual script in my original question and here is the actual error message:
Warning: require_once(../Connections/connComparisonLogin.php) [function.require-once]: failed to open stream: No such file or directory in /home/fhlinux135/s/suzukigenuine.com/user/htdocs/comparison.php on line 1
Fatal error: require_once() [function.require]: Failed opening required '../Connections/connComparisonLogin.php' (include_path='.:/usr/share/pear-php5') in /home/fhlinux135/s/suzukigenuine.com/user/htdocs/comparison.php on line 1
Have I done it all wrong?
I think your require statement should be:
require_once 'Connections/connComparisonLogin.php';
Where is your "Connections/Login.php" relative to the currrent php file.
php will look for the file relative to the current file, or, in one of the directories specified in the "include_path" php.ini setting.
The error just means php can't find the Login.php file. Assuming the page you are calling is index.php you should have a director structure like
-Dir1
|-index.php
-Connections
|-Login.php
Why are you going up a directory in your require statement? Remove the "../" from the beginning of your require_once path.

Categories