@@ -3809,13 +3809,19 @@ private function processTokenStack($tokens, $cellID = null, Cell $pCell = null)
38093809 if ($ this ->branchPruningEnabled && isset ($ tokenData ['onlyIf ' ])) {
38103810 $ onlyIfStoreKey = $ tokenData ['onlyIf ' ];
38113811 $ storeValue = $ branchStore [$ onlyIfStoreKey ] ?? null ;
3812+ $ storeValueAsBool = ($ storeValue === null ) ?
3813+ true : (bool ) Functions::flattenSingleValue ($ storeValue );
38123814 if (is_array ($ storeValue )) {
38133815 $ wrappedItem = end ($ storeValue );
38143816 $ storeValue = end ($ wrappedItem );
38153817 }
38163818
3817- if (isset ($ storeValue ) && (($ storeValue !== true )
3818- || ($ storeValue === 'Pruned branch ' ))
3819+ if (isset ($ storeValue )
3820+ && (
3821+ !$ storeValueAsBool
3822+ || Functions::isError ($ storeValue )
3823+ || ($ storeValue === 'Pruned branch ' )
3824+ )
38193825 ) {
38203826 // If branching value is not true, we don't need to compute
38213827 if (!isset ($ fakedForBranchPruning ['onlyIf- ' . $ onlyIfStoreKey ])) {
@@ -3838,12 +3844,17 @@ private function processTokenStack($tokens, $cellID = null, Cell $pCell = null)
38383844 if ($ this ->branchPruningEnabled && isset ($ tokenData ['onlyIfNot ' ])) {
38393845 $ onlyIfNotStoreKey = $ tokenData ['onlyIfNot ' ];
38403846 $ storeValue = $ branchStore [$ onlyIfNotStoreKey ] ?? null ;
3847+ $ storeValueAsBool = ($ storeValue === null ) ?
3848+ true : (bool ) Functions::flattenSingleValue ($ storeValue );
38413849 if (is_array ($ storeValue )) {
38423850 $ wrappedItem = end ($ storeValue );
38433851 $ storeValue = end ($ wrappedItem );
38443852 }
3845- if (isset ($ storeValue ) && ($ storeValue
3846- || ($ storeValue === 'Pruned branch ' ))
3853+ if (isset ($ storeValue )
3854+ && (
3855+ $ storeValueAsBool
3856+ || Functions::isError ($ storeValue )
3857+ || ($ storeValue === 'Pruned branch ' ))
38473858 ) {
38483859 // If branching value is true, we don't need to compute
38493860 if (!isset ($ fakedForBranchPruning ['onlyIfNot- ' . $ onlyIfNotStoreKey ])) {
0 commit comments