This is a great Module. I thought I'd start off with that.
I have Search API module installed and I'm able to create Views based off of the Search Indexes I've made.
When I try and add any Global PHP field to one of these Search Index views, the results are blank. the individual fields I enter in the View appear fine, it's just the PHP field that's blank.

When I add something like

<?php
 
print '<pre>';
 
print_r($row);
  print
'</pre>';
?>

in the Global PHP field, I get this returned:

stdClass Object
(
[title] =>
[php] =>
[price] =>
[author] =>
[uc_product_image] =>
[body] =>
[taxonomy_catalog] =>
[field_rating] =>
[nid] =>
)

The Global PHP fields work great when I create a standard View.

Files: 
CommentFileSizeAuthor
#2 good.png38.73 KBntfreddy
#2 bad.png39.95 KBntfreddy

Comments

I am having the same problem with my Search API view.

Can anyone help?

StatusFileSize
new39.95 KB
new38.73 KB

I have a work around for this problem. replace the line 214 in the file
views_php/plugins/views/views_php_handler_field.inc

Replace the line :

<?php
        $normalized_row
->$field = isset($values->{$handler->field_alias}) ? $values->{$handler->field_alias} : NULL;
?>

by :

<?php
       
//$normalized_row->$field = isset($values->{$handler->field_alias}) ? $values->{$handler->field_alias} : NULL;
       
$search_api = isset($values->_entity_properties) && isset($values->_entity_properties[$handler->field_alias]) ? $values->_entity_properties[$handler->field_alias] : NULL;
       
$normalized_row->$field = isset($values->{$handler->field_alias}) ? $values->{$handler->field_alias} : $search_api;
?>

When using search api index entities you have to make sure the Global:php field is arranged below the fields it uses, otherwise the all referenced field will be empty.

This is good :
Good arrangement

This is bad :
Bad arrangement

Thanks fidomou - your solution worked for me.

Subscribing: Experiencing the same issue with Search API v 7.x-1.7. @ntfreddy's fix unfortunately does not work for me. The output for the Views PHP field is always empty, but other fields work just fine. The Views PHP field's label and rewriting works fine. If I add "No Results" text, that is what displays on every field. The "No Results" text can be rewritten with tokens.

@ntfreddy's: Many thanks, it works (Search API 7.x-1.8, Views PHP 7.x-1.x-dev)
@bryanzera: Are you sure that you have replaced code at line 214?

Hacking views_php_handler_field.inc fixed the problem for me, too. Not the cleanest solution, though :-(

#2 worked for me. Thanks.