WooYellowCube / wooyellowcube

WooCommerce plugin to synchronize YellowCube
MIT License
4 stars 4 forks source link

empty(trim(mixed $var)) not working < php 5.5 #6

Closed lduenser closed 8 years ago

lduenser commented 8 years ago

https://github.com/WooYellowCube/wooyellowcube/blob/master/views/metabox-order.php#L69

This line throws a PHP Fatal error. PHP Fatal error: Can't use function return value in write context in .../wp-content/plugins/wooyellowcube/views/metabox-order.php on line 69

empty() only supports variables and no function calls until php 5.5 -> see http://php.net/manual/en/function.empty.php

Solution $yc_shipping = rtrim($yellowcube_order->yc_shipping); ?> <strong><?php echo __('Track & trace', 'wooyellowcube'); ?> :</strong> <?php if(empty($yc_shipping)) { ?> <?php echo __('The track & trace is not ready yet, please come back later', 'wooyellowcube'); ?> <?php } else { ?> <a href="http://www.post.ch/swisspost-tracking?p_language=en&formattedParcelCodes=<?php echo $yellowcube_order->yc_shipping; ?>" target="_blank"><?php echo $yellowcube_order->yc_shipping; ?></a> <?php } ?>