Shock from the mobile phone when charger is plugged occurs, when the primary side voltage of the charger circuit (which is generally high voltage like 230V ac) with heavy current passes to secondary side circuit (the very low voltage and current side). Usually primary circuit is isolated from secondary circuit. If poor quality components are used inside the circuit board, this kind of hazard happens.
So,better go for a quality and branded charger to avoid this kind of hazards. If a phone call has to be attended while the phone is charging,it is advisable to disconnect it from power and use it.
While charging, if phone gives a beep or indication of charge process completed, disconnect the charger. Never keep the charger connected to the phone for long period with which the charger’s life decreases.