Friday, June 5, 2015

The moment ...

The moment when I realize you no longer needed me, I should just move on ...

Come on ...

Wednesday, April 29, 2015

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

Recently tried upgrading PHP version from 5.2 to 5.5 and one of our package program ECSHOP thrown bunches of errors and warning. Yes, our company's shared hosting PHP version is seriously outdated, still mainly using PHP5.2, due to the lack-of-update ECSHOP program ... (yes we still have huge number of ECSHOP clients with us).

First thing I saw ECSHOP running on PHP5.5 is the following warning message :

Deprecated: preg_replace(): The /e modifier is deprecated, use
preg_replace_callback instead in /home/name/domains/domain.com/
public_html/includes/cls_template.php on line 300


Immediately went Google to run a brief search, find out that it is the /e is causing the warning. And to resolve it, had to change to use preg_replace_callback function instead.

Opening the script, found the problem script as :

return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);

And change it to :
return preg_replace_callback('/{([^\}\{\n]*)}/', 
    function($matches) {
       return $this->select($matches[1]);
    }, $source);

This issue affects all preg_ functions, and it's not too difficult to migrate actually.
  1. Change the function to preg_ function to preg_<func>_callback.
  2. The first parameter (regex expression) remain the same, only remove the e identifier from the regex.
  3. Second parameter changed to use function($matches) {}, then inside the function will be what originally used in the old deprecated function (remove the quotes!).
  4. Inside the function, find all respective arguments (i.e. \\1, \\2), and replace them in the new function with $matches[<index>]. The <index> would be follow what were used originally (i.e. \\1, \\2).
  5. Third parameter just remain the same.


Please be aware to to use $this directly inside the created function, your PHP version must be version 5.5 and above.

Saturday, April 25, 2015

Back to life ...

It's been quite a few years since I last posted a blog post... almost 3 years.

Well, I'm kind of a lazy person, not really into the mood of writing blog.

Previously most of my blog post are related to iPhones/iOS/Jailbreaking stuffs, well, from now on I guess I'll not so much towards that, as I've stopped jailbreaking my devices since iOS6. Of course I'm still an iOS user, an iPhone and an iPad. Just love it.

That it for now. I'll update more once I have time or I have anything to share here. Probably programming stuffs. Who knows?







Monday, July 2, 2012

Dropbox - Your life's work, wherever you are

With Dropbox, you can access your files from almost anywhere!
Dropbox is a free service that lets you bring all your photos, docs, and videos anywhere. This means that any file you save to your Dropbox will automatically save to all your computers, phones and even the Dropbox website.

Dropbox also makes it super easy to share with others, whether you're a student or professional, parent or grandparent. Even if you accidentally spill a latte on your laptop, have no fear! You can relax knowing that Dropbox always has you covered, and none of your stuff will ever be lost.

No more waiting and join Dropbox today at http://db.tt/TpHo0M2!

Download links:

Thursday, May 31, 2012

Step-by-step restore iOS5.0.1 WITH SHSH

Had just restored my iPhone 4 GSM to iOS5.0.1 two days ago. Was confusing what to do to restore to iOS 5.0.1 which Apple had stopped signing (and they had implemented new APTicket method for restoring process), luckily I found this FAQ and it provides complete step-by-step guide to restore. Just to share here in case anyone needs it.
Source:  http://www.jailbreakqa.com/questions/32462/frequently-asked-questions#94647

How do I restore (downgrade/upgrade) my device to iOS 5.0.1 or other non-latest iOS versions?

Since Apple has introduced an APTicket/APNonce check for restores to iOS 5, the TinyUmbrella TSS Server procedure does not work anymore when restoring to any version of iOS 5.x (you can still use that procedure for restoring to iOS 4.x if you want, but the following stitching procedure should work too). Instead, you need to create and restore to a custom IPSW (custom firmware file) with stitched SHSH blobs. (If you're lucky enough to have an old-bootrom iPhone 3GS, you don't need SHSH blobs and can go through this process without doing the stitching steps.)
To successfully restore to iOS 5.0.1, you must have iOS 5.0.1 SHSH blobs saved for this device in your computer (what are SHSH blobs and why are they necessary?). If your device was previously jailbroken, Cydia may have been able to automatically save iOS 5.0.1 SHSH blobs for your device. You can try retrieving SHSH from Cydia's servers by running TinyUmbrella, plugging your device into your computer, clicking the "Advanced" tab, checking "Request SHSH from Cydia", noting where the SHSH will be saved in "Save SHSH Folder", unchecking "Set Host File to Cydia on Exit", and then clicking "Save SHSH" at top right. Verify that your 5.0.1 SHSH blobs are saved (in the General tab) and close TinyUmbrella before proceeding. (If you're interested in restoring to a non-latest version of iOS other than 5.0.1, mentally replace 5.0.1 with your desired iOS version number and follow the same instructions.)