Syntax error from older PHP script - syntax

Can someone please tell me what the error is in the following script? Was forced to update to php 5.3 instead of 4 and now site is down
<!--form action : <?=//MYSURL_DEV?>properties_features.php-->

You should check your php.ini to see if short tags are enabled. They are often disabled by default. As of PHP 5.4 short tags are always on, but not so on PHP 5.3 and lower.
If you're able, in php.ini you'd enable this with:
short_open_tag = On
Be aware thought that in some hosting environments you actually may be prevented from enabling the use of short tags. And even though 5.4 has them always available, they are generally not recommended because of the very issue that you may have encountered: you may move to another environment that doesn't have them enabled (or even allow it).
The alternative is to use:
<?php echo $var; ?>
More info can be found here: Are PHP short tags acceptable to use?

Related

Prestashop 1.7.6.5 not taking into account php module modifications

I've been modifying a module and for some reason prestashop does not take into consideration the code modifications in module.php.
I've made modifications a while back and I need to modify it again due to an update that raises an error, the problem is that I get the error even if I remove said line.
I get this type of error: PHP message: PHP Notice: Undefined index: ordersorderFilter!active in /modules/module/module.php on line 104
I've commented first than removed that line but I still get the error.
It seems like there is a cache somewhere that I can't find, I've deactivated all possible cache in prestashop, activated debug mode, deleted the dev and prod folders in /var/cache/ but I still get the error.
I've used grep on the server to try to find that line, and when I delete it from the file I can not find it anywhere else on the server (but can find it if I add it).
Anybody has any idea?
Thanks a lot!
Prestashop does not perform any kind of caching on the modules PHP files so the problem lies elsewhere or at "lower level" (webserver / proxy ie.).
So check your environment for server-side caching, proxies or PHP accelerators such as opCache that may not serve changes from the source server.
Also try renaming or deleting the offending file altogether and see if the error changes, if not you might simply be looking at the wrong file :)

function ereg deprecated, how to update to preg_match?:

I'm using an old php script that runs on php 5.2 but host no longer provides php below 5.4
I'm getting an error regarding function ereg that needs to be updated to preg_match but I have no idea how this is done and a look around the web isn't too helpful. Any help available?
Existing code:
if (!ereg('^/[^./][^/]/*$', $cfg["theme"]))
You may use
if (!preg_match('~^/[^./][^/]/*$~', $cfg["theme"]))
Pay attention to the regex delimiter, here, ~.

Laravel's pretty var_dump(), dd(), not working anymore

For some reason laravel's dd() function decided to stop functioning. I have no idea how this happened. I tried composer update already but I'm not sure what else can be going on. The debug key is set to true in the config.
Where should I look to solve this problem? I'm using Laravel 4.2.16
NOTE:
dd() now simply functions as var_dump(), it doesn't prettify it anymore
Solved it. I loaded my vagrant machine with the wrong config and was running hhvm instead of regular php-fpm. Hence xdebug, which handles the pretty dd(), was not being loaded. I reloaded my box with the correct settings (without hhvm and hack) and everything started working again
Is dd the only Laravel helper function that doesn't work? If not then check the contents of vendor/composer/autoload_files.php. The laravel support helpers are loaded here. If the other helper functions are fine you can check the contents of laravel/framework/src/Illuminate/Support/helpers.php to see what's going on - this is where the function is created.

CodeIgniter 2.0.2 syntax error blank page

CodeIgniter 2.0.2 syntax error blank page
i have CodeIgniter 2.0.2 (CI) and its annoing, that when i write lots of code and then just get blank page. Hard to debug without error. i got error reporting E_ALL in php.ini and in config of CI its turned on for every case of enviroment (devel, product) just for sure...
Does anyone knows, where the bug can be? How to turn it on? I think CI is rewriting php.ini error reporting setting somewhere somehow...
Thanks.
The other thing to check in your php.ini are the 'display_errors' and 'display_startup_errors' variables, they should both be set to 1.
In my (little) experience with CI this issue has been the most frustating one. I can understand that no framework is perfect, and any web developer is used to deal with errors (no matter if the framework or the developer is to blame). But that ANY error results in a blank page, with ZERO information in logs, console, whatever, is unacceptable.
If I recall correctly, in my case this was caused by of some combination of CI (ab)using the "silent error" PHP operator (e.g. prepending some db statements with the # operator, a not very clever way of avoiding leaking potentially private information to the end user), together with some bad use of *error_reporting*. See my post here (and see how many answers I got!).
I reported another related CI's idiocyidiosyncrasy related with logging here (again, zero answers)
please check the index.php which locate in the SAME LEVEL of the application folder
inside the index.php the second line
line 2:
ini_set("display_errors", "1"); //ensure it is set to 1
line 23:
define('ENVIRONMENT', 'development'); // development | testing | production
grep your php.ini for the word "error", turn them to On etc...
Do you have output compression turned on in the config? I find that will cause white pages when you have errors.
$config['compress_output'] = FALSE; // Should be set to this when developing.
I had the same problem and eventually fixed it when i noticed I had no 'logs' directory in my application folder

Error when logging to Magento connect manager

I am getting the following error when I log into Magento connect Manager.
Exception caught:
Unknown error (8192): Function eregi() is deprecated in /home/nirmal/public_html/magento/downloader/pearlib/php/PEAR/Registry.php on line 774
The php version I am using is 5.3. Can you help me?
Hmm, this is tricky. This is a so-called E_DEPRECATED notice, pointing out a function call that still works, but will be removed in one of the coming versions of PHP.
You could manually edit the code to fix this, but it seems to be in a core part of Magento or the PEAR client. It is likely to be fixed in a future version of Magento. Turning off error reporting for E_DEPRECATED notices might be justified in this case.
The error_reporting setting for that would be
error_reporting(E_ALL ^ E_DEPRECATED);
This is because eregi() function is deprecated
Warning
This function has been DEPRECATED as
of PHP 5.3.0. Relying on this feature
is highly discouraged.
http://php.net/manual/en/function.ereg.php
Here is a fix of this problem
http://www.devcomments.com/magento-and-deprecated-errors-solved-to290776.htm
Here is also a very similar issue and fix. Take a look here
http://www.magentocommerce.com/boards/viewthread/59208/
The core of this problem is that Magento still doesn't officially support the PHP 5.3 branch as far as I am aware. Since the framework catches even quasi-serious errors and kills execution, you may discover many such bugs.
The easy fix is to use the current 5.2.X version of PHP.

Resources